<?xml version="1.0" encoding="UTF-8"?>
<urlset>
    
    <url>
        <loc>https://blog.yourtion.com/nodejs-download-encrypted-m3u8.html</loc>
        <lastmod>2022-07-26T21:44:23+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Node.js 流式下载加密 m3u8 视频</title>
                <content>
&lt;p&gt;之前做一个下载工具，发现有些视频内容是 m3u8 的格式，而且视频是加密的，只有在网页上可以正常播放，下载下来播放会报错。&lt;/p&gt;

&lt;p&gt;研究了一轮之后，这个视频还是比较简单的采用了 m3u8 ts 切片方式，同时切片采用默认的 aes-128 加密方式，key 值也是相对简单的明文传输。&lt;/p&gt;

&lt;p&gt;这里不打算详细解析怎么拿到视频的密钥和 m3u8 列表，主要讲一下怎么把加密的 m3u8 ts 切片下载解密并保存成一个 ts 文件的过程。&lt;/p&gt;

&lt;p&gt;最简单的方式自然就是把 m3u8 中的每个视频下载下来，然后逐个解密好后拼接成一个文件，但是这样过于复杂，而且也不优雅。&lt;/p&gt;

&lt;p&gt;这里想到的是基于 Node.js 的 Streaming 方式，一次性下载解密并拼接保存成一个文件，方便后续处理。这里做一下笔记，也算是进一步熟悉 Node.js 中 Stream 的使用。&lt;/p&gt;

&lt;h2 id=&quot;解析-m3u8&quot;&gt;解析 m3u8&lt;/h2&gt;

&lt;p&gt;这里就使用给比较简单的脚本，对 m3u8 文件转换成一个切片列表。&lt;/p&gt;

&lt;div class=&quot;language-typescript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;parseM3u8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&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;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;ts$/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;解密视频&quot;&gt;解密视频&lt;/h2&gt;

&lt;p&gt;这里相对比较简单，直接使用 crypot 库，创建一个解密实例即可：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crypot.createDecipheriv(&quot;aes-128-cbc&quot;, key, &quot;0000000000000000&quot;)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;其中注意解密信息这里是否需要有除了 key 之外的 iv 信息，这里的 iv 使用的是全零的（根据拿到的解密信息定）。&lt;/p&gt;

&lt;h2 id=&quot;stream-下载与保存&quot;&gt;Stream 下载与保存&lt;/h2&gt;

&lt;p&gt;这里直接使用了 axios 作为下载的库，使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;axios.get(url, { responseType: &quot;stream&quot; })&lt;/code&gt;，创建一个流式下载的实例，后续可以通过 pipe 的方式进行解密和文件写入，关于 stream 流控制相关内容，可以查看&lt;a href=&quot;https://blog.yourtion.com/nodejs-backpressuring.html&quot;&gt;《Node.js Backpressuring（背压）》&lt;/a&gt;。&lt;/p&gt;

&lt;p&gt;之后使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fs.createWriteStream&lt;/code&gt; 创建一个写入流，就可以把下载并解密后的内容流式地到本地文件中，最后成为一个 ts 文件了。&lt;/p&gt;

&lt;p&gt;这里需要注意的是，因为一个 m3u8 中有多个 ts 切片需要保存到一个文件，所以在每个切片下载完后，不能直接关闭写入流，否则后续的切片无法写入，这里在执行 pipe 操作时，就要添加 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{ end: false }&lt;/code&gt; 的选项。&lt;/p&gt;

&lt;h2 id=&quot;整合形成&quot;&gt;整合形成&lt;/h2&gt;

&lt;p&gt;最后就是把上面的流程整合在一起，形成一个闭环，就能一次下载把加密的 m3u8 下载成一个 ts 文件的过程了。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crypot.createDecipheriv&lt;/code&gt; 创建解密实例&lt;/li&gt;
  &lt;li&gt;将 ts 切片的 url 变成 Readable 便于后续操作&lt;/li&gt;
  &lt;li&gt;通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d.pipe(dec).pipe(w, { end: false });&lt;/code&gt; 解密并保存到本地文件&lt;/li&gt;
  &lt;li&gt;最后使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wstream.end&lt;/code&gt; 结束文件写入并 resolve&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-typescript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;VideoDownloader&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dir&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__dirname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;../videos&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&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;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;axios&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&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;na&quot;&gt;responseType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Readable&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;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;appendSteram&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;WriteStream&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;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dec&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;crypot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createDecipheriv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;aes-128-cbc&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;0000000000000000&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Promise&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;w&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;na&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;p&quot;&gt;});&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;download&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;m3u8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;srting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Buffer&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;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;parseM3u8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;m3u8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.ts`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;wstream&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createWriteStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;u&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;list&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;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendSteram&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;u&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;wstream&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;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Promise&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;wstream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&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;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>Node.js</tag> 
                <pubTime>2022-07-26T21:44:23+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/nodejs-backpressuring.html</loc>
        <lastmod>2021-03-02T18:31:46+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Node.js Backpressuring（背压）</title>
                <content>
&lt;p&gt;通常在数据处理的时候我们会遇到一个普遍的问题：背压，意思是在数据传输过程中有一大堆数据在缓存之后积压着。每次当数据到达结尾又遇到复杂的运算，又或者无论什么原因它比预期的慢，这样累积下来，从源头来的数据就会变得很庞大，像一个塞子一样堵塞住。&lt;/p&gt;

&lt;p&gt;为解决这个问题，必须存在一种适当的代理机制，确保流从一个源流入另外一个的时候是平滑顺畅的。不同的社区组织针对他们各自的问题单独做了解决，好例子比如 Unix 的管道和 TCP 的 Socket。此问题经常与流控制相关。在 Node.js 中，流已经是被采纳的解决方案。&lt;/p&gt;

&lt;p&gt;此文的目的在于详细深入介绍什么是背压，并从代码角度详细解释在 Node.js 中，流是如何针对此问题进行处理的。本文的第二部分将给予你实现流的功能时最佳实践，以确保你的程序既安全又精简。&lt;/p&gt;

&lt;p&gt;我们假定你对 Node.js 中的背压，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Buffer&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;EventEmitter&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Stream&lt;/code&gt; 的基本概念有一点了解。如果你尚未完整阅读过 API 文档，那么最好是先看一下相关 API 说明，它也会有助于你扩展理解本文的主旨。&lt;/p&gt;

&lt;h2 id=&quot;处理数据中遇到的问题&quot;&gt;处理数据中遇到的问题&lt;/h2&gt;

&lt;p&gt;我们使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.pipe()&lt;/code&gt; 从一个数据源终端到另外一个终端，不过没有使用任何出错处理机制。如果一大堆数据出错了但是又要被接收， &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ReadStream&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gzip&lt;/code&gt; 流不会被销毁。&lt;/p&gt;

&lt;p&gt;pump（pump 是一个工具类，如果有某个流发生错误或者关闭，它会自动销毁相关所有的流）对于 Node.js 8.x 以及先前版本是必须的。但对于 10.x 和之后的版本而言，我们引入了 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pipeline&lt;/code&gt; 来取而代之。这是一个模块化函数，用于对接不同的数据流，可以处理异常错误并善后清理释放资源。它同时也提供了一个回调函数——当整个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pipeline&lt;/code&gt; 任务完成时将触发。&lt;/p&gt;

&lt;p&gt;这里给出一个例子，告诉你如何使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pipeline&lt;/code&gt;：&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;pipeline&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;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;fs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;zlib&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;zlib&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Use the pipeline API to easily pipe a series of streams&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// together and get notified when the pipeline is fully done.&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// A pipeline to gzip a potentially huge video file efficiently:&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;pipeline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createReadStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;The.Matrix.1080p.mkv&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;zlib&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createGzip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createWriteStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;The.Matrix.1080p.mkv.gz&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&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;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Pipeline failed&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;err&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;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Pipeline succeeded&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// async&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;util&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;util&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;pipeline&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;util&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;promisify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pipeline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;run&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;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;pipeline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createReadStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;The.Matrix.1080p.mkv&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;zlib&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createGzip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createWriteStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;The.Matrix.1080p.mkv.gz&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Pipeline succeeded&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&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;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Pipeline failed&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;err&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;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;数据太多速度太快&quot;&gt;数据太多，速度太快&lt;/h2&gt;

&lt;p&gt;有太多的例子证明有时 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Readable&lt;/code&gt; 传输给 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Writable&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;ul&gt;
  &lt;li&gt;明显使得其它进程处理变慢&lt;/li&gt;
  &lt;li&gt;太多繁重的垃圾回收&lt;/li&gt;
  &lt;li&gt;内存耗尽&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;没有合适的流来处理背压，同样的进程处理就会产生一个内存占用数量级的差异！&lt;/p&gt;

&lt;h2 id=&quot;背压是怎么处理这些问题的&quot;&gt;背压是怎么处理这些问题的？&lt;/h2&gt;

&lt;p&gt;我们有不同的函数将数据从一个进程传入另外一个进程。在 Node.js 中，有一个内置函数称为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.pipe()&lt;/code&gt;，同样地，你们也可以使用其它工具包。最终，在这个进程的基本层面上我们有二个互不相关的组件：数据的 source 和 consumer。&lt;/p&gt;

&lt;p&gt;当 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.pipe()&lt;/code&gt; 被源调用之后，它通知消费者有数据需要传输。管道函数为事件触发建立了合适的背压封装。&lt;/p&gt;

&lt;p&gt;在 Node.js 中，源头是一个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Readable&lt;/code&gt; 的流，消费者是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Writable&lt;/code&gt; 流（它们两者可能通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Duplex&lt;/code&gt; 或 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Transform&lt;/code&gt; 进行交互）。&lt;/p&gt;

&lt;p&gt;当背压被触发的一刹那，它可以被缩小到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Writable&lt;/code&gt; 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.write()&lt;/code&gt; 函数的返回值。这是根据一些条件所决定的。&lt;/p&gt;

&lt;p&gt;在数据缓存超出了 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;highWaterMark&lt;/code&gt; 或者写入的列队处于繁忙状态，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.write()&lt;/code&gt; 会返回 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;false&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;当 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;false&lt;/code&gt; 返回之后，背压系统介入了。它将暂停从任何发送数据的数据流中进入的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Readable&lt;/code&gt;。一旦数据流清空了，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;'drain'&lt;/code&gt; 事件将被触发，消耗进来的数据流。&lt;/p&gt;

&lt;p&gt;一旦队列全部处理完毕，背压机制将允许允许数据再次发送。在使用中的内存空间将自我释放，同时准备接收下一次的批量数据。&lt;/p&gt;

&lt;p&gt;这个有效的举措允许一大堆锁住的内存可以为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.pipe()&lt;/code&gt; 函数随时使用而并没有内存泄露、无限扩大的内存缓冲。同时垃圾回收器仅需要处理一处地方。&lt;/p&gt;

&lt;p&gt;所以，背压既然如此重要，为什么还有理由说你没有听说过呢？显然答案很明显：Node.js 为你做了一切。&lt;/p&gt;

&lt;p&gt;注意：对于大部分机器，存在着一个字节的大小用以决定一个缓存是否已经满了（不同机器此值有变化）。Node.js 将允许你设置你自己的 highWaterMark。但是通常来说，默认是设置为 16kb（16384，对于对象模型流而言是 16）。在某些实例中你或许想提高那个值，尽管去提高吧，但是也要小心使用！&lt;/p&gt;

&lt;h2 id=&quot;pipe-的生命周期&quot;&gt;.pipe() 的生命周期&lt;/h2&gt;

&lt;p&gt;为了对背压有一个更好的理解，这里有一副 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Readable&lt;/code&gt; 流正通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;piped&lt;/code&gt; 流入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Writable&lt;/code&gt; 流的整个生命周期图：&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;                                                     &lt;span class=&quot;o&quot;&gt;+===================+&lt;/span&gt;
                         &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nx&quot;&gt;Piping&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;functions&lt;/span&gt;   &lt;span class=&quot;o&quot;&gt;+--&amp;gt;&lt;/span&gt;   &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dest&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;nx&quot;&gt;x&lt;/span&gt;     &lt;span class=&quot;nx&quot;&gt;are&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;up&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;during&lt;/span&gt;     &lt;span class=&quot;o&quot;&gt;|===================|&lt;/span&gt;
                         &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;     &lt;span class=&quot;nx&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pipe&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;method&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;nx&quot;&gt;Event&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callbacks&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;+===============+&lt;/span&gt;      &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;                           &lt;span class=&quot;o&quot;&gt;|-------------------|&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;   &lt;span class=&quot;nx&quot;&gt;Your&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Data&lt;/span&gt;   &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;      &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;     &lt;span class=&quot;nx&quot;&gt;They&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;exist&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;outside&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;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cb&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;o&quot;&gt;+=======+=======+&lt;/span&gt;      &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;     &lt;span class=&quot;nx&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;flow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;but&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;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cb&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;o&quot;&gt;|&lt;/span&gt;              &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;     &lt;span class=&quot;nx&quot;&gt;importantly&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;attach&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;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;drain&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cb&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;o&quot;&gt;|&lt;/span&gt;              &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;     &lt;span class=&quot;nx&quot;&gt;events&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;their&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;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;unpipe&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cb&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;o&quot;&gt;+---------&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;---------+&lt;/span&gt;    &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;     &lt;span class=&quot;nx&quot;&gt;respective&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callbacks&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;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cb&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;o&quot;&gt;|&lt;/span&gt;  &lt;span class=&quot;nx&quot;&gt;Readable&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Stream&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;+----+&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;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;finish&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cb&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;o&quot;&gt;+-^-------^-------^-+&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;|&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;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cb&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;o&quot;&gt;^&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;                           &lt;span class=&quot;o&quot;&gt;+-------------------+&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;+-------------------+&lt;/span&gt;         &lt;span class=&quot;o&quot;&gt;+=================+&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;+----&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nx&quot;&gt;Writable&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Stream&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;+---------&amp;gt;&lt;/span&gt;  &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;chunk&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;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;           &lt;span class=&quot;o&quot;&gt;+-------------------+&lt;/span&gt;         &lt;span class=&quot;o&quot;&gt;+=======+=========+&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;                                                 &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;                              &lt;span class=&quot;o&quot;&gt;+------------------&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;---------+&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;+-&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&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;nx&quot;&gt;chunk&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;nx&quot;&gt;Is&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;chunk&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;too&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;big&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;o&quot;&gt;^&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;     &lt;span class=&quot;nx&quot;&gt;emit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;end&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;nx&quot;&gt;Is&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;queue&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;busy&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;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;+-&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;                       &lt;span class=&quot;o&quot;&gt;+-------+----------------+---+&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;     &lt;span class=&quot;nx&quot;&gt;emit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;write&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;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;                                   &lt;span class=&quot;o&quot;&gt;+--&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;---+&lt;/span&gt;        &lt;span class=&quot;o&quot;&gt;+---&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;---+&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;^-----------------------------------&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nx&quot;&gt;No&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;        &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;  &lt;span class=&quot;nx&quot;&gt;Yes&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;                                           &lt;span class=&quot;o&quot;&gt;+------+&lt;/span&gt;        &lt;span class=&quot;o&quot;&gt;+---&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;---+&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;                                                               &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;               &lt;span class=&quot;nx&quot;&gt;emit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pause&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;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;^---------------^-----------------------+&lt;/span&gt;  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;&amp;lt;-----+---+&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;                                               &lt;span class=&quot;o&quot;&gt;+=================+&lt;/span&gt;         &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;                                                                           &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;            &lt;span class=&quot;nx&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;queue&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;is&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;empty&lt;/span&gt;     &lt;span class=&quot;o&quot;&gt;+============+&lt;/span&gt;                         &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;^------------^-----------------------&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nx&quot;&gt;Buffering&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;                         &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
               &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;                       &lt;span class=&quot;o&quot;&gt;|============|&lt;/span&gt;                         &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
               &lt;span class=&quot;o&quot;&gt;+&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;emit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;drain&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;o&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Buffer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;                         &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
               &lt;span class=&quot;o&quot;&gt;+&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;emit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resume&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;o&quot;&gt;|&lt;/span&gt;
                                       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Buffer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;                         &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
                                       &lt;span class=&quot;o&quot;&gt;+------------+&lt;/span&gt;   &lt;span class=&quot;nx&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;chunk&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;queue&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
                                       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;            &lt;span class=&quot;o&quot;&gt;&amp;lt;---^---------------------&amp;lt;&lt;/span&gt;
                                       &lt;span class=&quot;o&quot;&gt;+============+&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;注意：如果你创建一些管道准备把一些流串联起来从而操纵数据，你应该实现 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Transform&lt;/code&gt; 流。&lt;/p&gt;

&lt;p&gt;在这种情况下，从 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Readable&lt;/code&gt; 流中的输出进入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Transform&lt;/code&gt;，并且会被管道输送进入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Writable&lt;/code&gt;。&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;Readable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Transformable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Writable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;背压将被自动应用，但是同时请注意输入和输出 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Transform&lt;/code&gt; 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;highWaterMark&lt;/code&gt; 可以手动控制，并且会影响到背压系统。&lt;/p&gt;

&lt;h2 id=&quot;实现用户自定义流须知&quot;&gt;实现用户自定义流须知&lt;/h2&gt;

&lt;p&gt;流的黄金法则是&lt;strong&gt;总是接受背压&lt;/strong&gt;。作为最佳实践的构成是不矛盾的实践。只要你小心避免与内部背压支持冲突的行为，你可以确信你在遵循良好的实践。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;没有特殊要求下，绝对不要用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.push()&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;在流返回 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;false&lt;/code&gt; 后不要调用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.write()&lt;/code&gt; 方法，而是等待 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;'drain'&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;流在不同的 Node.js 版本和库中是有变化的，小心使用并进行相应的测试&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;对于可读流的规则&quot;&gt;对于可读流的规则&lt;/h3&gt;

&lt;p&gt;因为 Node.js 的功能，数据从 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Readable&lt;/code&gt; 流到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Writable&lt;/code&gt; 流。但是正如我们在数据流传输过程中我们观察到，source 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Readable&lt;/code&gt; 目标一样重要， &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Readable&lt;/code&gt; 流对于背压是如何处理的至关重要。&lt;/p&gt;

&lt;p&gt;这两个过程相互依赖地进行有效沟通，如果 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Readable&lt;/code&gt; 流在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Writable&lt;/code&gt; 流需要它停止发送数据的时候忽略了，那就会跟 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.write()&lt;/code&gt; 的返回值不正确时一样，产生相应的问题。&lt;/p&gt;

&lt;p&gt;所以，除了谨慎对待 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.write()&lt;/code&gt; 方法的返回值，我们同样要小心在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;._read()&lt;/code&gt; 方法中使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.push()&lt;/code&gt; 方法的返回值。如果 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.push()&lt;/code&gt; 方法返回一个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;false&lt;/code&gt;，流就会停止从源读数据。否则，它就不会停止而继续读下去。&lt;/p&gt;

&lt;h3 id=&quot;关于可写流的规则&quot;&gt;关于可写流的规则&lt;/h3&gt;

&lt;p&gt;重新调用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.write()&lt;/code&gt; 方法根据一些条件可能返回 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;true&lt;/code&gt; 或者 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;false&lt;/code&gt;。幸运地是，当我们构建属于自己的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Writable&lt;/code&gt; 流的时候，流状态机（stream state machine）会处理我们的回调，并且决定什么时候处理背压并且为我们简化数据流。&lt;/p&gt;

&lt;p&gt;但是当我们需要直接使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Writable&lt;/code&gt; 流时，我们必须考虑 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.write()&lt;/code&gt; 方法返回的值，并且注意到以下一些情况：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;如果写队列确实繁忙，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.write()&lt;/code&gt; 方法将返回 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;false&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;如果数据块太大，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.write()&lt;/code&gt; 方法将返回 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;false&lt;/code&gt;（限定通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;highWaterMark&lt;/code&gt; 决定）&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;总结&quot;&gt;总结&lt;/h2&gt;

&lt;p&gt;流经常作为一个模块用于 Node.js 中，对于内部的系统结构而言非常重要。对于开发者而言，可以通过 Node.js 扩展连接应答系统。&lt;/p&gt;

&lt;p&gt;现在我们希望你有能力进行故障排除，记住了是如何为你的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Writable&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Readable&lt;/code&gt; 流编写背压处理的。并且你还可以把这些知识分享给你的同事和朋友们。&lt;/p&gt;

&lt;p&gt;在此之后请仔细阅读更多的有关 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Stream&lt;/code&gt; 其它 API 函数，这样有助于当你在构建 Node.js 的应用程序之时更好地理解关于流的能力。&lt;/p&gt;

&lt;h2 id=&quot;参考&quot;&gt;参考&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;https://nodejs.org/en/docs/guides/backpressuring-in-streams/&lt;/li&gt;
  &lt;li&gt;https://nodejs.org/zh-cn/docs/guides/backpressuring-in-streams/&lt;/li&gt;
&lt;/ul&gt;
</content>
                 <tag>Node.js</tag> 
                 <tag>学习</tag> 
                <pubTime>2021-03-02T18:31:46+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/nodejs-not-block-eventloop.html</loc>
        <lastmod>2021-02-26T11:43:03+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>不要阻塞事件循环（或工作线程池）</title>
                <content>
&lt;h2 id=&quot;概述&quot;&gt;概述&lt;/h2&gt;

&lt;p&gt;Node.js 通过事件循环机制（初始化和回调）的方式运行 JavaScript 代码，并且提供了一个线程池处理诸如文件 I/O 等高成本的任务。&lt;/p&gt;

&lt;p&gt;Node 的伸缩性非常好，某些场景下它甚至比类似 Apache 等更重量级的解决方案表现更优异。Node 可伸缩性的秘诀在于它仅使用了极少数的线程就可以处理大量客户端连接。如果 Node.js 只需占用很少的线程，那么它就可以将更多的系统 CPU 时间和内存花费在客户端任务而不是线程的空间和时间消耗上（内存，上下文切换）。但是同样由于 Node.js 只有少量线程，你必须非常小心的组织你的应用程序以便合理的使用它们。&lt;/p&gt;

&lt;p&gt;这里有一个很好的经验法则，能使您的 Node.js 服务器变快：&lt;strong&gt;在任何时候，当分配到每个客户端的任务是“少量”的情况下，Node.js 是非常快的&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;这条法则可以应用于事件轮询中的回调任务，以及在工作线程池上的任务。&lt;/p&gt;

&lt;h2 id=&quot;为什么不要阻塞你的事件轮询&quot;&gt;为什么不要阻塞你的事件轮询&lt;/h2&gt;

&lt;p&gt;Node.js 是用很少量的线程来处理大量客户端请求的。在 Node.js 中，有两种类型的线程：一个事件循环线程（也被称为主循环，主线程，事件线程等）。另外一个是在工作线程池里的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k&lt;/code&gt; 个工作线程（也被称为线程池）。&lt;/p&gt;

&lt;p&gt;如果一个线程执行一个回调函数（事件轮询线程）或者任务（工作线程）需要耗费很长时间，我们称之为“阻塞”。当一个线程在处理某一个客户端请求时被阻塞了，它就无法处理其它客户端的请求了。这里给出两个不能阻塞事件轮询线程和工作线程的理由：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;性能：如果你在任意类型的线程上频繁处理繁重的任务，那么你的服务器的吞吐量（请求/秒）将面临严峻考验&lt;/li&gt;
  &lt;li&gt;安全性：如果对于特定的输入，你的某种类型的线程可能会被阻塞，那么恶意攻击者可以通过构造类似这样的“恶意输入”，故意让你的线程阻塞，然后使其它客户端请求得不到处理。这就是拒绝服务攻击&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;关于-nodejs&quot;&gt;关于 Node.js&lt;/h2&gt;

&lt;p&gt;Node.js 使用事件驱动机制：它有一个事件轮询线程负责任务编排，和一个专门处理繁重任务的工作线程池。&lt;/p&gt;

&lt;h3 id=&quot;运行在事件轮询线程上&quot;&gt;运行在事件轮询线程上&lt;/h3&gt;

&lt;p&gt;当 Node.js 程序运行时，程序首先完成初始化部分，即处理 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;require&lt;/code&gt; 加载的模块和注册事件回调。然后，Node.js 应用程序进入事件循环阶段，通过执行对应回调函数来对客户端请求做出回应。该回调将同步执行，并且可能在完成之后继续注册新的异步请求。这些异步请求的回调也会在事件轮询线程中被处理。&lt;/p&gt;

&lt;p&gt;事件循环中同样也包含很多非阻塞异步请求的回调，如网络 I/O。&lt;/p&gt;

&lt;p&gt;总体来说，事件轮询线程执行事件的回调函数，并且负责对处理类似网络 I/O 的非阻塞异步请求。&lt;/p&gt;

&lt;h3 id=&quot;运行在工作线程池&quot;&gt;运行在工作线程池&lt;/h3&gt;

&lt;p&gt;Node.js 的工作线程池是通过 libuv 来实现的，它对外提供了一个通用的任务处理 API。&lt;/p&gt;

&lt;p&gt;Node.js 使用工作线程池来处理“高成本”的任务。这包括一些操作系统并没有提供非阻塞版本的 I/O 操作，以及一些 CPU 密集型的任务。&lt;/p&gt;

&lt;p&gt;Node.js 模块中有如下这些 API 用到了工作线程池：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;I/O 密集型任务：
    &lt;ul&gt;
      &lt;li&gt;DNS：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dns.lookup()&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dns.lookupService()&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;文件系统：所有的文件系统 API。除 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fs.FSWatcher()&lt;/code&gt; 和那些显式同步调用的 API 之外，都使用 libuv 的线程池&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;CPU 密集型任务：
    &lt;ul&gt;
      &lt;li&gt;Crypto：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crypto.pbkdf2()&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crypto.scrypt()&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crypto.randomBytes()&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crypto.randomFill()&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crypto.generateKeyPair()&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;Zlib：所有 Zlib 相关函数，除那些显式同步调用的 API 之外，都适用 libuv 的线程池&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;在大部分 Node.js 应用程序中，这些 API 是工作线程池任务的唯一来源。此外应用程序和模块可以使用 C++ 插件向工作线程池提交其它任务。&lt;/p&gt;

&lt;p&gt;当你在事件轮询线程的一个回调中调用这些 API 时，事件轮询线程将不得不为此花费少量的额外开销，因为它必须要进入对应 API 与 C++ 桥接通讯的 Node.js C++ binding 中，从而向工作线程池提交一个任务。和整个任务的成本相比，这些开销微不足道。这就是为什么事件循环线程总是将这些任务转交给工作线程池。当向工作线程池中提交了某个任务，Node.js 会在 C++ binding 中为对应的 C++ 函数提供一个指针。&lt;/p&gt;

&lt;h3 id=&quot;下一步该运行哪些代码&quot;&gt;下一步该运行哪些代码？&lt;/h3&gt;

&lt;p&gt;抽象来说，事件轮询线程和工作池线程分别为等待中的事件回调和等待中的任务维护一个队列。&lt;/p&gt;

&lt;p&gt;而事实上，事件轮询线程本身并不维护队列，它持有一堆要求操作系统使用诸如 epoll (Linux)，kqueue (OSX)，event ports (Solaris) 或者 IOCP (Windows) 等机制去监听的文件描述符。这些文件描述符可能代表一个网络套接字，一个监听的文件等等。当操作系统确定某个文件的描述符发生变化，事件轮询线程将把它转换成合适的事件，然后触发与该事件对应的回调函数。&lt;/p&gt;

&lt;p&gt;相对而言，工作线程池则使用一个真实的队列，里边装的都是要被处理的任务。一个工作线程从这个队列中取出一个任务，开始处理它。当完成之后这个工作线程向事件循环线程中发出一个“至少有一个任务完成了”的消息。&lt;/p&gt;

&lt;h3 id=&quot;这意味着什么&quot;&gt;这意味着什么？&lt;/h3&gt;

&lt;p&gt;因为 Node.js 用少量的线程处理许多客户端连接，如果在处理某个客户端的时候阻塞了，在该客户端请求的回调或任务完成之前，其他等待中的任务可能都不会得到执行机会。因此，&lt;strong&gt;保证每个客户端请求得到公平的执行机会变成了应用程序的责任&lt;/strong&gt;。这意味着，对于任意一个客户端，你不应该在一个回调或任务中做太多的事情。&lt;/p&gt;

&lt;p&gt;这既是 Node.js 服务能够保持良好伸缩性的原因，同时也意味应用程序必须自己确保公平调度。&lt;/p&gt;

&lt;h2 id=&quot;不要阻塞你的事件轮询线程&quot;&gt;不要阻塞你的事件轮询线程&lt;/h2&gt;

&lt;p&gt;事件轮询线程关注着每个新的客户端连接，协调产生一个回应。所有这些进入的请求和输出的应答都要通过事件轮询线程。这意味着如果你的事件轮询线程在某个地方花费太多的时间，所有当前和未来新的客户端请求都得不到处理机会了。&lt;/p&gt;

&lt;p&gt;因此，你应该保证永远不要阻塞事件轮询线程。 换句话说，每个 JavaScript 回调应该快速完成。这些当然对于 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;await&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Promise.then&lt;/code&gt; 也同样适用。&lt;/p&gt;

&lt;p&gt;一个能确保做到这一点的方法是分析关于你回调代码的 “计算复杂度”。如果你的回调函数在任意的参数输入下执行步骤数量都相同，那么你总能保证每个等待中的请求得到一个公平的执行机会。如果回调根据其参数不同所需要的执行步骤数量也不同，则应深入考虑参数复杂度增长的情况下请求的可能执行时间增长情况。&lt;/p&gt;

&lt;h2 id=&quot;你应当注意些什么呢&quot;&gt;你应当注意些什么呢？&lt;/h2&gt;

&lt;p&gt;Node.js 使用谷歌的 V8 引擎处理 JavaScript，对于大部分操作确实很快。但有个例外是正则表达式以及 JSON 的处理。&lt;/p&gt;

&lt;p&gt;但是，对于复杂的任务你应当考虑限定输入范围，拒绝会导致太长执行时间的输入。那样的话，即便你的输入相当长而且复杂，因为你限定了输入范围，你也可以确保回调函数的执行时间在你预估的最差情况范围之内。然后你可以评估此回调函数的最糟糕执行时间，根据你的业务场景决定此运行时间是否可以接受。&lt;/p&gt;

&lt;p&gt;请记住，&lt;strong&gt;事件循环线程只负责协调客户端的请求，而不是独自执行完所有任务&lt;/strong&gt;。对一个复杂的任务，最好把它从事件循环线程转移到工作线程池上。&lt;/p&gt;

&lt;h2 id=&quot;关于分流的建议&quot;&gt;关于分流的建议&lt;/h2&gt;

&lt;p&gt;您可能希望区分 CPU 密集型和 I/O 密集型任务，因为它们具有明显不同的特性。&lt;/p&gt;

&lt;p&gt;CPU 密集型任务只有在该 Worker 线程被调度到时候才得到执行机会，并且必须将该任务分配到机器的某一个逻辑核心中。&lt;/p&gt;

&lt;p&gt;如果你的机器有 4 个逻辑核心和 5 个工作线程，那这些工作线程中的某一个则无法得到执行。因此，您实质上只是在为该工作线程白白支付开销（内存和调度开销），却无法得到任何返回。&lt;/p&gt;

&lt;p&gt;I/O 密集型任务通常包括查询外部服务提供程序（DNS、文件系统等）并等待其响应。当 I/O 密集型任务的工作线程正在等待其响应时，它没有其它工作可做，并且可以被操作系统重新调度，从而使另一个 Worker 有机会提交它的任务。因此，即使关联的线程并没有被保持，I/O 密集型任务也可以持续运行。像数据库和文件系统这样的外部服务提供程序已经经过高度优化，可以同时处理许多并发的请求。例如，文件系统会检查一大组并发等待的写入和读取请求，以合并冲突更新并以最佳顺序读取文件（请参阅这些幻灯片）。&lt;/p&gt;

&lt;p&gt;如果只依赖一个工作线程池（例如 Node.js 工作池），则 CPU 密集和 I/O 密集的任务的不同特效性可能会损害应用程序的性能。&lt;/p&gt;

&lt;p&gt;因此，您可能希望一个维护单独的计算工作线程池。&lt;/p&gt;

&lt;h3 id=&quot;分流总结&quot;&gt;分流：总结&lt;/h3&gt;

&lt;p&gt;对于简单的任务：比如遍历任意长数组的元素，拆分可能是一个很好的选择。如果计算更加复杂，则分流是一种更好的方法：通信成本（即在事件循环线程和工作线程之间传递序列化对象的开销）被使用多个物理内核的好处抵消。&lt;/p&gt;

&lt;p&gt;但是，如果你的服务器严重依赖复杂的计算，则应该重新考虑 Node.js 是否真的很适合该场景？Node.js 擅长于 I/O 密集型任务，但对于昂贵的计算，它可能不是最好的选择。&lt;/p&gt;

&lt;h2 id=&quot;不要阻塞你的工作线程池&quot;&gt;不要阻塞你的工作线程池&lt;/h2&gt;

&lt;p&gt;Node.js 由 k 个工作线程组成了工作线程池。在这两种情况下，让我们假设 k 比您可能需要同时处理的客户端请求数量要小得多。这与 Node.js 的“一个线程处理许多客户端连接”的哲学是一致的，这也是它的可伸缩性秘诀。&lt;/p&gt;

&lt;p&gt;每个工作线程必须完成其当前任务，才能继续执行工作线程池队列中的下一项。&lt;/p&gt;

&lt;p&gt;那么，处理客户请求所需的任务成本将会在不同的客户端输入场景下发生很大变化。有些任务可以快速完成（例如读取小文件或缓存文档，或者生成少量的随机字节），而另一些则需要更长的时间（例如读取较大或未缓存的文件，或生成更多的随机字节）。您的目标应该是&lt;strong&gt;使用任务拆分来尽量缩小不同请求任务执行时间的动态变化&lt;/strong&gt;。&lt;/p&gt;

&lt;h3 id=&quot;最小化任务时间的变化&quot;&gt;最小化任务时间的变化&lt;/h3&gt;

&lt;p&gt;如果工作线程的当前任务比其它任务开销大很多，则他无法处理其它等待中任务。换言之，每个相对长的任务会直接减少了工作线程池的可用线程数量，直到它的任务完成。这是不可取的，因为从某种程度上说，工作池中的工作线程越多，工作池吞吐量（任务/秒）就越大，因此服务器吞吐量（客户端请求/秒）就越大。一个具有相对昂贵开销任务的客户端请求将减少工作线程池整体的吞吐量，从而降低服务器的吞吐量。&lt;/p&gt;

&lt;p&gt;为避免这种情况，应尽量减少提交给工作池的不同任务在执行时间上的变化。虽然将 I/O 请求（DB、FS 等）访问的外部系统视为黑盒在某种角度是适当的；但您应该知道这些 I/O 请求的相对成本，并应避免提交您预估可能特别耗时的任务。&lt;/p&gt;

&lt;h3 id=&quot;任务拆分&quot;&gt;任务拆分&lt;/h3&gt;

&lt;p&gt;具有可变时间成本的任务可能会损害工作池的吞吐量。为了尽量减少任务时间的变化，应尽可能将每个任务&lt;em&gt;划分&lt;/em&gt;为开销接近一致的子任务。当每个子任务完成时，它应该提交下一个子任务；并且当最终的子任务完成时，它应该通知提交者，同样的原理也适用于 CPU 密集型任务。&lt;/p&gt;

&lt;p&gt;继续使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fs.readFile()&lt;/code&gt; 的示例，更好的方案是使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fs.read()&lt;/code&gt;（手动拆分）或 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ReadStream&lt;/code&gt;（自动拆分）。&lt;/p&gt;

&lt;p&gt;将任务拆分为子任务时，较短的任务将拆分为少量的子任务，而更长的任务将拆分为更多的子任务。在较长任务的每个子任务之间，分配给它的工作线程可以调度执行另一个更短的任务拆分出来的子任务，从而提高工作池的总体任务吞吐量。&lt;/p&gt;

&lt;p&gt;请注意：完成的子任务数对于工作线程池的吞吐量不是一个有用的度量指标。相反，请关注完成的任务数。&lt;/p&gt;

&lt;h3 id=&quot;避免任务拆分&quot;&gt;避免任务拆分&lt;/h3&gt;

&lt;p&gt;我们需要明确任务拆分的目的是尽量减少任务执行时间的动态变化。但是如果你可以人工区分较短的任务和较长的任务（例如，对数组求和或排序），则可以手动为每个类型的任务创建一个工作池。将较短的任务和更长的任务分别路由到各自的工作线程池，也是减少任务时间动态变化的另一种方法。&lt;/p&gt;

&lt;p&gt;建议这种方案的原因是：做任务拆分会导致额外的开销（创建工作线程，表示和操作线程池任务队列），而避免拆分会为您节省这些外成本，同时也会避免你在拆分任务的时候犯错误。&lt;/p&gt;

&lt;p&gt;这种方案的缺点是：所有这些工作池中的工作线程都将消耗空间和时间开销，并将相互竞争 CPU 时间片。请记住：每个 CPU 密集任务只在它被调度到的时候才会得到执行。因此，您应该再仔细分析后才考虑此方案。&lt;/p&gt;

&lt;h3 id=&quot;工作线程池总结&quot;&gt;工作线程池：总结&lt;/h3&gt;

&lt;p&gt;无论您只使用 Node.js 工作线程池还是维护单独的工作线程池，都应着力优化线程池的任务吞吐量。&lt;/p&gt;

&lt;p&gt;为此，请使用任务拆分最小化任务执行时间的动态变化范围。&lt;/p&gt;

&lt;h2 id=&quot;总结&quot;&gt;总结&lt;/h2&gt;

&lt;p&gt;Node.js 有两种类型的线程：一个事件循环线程和 k 个工作线程。事件循环负责 JavaScript 回调和非阻塞 I/O，工作线程执行与 C++ 代码对应的、完成异步请求的任务，包括阻塞 I/O 和 CPU 密集型工作。这两种类型的线程一次都只能处理一个活动。如果任意一个回调或任务需要很长时间，则运行它的线程将被 阻塞。如果你的应用程序发起阻塞的回调或任务，在好的情况下这可能只会导致吞吐量下降（客户端/秒），而在最坏情况下可能会导致完全拒绝服务。&lt;/p&gt;

&lt;p&gt;要编写高吞吐量、防 DoS 攻击的 web 服务，您必须确保不管在良性或恶意输入的情况下，您的事件循环线程和您的工作线程都不会阻塞。&lt;/p&gt;

&lt;h2 id=&quot;参考&quot;&gt;参考&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;https://nodejs.org/en/docs/guides/dont-block-the-event-loop/&lt;/li&gt;
  &lt;li&gt;https://nodejs.org/zh-cn/docs/guides/dont-block-the-event-loop/&lt;/li&gt;
&lt;/ul&gt;
</content>
                 <tag>Node.js</tag> 
                 <tag>学习</tag> 
                <pubTime>2021-02-26T11:43:03+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/nodejs-eventloop.html</loc>
        <lastmod>2021-02-24T11:25:45+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Node.js事件循环详解</title>
                <content>
&lt;h2 id=&quot;event-loop事件循环&quot;&gt;Event Loop（事件循环）&lt;/h2&gt;

&lt;p&gt;EventLoop 运行 Node.js 去处理非阻塞 I/O 操作的机制，尽管 JavaScript 是单线程的（当有可能的时候，它们会把操作转移到系统内核中去）。&lt;/p&gt;

&lt;p&gt;目前大多数内核都是多线程的，它们可在后台处理多种操作。当其中的一个操作完成的时候，内核通知 Node.js 将适合的回调函数添加到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;poll&lt;/code&gt; 队列中等待时机执行。&lt;/p&gt;

&lt;p&gt;当 Node.js 启动后，它会初始化事件循环，处理已提供的输入脚本（或 REPL），它可能会调用一些异步的 API、调度定时器，或者调用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;process.nextTick()&lt;/code&gt;，然后开始处理事件循环。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;事件循环操作顺序的简化概览

   ┌───────────────────────────┐
┌─&amp;gt;│           timers          │
│  └─────────────┬─────────────┘
│  ┌─────────────┴─────────────┐
│  │     pending callbacks     │
│  └─────────────┬─────────────┘
│  ┌─────────────┴─────────────┐
│  │       idle, prepare       │
│  └─────────────┬─────────────┘      ┌───────────────┐
│  ┌─────────────┴─────────────┐      │   incoming:   │
│  │           poll            │&amp;lt;─────┤  connections, │
│  └─────────────┬─────────────┘      │   data, etc.  │
│  ┌─────────────┴─────────────┐      └───────────────┘
│  │           check           │
│  └─────────────┬─────────────┘
│  ┌─────────────┴─────────────┐
└──┤      close callbacks      │
   └───────────────────────────┘

// 每个框被称为事件循环机制的一个阶段
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;每个阶段都有一个 FIFO 队列来执行回调。虽然每个阶段都是特殊的，但通常情况下，当事件循环进入该阶段时，它将执行该阶段的特定操作，然后执行该阶段队列中的回调，直到队列用尽或最大回调数已执行。当该队列已用尽或达到回调限制，事件循环将移动到下一阶段，然后继续下一循环。&lt;/p&gt;

&lt;p&gt;由于这些操作中的任何一个都可能调度更多的操作和由内核入队并在 poll 阶段需要被处理的新事件，在处理轮询事件时，轮询队列可以继续入队。因此，轮询阶段允许运行长于计时器的阈值的长时间回调。（详见 timers 和 poll）。&lt;/p&gt;

&lt;p&gt;Node 开始执行脚本时，会先进行事件循环的初始化，但是这时事件循环还没有开始，会先完成下面的事情：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;同步任务&lt;/li&gt;
  &lt;li&gt;发出异步请求&lt;/li&gt;
  &lt;li&gt;规划定时器生效的时间&lt;/li&gt;
  &lt;li&gt;执行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;process.nextTick()&lt;/code&gt; 等等&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;最后，上面这些事情都干完了，事件循环就正式开始了。事件循环会无限次地执行，一轮又一轮。只有异步任务的回调函数队列清空了，才会停止执行。&lt;/p&gt;

&lt;h2 id=&quot;阶段概述&quot;&gt;阶段概述&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;timers（定时器）：本阶段执行已经被 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setTimeout()&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setInterval()&lt;/code&gt; 调度的回调函数&lt;/li&gt;
  &lt;li&gt;pending callbacks（待定回调）：执行延迟到下一个循环迭代的 I/O 回调&lt;/li&gt;
  &lt;li&gt;idle, prepare：仅系统内部使用&lt;/li&gt;
  &lt;li&gt;poll（轮询）：检索新的 I/O 事件；执行与 I/O 相关的回调（除了 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;close&lt;/code&gt; 回调、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;timers&lt;/code&gt; 调度的回调和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate()&lt;/code&gt; 外几乎所有回调）， node 将在适当的时候在此阻塞&lt;/li&gt;
  &lt;li&gt;check（检测）：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate()&lt;/code&gt; 回调函数在这里执行&lt;/li&gt;
  &lt;li&gt;close callbacks（关闭的回调函数）：一些关闭的回调函数，如 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;socket.on('close', ...)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;在每次运行的事件循环之间，Node.js 检查它是否在等待任何异步 I/O 或 timers，如果没有的话，则完全关闭。&lt;/p&gt;

&lt;h2 id=&quot;阶段的详细概述&quot;&gt;阶段的详细概述&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;/images/2021/02/nodejs-eventloop-1.jpg&quot;&gt;&lt;img src=&quot;/images/2021/02/nodejs-eventloop-1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;timerss定时器&quot;&gt;timerss（定时器）&lt;/h3&gt;

&lt;p&gt;timers 指定可以执行所提供回调的阈值（threshold），而不是用户希望其执行的确切时间。在指定的一段时间间隔后，计时器回调将被尽可能早地运行。但是，操作系统调度或其它正在运行的回调可能会延迟它们。&lt;/p&gt;

&lt;p&gt;注意：技术上讲，poll 阶段控制了 timers 何时被执行&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;为了防止 poll 阶段饿死事件循环，libuv 有一个硬性最大值（依赖于系统）以停止轮询获得更多事件。&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;pending-callbacks待定回调&quot;&gt;pending callbacks（待定回调）&lt;/h3&gt;

&lt;p&gt;此阶段对某些系统操作（如 TCP 错误）执行回调。如：TCP 套接字在尝试连接时接收到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ECONNREFUSED&lt;/code&gt;，某些 *nix 的系统希望等待报告错误。这将被排队以在 pending callbacks 阶段执行。&lt;/p&gt;

&lt;p&gt;除了以下操作的回调函数，其他的回调函数都在这个阶段执行。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setTimeout()&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setInterval()&lt;/code&gt; 的回调函数&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate()&lt;/code&gt; 的回调函数&lt;/li&gt;
  &lt;li&gt;用于关闭请求的回调函数，比如 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;socket.on('close', () =&amp;gt; {})&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;poll轮询&quot;&gt;poll（轮询）&lt;/h3&gt;

&lt;p&gt;在 poll 阶段有两个主要功能：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;计算应该阻塞和轮询 I/O 的时间&lt;/li&gt;
  &lt;li&gt;然后，处理 poll 队列里的事件&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;当事件循环进入 poll 阶段且没有 timers 需要被调度时，将发生以下两种情况之一：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;如果 poll 队列不为空，事件循环将循环访问回调队列并同步执行它们，直到队列用尽，或者达到了系统的硬性限制&lt;/li&gt;
  &lt;li&gt;如果 poll 队列为空，还有两件事会发生：
    &lt;ul&gt;
      &lt;li&gt;如果代码被 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate()&lt;/code&gt; 调度，则事件循环将结束 poll 阶段，并进入 check 阶段以执行那些被调度的脚本&lt;/li&gt;
      &lt;li&gt;如果代码未被 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate()&lt;/code&gt; 调度，则事件循环将等待回调被添加到队列中，然后立即执行&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;一旦 poll 队列为空，事件循环将检查“已达到时间阈值的计时器”。如果一个或多个计时器已准备就绪，则事件循环将绕回 timers 阶段以执行这些计时器的回调。&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;check检测&quot;&gt;check（检测）&lt;/h3&gt;

&lt;p&gt;此阶段允许开发者在 poll 阶段完成后立即执行函数回调。如果 poll 阶段变为空闲状态，并且代码使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate()&lt;/code&gt; 而被排列到队列中，则事件循环可能进入到 check 阶段而不是继续等待。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate()&lt;/code&gt; 实际上是一个在事件循环中单独阶段运行的特殊计时器。它使用一个 libuv 的 API 以安排回调在 poll 阶段完成后执行。&lt;/p&gt;

&lt;p&gt;通常，在执行代码时，事件循环最终会进入 poll 阶段，在那等待传入连接、请求等。但是，如果回调代码使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate()&lt;/code&gt; 调度过，并且 poll 阶段变为空闲状态，则它将结束此阶段，并继续到 check 阶段而不是继续等待轮询事件。&lt;/p&gt;

&lt;h3 id=&quot;close-callbacks关闭的回调函数&quot;&gt;close callbacks（关闭的回调函数）&lt;/h3&gt;

&lt;p&gt;如果套接字或处理函数突然关闭（如 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;socket.destroy()&lt;/code&gt;），则 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;'close'&lt;/code&gt; 事件将在这个阶段发出。否则它将通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;process.nextTick()&lt;/code&gt; 发出。&lt;/p&gt;

&lt;h2 id=&quot;processnexttick&quot;&gt;process.nextTick()&lt;/h2&gt;

&lt;p&gt;因为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;process.nextTick()&lt;/code&gt; 从技术上讲不是事件循环的一部分。相反，不管事件循环的在哪个阶段，它都将在当前操作完成后处理 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nextTickQueue&lt;/code&gt;。这里，操作被定义为从底层 C/C++处理器的转换，以及处理需要执行的 JavaScript。&lt;/p&gt;

&lt;p&gt;任何时候在给定的阶段中调用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;process.nextTick()&lt;/code&gt;，所有传递到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;process.nextTick()&lt;/code&gt; 的回调将在事件循环继续之前处理。这可能会造成一些糟糕的情况，&lt;strong&gt;因为它允许您通过递归 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;process.nextTick()&lt;/code&gt; 调用来“饿死”您的 I/O&lt;/strong&gt;，因为这将阻止事件循环到达 poll 阶段。&lt;/p&gt;

&lt;p&gt;为什么这样的事情会包含在 Node.js 中？它的一部分是一种设计理念，在这种理念下，&lt;strong&gt;API 应该始终是异步的，即使它不必是异步的&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;什么时候要使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;process.nextTick()&lt;/code&gt;？有两个主要原因：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;允许用户处理错误，清理任何不需要的资源，或者在事件循环继续之前重试请求&lt;/li&gt;
  &lt;li&gt;有时有让回调在栈展开后，但在事件循环继续之前运行的必要。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Node 执行完所有同步任务，接下来就会执行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;process.nextTick&lt;/code&gt; 的任务队列&lt;/p&gt;

&lt;h2 id=&quot;本轮循环和次轮循环&quot;&gt;本轮循环和次轮循环&lt;/h2&gt;

&lt;p&gt;异步任务可以分成两种：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;追加在本轮循环的异步任务 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;process.nextTick&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Promise&lt;/code&gt; 的回调函数，即同步任务一旦执行完成，就开始执行它们&lt;/li&gt;
  &lt;li&gt;追加在次轮循环的异步任务：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setTimeout&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setInterval&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate&lt;/code&gt;的回调函数，追加在次轮循环&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;setimmediate-与-settimeout&quot;&gt;setImmediate() 与 setTimeout()&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate()&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setTimeout()&lt;/code&gt; 很类似，但是针对被调用的时机，他们会有有不同表现。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate()&lt;/code&gt; 设计为一旦在当前 poll 阶段完成，就执行脚本&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setTimeout()&lt;/code&gt; 在最小阈值（ms 单位）过后运行脚本&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;执行计时器的顺序将根据调用它们的上下文而异。如果二者都从主模块内调用，则计时器将受进程性能的约束（这可能会受到计算机上其他正在运行应用程序的影响：进入事件循环以后，有可能到了 1 毫秒，也可能还没到 1 毫秒，取决于系统当时的状况。如果没到 1 毫秒，那么 timers 阶段就会跳过，进入 check 阶段，先执行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate&lt;/code&gt; 的回调函数，否则先执行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setTimeout&lt;/code&gt;）。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;如果运行以下不在 I/O 周期（即主模块）内的脚本，则执行两个计时器的顺序是非确定性的，因为它受进程性能的约束&lt;/li&gt;
  &lt;li&gt;如果你把这两个函数放入一个 I/O 循环内调用，setImmediate 总是被优先调用&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate()&lt;/code&gt; 相对于 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setTimeout()&lt;/code&gt; 的主要优势是，如果 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate()&lt;/code&gt; 是在 I/O 周期内被调度的，那它将会在其中任何的定时器之前执行，跟这里存在多少个定时器无关。&lt;/p&gt;

&lt;h3 id=&quot;processnexttick-对比-setimmediate&quot;&gt;process.nextTick() 对比 setImmediate()&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;process.nextTick()&lt;/code&gt; 在同一个阶段立即执行&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate()&lt;/code&gt; 在事件循环的接下来的迭代或 ‘tick’ 上触发&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;我们建议开发人员在所有情况下都使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setImmediate()&lt;/code&gt;，因为它更容易理解&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;微任务&quot;&gt;微任务&lt;/h3&gt;

&lt;p&gt;根据语言规格，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Promise&lt;/code&gt; 对象的回调函数，会进入异步任务里面的 “微任务”（microtask）队列。&lt;/p&gt;

&lt;p&gt;微任务队列追加在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;process.nextTick&lt;/code&gt; 队列的后面，也属于本轮循环。&lt;strong&gt;只有前一个队列全部清空以后，才会执行下一个队列&lt;/strong&gt;。&lt;/p&gt;

&lt;h2 id=&quot;参考&quot;&gt;参考&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;https://nodejs.org/zh-cn/docs/guides/dont-block-the-event-loop/&lt;/li&gt;
  &lt;li&gt;https://nodejs.org/en/docs/guides/dont-block-the-event-loop/&lt;/li&gt;
  &lt;li&gt;http://www.ruanyifeng.com/blog/2018/02/node-event-loop.html&lt;/li&gt;
&lt;/ul&gt;
</content>
                 <tag>Node.js</tag> 
                 <tag>学习</tag> 
                <pubTime>2021-02-24T11:25:45+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/microservice-simple-distributed-log-tracing.html</loc>
        <lastmod>2021-01-15T14:56:06+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>微服务实现简单的分布式日志追踪</title>
                <content>
&lt;p&gt;最近想给项目添加一个简单的分布式请求跟踪功能，从前端发起请求到网关，再从网关调用 SpringCloud 的微服务，这些过程中希望能从日志中看到一个分布式 ID 的链路，通过请求的 ID 可以追踪整一条链路，方便问题的排查。&lt;/p&gt;

&lt;p&gt;现成的方案自然是使用 SkyWalking 、 Spring Cloud Sleuth 、Zipkin 之类的组件，但是想到主要的目的记录一个可以一直贯通各个服务的 ID，方便日志查询，也就不想引入太多复杂的组件，最终决定通过 MDC 在日志中输出追踪的 ID，然后在 Feign 和 RestTemplate 中将请求 ID 在微服务中传递。&lt;/p&gt;

&lt;p&gt;主要包括几个步骤：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;从前端生成请求 ID 并加入请求头带入网关&lt;/li&gt;
  &lt;li&gt;网关通过 WebFilter 拦截并加入 MDC 中，在 log 中输出&lt;/li&gt;
  &lt;li&gt;在 Feign 和 RequestTemplate 中将请求 ID 在带到 HTTP 的 Header 中微服务传递&lt;/li&gt;
  &lt;li&gt;各个微服务同样通过 WebFilter 实现拦截并加入 MDC，在 log 中输出&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;mdc&quot;&gt;MDC&lt;/h2&gt;

&lt;p&gt;MDC（Mapped Diagnostic Context，映射调试上下文）是 log4j 和 logback 提供的一种方便在多线程条件下记录日志的功能。 MDC 可以看成是一个与当前线程绑定的哈希表，可以往其中添加键值对。&lt;/p&gt;

&lt;p&gt;MDC 的关键操作：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;向 MDC 中设置值：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MDC.put(key, value);&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;从 MDC 中取值：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MDC.get(key);&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;将 MDC 中内容打印到日志中：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;%X{key}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;新增-traceid-工具类&quot;&gt;新增 TraceId 工具类&lt;/h2&gt;

&lt;p&gt;先新增一个 TraceIdUtils 工具类，用于定义 TRACE_ID 的常量值以及设置及生成 TRACE_ID 的方法，后续代码中都是通过这个估计类进行操作&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.apache.commons.lang.RandomStringUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.apache.commons.lang.StringUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.slf4j.MDC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TraceIdUtils&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;TRACE_ID&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;traceId&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;MAX_ID_LENGTH&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;cm&quot;&gt;/**
     * 生成 traceId
     */&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;genTraceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;RandomStringUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;randomAlphanumeric&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;MAX_ID_LENGTH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;cm&quot;&gt;/**
     * 设置 traceId
     */&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setTraceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;traceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 如果参数为空，则生成新 ID&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;traceId&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;StringUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isBlank&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;traceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;genTraceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;traceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 将 traceId 放到 MDC 中&lt;/span&gt;
        &lt;span class=&quot;no&quot;&gt;MDC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;put&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;TRACE_ID&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;StringUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;substring&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;traceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;MAX_ID_LENGTH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;cm&quot;&gt;/**
     * 获取 traceId
     */&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getTraceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 获取&lt;/span&gt;
        &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;traceId&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;MDC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;TRACE_ID&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 如果 traceId 为空，则生成新 ID&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;StringUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isBlank&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;traceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;genTraceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;traceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;通过-webfilter-添加-traceid-过滤器&quot;&gt;通过 WebFilter 添加 TraceId 过滤器&lt;/h2&gt;

&lt;p&gt;新增一个 GenericFilterBean ，从请求头中获取 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TraceIdUtils.TRACE_ID&lt;/code&gt; 对应的值，该值在前端发起请求或者微服务之间传递都会带上，如果没有，则 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TraceIdUtils.setTraceId&lt;/code&gt; 会生成一个。&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.springframework.core.annotation.Order&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.springframework.web.filter.GenericFilterBean&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nd&quot;&gt;@WebFilter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;urlPatterns&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/*&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;filterName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;traceIdFilter&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nd&quot;&gt;@Order&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TraceIdFilter&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;GenericFilterBean&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;doFilter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ServletRequest&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;nc&quot;&gt;ServletResponse&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;FilterChain&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;filterChain&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;IOException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ServletException&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// traceId初始化&lt;/span&gt;
        &lt;span class=&quot;nc&quot;&gt;HttpServletRequest&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;req&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;HttpServletRequest&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;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;traceId&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getHeader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;TraceIdUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;TRACE_ID&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nc&quot;&gt;TraceIdUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setTraceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;traceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 执行后续过滤器&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;filterChain&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;doFilter&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;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;不要忘记在 SpringBoot 的启动类加上 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@ServletComponentScan&lt;/code&gt; 注解，否则自定义的 Filter 无法生效。其中 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&quot;com.yourtion.trace.filter&quot;&lt;/code&gt; 是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TraceIdFilter&lt;/code&gt; 所在的包名。&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@ServletComponentScan&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;basePackages&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;com.yourtion.trace.filter&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nd&quot;&gt;@SpringBootApplication&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MyApplication&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nc&quot;&gt;SpringApplication&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;MyApplication&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;在-feign-上添加-traceid&quot;&gt;在 feign 上添加 TraceId&lt;/h2&gt;

&lt;p&gt;因为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@FeignClient&lt;/code&gt; 的代理类在执行的时候，会去使用使用到 spring 上下文的 RequestInterceptor，所以自定义自己的拦截器，然后注入到 spring 上下文中，这样就可以在请求的上下文中添加自定义的请求头。&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;feign.RequestInterceptor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;feign.RequestTemplate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.springframework.stereotype.Service&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nd&quot;&gt;@Service&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;FeignInterceptor&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;RequestInterceptor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;apply&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;RequestTemplate&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;TraceIdUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;TRACE_ID&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TraceIdUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getTraceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;在-resttemplate-上添加-traceid&quot;&gt;在 RestTemplate 上添加 TraceId&lt;/h2&gt;

&lt;p&gt;还有一部分请求是通过 RestTemplate 发起的，之前我们是自己实现了 RestTemplateConfig 的配置类，这次在相关的配置上添加：&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;RestTemplate&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;restTemplate&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;builder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;additionalInterceptors&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;body&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;execution&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&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;na&quot;&gt;getHeaders&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;TraceIdUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;TRACE_ID&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TraceIdUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getTraceId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;execution&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;execute&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;body&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;至此，链路上的 TraceId 添加已经完成，剩下的就是在日志中打印出来了。&lt;/p&gt;

&lt;h2 id=&quot;修改-log4j2-的-layout-格式&quot;&gt;修改 log4j2 的 layout 格式&lt;/h2&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;修改日志的layout格式，将MDC中的traceId打印出来：

&lt;span class=&quot;c&quot;&gt;&amp;lt;!-- 原始格式 --&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;PatternLayout&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;pattern=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%5p %c:%L - %m %throwable{separator( --&amp;gt; )}%n&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;&amp;lt;!-- 增加traceId的格式 --&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;PatternLayout&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;pattern=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%5p traceId:%X{traceId} %c:%L - %m %throwable{separator( --&amp;gt; )}%n&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;至此，修改就大功告成了。&lt;/p&gt;

&lt;h2 id=&quot;参考文章&quot;&gt;参考文章&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://hanchao.blog.csdn.net/article/details/92107651&quot;&gt;SpringBoot 项目中通过 MDC 和自定义 Filter 操作 traceId 实现日志链路追踪&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://bishion.github.io/2019/05/29/spring-feign-headers/#%E6%96%B9%E6%A1%88%E4%B8%80%E8%87%AA%E5%AE%9A%E4%B9%89-requestinterceptor&quot;&gt;为 springcloud feign 添加自定义 headers&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/32623407/add-my-custom-http-header-to-spring-resttemplate-request-extend-resttemplate&quot;&gt;Add my custom http header to Spring RestTemplate request / extend RestTemplate&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
                 <tag>微服务</tag>  <tag>Java</tag> 
                 <tag>开发笔记</tag> 
                <pubTime>2021-01-15T14:56:06+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/fix-cloudera-scm-server-start-failed.html</loc>
        <lastmod>2020-09-12T11:53:53+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>解决 CDH6 启动 cloudera-scm-server 失败问题</title>
                <content>
&lt;p&gt;最近尝试在 CentOS7 上使用 Cloudera CM 搭建 CDH6 的集群，安装好了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cloudera-manager-daemons&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cloudera-manager-agent&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cloudera-manager-server&lt;/code&gt; 后，通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;systemctl start cloudera-scm-server&lt;/code&gt;，一直没有成功启动服务。&lt;/p&gt;

&lt;p&gt;看到的都报错的信息：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2020/09/fix-cloudera-scm-server-start-failed-1.jpg&quot;&gt;&lt;img src=&quot;/images/2020/09/fix-cloudera-scm-server-start-failed-1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;● cloudera-scm-server.service - Cloudera CM Server Service
   Loaded: loaded (/usr/lib/systemd/system/cloudera-scm-server.service; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Thu 2020-09-10 17:03:36 CST; 4s ago
  Process: 5045 ExecStart=/opt/cloudera/cm/bin/cm-server (code=exited, status=1/FAILURE)
  Process: 5042 ExecStartPre=/opt/cloudera/cm/bin/cm-server-pre (code=exited, status=0/SUCCESS)
 Main PID: 5045 (code=exited, status=1/FAILURE)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Sep 10 17:03:36 cdh1 systemd[1]: cloudera-scm-server.service: main process exited, code=exited, status=1/FAILURE
Sep 10 17:03:36 cdh1 systemd[1]: Unit cloudera-scm-server.service entered failed state.
Sep 10 17:03:36 cdh1 systemd[1]: cloudera-scm-server.service failed.
Sep 10 17:03:36 cdh1 systemd[1]: cloudera-scm-server.service holdoff time over, scheduling restart.
Sep 10 17:03:36 cdh1 systemd[1]: Stopped Cloudera CM Server Service.
Sep 10 17:03:36 cdh1 systemd[1]: start request repeated too quickly for cloudera-scm-server.service
Sep 10 17:03:36 cdh1 systemd[1]: Failed to start Cloudera CM Server Service.
Sep 10 17:03:36 cdh1 systemd[1]: Unit cloudera-scm-server.service entered failed state.
Sep 10 17:03:36 cdh1 systemd[1]: cloudera-scm-server.service failed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;而且没有任何更多的日志，包括&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/log/cloudera-scm-server/&lt;/code&gt;目录也没有任何文件。&lt;/p&gt;

&lt;p&gt;然后通过命令&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;journalctl -xe&lt;/code&gt;发现了一些端倪，提示&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JAVA_HOME&lt;/code&gt;找不到，但是我明明已经安装过了jdk，使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;java -version&lt;/code&gt;也可以正常列出版本信息，怎么还会找不到呢？之后在一个脚本文件中找到了些答案，原来程序默认会去使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/java&lt;/code&gt;下的jdk，所以解决办法执行以下两条命令即可：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir -p /usr/java
ln -s /opt/java/  /usr/java/default
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;再次执行就能正常的启动了：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;systemctl status cloudera-scm-server
● cloudera-scm-server.service - Cloudera CM Server Service
   Loaded: loaded (/usr/lib/systemd/system/cloudera-scm-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-09-10 17:08:18 CST; 3s ago
  Process: 5098 ExecStartPre=/opt/cloudera/cm/bin/cm-server-pre (code=exited, status=0/SUCCESS)
 Main PID: 5101 (java)
   CGroup: /system.slice/cloudera-scm-server.service&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;同时注意的是，集群内其他已经安装 Java 的机器也建议这样操作&lt;/strong&gt;，因为 CDH 在安装过程也会检查集群内各个机器的环境情况，如果机器只是安装了 Java 并配合环境变量，但是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/java&lt;/code&gt;没有信息的话，检测也会提示机器没有 Java 环境的。&lt;/p&gt;
</content>
                 <tag>CDH</tag> 
                 <tag>解决问题</tag> 
                <pubTime>2020-09-12T11:53:53+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/join-file-data-using-awk.html</loc>
        <lastmod>2020-07-26T18:03:27+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用AWK进行文件内容join</title>
                <content>
&lt;p&gt;最近在做一个项目，需要在两个不同的数据源上导出两个 CSV 文件，同时对导出的文件进行类似于 SQL 的 join 操作，由于只是一个查询脚本，没办法修改程序或者数据库等功能，所以就想到将 csv 文件导出后，通过 Linux 自带的命令来完成内容的合并。&lt;/p&gt;

&lt;p&gt;首选的工具自然是最强大的 AWK 了。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;AWK是一种优良的文本处理工具，Linux及Unix环境中现有的功能最强大的数据处理引擎之一。
https://zh.wikipedia.org/zh-hans/AWK&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;需求&quot;&gt;需求&lt;/h2&gt;

&lt;p&gt;首先来看一导出的两个 csv 文件：&lt;/p&gt;

&lt;p&gt;channel.csv 主要保存渠道 ID 与渠道名称的关系&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-csv&quot;&gt;id	Name
1	渠道1
2	渠道2
...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;data.csv 记录每个渠道带来的 PV/UV 等信息&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-csv&quot;&gt;id	pv	uv	submit
2	4	3	2
12	1	1	0
3	1	1	0
...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;需要的结果是将两个文档进行整合，输出一个完整的csv&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-csv&quot;&gt;channle	id	pv	uv	submit
渠道2	2	4	3	2
未知	12	1	1	0
渠道3	3	1	1	0
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;思路&quot;&gt;思路&lt;/h2&gt;

&lt;p&gt;其实解答的一个思路还是比较简单的，因为渠道 ID 本身不会重复，最简单的方法就是将其转换为一个字典，然后对于 data.csv 的内容根据 id 去字典中获取对应的渠道名称，最后组合到一起。&lt;/p&gt;

&lt;p&gt;首先去网上找到了一个在 awk 内按行读取文件的方法，并根据需求将文件内容转换成一个数组（其实 awk 里面数组跟 map 是一样的）。最后再按行拼装数据即可。&lt;/p&gt;

&lt;p&gt;需要处理一下渠道 ID 找不到对应的情况，很简单，同一个三元表达式即可 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$1 in File ? File[$1] : &quot;未知&quot;&lt;/code&gt;。&lt;/p&gt;

&lt;h2 id=&quot;最终版本&quot;&gt;最终版本&lt;/h2&gt;

&lt;p&gt;首先是最核心的 join.awk ，实现了 awk 核心的逻辑：&lt;/p&gt;

&lt;div class=&quot;language-awk highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;read_file_into_array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;record&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;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&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;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;getline&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;record&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;file&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&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;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Failed to read file &quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;exit&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;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&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;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;record&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;\t&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;nx&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;file&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;kr&quot;&gt;BEGIN&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;read_file_into_array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CHANNEL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;File&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;p&quot;&gt;{&lt;/span&gt; 
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;NR&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&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;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;channel\tid\tpv\tuv\tsubmit&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;next&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;k&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;%s\t%s\t%s\t%s\t%s\t\n&quot;&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;nv&quot;&gt;$1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;File&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&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;s2&quot;&gt;&quot;未知&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$4&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;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;执行方法（通过 CHANNEL 参数传入变量）：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;CHANNEL&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;channel.csv &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; join.awk  data.csv
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;运行结果：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2020/07/join-file-data-using-awk-1.jpg&quot;&gt;&lt;img src=&quot;/images/2020/07/join-file-data-using-awk-1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;代码详见：https://github.com/yourtion/BlogCodes/tree/master/awk_join&lt;/p&gt;

&lt;h2 id=&quot;参考&quot;&gt;参考&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;https://www.unix.com/302417048-post3.html&lt;/li&gt;
  &lt;li&gt;https://www.unix.com/303007698-post1.html&lt;/li&gt;
  &lt;li&gt;https://blog.csdn.net/bitcarmanlee/article/details/51324585&lt;/li&gt;
&lt;/ul&gt;

</content>
                 <tag>解决问题</tag> 
                 <tag>开发笔记</tag> 
                <pubTime>2020-07-26T18:03:27+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-21.html</loc>
        <lastmod>2020-06-07T17:40:06+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 21</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;需要进一步熟悉回溯法&lt;/li&gt;
  &lt;li&gt;学习并掌握“字典排序（二进制排序） 子集”&lt;/li&gt;
  &lt;li&gt;对回溯方法需要进一步理解，做到举一反三&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;49-字母异位词分组&quot;&gt;49. 字母异位词分组&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/group-anagrams/&quot;&gt;https://leetcode-cn.com/problems/group-anagrams/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先对每个单词转换成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;char[]&lt;/code&gt;后进行排序，并重新转换为一个 key，使用一个 Map 对相同字母的异位词进行存储，将相同字母组成的词放入 map 中，最后转换成数组输出&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/75437663/&quot;&gt;https://leetcode-cn.com/submissions/detail/75437663/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;除了使用排序外，还可以使用统计字符计数的方式，性能会相对更好一些&lt;/p&gt;

&lt;h2 id=&quot;54-螺旋矩阵&quot;&gt;54. 螺旋矩阵&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/spiral-matrix/&quot;&gt;https://leetcode-cn.com/problems/spiral-matrix/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过一个方向矩阵模拟遍历的路径，但是这样写起来比较复杂&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/75430714/&quot;&gt;https://leetcode-cn.com/submissions/detail/75430714/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;需要通过另外一个矩阵，记录访问过的单元格位置，遍历整个矩阵，下一步候选移动位置是 (cr, cc)。如果这个候选位置在矩阵范围内并且没有被访问过，那么它将会变成下一步移动的位置；否则，我们将前进方向顺时针旋转之后再计算下一步的移动位置&lt;/p&gt;

&lt;h2 id=&quot;59-螺旋矩阵-ii&quot;&gt;59. 螺旋矩阵 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/spiral-matrix-ii/&quot;&gt;https://leetcode-cn.com/problems/spiral-matrix-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;跟 54 题解法类似，先生成结果矩阵，然后循环生成 1 到 n 平方的数，按照方向矩阵指向，累加并填充到目标矩阵&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/75436057/&quot;&gt;https://leetcode-cn.com/submissions/detail/75436057/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;60-第-k-个排列&quot;&gt;60. 第 k 个排列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/permutation-sequence/&quot;&gt;https://leetcode-cn.com/problems/permutation-sequence/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始考虑的方法是根据排列数量直接算出结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/75711526/&quot;&gt;https://leetcode-cn.com/submissions/detail/75711526/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;应该使用数字生成排列，然后映射到组合/子集/排列中。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;生成输入数组，存储从 1 到 N 的数字。&lt;/li&gt;
  &lt;li&gt;计算从 0 到 (N−1)! 的所有阶乘数。&lt;/li&gt;
  &lt;li&gt;(0,N!−1) 区间内，k 重复减 1。&lt;/li&gt;
  &lt;li&gt;计算 k 的阶乘，使用阶乘系数构造排列。&lt;/li&gt;
  &lt;li&gt;返回排列字符串。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;61-旋转链表&quot;&gt;61. 旋转链表&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/rotate-list/&quot;&gt;https://leetcode-cn.com/problems/rotate-list/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先计算链表长度，然后将 k 与长度取模，最后循环 k-1，直到 k 为 0，将上一个节点的 next 置为 null，最后返回当前节点&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/75711816/&quot;&gt;https://leetcode-cn.com/submissions/detail/75711816/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法一致：先将链表闭合成环，找到相应的位置断开这个环，确定新的链表头和链表尾&lt;/p&gt;

&lt;h2 id=&quot;62-不同路径&quot;&gt;62. 不同路径&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/unique-paths/&quot;&gt;https://leetcode-cn.com/problems/unique-paths/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始考虑是通过模拟的方式进行计算，但是这样太复杂&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/75711885/&quot;&gt;https://leetcode-cn.com/submissions/detail/75711885/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;通过动态规划方式，令&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dp[i][j]&lt;/code&gt;是到达 i, j 最多路径&lt;/p&gt;

&lt;h2 id=&quot;63-不同路径-ii&quot;&gt;63. 不同路径 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/unique-paths-ii/&quot;&gt;https://leetcode-cn.com/problems/unique-paths-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的思路是参考之前“不同路径”题目的解答，只是判断遇到的节点是否为 1&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/75977349/&quot;&gt;https://leetcode-cn.com/submissions/detail/75977349/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;从左至右、从上至下的遍历整个数组，那么在到达某个顶点之前我们就已经获得了到达前驱节点的方案数&lt;/p&gt;

&lt;h2 id=&quot;64-最小路径和&quot;&gt;64. 最小路径和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/minimum-path-sum/&quot;&gt;https://leetcode-cn.com/problems/minimum-path-sum/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过遍历矩阵，计算到达当前节点最短路径，当前节点加上上方或左方的最小值，到达最后返回对应元素即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/75991166/&quot;&gt;https://leetcode-cn.com/submissions/detail/75991166/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法“方法 4：动态规划（不需要额外存储空间）”一致，只是官方解法从后向前遍历，最后返回&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grid[0][0]&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;71-简化路径&quot;&gt;71. 简化路径&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/simplify-path/&quot;&gt;https://leetcode-cn.com/problems/simplify-path/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过将路径使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/&lt;/code&gt;分割成数组。然后循环遍历&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;遇到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.&lt;/code&gt;或者空串则跳过&lt;/li&gt;
  &lt;li&gt;遇到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;..&lt;/code&gt;则从栈 pop 出一个元素（如果栈不为空）&lt;/li&gt;
  &lt;li&gt;如果是其他情况则将字符串压入栈中&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;最后将栈内元素组合成目标路径，如果栈为空则返回“/”&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/75993108/&quot;&gt;https://leetcode-cn.com/submissions/detail/75993108/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;73-矩阵置零&quot;&gt;73. 矩阵置零&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/set-matrix-zeroes/&quot;&gt;https://leetcode-cn.com/problems/set-matrix-zeroes/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先遍历找出存在 0 的行和列，将第一行第一列作为标志位，再按照标志位循环遍历行列给对应数据填 0，最后处理第一行和列的情况&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/76217390/&quot;&gt;https://leetcode-cn.com/submissions/detail/76217390/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法思路基本一致，但是实现上还是有些细节没有处理好&lt;/p&gt;

&lt;h2 id=&quot;74-搜索二维矩阵&quot;&gt;74. 搜索二维矩阵&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/search-a-2d-matrix/&quot;&gt;https://leetcode-cn.com/problems/search-a-2d-matrix/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先按照行判断目标值是否再行的范围内，再使用二分法查找&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/76222561/&quot;&gt;https://leetcode-cn.com/submissions/detail/76222561/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;可以将整个矩阵看成一个长的有序数组，然后使用二分法查找，只是在取值时候转换成矩阵行列&lt;/p&gt;

&lt;h2 id=&quot;75-颜色分类&quot;&gt;75. 颜色分类&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/sort-colors/&quot;&gt;https://leetcode-cn.com/problems/sort-colors/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用双指针法，前面遇到 2 就跟后面交换，后面遇到 0 就跟前面交换&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/76222657/&quot;&gt;https://leetcode-cn.com/submissions/detail/76222657/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;沿着数组移动 curr 指针，若&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nums[curr] = 0&lt;/code&gt;，则将其与&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nums[p0]&lt;/code&gt;互换；若&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nums[curr] = 2&lt;/code&gt;，则与&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nums[p2]&lt;/code&gt;互换。&lt;/p&gt;

&lt;h2 id=&quot;9050-面试题-18-删除链表的节点&quot;&gt;9050. 面试题 18. 删除链表的节点&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/shan-chu-lian-biao-de-jie-dian-lcof/&quot;&gt;https://leetcode-cn.com/problems/shan-chu-lian-biao-de-jie-dian-lcof/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;循环链表并记录当前节点与之前节点，遇到目标值后将之前节点指向下一节点，注意处理目标值是头部的情况&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/76533389/&quot;&gt;https://leetcode-cn.com/submissions/detail/76533389/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;9051-面试题-21-调整数组顺序使奇数位于偶数前面&quot;&gt;9051. 面试题 21. 调整数组顺序使奇数位于偶数前面&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/diao-zheng-shu-zu-shun-xu-shi-qi-shu-wei-yu-ou-shu-qian-mian-lcof/&quot;&gt;https://leetcode-cn.com/problems/diao-zheng-shu-zu-shun-xu-shi-qi-shu-wei-yu-ou-shu-qian-mian-lcof/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过首尾双指针的方式进行搜索，指针 i 左边都是奇数，指针 j 右边都是偶数&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/76533594/&quot;&gt;https://leetcode-cn.com/submissions/detail/76533594/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;9052-面试题-22-链表中倒数第-k-个节点&quot;&gt;9052. 面试题 22. 链表中倒数第 k 个节点&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/lian-biao-zhong-dao-shu-di-kge-jie-dian-lcof/&quot;&gt;https://leetcode-cn.com/problems/lian-biao-zhong-dao-shu-di-kge-jie-dian-lcof/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过快慢指针的方式，快指针先走 k 步，慢指针开始走直到快指针到达就可以返回&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/76533760/&quot;&gt;https://leetcode-cn.com/submissions/detail/76533760/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法一致&lt;/p&gt;

&lt;h2 id=&quot;77-组合&quot;&gt;77. 组合&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/combinations/&quot;&gt;https://leetcode-cn.com/problems/combinations/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用回溯的方式，循环数字，并不断添加到 list 中，当 list 长度达到目标时添加到结果列表中&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/76766365/&quot;&gt;https://leetcode-cn.com/submissions/detail/76766365/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;若组合完成- 添加到输出中。&lt;/li&gt;
  &lt;li&gt;遍历从 first t 到 n 的所有整数。&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
  &lt;li&gt;将整数 i 添加到现有组合&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curr&lt;/code&gt;中。&lt;/li&gt;
  &lt;li&gt;继续向组合中添加更多整数 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;backtrack(i + 1, curr)&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;将 i 从&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curr&lt;/code&gt;中移除，实现回溯。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;78-子集&quot;&gt;78. 子集&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/subsets/&quot;&gt;https://leetcode-cn.com/problems/subsets/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;跟前面 77 题的方法类似，使用回溯的方法解答&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/76792979/&quot;&gt;https://leetcode-cn.com/submissions/detail/76792979/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用“字典排序（二进制排序） 子集”更快，将每个子集映射到长度为 n 的位掩码中，其中第 i 位掩码&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nums[i]&lt;/code&gt;为 1，表示第 i 个元素在子集中；如果第 i 位掩码&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nums[i]&lt;/code&gt;为 0，表示第 i 个元素不在子集中。&lt;/p&gt;

&lt;h2 id=&quot;79-单词搜索&quot;&gt;79. 单词搜索&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/word-search/&quot;&gt;https://leetcode-cn.com/problems/word-search/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;因为存在平面多个方向的问题，同时还要处理不能往回走的问题，一开始的递归解法没有正确&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/76795651/&quot;&gt;https://leetcode-cn.com/submissions/detail/76795651/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;需要另外一个数组记录访问过的情况，然后使用回溯加 DFS 法解答&lt;/p&gt;

&lt;h2 id=&quot;80-删除排序数组中的重复项-ii&quot;&gt;80. 删除排序数组中的重复项 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array-ii/&quot;&gt;https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过两个指针分别记录当前个数和当前索引，只有当前位置数组与之前数字不相等或者当前数字只要一个才添加数字并向后移动，否则只有索引后移&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/77035016/&quot;&gt;https://leetcode-cn.com/submissions/detail/77035016/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法逻辑一致，但是看起来更加简单优雅一些&lt;/p&gt;

&lt;h2 id=&quot;81-搜索旋转排序数组-ii&quot;&gt;81. 搜索旋转排序数组 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/search-in-rotated-sorted-array-ii/&quot;&gt;https://leetcode-cn.com/problems/search-in-rotated-sorted-array-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;还是跟前面的题目一样使用二分查找法，但是因为存在重复的元素，需要做特殊的处理&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/77035079/&quot;&gt;https://leetcode-cn.com/submissions/detail/77035079/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;类似二分查找法，根据前半部分有序或者后半部分有序进行处理判断&lt;/p&gt;

&lt;h2 id=&quot;82-删除排序链表中的重复元素-ii&quot;&gt;82. 删除排序链表中的重复元素 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list-ii/&quot;&gt;https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-20&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过哑节点，然后循环遍历链表，只有节点数组不等于前后节点则加入目标链表，否则前进&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list-ii/submissions/&quot;&gt;https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list-ii/submissions/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法类似&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-06-07T17:40:06+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-20.html</loc>
        <lastmod>2020-05-31T18:40:54+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 20</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;充分了解贪心算法，尽可能减少比对与循环次数&lt;/li&gt;
  &lt;li&gt;熟悉二分法和位运算&lt;/li&gt;
  &lt;li&gt;熟悉回溯算法+剪枝&lt;/li&gt;
  &lt;li&gt;针对回溯中遇到重复的情况，需要仔细考虑剪枝方法&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;2-两数相加&quot;&gt;2. 两数相加&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/add-two-numbers/&quot;&gt;https://leetcode-cn.com/problems/add-two-numbers/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;循环两个列表，获取对应节点的数值进行累加，注意处理空节点和进位问题，按序放入新的链表中&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/73446189/&quot;&gt;https://leetcode-cn.com/submissions/detail/73446189/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方题解解法一致&lt;/p&gt;

&lt;h2 id=&quot;6-z-字形变换&quot;&gt;6. Z 字形变换&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/zigzag-conversion/&quot;&gt;https://leetcode-cn.com/problems/zigzag-conversion/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始企图通过计算错位的数量来拼接结果字符串，但是这样做会非常复杂，只能通过构建一个数组模拟各个行的情况，最后重新拼接结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/73512707/&quot;&gt;https://leetcode-cn.com/submissions/detail/73512707/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;对于一开始希望的按行访问的场景：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;行 0 中的字符位于索引 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k(2⋅numRows−2)&lt;/code&gt; 处;&lt;/li&gt;
  &lt;li&gt;行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;numRows−1&lt;/code&gt; 中的字符位于索引&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k(2⋅numRows−2)+numRows−1&lt;/code&gt;处;&lt;/li&gt;
  &lt;li&gt;内部的行 i 中的字符位于索引&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k(2⋅numRows−2)+i&lt;/code&gt;以及&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(k+1)(2⋅numRows−2)−i&lt;/code&gt;处;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;12-整数转罗马数字&quot;&gt;12. 整数转罗马数字&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/integer-to-roman/&quot;&gt;https://leetcode-cn.com/problems/integer-to-roman/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过循环的方式调用一个转换函数，根据返回结果拼接字符串并不断减去返回字母对应的数值，直到数字为 0&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/73518650/&quot;&gt;https://leetcode-cn.com/submissions/detail/73518650/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用贪心算法，通过将数组比对方式，寻找适合它的最大符号。我们减去它，然后寻找适合余数的最大符号，依此类推，直到余数为 0&lt;/p&gt;

&lt;h2 id=&quot;15-三数之和&quot;&gt;15. 三数之和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/3sum/&quot;&gt;https://leetcode-cn.com/problems/3sum/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的解法是先对数组进行排序，然后使用三层循环的方式进行计算，但是在大数据量的情况会超时&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/73817533/&quot;&gt;https://leetcode-cn.com/submissions/detail/73817533/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;首先对数组进行排序，排序后固定一个数 nums[i]，再使用左右指针指向 nums[i]后面的两端，数字分别为 nums[L] 和 nums[R]，计算三个数的和 sum 判断是否满足为 0，满足则添加进结果集&lt;/li&gt;
  &lt;li&gt;如果 nums[i]大于 0，则三数之和必然无法等于 0，结束循环&lt;/li&gt;
  &lt;li&gt;如果 nums[i] == nums[i−1]，则说明该数字重复，会导致结果重复，所以应该跳过&lt;/li&gt;
  &lt;li&gt;当 sum == 0 时，nums[L] == nums[L+1] 则会导致结果重复，应该跳过，L++&lt;/li&gt;
  &lt;li&gt;当 sum == 0 时，nums[R] == nums[R−1] 则会导致结果重复，应该跳过，R−−&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;16-最接近的三数之和&quot;&gt;16. 最接近的三数之和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/3sum-closest/&quot;&gt;https://leetcode-cn.com/problems/3sum-closest/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;与解决 15 题的思路类似，遍历计算最小值&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/73840072/&quot;&gt;https://leetcode-cn.com/submissions/detail/73840072/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;左右指针向中间移动，中间同时从左向右移动 i，并三数相加。通过每次&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;三数之和 - 目标值&lt;/code&gt;，比较绝对值&lt;/p&gt;

&lt;h2 id=&quot;17-电话号码的字母组合&quot;&gt;17. 电话号码的字母组合&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number/&quot;&gt;https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始考虑使用回溯法进行构建，但是没有写出结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/73842290/&quot;&gt;https://leetcode-cn.com/submissions/detail/73842290/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;如果没有更多的数字需要被输入，那意味着当前的组合已经产生好了。&lt;/li&gt;
  &lt;li&gt;如果还有数字需要被输入：&lt;/li&gt;
  &lt;li&gt;遍历下一个数字所对应的所有映射的字母。&lt;/li&gt;
  &lt;li&gt;将当前的字母添加到组合最后，也就是 combination = combination + letter 。&lt;/li&gt;
  &lt;li&gt;重复这个过程&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;9047-面试题-11-旋转数组的最小数字&quot;&gt;9047. 面试题 11. 旋转数组的最小数字&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/xuan-zhuan-shu-zu-de-zui-xiao-shu-zi-lcof/&quot;&gt;https://leetcode-cn.com/problems/xuan-zhuan-shu-zu-de-zui-xiao-shu-zi-lcof/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过从尾向头遍历数组，发现数字变大即返回&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/74140587/&quot;&gt;https://leetcode-cn.com/submissions/detail/74140587/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;也可以使用二分法查找&lt;/p&gt;

&lt;h2 id=&quot;9048-面试题-15-二进制中-1-的个数&quot;&gt;9048. 面试题 15. 二进制中 1 的个数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/er-jin-zhi-zhong-1de-ge-shu-lcof/&quot;&gt;https://leetcode-cn.com/problems/er-jin-zhi-zhong-1de-ge-shu-lcof/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始考虑使用二进制除法后累加，但是发现还是有些问题，最后使用 bitCount&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/74143394/&quot;&gt;https://leetcode-cn.com/submissions/detail/74143394/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;res += n &amp;amp; 1&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n &amp;gt;&amp;gt;= 1&lt;/code&gt;循环累加&lt;/p&gt;

&lt;h2 id=&quot;9049-面试题-17-打印从-1-到最大的-n-位数&quot;&gt;9049. 面试题 17. 打印从 1 到最大的 n 位数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/da-yin-cong-1dao-zui-da-de-nwei-shu-lcof/&quot;&gt;https://leetcode-cn.com/problems/da-yin-cong-1dao-zui-da-de-nwei-shu-lcof/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;计算位数，然后循环放入相应位置&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/74142586/&quot;&gt;https://leetcode-cn.com/submissions/detail/74142586/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;对于存在大数的场景：通过使用 char 数组进行求解；通过使用 string 进行求解&lt;/p&gt;

&lt;h2 id=&quot;18-四数之和&quot;&gt;18. 四数之和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/4sum/&quot;&gt;https://leetcode-cn.com/problems/4sum/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;跟三数之和类似，先排序再计算&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/74396879/&quot;&gt;https://leetcode-cn.com/submissions/detail/74396879/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;第一层循环选择第一个数固定然后去遍历其它三个数。&lt;/li&gt;
  &lt;li&gt;第二层循环选择第二个数固定然后去遍历最后两个数。&lt;/li&gt;
  &lt;li&gt;通过双指针选出最后符合条件的两个数。&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;19-删除链表的倒数第-n-个节点&quot;&gt;19. 删除链表的倒数第 N 个节点&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/&quot;&gt;https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用快慢指针的方式，先让快指针走 n 步后，慢指针才开始向后移动。需要处理倒数 N 个节点正好是头节点的情况&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/74428576/&quot;&gt;https://leetcode-cn.com/submissions/detail/74428576/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解使用一个 dummy 节点处理头节点的情况&lt;/p&gt;

&lt;h2 id=&quot;24-两两交换链表中的节点&quot;&gt;24. 两两交换链表中的节点&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/swap-nodes-in-pairs/&quot;&gt;https://leetcode-cn.com/problems/swap-nodes-in-pairs/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;循环遍历链表，如当前的节点的 next 不为空，则交换当前节点和下一节点，否则直接跳过&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/74385676/&quot;&gt;https://leetcode-cn.com/submissions/detail/74385676/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法一致&lt;/p&gt;

&lt;h2 id=&quot;29-两数相除&quot;&gt;29. 两数相除&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/divide-two-integers/&quot;&gt;https://leetcode-cn.com/problems/divide-two-integers/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始也没有想到使用减法替代除法，后来发现直接迭代计算还会超时&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/74687167/&quot;&gt;https://leetcode-cn.com/submissions/detail/74687167/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;采用二分法的思想，dividend 每次减去 2^n 个 divisor（尽可能多），同时 reslut 每次加 2^n&lt;/p&gt;

&lt;h2 id=&quot;31-下一个排列&quot;&gt;31. 下一个排列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/next-permutation/&quot;&gt;https://leetcode-cn.com/problems/next-permutation/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;考虑使用递归进行找出次小的数，但是这样计算很复杂&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/74688639/&quot;&gt;https://leetcode-cn.com/submissions/detail/74688639/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;交换数字 a[i−1] 和 a[j]，然后反转 a[i−1] 之后的数字&lt;/p&gt;

&lt;h2 id=&quot;34-在排序数组中查找元素的第一个和最后一个位置&quot;&gt;34. 在排序数组中查找元素的第一个和最后一个位置&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/&quot;&gt;https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用二分法找到目标数字，然后从中间向两边查找，找到边界&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/74685548/&quot;&gt;https://leetcode-cn.com/submissions/detail/74685548/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;为了找到最左边（或者最右边）包含 target 的下标（而不是找到的话就返回 true ），所以算法在我们找到一个 target 后不能马上停止。我们需要继续搜索，直到 lo == hi 且它们在某个 target 值处下标相同。&lt;/p&gt;

&lt;h2 id=&quot;36-有效的数独&quot;&gt;36. 有效的数独&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/valid-sudoku/&quot;&gt;https://leetcode-cn.com/problems/valid-sudoku/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过遍历行列和每个单元格内的情况，通过 Set 判断是否已经存在&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/74929240/&quot;&gt;https://leetcode-cn.com/submissions/detail/74929240/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;更快的方法是直接循环遍历然后使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[]&lt;/code&gt;保存结果，检查看到每个单元格值是否已经在当前的行 / 列 / 子数独中出现过&lt;/p&gt;

&lt;h2 id=&quot;39-组合总和&quot;&gt;39. 组合总和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/combination-sum/&quot;&gt;https://leetcode-cn.com/problems/combination-sum/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;考虑的思路是将数组放入 Set 中，通过遍历每个数，不断减去自身并在 Set 中查找是否存在目标&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/74933540/&quot;&gt;https://leetcode-cn.com/submissions/detail/74933540/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;应该使用“回溯算法 + 剪枝”&lt;/p&gt;

&lt;h2 id=&quot;40-组合总和-ii&quot;&gt;40. 组合总和 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/combination-sum-ii/&quot;&gt;https://leetcode-cn.com/problems/combination-sum-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;跟 39 题解法类似，使用回溯+剪枝&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/74963022/&quot;&gt;https://leetcode-cn.com/submissions/detail/74963022/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;编码的不同在于下一层递归的起始索引不一样，从候选数组的当前索引值的下一位开始&lt;/p&gt;

&lt;h2 id=&quot;43-字符串相乘&quot;&gt;43. 字符串相乘&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/multiply-strings/&quot;&gt;https://leetcode-cn.com/problems/multiply-strings/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过遍历的方式，将 num2 每一位与 num1 进行相乘，将每一步的结果进行累加。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/75156978/&quot;&gt;https://leetcode-cn.com/submissions/detail/75156978/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;优化上述过程：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;乘数 num1 位数为 M，被乘数 num2 位数为 N， &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;num1 x num2&lt;/code&gt;结果 res 最大总位数为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M+N&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;num1[i] x num2[j]&lt;/code&gt;的结果为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tmp&lt;/code&gt;(位数为两位，”0x”,”xy”的形式)，其第一位位于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;res[i+j]&lt;/code&gt;，第二位位于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;res[i+j+1]&lt;/code&gt;。&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;47-全排列-ii&quot;&gt;47. 全排列 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/permutations-ii/&quot;&gt;https://leetcode-cn.com/problems/permutations-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始考虑使用回溯法，但是因为数字中存在相同的数字，没有很好的做出来&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/75172751/&quot;&gt;https://leetcode-cn.com/submissions/detail/75172751/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;在搜索之前就对候选数组排序，一旦发现这一支搜索下去可能搜索到重复的元素就停止搜索，这样结果集中不会包含重复元素。&lt;/p&gt;

&lt;h2 id=&quot;48-旋转图像&quot;&gt;48. 旋转图像&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/rotate-image/&quot;&gt;https://leetcode-cn.com/problems/rotate-image/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-20&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过对矩阵进行行列转换再对每一行进行翻转得到结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/75168767/&quot;&gt;https://leetcode-cn.com/submissions/detail/75168767/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;可以通过将给定的矩阵分成四个矩形并且将原问题划归为旋转这些矩形的问题，在一次循环中完成&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-05-31T18:40:54+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-19.html</loc>
        <lastmod>2020-05-24T15:12:28+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 19</title>
                <content>
&lt;h2 id=&quot;1446-连续字符&quot;&gt;1446. 连续字符&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/consecutive-characters/&quot;&gt;https://leetcode-cn.com/problems/consecutive-characters/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;遍历字符串，不断获取并统计统计最长的连续字符（遇到相同则加一，否则取当前值与最大值比较）&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/71682347/&quot;&gt;https://leetcode-cn.com/submissions/detail/71682347/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人类似，也可以使用双指针计算&lt;/p&gt;

&lt;h2 id=&quot;1450-在既定时间做作业的学生人数&quot;&gt;1450. 在既定时间做作业的学生人数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/number-of-students-doing-homework-at-a-given-time/&quot;&gt;https://leetcode-cn.com/problems/number-of-students-doing-homework-at-a-given-time/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;循环 startTime 和 endTime 数组，遇到包含 queryTime 则加一&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/71682449/&quot;&gt;https://leetcode-cn.com/submissions/detail/71682449/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法一致&lt;/p&gt;

&lt;h2 id=&quot;9028-面试题-0806-汉诺塔问题&quot;&gt;9028. 面试题 08.06. 汉诺塔问题&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/hanota-lcci/&quot;&gt;https://leetcode-cn.com/problems/hanota-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;没有想到好的解题思路，应该需要通过递归解答&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/71682514/&quot;&gt;https://leetcode-cn.com/submissions/detail/71682514/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;当&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n = 1&lt;/code&gt;时，直接把盘子从 A 移到 C；&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n &amp;gt; 1&lt;/code&gt;时:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;先把上面 n - 1 个盘子从 A 移到 B（子问题，递归）；&lt;/li&gt;
  &lt;li&gt;再将最大的盘子从 A 移到 C；&lt;/li&gt;
  &lt;li&gt;再将 B 上 n - 1 个盘子从 B 移到 C（子问题，递归）。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;9029-面试题-0810-颜色填充&quot;&gt;9029. 面试题 08.10. 颜色填充&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/color-fill-lcci/&quot;&gt;https://leetcode-cn.com/problems/color-fill-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过 DFS 算法遍历替换目标点周边的元素，注意处理数据越界和不匹配的情况，避免出现死循环&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/71893819/&quot;&gt;https://leetcode-cn.com/submissions/detail/71893819/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;9030-面试题-1005-稀疏数组搜索&quot;&gt;9030. 面试题 10.05. 稀疏数组搜索&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/sparse-array-search-lcci/&quot;&gt;https://leetcode-cn.com/problems/sparse-array-search-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过遍历数组实现的，逻辑上应该使用二分法查找完成&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/71893904/&quot;&gt;https://leetcode-cn.com/submissions/detail/71893904/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;在原有二分法的情况下，针对稀疏数组情况，添加代码（遇到空串向右移动），当&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mid&amp;gt;right&lt;/code&gt;时&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;right=left+(right-left)/2-1;&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;9031-面试题-1605-阶乘尾数&quot;&gt;9031. 面试题 16.05. 阶乘尾数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/factorial-zeros-lcci/&quot;&gt;https://leetcode-cn.com/problems/factorial-zeros-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;参考之前的解答，只需要将 n 除以 5 的每个幂，也就是累加 n / 5 即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/71893993/&quot;&gt;https://leetcode-cn.com/submissions/detail/71893993/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;9032-面试题-1607-最大数值&quot;&gt;9032. 面试题 16.07. 最大数值&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/maximum-lcci/&quot;&gt;https://leetcode-cn.com/problems/maximum-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;没有想到合适到思路&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/72252164/&quot;&gt;https://leetcode-cn.com/submissions/detail/72252164/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用位运算平均值法： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;max(a, b) = ((a + b) + abs(a - b)) / 2&lt;/code&gt;。&lt;/p&gt;

&lt;h2 id=&quot;9033-面试题-1611-跳水板&quot;&gt;9033. 面试题 16.11. 跳水板&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/diving-board-lcci/&quot;&gt;https://leetcode-cn.com/problems/diving-board-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过计算长板和短板的差，然后循环 k，不断在短板上累加差值即可，注意处理 k 为 0 和长短板一样长度的问题&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/72255883/&quot;&gt;https://leetcode-cn.com/submissions/detail/72255883/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;9034-面试题-1615-珠玑妙算&quot;&gt;9034. 面试题 16.15. 珠玑妙算&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/master-mind-lcci/&quot;&gt;https://leetcode-cn.com/problems/master-mind-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过 map 存储字符数量，统计总猜中次数，计算伪猜中 = 总次数 - 猜中次数&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/72256076/&quot;&gt;https://leetcode-cn.com/submissions/detail/72256076/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法一致，使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[]&lt;/code&gt;替代 map&lt;/p&gt;

&lt;h2 id=&quot;9035-面试题-1617-连续数列&quot;&gt;9035. 面试题 16.17. 连续数列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/contiguous-sequence-lcci/&quot;&gt;https://leetcode-cn.com/problems/contiguous-sequence-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;两次遍历累加记录子数组的最大值&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/72502713/&quot;&gt;https://leetcode-cn.com/submissions/detail/72502713/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用动态规划和分治两种方法&lt;/p&gt;

&lt;h2 id=&quot;9036-面试题-1701-不用加号的加法&quot;&gt;9036. 面试题 17.01. 不用加号的加法&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/add-without-plus-lcci/&quot;&gt;https://leetcode-cn.com/problems/add-without-plus-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;对于位运算没有太多思路&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/72503179/&quot;&gt;https://leetcode-cn.com/submissions/detail/72503179/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;进行不含进位的加法的运算,即异或运算,结果记为 ans&lt;/li&gt;
  &lt;li&gt;每一位上的进位凑成一个数,记为 carry,显然 carry = (a&amp;amp;b) «1&lt;/li&gt;
  &lt;li&gt;如果 carry 为 0,则答案为 ans;如果 carry 不为 0,则答案为 ans+carry,为了完成新出现的加法运算,重复过程 1,2&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;9037-面试题-1704-消失的数字&quot;&gt;9037. 面试题 17.04. 消失的数字&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/missing-number-lcci/&quot;&gt;https://leetcode-cn.com/problems/missing-number-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过计算 0 到 n 的总和减去数组中每个数字，结果就是消失的数字&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/72503364/&quot;&gt;https://leetcode-cn.com/submissions/detail/72503364/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法类似&lt;/p&gt;

&lt;h2 id=&quot;9038-面试题-1710-主要元素&quot;&gt;9038. 面试题 17.10. 主要元素&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-majority-element-lcci/&quot;&gt;https://leetcode-cn.com/problems/find-majority-element-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先使用投票算法找出列表中的多数元素，再进一步使用循环算法判读是否超过一半&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/72746643/&quot;&gt;https://leetcode-cn.com/submissions/detail/72746643/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;9039-面试题-1712-binode&quot;&gt;9039. 面试题 17.12. BiNode&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/binode-lcci/&quot;&gt;https://leetcode-cn.com/problems/binode-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;之前考虑使用栈的形式去替换节点中的左节点，但是结果有些不一致&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/72746733/&quot;&gt;https://leetcode-cn.com/submissions/detail/72746733/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用中序遍历递归方式进行迭代&lt;/p&gt;

&lt;h2 id=&quot;9040-面试题-03-数组中重复的数字&quot;&gt;9040. 面试题 03. 数组中重复的数字&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/shu-zu-zhong-zhong-fu-de-shu-zi-lcof/&quot;&gt;https://leetcode-cn.com/problems/shu-zu-zhong-zhong-fu-de-shu-zi-lcof/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过循环数组，将数组中当前数组对于的下标置为负数，下次遇到负数则为出现第二次&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/72746780/&quot;&gt;https://leetcode-cn.com/submissions/detail/72746780/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;题解使用将数据放入 Set 中进行判断&lt;/p&gt;

&lt;h2 id=&quot;9041-面试题-04-二维数组中的查找&quot;&gt;9041. 面试题 04. 二维数组中的查找&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/er-wei-shu-zu-zhong-de-cha-zhao-lcof/&quot;&gt;https://leetcode-cn.com/problems/er-wei-shu-zu-zhong-de-cha-zhao-lcof/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;从前向后循环每一行，如果行的首尾不在目标值范围内则跳过，否则使用二分查找法查找结果，最后返回 false&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/73052957/&quot;&gt;https://leetcode-cn.com/submissions/detail/73052957/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;如果当前元素大于目标值，说明当前元素的下边的所有元素都一定大于目标值，因此往下查找不可能找到目标值，往左查找可能找到目标值。如果当前元素小于目标值，说明当前元素的左边的所有元素都一定小于目标值，因此往左查找不可能找到目标值，往下查找可能找到目标值。&lt;/p&gt;

&lt;h2 id=&quot;9042-面试题-05-替换空格&quot;&gt;9042. 面试题 05. 替换空格&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof/&quot;&gt;https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;直接将字符串转换成字符数组，然后使用 StringBuilder 进行字符串拼接&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/73040148/&quot;&gt;https://leetcode-cn.com/submissions/detail/73040148/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法直接使用一个三倍于输入字符串长度的数组进行拼接，最后按照实际长度返回&lt;/p&gt;

&lt;h2 id=&quot;9043-面试题-06-从尾到头打印链表&quot;&gt;9043. 面试题 06. 从尾到头打印链表&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/cong-wei-dao-tou-da-yin-lian-biao-lcof/&quot;&gt;https://leetcode-cn.com/problems/cong-wei-dao-tou-da-yin-lian-biao-lcof/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;第一次循环计算链表长度&lt;/li&gt;
  &lt;li&gt;根据链表长度创建结果数组&lt;/li&gt;
  &lt;li&gt;从头再次遍历链表，在数组中从尾向前填充遍历结果&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/73040193/&quot;&gt;https://leetcode-cn.com/submissions/detail/73040193/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方结果需要使用栈重新存储一遍节点内容&lt;/p&gt;

&lt;h2 id=&quot;9044-面试题-09-用两个栈实现队列&quot;&gt;9044. 面试题 09. 用两个栈实现队列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/yong-liang-ge-zhan-shi-xian-dui-lie-lcof/&quot;&gt;https://leetcode-cn.com/problems/yong-liang-ge-zhan-shi-xian-dui-lie-lcof/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用两个栈进行模拟，一个作为辅助栈，如果在推入时辅助栈为空，数据可直接压入辅助栈（等待推出再推入目标栈），从头部取数据时，如果辅助栈不为空，先将数据导回目标栈中，提升连续压入和取出性能&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/73244453/&quot;&gt;https://leetcode-cn.com/submissions/detail/73244453/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方题解类似，感觉特定条件下更优&lt;/p&gt;

&lt;h2 id=&quot;9045-面试题-10-i-斐波那契数列&quot;&gt;9045. 面试题 10-I. 斐波那契数列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/fei-bo-na-qi-shu-lie-lcof/&quot;&gt;https://leetcode-cn.com/problems/fei-bo-na-qi-shu-lie-lcof/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用自下而上解法，从头开始计算数列结果，只保留&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;F(N - 1)和&lt;/code&gt;F(N - 2)`&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/73244806/&quot;&gt;https://leetcode-cn.com/submissions/detail/73244806/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法一致&lt;/p&gt;

&lt;h2 id=&quot;9046-面试题-10-ii-青蛙跳台阶问题&quot;&gt;9046. 面试题 10-II. 青蛙跳台阶问题&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/qing-wa-tiao-tai-jie-wen-ti-lcof/&quot;&gt;https://leetcode-cn.com/problems/qing-wa-tiao-tai-jie-wen-ti-lcof/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-20&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;与之前的三步问题类似，使用动态规划，从最后开始向前推进计算结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/73244834/&quot;&gt;https://leetcode-cn.com/submissions/detail/73244834/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;首先知道青蛙每走一步，只有两种情况：这一步要么跳一级，要么跳两级，所以最后一步一定是从第（n-1）级或者第（n-2）级开始跳的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;F(n) = F(n-1) + F(n-2)&lt;/code&gt;&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-05-24T15:12:28+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-18.html</loc>
        <lastmod>2020-05-17T18:09:18+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 18</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;String.valueOf&lt;/code&gt;从&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;char[]&lt;/code&gt;中获取子串&lt;/li&gt;
  &lt;li&gt;通过快慢指针找链表中点更简单（快指针走两步、慢指针走一步）&lt;/li&gt;
  &lt;li&gt;通过一定策略降低无谓的存储，减少内存的使用&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;1441-用栈操作构建数组&quot;&gt;1441. 用栈操作构建数组&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/build-an-array-with-stack-operations/&quot;&gt;https://leetcode-cn.com/problems/build-an-array-with-stack-operations/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;操作方式比较简单，匹配当前数字则 Psuh，否则加入 Push、Pop&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/69920060/&quot;&gt;https://leetcode-cn.com/submissions/detail/69920060/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人的解法一致&lt;/p&gt;

&lt;h2 id=&quot;9008-面试题-0103-url-化&quot;&gt;9008. 面试题 01.03. URL 化&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/string-to-url-lcci/&quot;&gt;https://leetcode-cn.com/problems/string-to-url-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过转换成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;char[]&lt;/code&gt;，然后从后向前遍历，遇到空格插入“%20”，否则原样拷贝原位置字符，最后通过 substring 取出结果字符串&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/69933349/&quot;&gt;https://leetcode-cn.com/submissions/detail/69933349/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人的解法类似&lt;/p&gt;

&lt;h2 id=&quot;9009-面试题-0104-回文排列&quot;&gt;9009. 面试题 01.04. 回文排列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/palindrome-permutation-lcci/&quot;&gt;https://leetcode-cn.com/problems/palindrome-permutation-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过对字符串的字母进行计数，只要不超过一个字符为奇数即为“回文排列”&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/69923357/&quot;&gt;https://leetcode-cn.com/submissions/detail/69923357/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法一致&lt;/p&gt;

&lt;h2 id=&quot;9010-面试题-0109-字符串轮转&quot;&gt;9010. 面试题 01.09. 字符串轮转&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/string-rotation-lcci/submissions/&quot;&gt;https://leetcode-cn.com/problems/string-rotation-lcci/submissions/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;如果 s2 为 s1 轮转而成，那么将两个 s2 拼接起来必然包含一个 s1，只需要调用一次检查子串&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(s2 + s2).lastIndexOf(s1) &amp;gt; -1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/70194079/&quot;&gt;https://leetcode-cn.com/submissions/detail/70194079/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;更快的方法应该是：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(s1+s1).contains(s2)&lt;/code&gt;，如果 s2 是 s1 的子串， 那么 s2 必然在 s1+s1 里面&lt;/p&gt;

&lt;h2 id=&quot;9011-面试题-0201-移除重复节点&quot;&gt;9011. 面试题 02.01. 移除重复节点&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/remove-duplicate-node-lcci/&quot;&gt;https://leetcode-cn.com/problems/remove-duplicate-node-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用一个 Set 保存之前遇到的节点，如果是之前没有遇到的则加入，否则跳过&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/70194767/&quot;&gt;https://leetcode-cn.com/submissions/detail/70194767/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法类似，但是没有看到如何不使用临时缓冲区&lt;/p&gt;

&lt;h2 id=&quot;9024-面试题-0202-返回倒数第-k-个节点&quot;&gt;9024. 面试题 02.02. 返回倒数第 k 个节点&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/kth-node-from-end-of-list-lcci/&quot;&gt;https://leetcode-cn.com/problems/kth-node-from-end-of-list-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先遍历一遍计算整个链表有多少元素，再遍历到倒数第 k 个（通过总数减去 k）元素返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/70200458&quot;&gt;https://leetcode-cn.com/submissions/detail/70200458&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;通过两个指针，让快指针先跑 k 步，再开始同时循环，到了快指针到尾部时候返回慢指针的结果&lt;/p&gt;

&lt;h2 id=&quot;9026-面试题-0203-删除中间节点&quot;&gt;9026. 面试题 02.03. 删除中间节点&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/delete-middle-node-lcci/&quot;&gt;https://leetcode-cn.com/problems/delete-middle-node-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;因为只要删除当前节点，只要把下一个节点的值和下下个节点的指针放到当前被删除节点即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/70431736/&quot;&gt;https://leetcode-cn.com/submissions/detail/70431736/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法一致&lt;/p&gt;

&lt;h2 id=&quot;9012-面试题-0206-回文链表&quot;&gt;9012. 面试题 02.06. 回文链表&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/palindrome-linked-list-lcci/&quot;&gt;https://leetcode-cn.com/problems/palindrome-linked-list-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先循环一遍确定链表的长度，然后在一半的位置，取出节点，把链表反转，再与原来的一半链表比对，相同即为回文&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/70431795/&quot;&gt;https://leetcode-cn.com/submissions/detail/70431795/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;在出来链表反转的时候没有做对，后来重新梳理了。&lt;/p&gt;

&lt;h2 id=&quot;9013-面试题-0207-链表相交&quot;&gt;9013. 面试题 02.07. 链表相交&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/intersection-of-two-linked-lists-lcci/&quot;&gt;https://leetcode-cn.com/problems/intersection-of-two-linked-lists-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过双指针同时遍历两个单链表，当其中一个指针为空，即到到达表尾，就指向另一个链表的表头。当两个指针相等时说明相交。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/70431846/&quot;&gt;https://leetcode-cn.com/submissions/detail/70431846/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;参考了之前的双指针解法&lt;/p&gt;

&lt;h2 id=&quot;9014-面试题-0301-三合一&quot;&gt;9014. 面试题 03.01. 三合一&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/three-in-one-lcci/&quot;&gt;https://leetcode-cn.com/problems/three-in-one-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过一个数组记录栈中的数据，然后另外一个数组记录对应一个栈在数组中的索引变化情况，根据栈号码 psuh 或者 pop 对应栈内容即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/70699308/&quot;&gt;https://leetcode-cn.com/submissions/detail/70699308/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法一致&lt;/p&gt;

&lt;h2 id=&quot;9015-面试题-0302-栈的最小值&quot;&gt;9015. 面试题 03.02. 栈的最小值&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/min-stack-lcci/&quot;&gt;https://leetcode-cn.com/problems/min-stack-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过两个栈，一个记录栈的数值，另外一个栈记录当前最小值，同时操作两个栈即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/70697916/&quot;&gt;https://leetcode-cn.com/submissions/detail/70697916/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;压栈时，如果最小元素发生变更，就把当前最小元素也进行压栈，标记这一次的最小元素变更情况。&lt;/li&gt;
  &lt;li&gt;出栈时，如果遇到当前最小值与栈顶元素相同的情况，就连着这个元素一起弹出，并将当前最小值更新为这个元素的下一个元素。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;9016-面试题-0304-化栈为队&quot;&gt;9016. 面试题 03.04. 化栈为队&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/implement-queue-using-stacks-lcci/&quot;&gt;https://leetcode-cn.com/problems/implement-queue-using-stacks-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过一个临时栈，在 push 的时候使用临时栈倒一遍数据出来，放入新数据，再把数据倒回去&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/70698006/&quot;&gt;https://leetcode-cn.com/submissions/detail/70698006/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;添加：添加到 stack1；&lt;/li&gt;
  &lt;li&gt;判断是否是空：判断两个栈是不是空的&lt;/li&gt;
  &lt;li&gt;pop：首先 pop stack2 然后将 stack1 中的元素添加到 stack2 中，再 pop stack2&lt;/li&gt;
  &lt;li&gt;top：首先 top stack2 然后将 stack1 中的元素添加到 stack2 中，再 top stack2&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;9017-面试题-0306-动物收容所&quot;&gt;9017. 面试题 03.06. 动物收容所&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/animal-shelter-lcci/&quot;&gt;https://leetcode-cn.com/problems/animal-shelter-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用两个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Queue&lt;/code&gt;保存猫和狗的收容情况，同时使用一个计数器保存收容顺序，如果是 dequeueAny 则先判断收容顺序，否则从各自队列获取&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/70982028/&quot;&gt;https://leetcode-cn.com/submissions/detail/70982028/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人的类似&lt;/p&gt;

&lt;h2 id=&quot;9018-面试题-0402-最小高度树&quot;&gt;9018. 面试题 04.02. 最小高度树&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/minimum-height-tree-lcci/&quot;&gt;https://leetcode-cn.com/problems/minimum-height-tree-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;因为输入的是一个有序数组，所以通过递归的形式，不断通过中间构建节点，并把左边元素作为左子树，右边元素作为右子树&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/70972848/&quot;&gt;https://leetcode-cn.com/submissions/detail/70972848/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人的解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;9019-面试题-0404-检查平衡性&quot;&gt;9019. 面试题 04.04. 检查平衡性&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/check-balance-lcci/&quot;&gt;https://leetcode-cn.com/problems/check-balance-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;计算树的左右子树高度差并递归计算计算子树并判断是否平衡&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/70973811/&quot;&gt;https://leetcode-cn.com/submissions/detail/70973811/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法类似&lt;/p&gt;

&lt;h2 id=&quot;9020-面试题-0501-插入&quot;&gt;9020. 面试题 05.01. 插入&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/insert-into-bits-lcci/&quot;&gt;https://leetcode-cn.com/problems/insert-into-bits-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的思路是通过转换为字符串然后通过字符串操作，但是这样是完全不正确的，应该基于位运算&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/71228964/&quot;&gt;https://leetcode-cn.com/submissions/detail/71228964/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;通过将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;11111111111111111111111111111110&lt;/code&gt;首尾循环移动&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;distance&lt;/code&gt;位并与 N 与运算将第&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;distance&lt;/code&gt;位清零&lt;/p&gt;

&lt;h2 id=&quot;9021-面试题-0503-翻转数位&quot;&gt;9021. 面试题 05.03. 翻转数位&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/reverse-bits-lcci/&quot;&gt;https://leetcode-cn.com/problems/reverse-bits-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过将数字转化成二进制字符串，然后尝试将每一个遇到的 0 转换为 1，计算连续 1 的个数，最后取最大值，注意全部为 1 的情况&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/71229119/&quot;&gt;https://leetcode-cn.com/submissions/detail/71229119/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;通过位运算一次遍历，pre 表示上一个连续 1 的长度+1，cur 表示当前连续 1 的长度，结果即为最大的 pre+cur&lt;/p&gt;

&lt;h2 id=&quot;9022-面试题-0506-整数转换&quot;&gt;9022. 面试题 05.06. 整数转换&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/convert-integer-lcci/&quot;&gt;https://leetcode-cn.com/problems/convert-integer-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始是通过一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[]&lt;/code&gt;对数字进行计数，然后比对不同，结果发现对负数也是不对的&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/71230027/&quot;&gt;https://leetcode-cn.com/submissions/detail/71230027/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;求 A 与 B 异或的值中 1 的个数, 通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&amp;amp;(n - 1)&lt;/code&gt;可以去掉一个数的二进制表示的最右边的 1&lt;/p&gt;

&lt;h2 id=&quot;9023-面试题-0507-配对交换&quot;&gt;9023. 面试题 05.07. 配对交换&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/exchange-lcci/&quot;&gt;https://leetcode-cn.com/problems/exchange-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的解题思路是通过不断除二后获取特定位交换，但是这样的不行的&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/71497997/&quot;&gt;https://leetcode-cn.com/submissions/detail/71497997/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;取出奇数位和偶数位，移动后做或运算&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;0xaaaaaaaa 10101010101010101010101010101010 (偶数位为 1，奇数位为 0）&lt;/li&gt;
  &lt;li&gt;0x55555555 1010101010101010101010101010101 (偶数位为 0，奇数位为 1）&lt;/li&gt;
  &lt;li&gt;
    &lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td&gt;even + odd 和 even&lt;/td&gt;
          &lt;td&gt;odd 性质一样&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;9025-面试题-0801-三步问题&quot;&gt;9025. 面试题 08.01. 三步问题&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/three-steps-problem-lcci/&quot;&gt;https://leetcode-cn.com/problems/three-steps-problem-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;没有太多的思路，考虑使用的是动态规划实现&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/71497902/&quot;&gt;https://leetcode-cn.com/submissions/detail/71497902/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;考虑倒数第二步：可以在第&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n-1&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n-2&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n-3&lt;/code&gt;这 3 个台阶上，然后一步就可以到达终点，所以&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dp(n) = dp(n-1) + dp(n-2) + dp(n-3)&lt;/code&gt;，初始状态容易得到：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dp(1), dp(2), dp(3) = 1, 2, 4&lt;/code&gt;，可以用 3 个变量代表 dp 过程中的数字，无需开辟 dp 数组&lt;/p&gt;

&lt;h2 id=&quot;9027-面试题-0803-魔术索引&quot;&gt;9027. 面试题 08.03. 魔术索引&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/magic-index-lcci/&quot;&gt;https://leetcode-cn.com/problems/magic-index-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-20&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;方法很简单粗暴，就是循环数组，遇到和索引一致的就返回&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/71497954/&quot;&gt;https://leetcode-cn.com/submissions/detail/71497954/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;因为是一个有序数组，使用二分法进行解答，如果找到，则从左半边继续查找更小的解，如果未找到，则先搜索左半边，左半边无解的情况下再搜索右半边&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-05-17T18:09:18+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-17.html</loc>
        <lastmod>2020-05-10T17:56:12+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 17</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;可能的情况下使用桶记数而不是排序再判断&lt;/li&gt;
  &lt;li&gt;在查找/比较元素过程尽可能使用二分查找提升速度&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;1370-上升下降字符串&quot;&gt;1370. 上升下降字符串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/increasing-decreasing-string/&quot;&gt;https://leetcode-cn.com/problems/increasing-decreasing-string/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先对字符串转换成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;char[]&lt;/code&gt;并进行排序，然后从头到尾找出不相同到字符串，再从尾到头找出不相同到字符串填充到 StringBuilder 中，循环操作直到所以字符使用完，返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/68116785/&quot;&gt;https://leetcode-cn.com/submissions/detail/68116785/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法使用桶记数的方式，避免了排序等问题&lt;/p&gt;

&lt;h2 id=&quot;1374-生成每种字符都是奇数个的字符串&quot;&gt;1374. 生成每种字符都是奇数个的字符串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/generate-a-string-with-characters-that-have-odd-counts/&quot;&gt;https://leetcode-cn.com/problems/generate-a-string-with-characters-that-have-odd-counts/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用一个很简单粗暴的方法，先生成一个 n 个字符都是 a 的 char 数组，如果 n 是偶数，则把第一个字母换成 b&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/68118688/&quot;&gt;https://leetcode-cn.com/submissions/detail/68118688/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法类似，但是使用 StringBuilder 貌似比 char 数组更快&lt;/p&gt;

&lt;h2 id=&quot;1380-矩阵中的幸运数&quot;&gt;1380. 矩阵中的幸运数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/lucky-numbers-in-a-matrix/&quot;&gt;https://leetcode-cn.com/problems/lucky-numbers-in-a-matrix/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过两个数组记录每列最大和每行最小，然后循环矩阵，记录最大最小值，最后通过 set 查找除相交的结果（因为数字唯一）&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/68119472/&quot;&gt;https://leetcode-cn.com/submissions/detail/68119472/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;其他人的解法使用坐标直接判断， 不需要使用 set，更迅速&lt;/p&gt;

&lt;h2 id=&quot;1385-两个数组间的距离值&quot;&gt;1385. 两个数组间的距离值&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-the-distance-value-between-two-arrays/&quot;&gt;https://leetcode-cn.com/problems/find-the-distance-value-between-two-arrays/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;循环 arr1 和 arr2 两个数组，对 arr1 的每个元素在 arr2 中计算距离并判断是否小于 d，如果小于等于则跳过，否则结果加 1&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/68376801/&quot;&gt;https://leetcode-cn.com/submissions/detail/68376801/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方题解的“模拟”类似，更高效的是使用“二分查找”（对 arr2 进行排序，加快 arr1 元素在 arr2 中的查找速度）&lt;/p&gt;

&lt;h2 id=&quot;1389-按既定顺序创建目标数组&quot;&gt;1389. 按既定顺序创建目标数组&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/create-target-array-in-the-given-order/&quot;&gt;https://leetcode-cn.com/problems/create-target-array-in-the-given-order/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用 List 进行数字的临时存储通过 add 方法在特定位置插入对应的数值，最后将 List 转换回&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[]&lt;/code&gt;返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/68376894/&quot;&gt;https://leetcode-cn.com/submissions/detail/68376894/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方题解思路一致，更快的解法是直接使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[]&lt;/code&gt;然后遇到插入当前位置/之前位置的情况则使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;System.arraycopy&lt;/code&gt;对数据进行移动&lt;/p&gt;

&lt;h2 id=&quot;1394-找出数组中的幸运数&quot;&gt;1394. 找出数组中的幸运数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-lucky-integer-in-an-array/&quot;&gt;https://leetcode-cn.com/problems/find-lucky-integer-in-an-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;创建一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[]&lt;/code&gt;用于记录对应数字出现次数&lt;/li&gt;
  &lt;li&gt;循环数组在数组中对应位置加，同时记录数字的最大值（减少循环）&lt;/li&gt;
  &lt;li&gt;从大到小遍历 map 数组，遇到元素与出现次数一致即返回&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/68376985/&quot;&gt;https://leetcode-cn.com/submissions/detail/68376985/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法一致&lt;/p&gt;

&lt;h2 id=&quot;1399-统计最大组的数目&quot;&gt;1399. 统计最大组的数目&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/count-largest-group/&quot;&gt;https://leetcode-cn.com/problems/count-largest-group/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;遍历每个数字计算数位和并放入 map 中进行计数，然后对 map 进行排序，从后向前遍历排序后的 map，遇到与最后一个（最大数量）不同的则返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/68585197/&quot;&gt;https://leetcode-cn.com/submissions/detail/68585197/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方的“哈希表”解法类似，但是官方不要排序，而是遍历数组累加与最大数量相同的个数&lt;/p&gt;

&lt;h2 id=&quot;1403-非递增顺序的最小子序列&quot;&gt;1403. 非递增顺序的最小子序列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/minimum-subsequence-in-non-increasing-order/&quot;&gt;https://leetcode-cn.com/problems/minimum-subsequence-in-non-increasing-order/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先对数组进行排序，从后向前取大数作为子序列 1，并从前向后取值累加，当累加大于大数子序列时候，则先累加后向数组（使其严格大于前面的）&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/68585252/&quot;&gt;https://leetcode-cn.com/submissions/detail/68585252/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;其他人解法通过将数组数字内容进行桶计数，并计算总和，再重新遍历计数数组，减少了排序和重复计算的问题&lt;/p&gt;

&lt;h2 id=&quot;1408-数组中的字符串匹配&quot;&gt;1408. 数组中的字符串匹配&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/string-matching-in-an-array/&quot;&gt;https://leetcode-cn.com/problems/string-matching-in-an-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;对于数组中的单词每个拿出来，跟数组中其他单词做比对（排除长度比当前单词大的）获取&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;word.lastIndexOf(w) != -1&lt;/code&gt;则加入结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/68585295/&quot;&gt;https://leetcode-cn.com/submissions/detail/68585295/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;其他人的解法通过将所有单词组合成一个字符串，然后进行比对&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;allS.indexOf(s) != allS.lastIndexOf(s)&lt;/code&gt;，有效减少了循环&lt;/p&gt;

&lt;h2 id=&quot;1413-逐步求和得到正数的最小值&quot;&gt;1413. 逐步求和得到正数的最小值&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/minimum-value-to-get-positive-step-by-step-sum/&quot;&gt;https://leetcode-cn.com/problems/minimum-value-to-get-positive-step-by-step-sum/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;遍历累加数组中数字，同时获取最小值，如果最小值大于 1 则返回 1，否则返回负数的绝对值加 1&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/68863599/&quot;&gt;https://leetcode-cn.com/submissions/detail/68863599/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人的解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;1417-重新格式化字符串&quot;&gt;1417. 重新格式化字符串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/reformat-the-string/&quot;&gt;https://leetcode-cn.com/problems/reformat-the-string/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;首先将字符串的数字和字母放入一个桶中，然后根据数字和字母的情况，填充到目标字符串里面&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/68881179/&quot;&gt;https://leetcode-cn.com/submissions/detail/68881179/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;其他人可以通过 stack 放入字符和数字，然后从 stack 从不断循环填充即可&lt;/p&gt;

&lt;h2 id=&quot;1422-分割字符串的最大得分&quot;&gt;1422. 分割字符串的最大得分&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/maximum-score-after-splitting-a-string/&quot;&gt;https://leetcode-cn.com/problems/maximum-score-after-splitting-a-string/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;循环字符串数组，先计数其中的 1 作为右边的结果&lt;/li&gt;
  &lt;li&gt;重新循环，如果遇到 0 则左边分数加一，否则右边分数减一，统计分数最大值&lt;/li&gt;
  &lt;li&gt;返回最大值即为结果最大分数&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/68883503/&quot;&gt;https://leetcode-cn.com/submissions/detail/68883503/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;1431-拥有最多糖果的孩子&quot;&gt;1431. 拥有最多糖果的孩子&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/kids-with-the-greatest-number-of-candies/&quot;&gt;https://leetcode-cn.com/problems/kids-with-the-greatest-number-of-candies/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先遍历 candies 记录最大的糖果数量，再次遍历 candies 只要每个值加上 extraCandies 主要大于最大值即为 true&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/69096599/&quot;&gt;https://leetcode-cn.com/submissions/detail/69096599/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;1436-旅行终点站&quot;&gt;1436. 旅行终点站&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/destination-city/&quot;&gt;https://leetcode-cn.com/problems/destination-city/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;先将所有路径的起点加入一个 Set 中&lt;/li&gt;
  &lt;li&gt;遍历路径，如果路径目标点不在 Set 中，即为目标终点&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/69096671/&quot;&gt;https://leetcode-cn.com/submissions/detail/69096671/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法一致&lt;/p&gt;

&lt;h2 id=&quot;1441-lcp-01-猜数字&quot;&gt;1441. LCP 01. 猜数字&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/guess-numbers/&quot;&gt;https://leetcode-cn.com/problems/guess-numbers/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法很简单直接循环数组比对数字，相同则加一&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/69096725/&quot;&gt;https://leetcode-cn.com/submissions/detail/69096725/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法一致&lt;/p&gt;

&lt;h2 id=&quot;1442-lcp-02-分式化简&quot;&gt;1442. LCP 02. 分式化简&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/deep-dark-fraction/&quot;&gt;https://leetcode-cn.com/problems/deep-dark-fraction/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;没有找到相应的解答思路&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/69393471/&quot;&gt;https://leetcode-cn.com/submissions/detail/69393471/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;从 cont 的末尾（即右下角的分数）开始计算，算出分子，分母，下一数时，因为有分号，上一轮的分子，要乘进来作为分母&lt;/p&gt;

&lt;h2 id=&quot;1446-lcp-06-拿硬币&quot;&gt;1446. LCP 06. 拿硬币&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/na-ying-bi/&quot;&gt;https://leetcode-cn.com/problems/na-ying-bi/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;对于一堆硬币，如果是偶数则取二分之 n 次，奇数则还要加一，然后累加每堆硬币次数即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/69393512/&quot;&gt;https://leetcode-cn.com/submissions/detail/69393512/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法一样&lt;/p&gt;

&lt;h2 id=&quot;1447-lcp-07-传递信息&quot;&gt;1447. LCP 07. 传递信息&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/chuan-di-xin-xi/&quot;&gt;https://leetcode-cn.com/problems/chuan-di-xin-xi/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始考虑的是从后向前不断遍历查找路径，但是结果没有正确&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/69397312/&quot;&gt;https://leetcode-cn.com/submissions/detail/69397312/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用深度优先搜索，找出所有可能的传递方案。枚举每一轮传递玩家的编号和被传递玩家的编号。若当前是最后一轮且信息位于 k 处，则方案总数加 1&lt;/p&gt;

&lt;h2 id=&quot;1451-lcp-11-期望个数统计&quot;&gt;1451. LCP 11. 期望个数统计&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/qi-wang-ge-shu-tong-ji/&quot;&gt;https://leetcode-cn.com/problems/qi-wang-ge-shu-tong-ji/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;其实最终只和分数的个数有关，如果是同个分数有多个人，平均下来概率还是 1&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/69695262/&quot;&gt;https://leetcode-cn.com/submissions/detail/69695262/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;对于一个排好序的序列，对相同的数字随机打乱顺序后期望有多少个数字保持原位置不变。&lt;/p&gt;

&lt;h2 id=&quot;1457-面试题-0101-判定字符是否唯一&quot;&gt;1457. 面试题 01.01. 判定字符是否唯一&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/is-unique-lcci/&quot;&gt;https://leetcode-cn.com/problems/is-unique-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;因为题目建议不使用额外的数据结构，会很加分，所以通过转换成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;char[]&lt;/code&gt;循环并通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;astr.indexOf(arr[i], i + 1)&lt;/code&gt;判断是否后面还出现当前字符&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/69695332/&quot;&gt;https://leetcode-cn.com/submissions/detail/69695332/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人类似，其他人也有使用其他数据结构的&lt;/p&gt;

&lt;h2 id=&quot;1458-面试题-0102-判定是否互为字符重排&quot;&gt;1458. 面试题 01.02. 判定是否互为字符重排&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/check-permutation-lcci/&quot;&gt;https://leetcode-cn.com/problems/check-permutation-lcci/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-20&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[]&lt;/code&gt;对两个字符中的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;char&lt;/code&gt;进行计数，一个执行加一，一个执行减一，如果是重排的，则最后计数数组全部为 0&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/69695425/&quot;&gt;https://leetcode-cn.com/submissions/detail/69695425/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;还有其他的解答使用数字异或与累加和进行判断，需要的空间更小&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-05-10T17:56:12+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-16.html</loc>
        <lastmod>2020-05-03T19:21:20+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 16</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;对于有序数组尽可能考虑使用二分查找等方法&lt;/li&gt;
  &lt;li&gt;特定场景下使用桶排序性能更佳&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;1260-二维网格迁移&quot;&gt;1260. 二维网格迁移&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/shift-2d-grid/&quot;&gt;https://leetcode-cn.com/problems/shift-2d-grid/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过将原有的网络按照移位转换成一个数组，然后重新输出到结果 List 中去，注意使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k % (m * n)&lt;/code&gt;避免数组越界&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/66342165/&quot;&gt;https://leetcode-cn.com/submissions/detail/66342165/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法主要还是通过原地模拟迁移来完成操作&lt;/p&gt;

&lt;h2 id=&quot;1266-访问所有点的最小时间&quot;&gt;1266. 访问所有点的最小时间&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/minimum-time-visiting-all-points/&quot;&gt;https://leetcode-cn.com/problems/minimum-time-visiting-all-points/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;没有想到很好的解决方法，通过遍历计算好像会有比较大问题&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/66342237/&quot;&gt;https://leetcode-cn.com/submissions/detail/66342237/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用切比雪夫距离算法：从 x 移动到 y 的最少次数为 dx 和 dy 中的较大值&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;max(dx, dy)&lt;/code&gt;，这也被称作 x 和 y 之间的 切比雪夫距离&lt;/p&gt;

&lt;h2 id=&quot;1275-找出井字棋的获胜者&quot;&gt;1275. 找出井字棋的获胜者&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-winner-on-a-tic-tac-toe-game/&quot;&gt;https://leetcode-cn.com/problems/find-winner-on-a-tic-tac-toe-game/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;首先通过循环按照 moves 数组的内容模拟完井字棋，然后通过 win 函数进行判别。通过预定义的判别矩阵获取相应的元素，然后判断是否练成线&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/66344019/&quot;&gt;https://leetcode-cn.com/submissions/detail/66344019/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解基本一致，关注转换成了一维数组，处理起来更加简单&lt;/p&gt;

&lt;h2 id=&quot;1281-整数的各位积和之差&quot;&gt;1281. 整数的各位积和之差&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer/&quot;&gt;https://leetcode-cn.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;这道题目解法比较简单，通过 while 循环累计每位的积与和，然后计算差值即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/66563802/&quot;&gt;https://leetcode-cn.com/submissions/detail/66563802/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法一致&lt;/p&gt;

&lt;h2 id=&quot;1287-有序数组中出现次数超过-25的元素&quot;&gt;1287. 有序数组中出现次数超过 25%的元素&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/element-appearing-more-than-25-in-sorted-array/&quot;&gt;https://leetcode-cn.com/problems/element-appearing-more-than-25-in-sorted-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;因为是一个有序的数组，所以超过 25%的数字一定是一起出现的，只需循环数组，当遇到相同的数就累加，当超过四分之一即可返回&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/66563876/&quot;&gt;https://leetcode-cn.com/submissions/detail/66563876/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解还有通过二分查找的解法，时间复杂度更低&lt;/p&gt;

&lt;h2 id=&quot;1290-二进制链表转整数&quot;&gt;1290. 二进制链表转整数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/convert-binary-number-in-a-linked-list-to-integer/&quot;&gt;https://leetcode-cn.com/problems/convert-binary-number-in-a-linked-list-to-integer/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过从头遍历链表，不断乘 2 累加即可得到结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/66563967/&quot;&gt;https://leetcode-cn.com/submissions/detail/66563967/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法一致&lt;/p&gt;

&lt;h2 id=&quot;1295-统计位数为偶数的数字&quot;&gt;1295. 统计位数为偶数的数字&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-numbers-with-even-number-of-digits/&quot;&gt;https://leetcode-cn.com/problems/find-numbers-with-even-number-of-digits/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;直接使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;String.valueOf(a).length()&lt;/code&gt;将数字转换成为字符串然后判断位数&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/66831642/&quot;&gt;https://leetcode-cn.com/submissions/detail/66831642/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解提到通过数学法：求以 10 为底的对数函数 log10() 来得到整数 x 包含的数字个数&lt;/p&gt;

&lt;h2 id=&quot;1299-将每个元素替换为右侧最大元素&quot;&gt;1299. 将每个元素替换为右侧最大元素&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/replace-elements-with-greatest-element-on-right-side/&quot;&gt;https://leetcode-cn.com/problems/replace-elements-with-greatest-element-on-right-side/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先取出最后一个数，将最后一位置为-1，然后从数组尾部开始，向前循环，把每一位替换成当前最大值，如果遇到大于当前值则替换&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/66831730/&quot;&gt;https://leetcode-cn.com/submissions/detail/66831730/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法基本一致，但是官方解法使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ans[i] = max(ans[i + 1], arr[i + 1])&lt;/code&gt;，减少了临时变量保存和比对的逻辑&lt;/p&gt;

&lt;h2 id=&quot;1304-和为零的-n-个唯一整数&quot;&gt;1304. 和为零的 N 个唯一整数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-n-unique-integers-sum-up-to-zero/&quot;&gt;https://leetcode-cn.com/problems/find-n-unique-integers-sum-up-to-zero/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;逻辑很简单，先生成一个目标长度的数组，从 1 开始，不断累加，数组从 0 开始放置 i 对应的负数，从中间位置放置对应的 i，如果是奇数个数，剩余一个位置为 0&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/66831801/&quot;&gt;https://leetcode-cn.com/submissions/detail/66831801/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法是直接放 1 到 n-2，最后放一个负数等于前面的和&lt;/p&gt;

&lt;h2 id=&quot;1313-解压缩编码列表&quot;&gt;1313. 解压缩编码列表&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/decompress-run-length-encoded-list/&quot;&gt;https://leetcode-cn.com/problems/decompress-run-length-encoded-list/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先计算总体解压后的数组大小，然后循环填充结果数组&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/67135389/&quot;&gt;https://leetcode-cn.com/submissions/detail/67135389/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;其他人的解法中使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Arrays.fill&lt;/code&gt;填充内容，性能可能较好&lt;/p&gt;

&lt;h2 id=&quot;1317-将整数转换为两个无零整数的和&quot;&gt;1317. 将整数转换为两个无零整数的和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/convert-integer-to-the-sum-of-two-no-zero-integers/&quot;&gt;https://leetcode-cn.com/problems/convert-integer-to-the-sum-of-two-no-zero-integers/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的想法是根据有没有 1 的情况再根据 0 的位置进行处理，但是这样处理的逻辑就会很复杂&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/67135526/&quot;&gt;https://leetcode-cn.com/submissions/detail/67135526/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解使用一个简单粗暴的方法，直接尝试减一直到找到结果&lt;/p&gt;

&lt;h2 id=&quot;1323-6-和-9-组成的最大数字&quot;&gt;1323. 6 和 9 组成的最大数字&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/maximum-69-number/&quot;&gt;https://leetcode-cn.com/problems/maximum-69-number/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;转换成数字转换成字符串数组，遇到 6 就转成 9 并返回&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/67135587/&quot;&gt;https://leetcode-cn.com/submissions/detail/67135587/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法类似，看到还有人使用穷举法直接按照数字返回结果&lt;/p&gt;

&lt;h2 id=&quot;1331-数组序号转换&quot;&gt;1331. 数组序号转换&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/rank-transform-of-an-array/&quot;&gt;https://leetcode-cn.com/problems/rank-transform-of-an-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;拷贝数组并进行排序，然后通过一个 map 记录数字对应的序号，最后重新遍历原数组，将对应需要填充到对应的位置&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/67369599/&quot;&gt;https://leetcode-cn.com/submissions/detail/67369599/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;更快的解法使用了桶排序的方法，先遍历 arr 数组，找到数组中的最大值和最小值，建立桶数组，将 arr 数组中出现过的元素在桶中设置为 1，最后利用前缀和统计出每个元素前面出现过的次数，即该元素的序号&lt;/p&gt;

&lt;h2 id=&quot;1332-删除回文子序列&quot;&gt;1332. 删除回文子序列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/remove-palindromic-subsequences/&quot;&gt;https://leetcode-cn.com/problems/remove-palindromic-subsequences/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;总体来说分成三种情况，空字符串返回 0，如果本身是回文串即一次可以删除返回 1，剩余的情况返回 2，因为回文子串删除后剩下的一定是一个字符组成的（因为只有 a 和 b 两个字符）&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/67369655/&quot;&gt;https://leetcode-cn.com/submissions/detail/67369655/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法一致&lt;/p&gt;

&lt;h2 id=&quot;1337-方阵中战斗力最弱的-k-行&quot;&gt;1337. 方阵中战斗力最弱的 K 行&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/the-k-weakest-rows-in-a-matrix/&quot;&gt;https://leetcode-cn.com/problems/the-k-weakest-rows-in-a-matrix/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先使用一个 count 方法对每一行进行战斗力计算，并放入一个二维数组中，然后使用定义的的 sort 方法&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Arrays.sort(map, (o1, o2) -&amp;gt; o1[0] == o2[0] ? o1[1] - o2[1] : o1[0] - o2[0])&lt;/code&gt;，在从排序好的数组中取出前 k 个的行序号&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/67369919/&quot;&gt;https://leetcode-cn.com/submissions/detail/67369919/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;一个更简单的方法是直接将战斗力乘以 100（题目说明 m 和 n 不大于 100）后加上行序号组成排序的 key，然后直接使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Arrays.sort&lt;/code&gt;排序即可，最后将 key 值与 100 取模即为行序号返回&lt;/p&gt;

&lt;h2 id=&quot;1342-将数字变成-0-的操作次数&quot;&gt;1342. 将数字变成 0 的操作次数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/number-of-steps-to-reduce-a-number-to-zero/&quot;&gt;https://leetcode-cn.com/problems/number-of-steps-to-reduce-a-number-to-zero/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;操作比较简单， 直接按照题目描述循环执行除 2 和减 1 然后计算次数&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/67613614/&quot;&gt;https://leetcode-cn.com/submissions/detail/67613614/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;也可以通过位操作的方式：把十进制转化成二进制，有 m 位表示需要做 m-1 次除法（最后一位不需要），有 n 个’1’表示需要做 n 次减法&lt;/p&gt;

&lt;h2 id=&quot;1346-检查整数及其两倍数是否存在&quot;&gt;1346. 检查整数及其两倍数是否存在&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/check-if-n-and-its-double-exist/&quot;&gt;https://leetcode-cn.com/problems/check-if-n-and-its-double-exist/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;循环将数组放入 set 中并检查是否在 set 中，如果没有负数，因为数组已经排序，所以从后往前检查的时候大数已经被放入 set 中，但是因为存在负数的情况，应该再执行一遍循环&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/67617956/&quot;&gt;https://leetcode-cn.com/submissions/detail/67617956/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法的哈希表法类似，但是不需要再做计数&lt;/p&gt;

&lt;h2 id=&quot;1351-统计有序矩阵中的负数&quot;&gt;1351. 统计有序矩阵中的负数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/count-negative-numbers-in-a-sorted-matrix/&quot;&gt;https://leetcode-cn.com/problems/count-negative-numbers-in-a-sorted-matrix/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过一个 count 函数计算负数个数（从头统计，减去正数个数），最后再累加即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/67614640/&quot;&gt;https://leetcode-cn.com/submissions/detail/67614640/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法的倒序统计类似，也可以使用二分法加快查找速度&lt;/p&gt;

&lt;h2 id=&quot;1356-根据数字二进制下-1-的数目排序&quot;&gt;1356. 根据数字二进制下 1 的数目排序&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/sort-integers-by-the-number-of-1-bits/&quot;&gt;https://leetcode-cn.com/problems/sort-integers-by-the-number-of-1-bits/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;循环并使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Integer.bitCount&lt;/code&gt;计算数字中 1 的个数，乘以 10000000（题目中不会大于 10^4）然后加上原数字，放入数组 map 中，并对 map 进行排序，最后&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;% 10000000&lt;/code&gt;获取原来的数组，填充到原数组返回即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/67888286/&quot;&gt;https://leetcode-cn.com/submissions/detail/67888286/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法使用更改 sort 比较方法也是一个很好的策略&lt;/p&gt;

&lt;h2 id=&quot;1360-日期之间隔几天&quot;&gt;1360. 日期之间隔几天&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/number-of-days-between-two-dates/&quot;&gt;https://leetcode-cn.com/problems/number-of-days-between-two-dates/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始通过一个复杂的方法计算两年直接的距离，先算起始年剩余天数，加上经过的年份天数，最后加上结束年份，但是计算结果有些问题，最后使用计算到 1971 年之间的天数差&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/67890539/&quot;&gt;https://leetcode-cn.com/submissions/detail/67890539/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;闰年的数量计算：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;先加上所有模 4 为 0 的年份的数量。此时有些模 100 为 0 的不是闰年的年份被加上了。&lt;/li&gt;
  &lt;li&gt;再减去所有模 100 为 0 的年份的数量。此时有些模 400 为 0 的是闰年的年份被减去了。&lt;/li&gt;
  &lt;li&gt;再加上所有模 400 为 0 的年份的数量。完成&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;1365-有多少小于当前数字的数字&quot;&gt;1365. 有多少小于当前数字的数字&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/how-many-numbers-are-smaller-than-the-current-number/&quot;&gt;https://leetcode-cn.com/problems/how-many-numbers-are-smaller-than-the-current-number/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-20&quot;&gt;思考&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;因为数字都小于 100，所以先构建一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[] map = int[100]&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;循环数组，将对应 map 的数字位加一进行计数（某个数字出现的次数）&lt;/li&gt;
  &lt;li&gt;循环 map，将小于当前数字的值累加到当前位上（比当前数字小的数字出现的次数）&lt;/li&gt;
  &lt;li&gt;循环原始数组，获取 map 对应位上的值即为结果&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/67889787/&quot;&gt;https://leetcode-cn.com/submissions/detail/67889787/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法的“频次数组 + 前缀和”一致&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-05-03T19:21:20+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-15.html</loc>
        <lastmod>2020-04-26T17:20:46+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 15</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;仔细阅读题目并理解题目意图很重要&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;1078-bigram-分词&quot;&gt;1078. Bigram 分词&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/occurrences-after-bigram/&quot;&gt;https://leetcode-cn.com/problems/occurrences-after-bigram/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先切分单词，然后不断比对，判断是否满足前两个单词，如果满足则添加当前单词&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/64522386/&quot;&gt;https://leetcode-cn.com/submissions/detail/64522386/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人类似，其他人使用 ArrayList，感觉更快些&lt;/p&gt;

&lt;h2 id=&quot;1089-复写零&quot;&gt;1089. 复写零&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/duplicate-zeros/&quot;&gt;https://leetcode-cn.com/problems/duplicate-zeros/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始考虑先把数字移动到最后，再从前面读，但是这样还是会出现数据互相覆盖的问题&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/64522518/&quot;&gt;https://leetcode-cn.com/submissions/detail/64522518/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;按照官方解法，首先计算需要复写零的数量，然后处理剩余元素边界上零的情况，最后从末尾迭代数组，遇到非零元素直接向后移动，遇到零需要复制和移动&lt;/p&gt;

&lt;h2 id=&quot;1108-ip-地址无效化&quot;&gt;1108. IP 地址无效化&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/defanging-an-ip-address/&quot;&gt;https://leetcode-cn.com/problems/defanging-an-ip-address/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;比较简单粗暴，直接使用字符串替换的方法&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;replaceAll(&quot;\\.&quot;, &quot;[.]&quot;)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/64522738/&quot;&gt;https://leetcode-cn.com/submissions/detail/64522738/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了一下，其他人使用扫码字符串重新构建结果，速度更快&lt;/p&gt;

&lt;h2 id=&quot;1114-按序打印&quot;&gt;1114. 按序打印&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/print-in-order/&quot;&gt;https://leetcode-cn.com/problems/print-in-order/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CountDownLatch&lt;/code&gt;，尝试了好几个版本才把东西做对&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/64794164/&quot;&gt;https://leetcode-cn.com/submissions/detail/64794164/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解使用 synchronization 实现&lt;/p&gt;

&lt;h2 id=&quot;1122-数组的相对排序&quot;&gt;1122. 数组的相对排序&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/relative-sort-array/&quot;&gt;https://leetcode-cn.com/problems/relative-sort-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先将 arr1 的内容计数放入 Map 中，然后遍历 arr2 数组，从 map 中取出结果，按数量填充入结果数组，剩余部分使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Arrays.sort&lt;/code&gt;进行排序&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/64789656/&quot;&gt;https://leetcode-cn.com/submissions/detail/64789656/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[]&lt;/code&gt;进行计数，这样本身整体就是有序，减少后面排序的过程&lt;/p&gt;

&lt;h2 id=&quot;1128-等价多米诺骨牌对的数量&quot;&gt;1128. 等价多米诺骨牌对的数量&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/number-of-equivalent-domino-pairs/&quot;&gt;https://leetcode-cn.com/problems/number-of-equivalent-domino-pairs/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始使用 Set 保存将两个数字组装构成的 key（正向和反向都组装成 key），随后检查是否存在，但是发现这个对计数是有要求的，所以改成使用 Map 记录 key 和次数，注意两个数字相同的情况&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/64792989/&quot;&gt;https://leetcode-cn.com/submissions/detail/64792989/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法类似，但是他们使用组成数字的方法（较小的数字作十位，较大的数字作个位）简化了整个流程&lt;/p&gt;

&lt;h2 id=&quot;1137-第-n-个泰波那契数&quot;&gt;1137. 第 N 个泰波那契数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/n-th-tribonacci-number/&quot;&gt;https://leetcode-cn.com/problems/n-th-tribonacci-number/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;因为 N 最大为 38，所以在一开始的时候先计算好结果，然后通过 map 取值返回即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/65037501/&quot;&gt;https://leetcode-cn.com/submissions/detail/65037501/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法还有一种“性能优化：带记忆的递归”的解法，跟计算斐波那契数类似&lt;/p&gt;

&lt;h2 id=&quot;1154-一年中的第几天&quot;&gt;1154. 一年中的第几天&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/day-of-the-year/&quot;&gt;https://leetcode-cn.com/problems/day-of-the-year/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过定义每个月的值，然后遍历累加，注意判断是否闰年（闰年加一天需要在二月份后才需要加上）&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/65037933/&quot;&gt;https://leetcode-cn.com/submissions/detail/65037933/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人的解法类似，可以通过预先累加好每个月距离一月一日的天数，去掉循环，直接累加即可&lt;/p&gt;

&lt;h2 id=&quot;1170-比较字符串最小字母出现频次&quot;&gt;1170. 比较字符串最小字母出现频次&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/compare-strings-by-frequency-of-the-smallest-character/&quot;&gt;https://leetcode-cn.com/problems/compare-strings-by-frequency-of-the-smallest-character/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过一个 map 进行计数，记录 words 中小于某个值的词数量，然后计算 queries 中的值，根据 map 查询结果返回&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/65040132/&quot;&gt;https://leetcode-cn.com/submissions/detail/65040132/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法类似&lt;/p&gt;

&lt;h2 id=&quot;1175-质数排列&quot;&gt;1175. 质数排列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/prime-arrangements/&quot;&gt;https://leetcode-cn.com/problems/prime-arrangements/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先通过一个函数判断 100 以内的质数，然后剩余的就是计算质数和非质数位置的全排列，通过乘积与取模的方法循环运算即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/65255357/&quot;&gt;https://leetcode-cn.com/submissions/detail/65255357/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;1179-重新格式化部门表&quot;&gt;1179. 重新格式化部门表&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/reformat-department-table/&quot;&gt;https://leetcode-cn.com/problems/reformat-department-table/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CASE&lt;/code&gt;的方式筛选出每个月对应的列，并通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gruop by&lt;/code&gt;合并对应的部门 ID&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/65255398/&quot;&gt;https://leetcode-cn.com/submissions/detail/65255398/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;很其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;1184-公交站间的距离&quot;&gt;1184. 公交站间的距离&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/distance-between-bus-stops/&quot;&gt;https://leetcode-cn.com/problems/distance-between-bus-stops/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;计算从起点到终点还有从终点到起点两个环行之间到距离，取小值&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/65315037/&quot;&gt;https://leetcode-cn.com/submissions/detail/65315037/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;其实更简单到一个方法是取起点到终点到距离，还有总距离，相减得到另外一半距离&lt;/p&gt;

&lt;h2 id=&quot;1185-一周中的第几天&quot;&gt;1185. 一周中的第几天&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/day-of-the-week/&quot;&gt;https://leetcode-cn.com/problems/day-of-the-week/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过 dayOfYear 函数计算从 1971 年到目标日期经过的天数，将结果加 4（处理 1971 年 1 月 1 日周期）与 7 取模，并从 WEEK 数组中查找结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/65567524/&quot;&gt;https://leetcode-cn.com/submissions/detail/65567524/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;1189-气球-的最大数量&quot;&gt;1189. “气球” 的最大数量&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/maximum-number-of-balloons/&quot;&gt;https://leetcode-cn.com/problems/maximum-number-of-balloons/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先对 text 中的字母进行计数，然后循环 balloon，从计数 map 中减去所需的字母个数，不足则返回&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/65567566/&quot;&gt;https://leetcode-cn.com/submissions/detail/65567566/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看到其他人的解法更加简单，通过计数后，取每个字母所需个数的最小值即为结果，不需要不断循环&lt;/p&gt;

&lt;h2 id=&quot;1200-最小绝对差&quot;&gt;1200. 最小绝对差&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/minimum-absolute-difference/&quot;&gt;https://leetcode-cn.com/problems/minimum-absolute-difference/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先对数组进行排序，然后遍历计算元素得到最小的绝对值差，最后将绝对值差与最小差相等的元素对加入 List&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/65567606/&quot;&gt;https://leetcode-cn.com/submissions/detail/65567606/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人的解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;1207-独一无二的出现次数&quot;&gt;1207. 独一无二的出现次数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/unique-number-of-occurrences/&quot;&gt;https://leetcode-cn.com/problems/unique-number-of-occurrences/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;通过对数字加 1000 将负数转为正数，&lt;/li&gt;
  &lt;li&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[]&lt;/code&gt;进行计数，计算每个每个数字出现的次数（map）&lt;/li&gt;
  &lt;li&gt;使用另外一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[]&lt;/code&gt;，表示数字出现的位置和次数（map2）&lt;/li&gt;
  &lt;li&gt;如果当前次数没有出现过则加 1，如果已经出现过则返回 false&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/65765984/&quot;&gt;https://leetcode-cn.com/submissions/detail/65765984/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;1217-玩筹码&quot;&gt;1217. 玩筹码&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/play-with-chips/&quot;&gt;https://leetcode-cn.com/problems/play-with-chips/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始对于题目没能很好理解没有找出解答思路&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/65766062/&quot;&gt;https://leetcode-cn.com/submissions/detail/65766062/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;移动偶数步无代价，移动奇数步代价一，找出数组中奇偶数的个数，将数量较少的一方移动奇数步。偶数&amp;gt;奇数=奇数、奇数&amp;lt;偶数=奇数&lt;/p&gt;

&lt;h2 id=&quot;1221-分割平衡字符串&quot;&gt;1221. 分割平衡字符串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/split-a-string-in-balanced-strings/&quot;&gt;https://leetcode-cn.com/problems/split-a-string-in-balanced-strings/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解题思路跟匹配括号类似，通过一个 Stack 进行存储，如果是空或者与栈顶字符一致则推入，否则弹出，直到栈为空则加一，因为输入已经是保证匹配的，所以不需要再做额外处理&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/65766118/&quot;&gt;https://leetcode-cn.com/submissions/detail/65766118/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;更简单的解法是通过一个数字进行计数统计，一个字符递增、一个字符递减，当出现计数为 0 则加一&lt;/p&gt;

&lt;h2 id=&quot;1232-缀点成线&quot;&gt;1232. 缀点成线&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/check-if-it-is-a-straight-line/&quot;&gt;https://leetcode-cn.com/problems/check-if-it-is-a-straight-line/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过计算两个点之间点斜率，只要全部斜率相同则共线&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/66126598/&quot;&gt;https://leetcode-cn.com/submissions/detail/66126598/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x1 * y2 != x2 * y1&lt;/code&gt;进行斜率计算&lt;/p&gt;

&lt;h2 id=&quot;1237-找出给定方程的正整数解&quot;&gt;1237. 找出给定方程的正整数解&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-positive-integer-solution-for-a-given-equation/&quot;&gt;https://leetcode-cn.com/problems/find-positive-integer-solution-for-a-given-equation/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过暴力解答的方法，遍历所有可能的 x 和 y&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/66126702/&quot;&gt;https://leetcode-cn.com/submissions/detail/66126702/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法类似&lt;/p&gt;

&lt;h2 id=&quot;1252-奇数值单元格的数目&quot;&gt;1252. 奇数值单元格的数目&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/cells-with-odd-values-in-a-matrix/&quot;&gt;https://leetcode-cn.com/problems/cells-with-odd-values-in-a-matrix/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-20&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过按照&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;indices&lt;/code&gt;的内容执行所有变更后，遍历统计奇数单元格的情况&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/66126785/&quot;&gt;https://leetcode-cn.com/submissions/detail/66126785/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;奇/偶的加减可以转变成 boolean 的 true 和 false，行列的加减可以统一用两个数组解决，最后根据公式（规律）来得出奇偶的数量&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-04-26T17:20:46+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-14.html</loc>
        <lastmod>2020-04-19T17:38:04+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 14</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;byte&lt;/code&gt;替代&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int&lt;/code&gt;可以有效降到内存&lt;/li&gt;
  &lt;li&gt;不要想着过度优化代码，先按照自己的思路实现出相应的解答&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;977-有序数组的平方&quot;&gt;977. 有序数组的平方&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/squares-of-a-sorted-array/&quot;&gt;https://leetcode-cn.com/problems/squares-of-a-sorted-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;直接使用 stream 然后 map 最后 sort 并最后返回 Array&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/62287613/&quot;&gt;https://leetcode-cn.com/submissions/detail/62287613/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解中除了上面排序的方法，还有双指针法：从前向后遍历数组中的非负数部分，并且反向遍历数组中的负数部分&lt;/p&gt;

&lt;h2 id=&quot;985-查询后的偶数和&quot;&gt;985. 查询后的偶数和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/sum-of-even-numbers-after-queries/&quot;&gt;https://leetcode-cn.com/problems/sum-of-even-numbers-after-queries/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的思路是每次应用结果后重新求和，但是这样在数据量大的时候会超时，最后的方法就是先计算数组和，然后在每个计算中当出现偶数或者偶数消失的时候不断调整结果。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/62291302/&quot;&gt;https://leetcode-cn.com/submissions/detail/62291302/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;989-数组形式的整数加法&quot;&gt;989. 数组形式的整数加法&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/add-to-array-form-of-integer/&quot;&gt;https://leetcode-cn.com/problems/add-to-array-form-of-integer/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先按照 K 的数值不断处理加法，然后处理多出来的位，最后处理进位问题，返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/62289414/&quot;&gt;https://leetcode-cn.com/submissions/detail/62289414/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方使用“逐位相加”实现起来更容易：将整个加数加入数组表示的数的最低位&lt;/p&gt;

&lt;h2 id=&quot;993-二叉树的堂兄弟节点&quot;&gt;993. 二叉树的堂兄弟节点&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/cousins-in-binary-tree/&quot;&gt;https://leetcode-cn.com/problems/cousins-in-binary-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过记录相应值的节点父节点和当前大深度，只要深度相同，同时父节点不同，即为堂兄弟节点&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/62673258/&quot;&gt;https://leetcode-cn.com/submissions/detail/62673258/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法通过深度搜索并使用 Map 保存，求出每一个节点的深度与父节点&lt;/p&gt;

&lt;h2 id=&quot;997-找到小镇的法官&quot;&gt;997. 找到小镇的法官&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-the-town-judge/&quot;&gt;https://leetcode-cn.com/problems/find-the-town-judge/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过一个 int 数组记录信任队列，如果信任他人，则标记为-1，被信任则投票+1，最后遍历数组，只要被信任数量为 N-1，则返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/62677216/&quot;&gt;https://leetcode-cn.com/submissions/detail/62677216/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人的解法基本一致，其他人使用两个数组记录与比对&lt;/p&gt;

&lt;h2 id=&quot;1002-查找常用字符&quot;&gt;1002. 查找常用字符&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-common-characters/&quot;&gt;https://leetcode-cn.com/problems/find-common-characters/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;生成一个 int 数组用于记录字母出现的情况，先遍历第一个单词的字母，记录到 table 上，然后逐个遍历其他单词，与 table 取交集（最小值），最后遍历 table 返回字母结果集合&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/62673484/&quot;&gt;https://leetcode-cn.com/submissions/detail/62673484/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人的结果基本一致&lt;/p&gt;

&lt;h2 id=&quot;1005-k-次取反后最大化的数组和&quot;&gt;1005. K 次取反后最大化的数组和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/maximize-sum-of-array-after-k-negations/&quot;&gt;https://leetcode-cn.com/problems/maximize-sum-of-array-after-k-negations/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先对数组进行排序，然后先将负数转我饿正数，如果 K 还有剩余同时剩下奇数个，那么再一次排序数组，将最小的转换为负数，最后求和&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/63025306/&quot;&gt;https://leetcode-cn.com/submissions/detail/63025306/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;1009-十进制整数的反码&quot;&gt;1009. 十进制整数的反码&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/complement-of-base-10-integer/&quot;&gt;https://leetcode-cn.com/problems/complement-of-base-10-integer/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;toBinaryString&lt;/code&gt;转换成字符串，然后每位取反，最后使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Integer.parseInt&lt;/code&gt;返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/63025361/&quot;&gt;https://leetcode-cn.com/submissions/detail/63025361/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用 bitCount 计算 N 共有多少二进制位，然后再一位位地与 1 异或运算就行了&lt;/p&gt;

&lt;h2 id=&quot;1010-总持续时间可被-60-整除的歌曲&quot;&gt;1010. 总持续时间可被 60 整除的歌曲&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/pairs-of-songs-with-total-durations-divisible-by-60/&quot;&gt;https://leetcode-cn.com/problems/pairs-of-songs-with-total-durations-divisible-by-60/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;将每个数字从 960 开始递减（数字最大 500，所以从跟 1000 最接近的 960 开始递减），然后判断是否存在于 Map 中，如果存在结果累加&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/63036455/&quot;&gt;https://leetcode-cn.com/submissions/detail/63036455/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;通过对所有时间求 mod 60 的余数，然后进行归类计数，余数相同的为一类，成对的时间必定 mod 60 的余数之和为 60&lt;/p&gt;

&lt;h2 id=&quot;1018-可被-5-整除的二进制前缀&quot;&gt;1018. 可被 5 整除的二进制前缀&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/binary-prefix-divisible-by-5/&quot;&gt;https://leetcode-cn.com/problems/binary-prefix-divisible-by-5/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;之前考虑的方法是不断累计构造数字然后尝试是否能被 5 整除&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/63297039/&quot;&gt;https://leetcode-cn.com/submissions/detail/63297039/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;因为单纯求和会遇到溢出 int 类型的最大值，只要 sum 大于 0，我们就减去 10，然后看该值是否为 0 或 5，是的话，为真，不是，为假&lt;/p&gt;

&lt;h2 id=&quot;1021-删除最外层的括号&quot;&gt;1021. 删除最外层的括号&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/remove-outermost-parentheses/&quot;&gt;https://leetcode-cn.com/problems/remove-outermost-parentheses/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先将字符串转换成 StringBuilder，然后通过一个计数器，遇到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(&lt;/code&gt;就加一，遇到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;)&lt;/code&gt;就减一，在计数器为 0 时候删除字符&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/63297121/&quot;&gt;https://leetcode-cn.com/submissions/detail/63297121/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人的解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;1022-从根到叶的二进制数之和&quot;&gt;1022. 从根到叶的二进制数之和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/sum-of-root-to-leaf-binary-numbers/&quot;&gt;https://leetcode-cn.com/problems/sum-of-root-to-leaf-binary-numbers/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过 DFS 遍历，然后不断乘 2 得到十进制结果，当遇到叶子节点即累加结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/63297223/&quot;&gt;https://leetcode-cn.com/submissions/detail/63297223/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;1025-除数博弈&quot;&gt;1025. 除数博弈&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/divisor-game/&quot;&gt;https://leetcode-cn.com/problems/divisor-game/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;因为只要能占到 2 的就能赢，所以只要是奇数则输&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/63592977/&quot;&gt;https://leetcode-cn.com/submissions/detail/63592977/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;1029-两地调度&quot;&gt;1029. 两地调度&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/two-city-scheduling/&quot;&gt;https://leetcode-cn.com/problems/two-city-scheduling/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;原本的思路是通过取两个价格中小的部分，但是这样要平均分比较复杂&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/63593038/&quot;&gt;https://leetcode-cn.com/submissions/detail/63593038/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;最优的方案是，选出 price_A - price_B 最小的 N 个人，让他们飞往 A 市，其余人飞往 B 市。&lt;/p&gt;

&lt;h2 id=&quot;1030-距离顺序排列矩阵单元格&quot;&gt;1030. 距离顺序排列矩阵单元格&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/matrix-cells-in-distance-order/submissions/&quot;&gt;https://leetcode-cn.com/problems/matrix-cells-in-distance-order/submissions/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;首先构造一个所需的矩阵，然后通过自定义&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Arrays.sort&lt;/code&gt;的排序方法，返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/63593097/&quot;&gt;https://leetcode-cn.com/submissions/detail/63593097/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;其他人提出了四种解法：数组排序、桶排序、BFS、几何法&lt;/p&gt;

&lt;h2 id=&quot;1033-移动石子直到连续&quot;&gt;1033. 移动石子直到连续&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/moving-stones-until-consecutive/&quot;&gt;https://leetcode-cn.com/problems/moving-stones-until-consecutive/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的思路是通过对吧三个数字的大小情况返回转换结果，但是会出现比较复杂的情况&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/63993631/&quot;&gt;https://leetcode-cn.com/submissions/detail/63993631/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;先排序方便解答，移动次数最大值：移动 a 和 c，一次只走一格。所以&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;max=(z-y-1)+(y-x-1)=z-x-2&lt;/code&gt;，移动次数最小值：移动一次尽可能的走多步&lt;/p&gt;

&lt;h2 id=&quot;1037-有效的回旋镖&quot;&gt;1037. 有效的回旋镖&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/valid-boomerang/&quot;&gt;https://leetcode-cn.com/problems/valid-boomerang/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;对三个点进行计算，检查是否能形成三角形&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/63994877/&quot;&gt;https://leetcode-cn.com/submissions/detail/63994877/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;当两点之间的距离不等于三点的距离之和&lt;/p&gt;

&lt;h2 id=&quot;1042-不邻接植花&quot;&gt;1042. 不邻接植花&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/flower-planting-with-no-adjacent/&quot;&gt;https://leetcode-cn.com/problems/flower-planting-with-no-adjacent/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;没什么解答对思路&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/63995380/&quot;&gt;https://leetcode-cn.com/submissions/detail/63995380/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用邻接表法：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;根据 paths 建立邻接表；&lt;/li&gt;
  &lt;li&gt;默认所有的花园先不染色，即染 0；&lt;/li&gt;
  &lt;li&gt;从第一个花园开始走，把与它邻接的花园的颜色从 color{1,2,3,4}这个颜色集中删除；&lt;/li&gt;
  &lt;li&gt;删完了所有与它相邻的颜色，就可以把集合中剩下的颜色随机选一个给它了，为了简单，将集合中的第一个颜色赋给当前花园；&lt;/li&gt;
  &lt;li&gt;循环 3 和 4 到最后一个花园。&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;1046-最后一块石头的重量&quot;&gt;1046. 最后一块石头的重量&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/last-stone-weight/&quot;&gt;https://leetcode-cn.com/problems/last-stone-weight/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始就是想通过模拟操作的方式进行模拟，但是因为需要不断重复排序，没有想到好的解决方法（后来看了其他人的解法，就是使用这样的方式，效果还很不错）&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/64218685/&quot;&gt;https://leetcode-cn.com/submissions/detail/64218685/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用优先队列&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PriorityQueue&lt;/code&gt;进行模拟，不断从中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;poll&lt;/code&gt;数据获取最大值&lt;/p&gt;

&lt;h2 id=&quot;1047-删除字符串中的所有相邻重复项&quot;&gt;1047. 删除字符串中的所有相邻重复项&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/remove-all-adjacent-duplicates-in-string/&quot;&gt;https://leetcode-cn.com/problems/remove-all-adjacent-duplicates-in-string/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过建立一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StringBuilder&lt;/code&gt;并对其进行循环删除操作，直到不会发生删除为止&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/64219770/&quot;&gt;https://leetcode-cn.com/submissions/detail/64219770/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法通过构建一个“替换函数”还有另外一个使用“栈”进行解答，栈解法更加简单：若当前的字母和栈顶的字母相同，则弹出栈顶的字母&lt;/p&gt;

&lt;h2 id=&quot;1051-高度检查器&quot;&gt;1051. 高度检查器&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/height-checker/&quot;&gt;https://leetcode-cn.com/problems/height-checker/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-20&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法比较简单粗暴，直接复制数组并排序，并与原数组比对，找出差异的数量&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/64219851/&quot;&gt;https://leetcode-cn.com/submissions/detail/64219851/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看到其他人的解答为 O(n)，其实并不关心排序后得到的结果，我们想知道的只是在该位置上，与最小的值是否一致，通过简单的计数即可，不需要排序&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-04-19T17:38:04+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-13.html</loc>
        <lastmod>2020-04-12T17:10:31+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 13</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;通过一个比较流替换多个标志位，多使用内置函数&lt;/li&gt;
  &lt;li&gt;了解&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Arrays.sort&lt;/code&gt;相关方法的自定义实现&lt;/li&gt;
  &lt;li&gt;需要注意题目描述中的细节&lt;/li&gt;
  &lt;li&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;String.format&lt;/code&gt;进行字符串格式化&lt;/li&gt;
  &lt;li&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;continue xxx&lt;/code&gt;跳转回去程序特定标签处&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;893-特殊等价字符串组&quot;&gt;893. 特殊等价字符串组&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/groups-of-special-equivalent-strings/&quot;&gt;https://leetcode-cn.com/problems/groups-of-special-equivalent-strings/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的想法比较简单，因为计算可以移动后等价其实就是对字符进行计数，然后计数序列一致即为可以转换&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/60270246/&quot;&gt;https://leetcode-cn.com/submissions/detail/60270246/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;没有深入理解题目中的点，其实并不能重排所有字母，只能排列偶数索引字母和奇数索引字母，所有需要进行转换，独立统计奇偶列&lt;/p&gt;

&lt;h2 id=&quot;896-单调数列&quot;&gt;896. 单调数列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/monotonic-array/&quot;&gt;https://leetcode-cn.com/problems/monotonic-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过在一次遍历中，如果结果递增或者递减则转换标志位，最后返回是否还有标志位为 true，如果递增递减的标志都为 false 则直接返回。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/60280057/&quot;&gt;https://leetcode-cn.com/submissions/detail/60280057/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Integer.compare&lt;/code&gt;函数，然后检查结果组成的比较流，如果发生翻转则返回&lt;/p&gt;

&lt;h2 id=&quot;897-递增顺序查找树&quot;&gt;897. 递增顺序查找树&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/increasing-order-search-tree/&quot;&gt;https://leetcode-cn.com/problems/increasing-order-search-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过构建一个虚拟根节点，然后执行中序遍历，不断往右节点添加值，最后返回虚拟根的右节点即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/60276733/&quot;&gt;https://leetcode-cn.com/submissions/detail/60276733/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法的“中序遍历 + 更改树的连接方式”跟我的解法类似，但是官方解法通过更改树的连接，不需要额外创建节点&lt;/p&gt;

&lt;h2 id=&quot;905-按奇偶排序数组&quot;&gt;905. 按奇偶排序数组&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/sort-array-by-parity/&quot;&gt;https://leetcode-cn.com/problems/sort-array-by-parity/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过双指针的方法，如果满足条件则向中间移动，否则交换位置。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/60632074/&quot;&gt;https://leetcode-cn.com/submissions/detail/60632074/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法的“方法 3：原地算法”一致&lt;/p&gt;

&lt;h2 id=&quot;908-最小差值-i&quot;&gt;908. 最小差值 I&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/smallest-range-i/&quot;&gt;https://leetcode-cn.com/problems/smallest-range-i/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过遍历数组，找出最大值和最小值，然后返回差值减去 2k 或者 0（因为不包括负数）&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/60632175/&quot;&gt;https://leetcode-cn.com/submissions/detail/60632175/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法一致&lt;/p&gt;

&lt;h2 id=&quot;917-仅仅反转字母&quot;&gt;917. 仅仅反转字母&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/reverse-only-letters/&quot;&gt;https://leetcode-cn.com/problems/reverse-only-letters/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过前后两个指针，如果是遇到非字母则向中间移动，否则交换两个字母，直到两个指针相遇&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/60632269/&quot;&gt;https://leetcode-cn.com/submissions/detail/60632269/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;922-按奇偶排序数组-ii&quot;&gt;922. 按奇偶排序数组 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/sort-array-by-parity-ii/&quot;&gt;https://leetcode-cn.com/problems/sort-array-by-parity-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过双指针的形式，将数组里面的元素安放到奇偶位置上，并将指针不断后移（条件满足即后移，否则交换元素）&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/60923507/&quot;&gt;https://leetcode-cn.com/submissions/detail/60923507/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方的算法更加简单，不需要考虑奇数位置，只需要保证偶数位即可（剩下的一定是奇数）&lt;/p&gt;

&lt;h2 id=&quot;925-长按键入&quot;&gt;925. 长按键入&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/long-pressed-name/&quot;&gt;https://leetcode-cn.com/problems/long-pressed-name/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过两个指针，然后进行比对如果相同则前进，否则与 name 的前一个元素比对（判断长按键入），如果都能跑到结尾即为相同（需要注意处理数组越界的问题）&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/60925090/&quot;&gt;https://leetcode-cn.com/submissions/detail/60925090/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方的双指针解法一致&lt;/p&gt;

&lt;h2 id=&quot;929-独特的电子邮件地址&quot;&gt;929. 独特的电子邮件地址&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/unique-email-addresses/&quot;&gt;https://leetcode-cn.com/problems/unique-email-addresses/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;按照规则处理每个邮件地址并放入 Set 中，最后返回 Set 中元素的数量即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/60925184/&quot;&gt;https://leetcode-cn.com/submissions/detail/60925184/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法的“规范化表示”逻辑一致&lt;/p&gt;

&lt;h2 id=&quot;933-最近的请求次数&quot;&gt;933. 最近的请求次数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/number-of-recent-calls/&quot;&gt;https://leetcode-cn.com/problems/number-of-recent-calls/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过一个双端队列进行计数，在 ping 的时候把超出时间的请求剔除，然后返回队列长度&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/61213829/&quot;&gt;https://leetcode-cn.com/submissions/detail/61213829/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法基本一致，不需要使用双端队列，同时官方解法使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;while (q.peek() &amp;lt; t - 3000)&lt;/code&gt;更加优雅&lt;/p&gt;

&lt;h2 id=&quot;937-重新排列日志文件&quot;&gt;937. 重新排列日志文件&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/reorder-data-in-log-files/&quot;&gt;https://leetcode-cn.com/problems/reorder-data-in-log-files/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;根据日志记录先分成数字类型和字母类型，数字类型直接放入一个 List，字母类似将头部移动到尾部后写入 TreeMap，依赖其自动排序结果，重新输出日志&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/61214332/&quot;&gt;https://leetcode-cn.com/submissions/detail/61214332/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法使用自定义&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Arrays.sort&lt;/code&gt;的排序方法解答&lt;/p&gt;

&lt;h2 id=&quot;938-二叉搜索树的范围和&quot;&gt;938. 二叉搜索树的范围和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/range-sum-of-bst/&quot;&gt;https://leetcode-cn.com/problems/range-sum-of-bst/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;直接使用递归深度优先搜索并判断结果累加&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/61214728/&quot;&gt;https://leetcode-cn.com/submissions/detail/61214728/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;没有考虑好在搜索时候处理搜索树的性质：对于当前节点&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;node&lt;/code&gt;，如果&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;node.val&lt;/code&gt;小于等于 L，那么只需要继续搜索它的右子树；如果&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;node.val&lt;/code&gt;大于等于 R，那么只需要继续搜索它的左子树；如果&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;node.val&lt;/code&gt;在区间&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(L, R)&lt;/code&gt;中，则需要搜索它的所有子树。&lt;/p&gt;

&lt;h2 id=&quot;941-有效的山脉数组&quot;&gt;941. 有效的山脉数组&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/valid-mountain-array/&quot;&gt;https://leetcode-cn.com/problems/valid-mountain-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;遍历数组，先要求数组递增，遇到转折后要求递减，否则返回 false，最后返回是否经历了递增后递减两个阶段&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/61424490/&quot;&gt;https://leetcode-cn.com/submissions/detail/61424490/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解通过多个循环计数的方式完成“线性扫描”，整体代码更加简洁&lt;/p&gt;

&lt;h2 id=&quot;942-增减字符串匹配&quot;&gt;942. 增减字符串匹配&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/di-string-match/&quot;&gt;https://leetcode-cn.com/problems/di-string-match/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始就考虑通过判断 I 与 D 来修改生成数组中数字位置的位置，最后返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/61429486/&quot;&gt;https://leetcode-cn.com/submissions/detail/61429486/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法每次会把可以使用的数的集合中的最小值或最大值取出，并放到当前的位置，如果是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;I&lt;/code&gt;从低处取，否则从高处取&lt;/p&gt;

&lt;h2 id=&quot;944-删列造序&quot;&gt;944. 删列造序&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/delete-columns-to-make-sorted/&quot;&gt;https://leetcode-cn.com/problems/delete-columns-to-make-sorted/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;循环每个列，如果列中非有序，则结果加一&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/61424746/&quot;&gt;https://leetcode-cn.com/submissions/detail/61424746/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法逻辑一致&lt;/p&gt;

&lt;h2 id=&quot;949-给定数字能组成的最大时间&quot;&gt;949. 给定数字能组成的最大时间&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/largest-time-for-given-digits/&quot;&gt;https://leetcode-cn.com/problems/largest-time-for-given-digits/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过穷举所有组合，然后判断是否符合时间格式，最后返回其中最大的结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/61817363/&quot;&gt;https://leetcode-cn.com/submissions/detail/61817363/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法思路基本一致，但是最后使用“String.format”格式化结果&lt;/p&gt;

&lt;h2 id=&quot;953-验证外星语词典&quot;&gt;953. 验证外星语词典&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/verifying-an-alien-dictionary/&quot;&gt;https://leetcode-cn.com/problems/verifying-an-alien-dictionary/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;遍历所有单词，在每个位置上通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lastIndexOf&lt;/code&gt;查找对于字符在字典排序中的位置，如果不符合则返回，注意处理单词长度不同的情况&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/61818903/&quot;&gt;https://leetcode-cn.com/submissions/detail/61818903/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法类似，官方解法通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;continue xxx&lt;/code&gt;的方式，跳转回去特定的位置&lt;/p&gt;

&lt;h2 id=&quot;961-重复-n-次的元素&quot;&gt;961. 重复 N 次的元素&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/n-repeated-element-in-size-2n-array/&quot;&gt;https://leetcode-cn.com/problems/n-repeated-element-in-size-2n-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过排序的方法，找出位于中间的数字即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/61819031/&quot;&gt;https://leetcode-cn.com/submissions/detail/61819031/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法中通过比较法：一旦找到一个重复元素，那么一定就是答案&lt;/p&gt;

&lt;h2 id=&quot;965-单值二叉树&quot;&gt;965. 单值二叉树&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/univalued-binary-tree/&quot;&gt;https://leetcode-cn.com/problems/univalued-binary-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用迭代的方式，先获取 root 的值，然后通过一个队列不断遍历整棵树并将值与根的值对吧，不一致则返回 false，否则就是单值&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/62104391/&quot;&gt;https://leetcode-cn.com/submissions/detail/62104391/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法使用递归的方式看起来更加简洁&lt;/p&gt;

&lt;h2 id=&quot;970-强整数&quot;&gt;970. 强整数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/powerful-integers/&quot;&gt;https://leetcode-cn.com/problems/powerful-integers/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过暴力穷举的方式，遍历从 x 到 y 的所有结果，满足条件即加入 Set 中，最后返回 Set 元素组成的 List&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/62105078/&quot;&gt;https://leetcode-cn.com/submissions/detail/62105078/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法思路基本一致&lt;/p&gt;

&lt;h2 id=&quot;976-三角形的最大周长&quot;&gt;976. 三角形的最大周长&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/largest-perimeter-triangle/&quot;&gt;https://leetcode-cn.com/problems/largest-perimeter-triangle/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-20&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过对输入结果进行排序，从尾部开始取最大的三个元素，看看是否能组成三角形，否则向前移动，继续取三个元素，直到找到匹配&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/62105190/&quot;&gt;https://leetcode-cn.com/submissions/detail/62105190/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法一致&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-04-12T17:10:31+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-12.html</loc>
        <lastmod>2020-04-05T16:55:01+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 12</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;使用 List 的 toArray 简化代码&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;811-子域名访问计数&quot;&gt;811. 子域名访问计数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/subdomain-visit-count/&quot;&gt;https://leetcode-cn.com/problems/subdomain-visit-count/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过对每个域名信息进行解析，并返回子域名列表，再通过 Map 进行累加计数并返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/58242053/&quot;&gt;https://leetcode-cn.com/submissions/detail/58242053/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法基本一致，但是使用正则匹配效率各方面还是有些影响&lt;/p&gt;

&lt;h2 id=&quot;812-最大三角形面积&quot;&gt;812. 最大三角形面积&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/largest-triangle-area/&quot;&gt;https://leetcode-cn.com/problems/largest-triangle-area/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过遍历穷举所有组合找到最大值&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/58217572/&quot;&gt;https://leetcode-cn.com/submissions/detail/58217572/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法类似，使用坐标进行计算&lt;/p&gt;

&lt;h2 id=&quot;819-最常见的单词&quot;&gt;819. 最常见的单词&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/most-common-word/&quot;&gt;https://leetcode-cn.com/problems/most-common-word/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先讲 banned 的内容写入到 Set 中，然后拆分 paragraph 并进行比对计数&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/58246600/&quot;&gt;https://leetcode-cn.com/submissions/detail/58246600/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法基本一致，官方解法使用 StringBuilder 去获取 CharArray 的内容，而不是直接 Split 字符串&lt;/p&gt;

&lt;h2 id=&quot;821-字符的最短距离&quot;&gt;821. 字符的最短距离&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/shortest-distance-to-a-character/&quot;&gt;https://leetcode-cn.com/problems/shortest-distance-to-a-character/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过先查找出字符中目标字符的 index 列表，再遍历字符，取再 index 列表中前后两个 index 的最小值&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/58596367/&quot;&gt;https://leetcode-cn.com/submissions/detail/58596367/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法通过找出距离向左或者向右下一个字符 C 的距离。答案就是这两个值的较小值&lt;/p&gt;

&lt;h2 id=&quot;824-山羊拉丁文&quot;&gt;824. 山羊拉丁文&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/goat-latin/&quot;&gt;https://leetcode-cn.com/problems/goat-latin/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过遍历字符串数组，如果遇到非字母和最后一个字母，按照逻辑处理元音和非元音并添加 a 即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/58586173/&quot;&gt;https://leetcode-cn.com/submissions/detail/58586173/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法类似，官方使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;S.split&lt;/code&gt;处理起来好像更加简单&lt;/p&gt;

&lt;h2 id=&quot;830-较大分组的位置&quot;&gt;830. 较大分组的位置&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/positions-of-large-groups/&quot;&gt;https://leetcode-cn.com/problems/positions-of-large-groups/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过两个指针进行计算，如果差值大于 3 则加入 List 中&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/58588081/&quot;&gt;https://leetcode-cn.com/submissions/detail/58588081/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法类似，官方解法更加简单优雅&lt;/p&gt;

&lt;h2 id=&quot;832-翻转图像&quot;&gt;832. 翻转图像&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/flipping-an-image/&quot;&gt;https://leetcode-cn.com/problems/flipping-an-image/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;处理方法比较简单，遍历每一行，然后进行翻转和反转&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/58891399/&quot;&gt;https://leetcode-cn.com/submissions/detail/58891399/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解答使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;^ 1&lt;/code&gt;进行反转操作&lt;/p&gt;

&lt;h2 id=&quot;840-矩阵中的幻方&quot;&gt;840. 矩阵中的幻方&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/magic-squares-in-grid/&quot;&gt;https://leetcode-cn.com/problems/magic-squares-in-grid/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;原来的思路很简单，就是逐个检查幻方，但是执行过程发现检查的方法总是有缺陷&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/58893459/&quot;&gt;https://leetcode-cn.com/submissions/detail/58893459/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;应该正确检查幻方：分别检查每 3x3 的网格。对于每个网格，所有数字必须不同，并且在 1 到 9 之间；且每一个行，列，对角线的和必须相同。&lt;/p&gt;

&lt;h2 id=&quot;844-比较含退格的字符串&quot;&gt;844. 比较含退格的字符串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/backspace-string-compare/&quot;&gt;https://leetcode-cn.com/problems/backspace-string-compare/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;直接针对字符按照退格操作后返回，对比字符是否一致即可，注意处理退格多次导致超出头部情况&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/58893568/&quot;&gt;https://leetcode-cn.com/submissions/detail/58893568/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法通过双指针法进行比对，不需要额外空间&lt;/p&gt;

&lt;h2 id=&quot;849-到最近的人的最大距离&quot;&gt;849. 到最近的人的最大距离&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/maximize-distance-to-closest-person/&quot;&gt;https://leetcode-cn.com/problems/maximize-distance-to-closest-person/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先遍历找出有人的位置，在遍历找出空位并计算当前位置与前后两个人的距离，注意需要处理最前和最后座位的情况&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/59191579/&quot;&gt;https://leetcode-cn.com/submissions/detail/59191579/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解提到“按零分组”，感觉更加简单：两个人之间有 K 个空座位，则存在座位到最近的人的距离为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(K+1) / 2&lt;/code&gt;，边缘的座位，它们的一侧没有人，那么认为它们到该侧最近的人的距离为 K。&lt;/p&gt;

&lt;h2 id=&quot;852-山脉数组的峰顶索引&quot;&gt;852. 山脉数组的峰顶索引&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/peak-index-in-a-mountain-array/&quot;&gt;https://leetcode-cn.com/problems/peak-index-in-a-mountain-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;从左往右扫描直到山的高度不再增长为止，停止增长点就是峰顶&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/59191692/&quot;&gt;https://leetcode-cn.com/submissions/detail/59191692/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解讲到使用二分查找，可以更快找到结果&lt;/p&gt;

&lt;h2 id=&quot;859-亲密字符串&quot;&gt;859. 亲密字符串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/buddy-strings/&quot;&gt;https://leetcode-cn.com/problems/buddy-strings/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;根据字符串是否相等进行不同的判断，一开始的策略是看是否有两个字符不同，但是发现这样解答是错误的&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/59193593/&quot;&gt;https://leetcode-cn.com/submissions/detail/59193593/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A[i], A[j], B[i], B[j]&lt;/code&gt;这四个自由变量中，只存在两种情况：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A[i] == A[j]&lt;/code&gt; 或 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A[i] != A[j]&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;860-柠檬水找零&quot;&gt;860. 柠檬水找零&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/lemonade-change/&quot;&gt;https://leetcode-cn.com/problems/lemonade-change/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;直接通过简单的当前硬币数量的加减进行状态判断，尽可能用大面额进行找零，如果找不开则返回失败&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/59481820/&quot;&gt;https://leetcode-cn.com/submissions/detail/59481820/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法的场景模拟方法基本一致，但是感觉官方解法更加简单易懂的样子&lt;/p&gt;

&lt;h2 id=&quot;867-转置矩阵&quot;&gt;867. 转置矩阵&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/transpose-matrix/&quot;&gt;https://leetcode-cn.com/problems/transpose-matrix/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用直接遍历复制到结果数组的方式进行解答&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/59481909/&quot;&gt;https://leetcode-cn.com/submissions/detail/59481909/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法一致&lt;/p&gt;

&lt;h2 id=&quot;868-二进制间距&quot;&gt;868. 二进制间距&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/binary-gap/&quot;&gt;https://leetcode-cn.com/problems/binary-gap/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Integer.toBinaryString(N)&lt;/code&gt;的方法，转换成字符串，然后在字符串中使用双指针计算两个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt;的距离&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/59481997/&quot;&gt;https://leetcode-cn.com/submissions/detail/59481997/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(N &amp;gt;&amp;gt; i) &amp;amp; 1&lt;/code&gt;的方式来进行位的判断&lt;/p&gt;

&lt;h2 id=&quot;872-叶子相似的树&quot;&gt;872. 叶子相似的树&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/leaf-similar-trees/&quot;&gt;https://leetcode-cn.com/problems/leaf-similar-trees/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过深度遍历一棵树，并把叶子节点加入队列，然后同样方式遍历另外一棵树，如果顺序一致即为相似的树&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/59807876/&quot;&gt;https://leetcode-cn.com/submissions/detail/59807876/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法的“深度优先搜索”基本一致，但是没有使用两个 List 再比对&lt;/p&gt;

&lt;h2 id=&quot;874-模拟行走机器人&quot;&gt;874. 模拟行走机器人&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/walking-robot-simulation/&quot;&gt;https://leetcode-cn.com/problems/walking-robot-simulation/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;obstacles&lt;/code&gt;转换成字符串放入 set 中，然后模拟机器人行走&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/59831393/&quot;&gt;https://leetcode-cn.com/submissions/detail/59831393/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;如果机器人得到转弯的指令，我们就更新方向；否则就沿给定的方向走指定的步数。&lt;/p&gt;

&lt;h2 id=&quot;883-三维形体投影面积&quot;&gt;883. 三维形体投影面积&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/projection-area-of-3d-shapes/&quot;&gt;https://leetcode-cn.com/problems/projection-area-of-3d-shapes/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过各个面积投影进行分享，并进行数学计算&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/60101165/&quot;&gt;https://leetcode-cn.com/submissions/detail/60101165/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;从顶部看，由该形状生成的阴影将是网格中非零值的数目。&lt;/li&gt;
  &lt;li&gt;从侧面看，由该形状生成的阴影将是网格中每一行的最大值。&lt;/li&gt;
  &lt;li&gt;从前面看，由该形状生成的阴影将是网格中每一列的最大值。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;884-两句话中的不常见单词&quot;&gt;884. 两句话中的不常见单词&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/uncommon-words-from-two-sentences/&quot;&gt;https://leetcode-cn.com/problems/uncommon-words-from-two-sentences/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;split(&quot;\\W&quot;)&lt;/code&gt;获得单词数组，然后加入到 Map 中，如果 Map 中的计数为 1，则可以返回，注意处理结果为空的情况&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/60095555/&quot;&gt;https://leetcode-cn.com/submissions/detail/60095555/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法一致，通过 List 可以直接使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ans.toArray(new String[ans.size()]);&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;888-公平的糖果交换&quot;&gt;888. 公平的糖果交换&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/fair-candy-swap/&quot;&gt;https://leetcode-cn.com/problems/fair-candy-swap/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过累加两个人糖果总数算出两个人的差距，同时将其中一个人的结果加入一个 Set 中，最后遍历第一个人的糖果数，如果第二个人有满足条件的糖果则返回。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/60100881/&quot;&gt;https://leetcode-cn.com/submissions/detail/60100881/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法一致&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-04-05T16:55:01+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-11.html</loc>
        <lastmod>2020-03-29T17:58:12+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 11</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int d = x % 10&lt;/code&gt;并不断&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x /= 10&lt;/code&gt;的方式获取每一个位数&lt;/li&gt;
  &lt;li&gt;计算花费&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f[i]&lt;/code&gt;有一个清楚的递归关系：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f[i] = cost[i] + min(f[i+1], f[i+2])&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;二叉搜索树中，中序遍历会将树中节点按数值大小顺序输出&lt;/li&gt;
  &lt;li&gt;了解“Rabin-Karp 字符串哈希”和“KMP 算法”&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;717-1-比特与-2-比特字符&quot;&gt;717. 1 比特与 2 比特字符&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/1-bit-and-2-bit-characters/&quot;&gt;https://leetcode-cn.com/problems/1-bit-and-2-bit-characters/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的想法是从后往前遍历，通过动态规划的方式进行判断&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/56460764/&quot;&gt;https://leetcode-cn.com/submissions/detail/56460764/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;原来一开始的思路就是错误，解法非常简单：从左到右扫描来判断最后一位是否为一比特字符&lt;/p&gt;

&lt;h2 id=&quot;720-词典中最长的单词&quot;&gt;720. 词典中最长的单词&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/longest-word-in-dictionary/&quot;&gt;https://leetcode-cn.com/problems/longest-word-in-dictionary/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始没有考虑到题目中词典的含义，只是简单地查找最长的单词，对于前缀的判断没有做好考虑&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/56461461/&quot;&gt;https://leetcode-cn.com/submissions/detail/56461461/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;题解中提到比较简单暴力的方法，直接在 Set 中判断前缀是否存在，或者使用“前缀树 + 深度优先搜索”的方法&lt;/p&gt;

&lt;h2 id=&quot;724-寻找数组的中心索引&quot;&gt;724. 寻找数组的中心索引&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-pivot-index/&quot;&gt;https://leetcode-cn.com/problems/find-pivot-index/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的思路比较简单，通过两个指针，前加后减，直到在中点相遇，但是没有考虑到负数的情况&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/56465637/&quot;&gt;https://leetcode-cn.com/submissions/detail/56465637/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;其实题解的逻辑很简单，当索引&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i是中心索引时，&lt;/code&gt;leftsum&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;满足&lt;/code&gt;S - nums[i] - leftsum`。所以只需要两次循环即可&lt;/p&gt;

&lt;h2 id=&quot;728-自除数&quot;&gt;728. 自除数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/self-dividing-numbers/&quot;&gt;https://leetcode-cn.com/problems/self-dividing-numbers/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过暴力解法，遍历每一个数字，并将数字转成字符串，然后逐位进行除法，将符合条件的加入列表中&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/56790379/&quot;&gt;https://leetcode-cn.com/submissions/detail/56790379/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;还有使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int d = x % 10&lt;/code&gt;并不断&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x /= 10&lt;/code&gt;的方式获取每一个位数，而不是使用字符串操作&lt;/p&gt;

&lt;h2 id=&quot;733-图像渲染&quot;&gt;733. 图像渲染&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/flood-fill/&quot;&gt;https://leetcode-cn.com/problems/flood-fill/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用 dfs 遍历周边的像素并做相应的替换，注意处理边界条件即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/56792236/&quot;&gt;https://leetcode-cn.com/submissions/detail/56792236/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法类似，只是官方解法将判断前置到执行递归之前&lt;/p&gt;

&lt;h2 id=&quot;744-寻找比目标字母大的最小字母&quot;&gt;744. 寻找比目标字母大的最小字母&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-smallest-letter-greater-than-target/&quot;&gt;https://leetcode-cn.com/problems/find-smallest-letter-greater-than-target/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过遍历字符串，根据比目标字符大或小确定计算方法，记录最小值和对应的字符&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/56800430/&quot;&gt;https://leetcode-cn.com/submissions/detail/56800430/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;由于 letters 已经有序，当我们从左往右扫描找到比目标字母大字母则该字母就是答案&lt;/p&gt;

&lt;h2 id=&quot;746-使用最小花费爬楼梯&quot;&gt;746. 使用最小花费爬楼梯&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/min-cost-climbing-stairs/&quot;&gt;https://leetcode-cn.com/problems/min-cost-climbing-stairs/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始就考虑使用动态规划，但是对于计算不是很熟悉&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/57018056/&quot;&gt;https://leetcode-cn.com/submissions/detail/57018056/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;从后往前计算 f，并计算出&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f[i+1] 和 f[i+2]&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;747-至少是其他数字两倍的最大数&quot;&gt;747. 至少是其他数字两倍的最大数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/largest-number-at-least-twice-of-others/&quot;&gt;https://leetcode-cn.com/problems/largest-number-at-least-twice-of-others/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;因为题目要求最大元素是否至少是数组中每个其他数字的两倍，那么只需要比较最大数和第二大的数即可，遍历找出最大和第二大的数，判断是否大于两倍，注意不要用除法，会出现除 0 的情况&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/57019085/&quot;&gt;https://leetcode-cn.com/submissions/detail/57019085/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方题解一致&lt;/p&gt;

&lt;h2 id=&quot;748-最短完整词&quot;&gt;748. 最短完整词&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/shortest-completing-word/&quot;&gt;https://leetcode-cn.com/problems/shortest-completing-word/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用一个比较复杂的方法，先找出待查找的字符串，在候选单词中判断是否满足完整词要求，最后从中选择最短的&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/57023028/&quot;&gt;https://leetcode-cn.com/submissions/detail/57023028/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解使用计数法：每个字母的计数大于或等于 licenseplate 中的字母数即为完整词&lt;/p&gt;

&lt;h2 id=&quot;762-二进制表示中质数个计算置位&quot;&gt;762. 二进制表示中质数个计算置位&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/prime-number-of-set-bits-in-binary-representation/&quot;&gt;https://leetcode-cn.com/problems/prime-number-of-set-bits-in-binary-representation/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过循环 L 和 R 直接的数，通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Integer.bitCount(x)&lt;/code&gt;计算 1 的个数，并判断个数是否数质数即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/57342766/&quot;&gt;https://leetcode-cn.com/submissions/detail/57342766/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;只需要穷举列出几个质数即可，因为题目限制了数字的大小&lt;/p&gt;

&lt;h2 id=&quot;766-托普利茨矩阵&quot;&gt;766. 托普利茨矩阵&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/toeplitz-matrix/&quot;&gt;https://leetcode-cn.com/problems/toeplitz-matrix/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法比较简单，从第一行和第一列开始，检查每个对角线元素是否相等即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/57342928/&quot;&gt;https://leetcode-cn.com/submissions/detail/57342928/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟题解方法不同，题解需要 Map 存储结果&lt;/p&gt;

&lt;h2 id=&quot;771-宝石与石头&quot;&gt;771. 宝石与石头&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/jewels-and-stones/&quot;&gt;https://leetcode-cn.com/problems/jewels-and-stones/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;直接遍历自己已经有的石头，计数记录到一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[] table&lt;/code&gt;中，在遍历宝石列表，从计数表中获取结果并累加即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/57343010/&quot;&gt;https://leetcode-cn.com/submissions/detail/57343010/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;不需要像题解中使用 Set 去记录石头，直接累加即可&lt;/p&gt;

&lt;h2 id=&quot;783-二叉搜索树结点最小距离&quot;&gt;783. 二叉搜索树结点最小距离&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/minimum-distance-between-bst-nodes/&quot;&gt;https://leetcode-cn.com/problems/minimum-distance-between-bst-nodes/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始只是比较当前节点叶子节点，但是发现会有问题，只能遍历后排序计算&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/57672317/&quot;&gt;https://leetcode-cn.com/submissions/detail/57672317/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解提到二叉搜索树的性质，只需要中序遍历（左中右），比较大小即可&lt;/p&gt;

&lt;h2 id=&quot;784-字母大小写全排列&quot;&gt;784. 字母大小写全排列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/letter-case-permutation/&quot;&gt;https://leetcode-cn.com/problems/letter-case-permutation/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;用了一个比较暴力的方法，一个个字符遍历，然后在两个列表中倒数据，遇到字母则遍历之前的结果，加上大小写，否则直接添加当前字符&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/57676835/&quot;&gt;https://leetcode-cn.com/submissions/detail/57676835/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法类似，官方解法使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StringBuilder&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;788-旋转数字&quot;&gt;788. 旋转数字&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/rotated-digits/&quot;&gt;https://leetcode-cn.com/problems/rotated-digits/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;对题目意图没有特别清晰，解答有些问题&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/57678737/&quot;&gt;https://leetcode-cn.com/submissions/detail/57678737/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;通过暴力法遍历：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;如果 X 中存在 3、4、7 这样的无效数字，则 X 不是一个好数。&lt;/li&gt;
  &lt;li&gt;如果 X 中不存在 2、5、6、9 这样的旋转后会变成不同的数字，则 X 不是一个好数。&lt;/li&gt;
  &lt;li&gt;否则，X 可以旋转成一个不同的有效数字。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;796-旋转字符串&quot;&gt;796. 旋转字符串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/rotate-string/&quot;&gt;https://leetcode-cn.com/problems/rotate-string/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;因为 B 可以通过 A 旋转所得，所以 A 和 B 中的字符间距应该相等，不断比较字符间距是否相等即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/57972907/&quot;&gt;https://leetcode-cn.com/submissions/detail/57972907/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;其实有时间解法非常简单：由于 A + A 包含了所有可以通过旋转操作从 A 得到的字符串，因此我们只需要判断 B 是否为 A + A 的子串即可&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(A + A).contains(B)&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;804-唯一摩尔斯密码词&quot;&gt;804. 唯一摩尔斯密码词&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/unique-morse-code-words/&quot;&gt;https://leetcode-cn.com/problems/unique-morse-code-words/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用 HashSet 保存 StringBuilder 生成的摩斯密码结果，返回集合长度&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/57973879/&quot;&gt;https://leetcode-cn.com/submissions/detail/57973879/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;与官方解法一致&lt;/p&gt;

&lt;h2 id=&quot;806-写字符串需要的行数&quot;&gt;806. 写字符串需要的行数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/number-of-lines-to-write-string/&quot;&gt;https://leetcode-cn.com/problems/number-of-lines-to-write-string/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;简单遍历字符串，计算所需的行数：如果小于 100 则累加，大于 100 则换行重新计算&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/57973974/&quot;&gt;https://leetcode-cn.com/submissions/detail/57973974/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法基本一致&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-03-29T17:58:12+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-10.html</loc>
        <lastmod>2020-03-22T18:27:39+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 10</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;字符串匹配&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lastIndexOf&lt;/code&gt;会快很多&lt;/li&gt;
  &lt;li&gt;有些情况下通过迭代可以减少空间的使用&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;653-两数之和-iv---输入-bst&quot;&gt;653. 两数之和 IV - 输入 BST&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/two-sum-iv-input-is-a-bst/&quot;&gt;https://leetcode-cn.com/problems/two-sum-iv-input-is-a-bst/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始使用直接在树上搜索的方法是错误的，因为有可能不在相邻的节点上，需要通过遍历比较长的路径&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/54206462/&quot;&gt;https://leetcode-cn.com/submissions/detail/54206462/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;利用 BST 的性质，BST 的中序遍历结果是按升序排列的。因此，中序遍历给定的 BST，并将遍历结果存储到 list 中。遍历完成后，使用两个指针 l 和 r 作为 list 的头部索引和尾部索引进行搜索&lt;/p&gt;

&lt;h2 id=&quot;657-机器人能否返回原点&quot;&gt;657. 机器人能否返回原点&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/robot-return-to-origin/&quot;&gt;https://leetcode-cn.com/problems/robot-return-to-origin/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法思路比较简单，对 x 和 y 两个变量进行操作，根据 UDLR 进行加减，最后 x 和 y 都为 0 即是回到原点&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/54207504/&quot;&gt;https://leetcode-cn.com/submissions/detail/54207504/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;更简单的是进行计数，然后相减&lt;/p&gt;

&lt;h2 id=&quot;661-图片平滑器&quot;&gt;661. 图片平滑器&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/image-smoother/&quot;&gt;https://leetcode-cn.com/problems/image-smoother/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;calculate&lt;/code&gt;方法计算当前节点的值，重新写回矩阵&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/54110993/&quot;&gt;https://leetcode-cn.com/submissions/detail/54110993/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法看起来很简洁，但一下子有些难理解&lt;/p&gt;

&lt;h2 id=&quot;665-非递减数列&quot;&gt;665. 非递减数列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/non-decreasing-array/&quot;&gt;https://leetcode-cn.com/problems/non-decreasing-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;之前的想法就是通过遍历整个数组如果出现不满足非递减的情况，但是出现了一些不满足的情况&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/54467621/&quot;&gt;https://leetcode-cn.com/submissions/detail/54467621/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;需要对每一个非递减数列中的断点，分为两种不同的情况进行处理&lt;/p&gt;

&lt;h2 id=&quot;669-修剪二叉搜索树&quot;&gt;669. 修剪二叉搜索树&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/trim-a-binary-search-tree/&quot;&gt;https://leetcode-cn.com/problems/trim-a-binary-search-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;如果根节点满足条件，直接通过递归的形式处理左右子树并返回，否则返回子树递归处理的结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/54391080/&quot;&gt;https://leetcode-cn.com/submissions/detail/54391080/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解的逻辑一致，只是看起来更加简单&lt;/p&gt;

&lt;h2 id=&quot;671-二叉树中第二小的节点&quot;&gt;671. 二叉树中第二小的节点&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/second-minimum-node-in-a-binary-tree/&quot;&gt;https://leetcode-cn.com/problems/second-minimum-node-in-a-binary-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过遍历整颗树，把结果放入 Set 中，并遍历两次 Set 中的元素找出第二大的结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/54393282/&quot;&gt;https://leetcode-cn.com/submissions/detail/54393282/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法二通过判断当 node.val &amp;gt; min1 不需要遍历子树&lt;/p&gt;

&lt;h2 id=&quot;674-最长连续递增序列&quot;&gt;674. 最长连续递增序列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/longest-continuous-increasing-subsequence/&quot;&gt;https://leetcode-cn.com/problems/longest-continuous-increasing-subsequence/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;思路很简单，就是遍历整个数组，然后遇到变小就重制并记录最大值。在实现过程中有很多细节、边界情况没有处理好，最后调试了几次&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/54722581/&quot;&gt;https://leetcode-cn.com/submissions/detail/54722581/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方的解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;680-验证回文字符串-ⅱ&quot;&gt;680. 验证回文字符串 Ⅱ&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/valid-palindrome-ii/&quot;&gt;https://leetcode-cn.com/problems/valid-palindrome-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始打算使用一个函数判断跳过的方法，后来觉得可以不需要，结果套路错了，因为跳过有两个方向&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/54725871/&quot;&gt;https://leetcode-cn.com/submissions/detail/54725871/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;对于给定字符串中的每个索 i，让我们删除该字符，然后检查结果字符串是否是回文。&lt;/p&gt;

&lt;h2 id=&quot;682-棒球比赛&quot;&gt;682. 棒球比赛&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/54723042/&quot;&gt;https://leetcode-cn.com/submissions/detail/54723042/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过一个数组和指针模拟栈，按照逻辑执行&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/54723042/&quot;&gt;https://leetcode-cn.com/submissions/detail/54723042/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方使用 Stack 实现一致&lt;/p&gt;

&lt;h2 id=&quot;686-重复叠加字符串匹配&quot;&gt;686. 重复叠加字符串匹配&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/repeated-string-match/&quot;&gt;https://leetcode-cn.com/problems/repeated-string-match/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始考虑的方法就是不断拼接字符串 A 并通过 indexOf 的方法，但是一直会出现时间超出限制的错误&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/55045499/&quot;&gt;https://leetcode-cn.com/submissions/detail/55045499/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lastIndexOf&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;indexOf&lt;/code&gt;来进行字符串匹配测试数据的问题&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lastIndexOf&lt;/code&gt;会快很多&lt;/p&gt;

&lt;h2 id=&quot;687-最长同值路径&quot;&gt;687. 最长同值路径&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/longest-univalue-path/&quot;&gt;https://leetcode-cn.com/problems/longest-univalue-path/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始通过递归并保存到 Map 的方式，但是这样计算的结果会有重复&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/55044230/&quot;&gt;https://leetcode-cn.com/submissions/detail/55044230/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;对于每个节点，我们向左延伸的最长箭头和向右延伸的最长箭头，将这些候选答案记录下来，并返回最佳答案。&lt;/p&gt;

&lt;h2 id=&quot;690-员工的重要性&quot;&gt;690. 员工的重要性&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/employee-importance/&quot;&gt;https://leetcode-cn.com/problems/employee-importance/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始解答时候忘记考虑员工下属的下属的递归的情况，后面使用栈解决了这个问题&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/55040904/&quot;&gt;https://leetcode-cn.com/submissions/detail/55040904/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法使用深度优先搜索 DFS 递归解答&lt;/p&gt;

&lt;h2 id=&quot;693-交替位二进制数&quot;&gt;693. 交替位二进制数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/binary-number-with-alternating-bits/&quot;&gt;https://leetcode-cn.com/problems/binary-number-with-alternating-bits/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法比较简单粗暴，通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Integer.toBinaryString(n).toCharArray()&lt;/code&gt;转换成字符串数组，然后按照字符进行判断是否交替&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/55255318/&quot;&gt;https://leetcode-cn.com/submissions/detail/55255318/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n%2&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n//2&lt;/code&gt;操作获得最后一位和其余的位。如果最后一位等于剩余的最后一位，那么两个相邻的位具有相同的值，则答案是 False 的，反之，答案是 True 的&lt;/p&gt;

&lt;h2 id=&quot;696-计数二进制子串&quot;&gt;696. 计数二进制子串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/count-binary-substrings/&quot;&gt;https://leetcode-cn.com/problems/count-binary-substrings/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的思路就暴力比较，因为存在两层循环，复杂度达到 n 平方级别，在长字符串就会出现超时&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/55256330/&quot;&gt;https://leetcode-cn.com/submissions/detail/55256330/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;需要按照分组的形式，字符串的中间部分必须出现在两个组之间&lt;/p&gt;

&lt;h2 id=&quot;697-数组的度&quot;&gt;697. 数组的度&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/degree-of-an-array/&quot;&gt;https://leetcode-cn.com/problems/degree-of-an-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始对题目对条件不是很清楚，其实主要是度数 d 的数组必须有一些元素 x 出现 d 次，并找到最短对子数组&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/55255833/&quot;&gt;https://leetcode-cn.com/submissions/detail/55255833/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;通过统计出现次数和最前最后索引，取出最大度的数为候选，取这些候选的最小值即可&lt;/p&gt;

&lt;h2 id=&quot;700-二叉搜索树中的搜索&quot;&gt;700. 二叉搜索树中的搜索&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/search-in-a-binary-search-tree/&quot;&gt;https://leetcode-cn.com/problems/search-in-a-binary-search-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过二叉搜索树性质加上递归很容易解答，只需要返回&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root.val &amp;gt; val ? searchBST(root.left, val) : searchBST(root.right, val);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/55625429/&quot;&gt;https://leetcode-cn.com/submissions/detail/55625429/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解也提到使用迭代进行，通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root = val &amp;lt; root.val ? root.left : root.right&lt;/code&gt;减少递归中栈空间的使用&lt;/p&gt;

&lt;h2 id=&quot;703-数据流中的第-k-大元素&quot;&gt;703. 数据流中的第 K 大元素&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/kth-largest-element-in-a-stream/&quot;&gt;https://leetcode-cn.com/problems/kth-largest-element-in-a-stream/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过使用 Java 内置的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PriorityQueue&lt;/code&gt;作为小根堆，然后在超出数量的情况下，不断驱逐元素即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/55625543/&quot;&gt;https://leetcode-cn.com/submissions/detail/55625543/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;可以使用数组实现小根堆&lt;/p&gt;

&lt;h2 id=&quot;704-二分查找&quot;&gt;704. 二分查找&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/binary-search/&quot;&gt;https://leetcode-cn.com/problems/binary-search/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;还是简单的二分查找，但是感觉自己掌握的还不够熟练&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/55626809/&quot;&gt;https://leetcode-cn.com/submissions/detail/55626809/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;初始化指针 left = 0, right = n - 1。&lt;/li&gt;
  &lt;li&gt;当 left &amp;lt;= right：比较中间元素 nums[pivot] 和目标值 target 。
    &lt;ol&gt;
      &lt;li&gt;如果 target = nums[pivot]，返回 pivot。&lt;/li&gt;
      &lt;li&gt;如果 target &amp;lt; nums[pivot]，则在左侧继续搜索 right = pivot - 1。&lt;/li&gt;
      &lt;li&gt;如果 target &amp;gt; nums[pivot]，则在右侧继续搜索 left = pivot + 1。&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;705-设计哈希集合&quot;&gt;705. 设计哈希集合&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/design-hashset/&quot;&gt;https://leetcode-cn.com/problems/design-hashset/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用一个数组作为哈希桶，然后每个桶里使用 LinkedList 作为内容存储&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/55953162/&quot;&gt;https://leetcode-cn.com/submissions/detail/55953162/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法还提到可以使用二叉搜索树进行内容存储，查找效率更高&lt;/p&gt;

&lt;h2 id=&quot;706-设计哈希映射&quot;&gt;706. 设计哈希映射&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/design-hashmap/&quot;&gt;https://leetcode-cn.com/problems/design-hashmap/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;跟哈希集合设计类似，使用一个 Pair 作为内容 KV 的存储容器&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/55953344/&quot;&gt;https://leetcode-cn.com/submissions/detail/55953344/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法一致&lt;/p&gt;

&lt;h2 id=&quot;709-转换成小写字母&quot;&gt;709. 转换成小写字母&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/to-lower-case/&quot;&gt;https://leetcode-cn.com/problems/to-lower-case/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-20&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过转换为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;char[]&lt;/code&gt;，然后循环判断，原地修改，最后重新生成字符串&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/55953438/&quot;&gt;https://leetcode-cn.com/submissions/detail/55953438/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人的解法基本一致&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-03-22T18:27:39+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-09.html</loc>
        <lastmod>2020-03-15T17:20:20+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 09</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;使用“除法和取模”进行矩阵填充&lt;/li&gt;
  &lt;li&gt;使用 Map 的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;containsKey()&lt;/code&gt;方法检查 key 是否存在&lt;/li&gt;
  &lt;li&gt;通过清空列表保存最小值结果&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;费马平方和定理&quot;&gt;费马平方和定理&lt;/h3&gt;

&lt;p&gt;一个非负整数&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c&lt;/code&gt;能够表示为两个整数的平方和，当且仅当&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c&lt;/code&gt;的所有形如&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;4k+3&lt;/code&gt;的质因子的幂次均为偶数。&lt;/p&gt;

&lt;h2 id=&quot;566-重塑矩阵&quot;&gt;566. 重塑矩阵&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/reshape-the-matrix/&quot;&gt;https://leetcode-cn.com/problems/reshape-the-matrix/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先判断矩阵转换是否能满足条件（行列积相等），然后新建一个返回结果矩阵，按照目标大小进行数据填充，返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/52302244/&quot;&gt;https://leetcode-cn.com/submissions/detail/52302244/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;因为计算填充行列时候需要判断是否要换行，还是比较麻烦的，官方题解中有个非常优雅的做法&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;res[count / c][count % c] = nums[i][j]&lt;/code&gt;，只要每次循环不断增加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;count&lt;/code&gt;即可，不需要不断判断与换行&lt;/p&gt;

&lt;h2 id=&quot;572-另一个树的子树&quot;&gt;572. 另一个树的子树&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/subtree-of-another-tree/&quot;&gt;https://leetcode-cn.com/problems/subtree-of-another-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过判断当前树是否相等，然后不断递归计算子树是否相等&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/52297094/&quot;&gt;https://leetcode-cn.com/submissions/detail/52297094/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了其他人的题解，通过更快跳出子树判断的循环可以加快判别的速度&lt;/p&gt;

&lt;h2 id=&quot;575-分糖果&quot;&gt;575. 分糖果&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/distribute-candies/&quot;&gt;https://leetcode-cn.com/problems/distribute-candies/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;方法比较简单， 使用一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;boolean[200001]&lt;/code&gt;的数组来记录糖果是否出现，如果没有出现过就加一，最后返回糖果类型和数组一半的最小值&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/52305146/&quot;&gt;https://leetcode-cn.com/submissions/detail/52305146/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了其他人的解法，可以先计算数组的一半大小，然后在循环中判断是否超过数组一半，这样可以减少循环的次数&lt;/p&gt;

&lt;h2 id=&quot;581-最短无序连续子数组&quot;&gt;581. 最短无序连续子数组&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/shortest-unsorted-continuous-subarray/&quot;&gt;https://leetcode-cn.com/problems/shortest-unsorted-continuous-subarray/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始就想使用不使用额外空间的指针查找方法，但是一直都没有做出结果，最后只能使用排序后比较的方法解答&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/52524655/&quot;&gt;https://leetcode-cn.com/submissions/detail/52524655/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;从官方题解的解法可以看到，解法需要四次循环（之前一直没做出处理是因为思路对了，解答有问题），应该是最小元素的正确位置可以决定左边界，最大元素的正确位置可以决定右边界&lt;/p&gt;

&lt;h2 id=&quot;589-n-叉树的前序遍历&quot;&gt;589. N 叉树的前序遍历&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/n-ary-tree-preorder-traversal/&quot;&gt;https://leetcode-cn.com/problems/n-ary-tree-preorder-traversal/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;还是递归的解法，跟二叉树类似&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/52525992/&quot;&gt;https://leetcode-cn.com/submissions/detail/52525992/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用迭代法需要使用一个栈来帮助我们得到前序遍历，需要保证栈顶的节点就是我们当前遍历到的节点。我们首先把根节点入栈，因为根节点是前序遍历中的第一个节点。随后每次我们从栈顶取出一个节点 u，它是我们当前遍历到的节点，并把 u 的所有子节点逆序推入栈中。&lt;/p&gt;

&lt;h2 id=&quot;590-n-叉树的后序遍历&quot;&gt;590. N 叉树的后序遍历&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/n-ary-tree-postorder-traversal/&quot;&gt;https://leetcode-cn.com/problems/n-ary-tree-postorder-traversal/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;继续还是使用递归法，跟二叉树类似&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/52526065/&quot;&gt;https://leetcode-cn.com/submissions/detail/52526065/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;迭代法：使用和 N 叉树的前序遍历 相同的方法，使用一个栈来得到后序遍历。我们首先把根节点入栈。当每次我们从栈顶取出一个节点 u 时，就把 u 的所有子节点顺序推入栈中&lt;/p&gt;

&lt;h2 id=&quot;594-最长和谐子序列&quot;&gt;594. 最长和谐子序列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/longest-harmonious-subsequence/&quot;&gt;https://leetcode-cn.com/problems/longest-harmonious-subsequence/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先通过一个 Map 进行哈希映射，然后查找是否能找到对应的数值，找到就累加 1&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/52795109/&quot;&gt;https://leetcode-cn.com/submissions/detail/52795109/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;题解中在哈希映射的基础上，只需要一次扫描，通过在扫描到 nums[i] 时，u + v 和 v + w 中一定有一个就是答案的逻辑，减少一次扫描&lt;/p&gt;

&lt;h2 id=&quot;595-大的国家&quot;&gt;595. 大的国家&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/big-countries/&quot;&gt;https://leetcode-cn.com/problems/big-countries/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法很简单，就是通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;where&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;or&lt;/code&gt;进行筛选&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/52797418/&quot;&gt;https://leetcode-cn.com/submissions/detail/52797418/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解中还提到使用两个查询然后&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UNION&lt;/code&gt;的方法&lt;/p&gt;

&lt;h2 id=&quot;596-超过-5-名学生的课&quot;&gt;596. 超过 5 名学生的课&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/classes-more-than-5-students/&quot;&gt;https://leetcode-cn.com/problems/classes-more-than-5-students/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始觉得很简单，但是没有看清楚题目，需要包括等于的，还有就是需要根据学生去重，使用两层查询完成&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/52797880/&quot;&gt;https://leetcode-cn.com/submissions/detail/52797880/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;除了子查询外，还可以使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HAVING COUNT(DISTINCT student) &amp;gt;= 5&lt;/code&gt;进行过滤&lt;/p&gt;

&lt;h2 id=&quot;598-范围求和-ii&quot;&gt;598. 范围求和 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/range-addition-ii/&quot;&gt;https://leetcode-cn.com/problems/range-addition-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;如果直接初始化一个巨大的矩阵是会超出内存的，其实逻辑非常简单，遍历操作矩阵，算出 M 和 N 的最小值，相乘即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/53119909/&quot;&gt;https://leetcode-cn.com/submissions/detail/53119909/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法与我的解法一致&lt;/p&gt;

&lt;h2 id=&quot;599-两个列表的最小索引总和&quot;&gt;599. 两个列表的最小索引总和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/minimum-index-sum-of-two-lists/&quot;&gt;https://leetcode-cn.com/problems/minimum-index-sum-of-two-lists/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用四次循环:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;首先将数量少的 list 放入 map 中&lt;/li&gt;
  &lt;li&gt;遍历另外一个 list，将存在的 key 放入 map2&lt;/li&gt;
  &lt;li&gt;遍历 map2，找出最小的索引&lt;/li&gt;
  &lt;li&gt;再次遍历 map2，将最小索引的 key 取出来并返回&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/53120145/&quot;&gt;https://leetcode-cn.com/submissions/detail/53120145/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解中使用一个 list，并判断当前索引是否最小，更小则清空并加入自己，否则将自己加入列表即可&lt;/p&gt;

&lt;h2 id=&quot;605-种花问题&quot;&gt;605. 种花问题&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/can-place-flowers/&quot;&gt;https://leetcode-cn.com/problems/can-place-flowers/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;思路比较简单，通过遍历 flowerbed 数组，判断当前位置前后是否没有花，可以种花则结果加 1，最后比较可以种的数量和需要种的数量即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/53121027/&quot;&gt;https://leetcode-cn.com/submissions/detail/53121027/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方使用贪心算法，将可以种植的位置重写为 1 降低判断逻辑复杂度，我使用的是临时变量，不去改变原数组&lt;/p&gt;

&lt;h2 id=&quot;606-根据二叉树创建字符串&quot;&gt;606. 根据二叉树创建字符串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/construct-string-from-binary-tree/&quot;&gt;https://leetcode-cn.com/problems/construct-string-from-binary-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过一个递归前序遍历，然后注意处理左子树为空以及叶子节点的特殊情况即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/53351511/&quot;&gt;https://leetcode-cn.com/submissions/detail/53351511/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方同样使用递归和迭代两种解法&lt;/p&gt;

&lt;h2 id=&quot;617-合并二叉树&quot;&gt;617. 合并二叉树&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/merge-two-binary-trees/&quot;&gt;https://leetcode-cn.com/problems/merge-two-binary-trees/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;采用递归前序遍历合并两棵树，如果都为空则直接返回，如果一个节点不为空即返回该节点，否则进行节点值相加再递归合并左右子树&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/53352017/&quot;&gt;https://leetcode-cn.com/submissions/detail/53352017/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方依然提供递归与迭代两种解法&lt;/p&gt;

&lt;h2 id=&quot;620-有趣的电影&quot;&gt;620. 有趣的电影&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/not-boring-movies/&quot;&gt;https://leetcode-cn.com/problems/not-boring-movies/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法比较简单，通过``id&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;% 2 = 1 AND&lt;/code&gt;description&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;&amp;gt; 'boring'&lt;/code&gt;进行过滤即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/53381741/&quot;&gt;https://leetcode-cn.com/submissions/detail/53381741/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;与官方解法基本一致，官方使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mod(id, 2) = 1&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;627-交换工资&quot;&gt;627. 交换工资&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/swap-salary/&quot;&gt;https://leetcode-cn.com/problems/swap-salary/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;方法比较简单，通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IF(&lt;/code&gt;sex&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;= 'f', 'm', 'f')&lt;/code&gt;一条语句完成更新&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/53576742/&quot;&gt;https://leetcode-cn.com/submissions/detail/53576742/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CASE...WHEN...&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;628-三个数的最大乘积&quot;&gt;628. 三个数的最大乘积&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/maximum-product-of-three-numbers/&quot;&gt;https://leetcode-cn.com/problems/maximum-product-of-three-numbers/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法比较简单粗暴，直接对数组进行排序，一开始没有考虑到负数的情况，错误后添加条件判断，如果有两个以上负数，就判断两个负数的乘积与倒数二三的乘积的大小&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/53609666/&quot;&gt;https://leetcode-cn.com/submissions/detail/53609666/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解还讲了使用线性扫描的方法，找出最大的三个数以及最小的两个数，最后比较乘积即可&lt;/p&gt;

&lt;h2 id=&quot;633-平方数之和&quot;&gt;633. 平方数之和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/sum-of-square-numbers/&quot;&gt;https://leetcode-cn.com/problems/sum-of-square-numbers/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用了一个比较暴力的解法，通过循环递增一个平方数，再判断剩余的数是否是平方数&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/53611739/&quot;&gt;https://leetcode-cn.com/submissions/detail/53611739/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解更简单的是使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sqrt&lt;/code&gt;函数，首先枚举 a，并保证&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c - a^2 &amp;gt;= 0&lt;/code&gt;，随后直接使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sqrt&lt;/code&gt;函数直接找出 b，还有使用费马平方和定理&lt;/p&gt;

&lt;h2 id=&quot;637-二叉树的层平均值&quot;&gt;637. 二叉树的层平均值&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/average-of-levels-in-binary-tree/&quot;&gt;https://leetcode-cn.com/problems/average-of-levels-in-binary-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过一个 Map 记录递归过程中的节点和以及个数，然后遍历 Map 输出结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/53877069/&quot;&gt;https://leetcode-cn.com/submissions/detail/53877069/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟题解中的深度优先搜索类似， 题解使用两个 List 保存结果&lt;/p&gt;

&lt;h2 id=&quot;643-子数组最大平均数-i&quot;&gt;643. 子数组最大平均数 I&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/maximum-average-subarray-i/&quot;&gt;https://leetcode-cn.com/problems/maximum-average-subarray-i/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先计算第 0 到 k-1 数的和，然后开始滑动计算，减去最前面的，加上最后面的，比较当前和的大小，最后返回和最大值的平均数&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/53868210/&quot;&gt;https://leetcode-cn.com/submissions/detail/53868210/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方题解的滑动窗口法一致&lt;/p&gt;

&lt;h2 id=&quot;645-错误的集合&quot;&gt;645. 错误的集合&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/set-mismatch/&quot;&gt;https://leetcode-cn.com/problems/set-mismatch/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-20&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始想到循环，计算出缺失值与真值的差，但是没办法找到缺失值与正确值的方法&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/53876754/&quot;&gt;https://leetcode-cn.com/submissions/detail/53876754/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了题解，最简单的方法就是遍历 nums 中的所有数字，在遇到的位上转换位负数，如果遇到负数就是重复值，缺失数字 j 对应的索引处仍然是正数&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-03-15T17:20:20+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-08.html</loc>
        <lastmod>2020-03-08T17:07:38+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 08</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;熟悉二叉搜索树的性质与遍历方法&lt;/li&gt;
  &lt;li&gt;使用全局变量保存递归中间结果，而不是不断调用递归函数计算&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;485-最大连续-1-的个数&quot;&gt;485. 最大连续 1 的个数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/max-consecutive-ones/&quot;&gt;https://leetcode-cn.com/problems/max-consecutive-ones/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法比较简单，通过应该计数器，当遇到 0 就比较当前 1 的数量和计数器，取最大值即可，注意最后返回时也要比对计数器（防止最后一位是 1）&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/50643972/&quot;&gt;https://leetcode-cn.com/submissions/detail/50643972/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解还有一致直接合并成字符串然后&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;split('0')&lt;/code&gt;最后返回最长一组的方法&lt;/p&gt;

&lt;h2 id=&quot;492-构造矩形&quot;&gt;492. 构造矩形&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/construct-the-rectangle/&quot;&gt;https://leetcode-cn.com/problems/construct-the-rectangle/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始就想到使用开平方拿到一个边，但是做题过程有个思路错了，应该是通过拿到的平方数直接递减找答案才对&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/50644902/&quot;&gt;https://leetcode-cn.com/submissions/detail/50644902/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;对这个数开方，然后往下递减第一个可以整除的是宽度，就是最好的结果。本质上是求因数&lt;/p&gt;

&lt;h2 id=&quot;496-下一个更大元素-i&quot;&gt;496. 下一个更大元素 I&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/next-greater-element-i/&quot;&gt;https://leetcode-cn.com/problems/next-greater-element-i/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;想法比较简单粗暴，直接遍历 nums2，然后构建一个 Map，最后遍历 nums1 返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/50589329/&quot;&gt;https://leetcode-cn.com/submissions/detail/50589329/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解中使用“单调栈”的方式，减少了在构建 Map 时候的遍历次数&lt;/p&gt;

&lt;h2 id=&quot;500-键盘行&quot;&gt;500. 键盘行&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/keyboard-row/&quot;&gt;https://leetcode-cn.com/problems/keyboard-row/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过拿单词的首个字母，获得键盘行的字母序列，然后使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;contains&lt;/code&gt;进行判断，符合要求的推入字符串，最后返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/50765714/&quot;&gt;https://leetcode-cn.com/submissions/detail/50765714/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看到其他人的解法中使用 char 进行比对，速度感觉更快&lt;/p&gt;

&lt;h2 id=&quot;501-二叉搜索树中的众数&quot;&gt;501. 二叉搜索树中的众数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-mode-in-binary-search-tree/&quot;&gt;https://leetcode-cn.com/problems/find-mode-in-binary-search-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用一个 Map 保存遍历过程中的数字和次数，并返回最大次数，最后遍历 Map 返回最大次数的结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/50880109/&quot;&gt;https://leetcode-cn.com/submissions/detail/50880109/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;二叉搜索树的中序遍历是一个升序序列，逐个比对当前结点(root)值与前驱结点(pre)值。更新当前节点值出现次数(curTimes)及最大出现次数(maxTimes)，更新规则：若 curTimes=maxTimes,将 root-&amp;gt;val 添加到结果向量(res)中；若 curTimes&amp;gt;maxTimes,清空 res,将 root-&amp;gt;val 添加到 res,并更新 maxTimes 为 curTimes&lt;/p&gt;

&lt;h2 id=&quot;504-七进制数&quot;&gt;504. 七进制数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/base-7/&quot;&gt;https://leetcode-cn.com/problems/base-7/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;这个跟二进制转换方法基本一致，就是取余数，然后除 7，最后返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/50883276/&quot;&gt;https://leetcode-cn.com/submissions/detail/50883276/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;大家解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;506-相对名次&quot;&gt;506. 相对名次&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/relative-ranks/&quot;&gt;https://leetcode-cn.com/problems/relative-ranks/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用一个 Map 保存排序过的数组对应的名次，再二次遍历，记录对应名次并转换前三名&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/51067423/&quot;&gt;https://leetcode-cn.com/submissions/detail/51067423/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;其他人的题解中不需要&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sort&lt;/code&gt;和 Map，而是初始化一个最大值的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[]&lt;/code&gt;，再按照数字位置写入，返回名次即可&lt;/p&gt;

&lt;h2 id=&quot;507-完美数&quot;&gt;507. 完美数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/perfect-number/&quot;&gt;https://leetcode-cn.com/problems/perfect-number/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;从 1 开始尝试算这个数的因子，并通过一个 Set 记录，最后计算因子的和，判断是否相等&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/51107279/&quot;&gt;https://leetcode-cn.com/submissions/detail/51107279/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;通过“欧几里得-欧拉定理”，只要带入最小的若干个素数 2, 3, 5, 7, 13, 17, 19, 31，将不超过 10^8 的所有完全数计算出来即可&lt;/p&gt;

&lt;h2 id=&quot;509-斐波那契数&quot;&gt;509. 斐波那契数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/fibonacci-number/&quot;&gt;https://leetcode-cn.com/problems/fibonacci-number/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[]&lt;/code&gt;缓存结果并按照逻辑计算&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/51100352/&quot;&gt;https://leetcode-cn.com/submissions/detail/51100352/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;题解有几种记忆缓存算法：先计算存储子问题的答案，然后利用子问题的答案计算当前斐波那契数的答案，还有“矩阵求幂”和“公式法”，使用黄金比例 Binet 公式&lt;/p&gt;

&lt;h2 id=&quot;520-检测大写字母&quot;&gt;520. 检测大写字母&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/detect-capital/&quot;&gt;https://leetcode-cn.com/problems/detect-capital/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始解法有问题，后来换了思路，先判断了大小写，再按照首字母大小去判断&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/51373667/&quot;&gt;https://leetcode-cn.com/submissions/detail/51373667/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看其他人的解法类似&lt;/p&gt;

&lt;h2 id=&quot;521-最长特殊序列-ⅰ&quot;&gt;521. 最长特殊序列 Ⅰ&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/longest-uncommon-subsequence-i/&quot;&gt;https://leetcode-cn.com/problems/longest-uncommon-subsequence-i/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始觉得这个问题比较复杂，但是后面也没想到解决方法，看了题解发现问题还是比较简单的&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/51387548/&quot;&gt;https://leetcode-cn.com/submissions/detail/51387548/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解提出：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;a=b。如果两个字符串相同，则没有特殊子序列，返回 -1&lt;/li&gt;
  &lt;li&gt;长度相等，但是字符串不同，返回任意一个的长度即可&lt;/li&gt;
  &lt;li&gt;长度不等，长的字符串一定不会是短字符串的子序列，返回长的字符串长度&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;530-二叉搜索树的最小绝对差&quot;&gt;530. 二叉搜索树的最小绝对差&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/minimum-absolute-difference-in-bst/&quot;&gt;https://leetcode-cn.com/problems/minimum-absolute-difference-in-bst/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;之前的思路有些问题，只是比较一级子树，后来发现有问题，只能整体遍历&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/51505025/&quot;&gt;https://leetcode-cn.com/submissions/detail/51505025/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了一下其他人的解法，使用 BST 中序遍历是升序，所以遍历时求相邻两个节点之间的最小绝对差值即可&lt;/p&gt;

&lt;h2 id=&quot;532-数组中的-k-diff-数对&quot;&gt;532. 数组中的 K-diff 数对&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/k-diff-pairs-in-an-array/&quot;&gt;https://leetcode-cn.com/problems/k-diff-pairs-in-an-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先对目标数组进行排序，排序后后面的数字必定大于等于前面的，只需要向后查找即不会出现重复并可快速判断：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;如果数字已经出现过，则跳过&lt;/li&gt;
  &lt;li&gt;如果两种的差已经超过 k，即可跳过（越往后差只会增大）&lt;/li&gt;
  &lt;li&gt;如果满足条件，计数器加一，跳出循环继续下一轮判断&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/51538831/&quot;&gt;https://leetcode-cn.com/submissions/detail/51538831/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看到更快速的解法通过两个指针进行循环，次数会更少&lt;/p&gt;

&lt;h2 id=&quot;538-把二叉搜索树转换为累加树&quot;&gt;538. 把二叉搜索树转换为累加树&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/convert-bst-to-greater-tree/&quot;&gt;https://leetcode-cn.com/problems/convert-bst-to-greater-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用一个列表来记录遇到的值，然后从右到左遍历树并处理累加，性能并不特别好，感觉使用列表会带来很大的消耗&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/51541625/&quot;&gt;https://leetcode-cn.com/submissions/detail/51541625/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法提到使用“回溯”（一个反序中序遍历方法），使用一个临时变量记录 sum 即可。还有“反序中序 Morris 遍历”（这个比较复杂，没怎么看懂）&lt;/p&gt;

&lt;h2 id=&quot;541-反转字符串-ii&quot;&gt;541. 反转字符串 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/reverse-string-ii/&quot;&gt;https://leetcode-cn.com/problems/reverse-string-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;按照题目说明梳理出了逻辑，然后有做了一下优化精简，但是整体代码感觉还是很复杂的样子&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/51574521/&quot;&gt;https://leetcode-cn.com/submissions/detail/51574521/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解很简单：为了翻转从&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt;到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;j&lt;/code&gt;的字符块，我们可以交换位于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i++&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;j--&lt;/code&gt;的字符，循环条件使用：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int start = 0; start &amp;lt; a.length; start += 2 * k&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;543-二叉树的直径&quot;&gt;543. 二叉树的直径&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/diameter-of-binary-tree/&quot;&gt;https://leetcode-cn.com/problems/diameter-of-binary-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始想到使用递归解，但是在最后计算的时候总是不对。看了一下题解，才明白计算中的问题&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/51899524/&quot;&gt;https://leetcode-cn.com/submissions/detail/51899524/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;题解中讲到“深度优先搜索”：最优路径经过 L + R + 1 个节点。&lt;/p&gt;

&lt;h2 id=&quot;551-学生出勤记录-i&quot;&gt;551. 学生出勤记录 I&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/student-attendance-record-i/&quot;&gt;https://leetcode-cn.com/problems/student-attendance-record-i/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解答比较简单，就是遍历字符串，根据条件进行判断，尽快跳出循环&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/51857528/&quot;&gt;https://leetcode-cn.com/submissions/detail/51857528/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;题解中还有更加简单的使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;indexOf&lt;/code&gt;和正则表达式的解法，确实也很神奇&lt;/p&gt;

&lt;h2 id=&quot;557-反转字符串中的单词-iii&quot;&gt;557. 反转字符串中的单词 III&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/reverse-words-in-a-string-iii/&quot;&gt;https://leetcode-cn.com/problems/reverse-words-in-a-string-iii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;先按照空格分割句子，再按照单词进行反转&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/51862332/&quot;&gt;https://leetcode-cn.com/submissions/detail/51862332/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了其他人的解法，更加快速的解法是转换成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;char[]&lt;/code&gt;然后遇到空格后就转换空格中间的部分&lt;/p&gt;

&lt;h2 id=&quot;559-n-叉树的最大深度&quot;&gt;559. N 叉树的最大深度&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/maximum-depth-of-n-ary-tree/&quot;&gt;https://leetcode-cn.com/problems/maximum-depth-of-n-ary-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法跟二叉树的遍历类似， 就是把左右子树比较换成子节点数组的循环，然后取最大值即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/52091007/&quot;&gt;https://leetcode-cn.com/submissions/detail/52091007/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解依然使用递归和迭代解答，在堆栈的帮助下将上面的递归转换为迭代&lt;/p&gt;

&lt;h2 id=&quot;561-数组拆分-i&quot;&gt;561. 数组拆分 I&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/array-partition-i/&quot;&gt;https://leetcode-cn.com/problems/array-partition-i/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;因为要保证 min 结果的和尽可能大， 那么就要把相近的数字放在一起，最简单的做法就是排序后取 0.2.4.6 这些偶数位置上的数字相加即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/52110387/&quot;&gt;https://leetcode-cn.com/submissions/detail/52110387/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解还提到一个使用额外的空间的哈希法，可以在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;O(n)&lt;/code&gt;时间复杂度完成&lt;/p&gt;

&lt;h2 id=&quot;563-二叉树的坡度&quot;&gt;563. 二叉树的坡度&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/binary-tree-tilt/&quot;&gt;https://leetcode-cn.com/problems/binary-tree-tilt/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-20&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;因为坡度计算需要计算树的左右子树的和，所以需要多次递归，通过添加一个 Map 缓存子树结果，性能有所提升&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/52108542/&quot;&gt;https://leetcode-cn.com/submissions/detail/52108542/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了题解发现，递归不需要再重复循环计算子树的和，而是使用全局变量保存递归结果即可（在任何结点调用该函数，都会返回当前结点下面包括其自身的结点和）&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-03-08T17:07:38+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-07.html</loc>
        <lastmod>2020-03-02T15:51:08+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 07</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;toCharArray()&lt;/code&gt;效率更高&lt;/li&gt;
  &lt;li&gt;仔细审题，利用好题目中的所有相关信息&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;401-二进制手表&quot;&gt;401. 二进制手表&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/binary-watch/&quot;&gt;https://leetcode-cn.com/problems/binary-watch/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始找不到思路，最后只能是通过计算数字中 1 的个数，然后按照小时和分钟计算，程序写起来相对复杂的样子&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49177882/&quot;&gt;https://leetcode-cn.com/submissions/detail/49177882/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了其他人的题解，发现不需要那么复杂，只要两层循环，计算小时和分钟，并且计算 1 的数量就够了&lt;/p&gt;

&lt;h2 id=&quot;404-左叶子之和&quot;&gt;404. 左叶子之和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/sum-of-left-leaves/&quot;&gt;https://leetcode-cn.com/problems/sum-of-left-leaves/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始想法比较简单，就是递归计算结果就好，但是提交的时候发现如果只有根的时候报错了。后来只能重构函数，添加是否需要返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49201987/&quot;&gt;https://leetcode-cn.com/submissions/detail/49201987/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人的解法基本一致&lt;/p&gt;

&lt;h2 id=&quot;405-数字转换为十六进制数&quot;&gt;405. 数字转换为十六进制数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/convert-a-number-to-hexadecimal/&quot;&gt;https://leetcode-cn.com/problems/convert-a-number-to-hexadecimal/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始通过取余的方式能解出正数的结果，但是对于负数部分没有找到方法，只能看看题解的方式&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49231542/&quot;&gt;https://leetcode-cn.com/submissions/detail/49231542/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;应该使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/code&gt;进行移位，然后通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;amp;15&lt;/code&gt;计算余数&lt;/p&gt;

&lt;h2 id=&quot;409-最长回文串&quot;&gt;409. 最长回文串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/longest-palindrome/&quot;&gt;https://leetcode-cn.com/problems/longest-palindrome/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过 map 计数后，只要是偶数，即可两两组成回文信息，并在中间可以外加一个字母&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49343291/&quot;&gt;https://leetcode-cn.com/submissions/detail/49343291/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法思路基本一致&lt;/p&gt;

&lt;h2 id=&quot;412-fizz-buzz&quot;&gt;412. Fizz Buzz&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/fizz-buzz/&quot;&gt;https://leetcode-cn.com/problems/fizz-buzz/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;思路比较简单，就是循环计算然后添加到结果数组&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49347584/&quot;&gt;https://leetcode-cn.com/submissions/detail/49347584/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;基础解法与官方一致，官方解法还提到可以使用“字符串连接”和“散列表”优化有更多规则的情况&lt;/p&gt;

&lt;h2 id=&quot;414-第三大的数&quot;&gt;414. 第三大的数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/third-maximum-number/&quot;&gt;https://leetcode-cn.com/problems/third-maximum-number/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始想到使用堆，但想想觉得不需要那么复杂，直接使用三个变量就好了，但是因为题目判定中有“-2147483648”这个边界值，后来没办法直接对数组进行排序了&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49357337/&quot;&gt;https://leetcode-cn.com/submissions/detail/49357337/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看到有人使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TreeSet&lt;/code&gt;可以很方便地判断&lt;/p&gt;

&lt;h2 id=&quot;415-字符串相加&quot;&gt;415. 字符串相加&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/add-strings/&quot;&gt;https://leetcode-cn.com/problems/add-strings/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法相对比较简单，就是从后面循环整个字符串，按照加法不断相加，同时注意处理进位问题。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49543236/&quot;&gt;https://leetcode-cn.com/submissions/detail/49543236/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了其他人的解法都是类似，但程序看起来简洁很多，例如使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;% 10&lt;/code&gt;直接处理大于 10 的结果，通过三元表达式处理长度问题等&lt;/p&gt;

&lt;h2 id=&quot;434-字符串中的单词数&quot;&gt;434. 字符串中的单词数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/number-of-segments-in-a-string/&quot;&gt;https://leetcode-cn.com/problems/number-of-segments-in-a-string/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;提交了很多次错误答案，因为思考的方向错了，其实应该是通过空格去判断单词数量&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49547870/&quot;&gt;https://leetcode-cn.com/submissions/detail/49547870/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;对于英文的理解跟中文还是很大差距，题解中比较简单的是使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.split(&quot;\\s+&quot;)&lt;/code&gt;进行解题，同时记得处理前后空格等情况&lt;/p&gt;

&lt;h2 id=&quot;437-路径总和-iii&quot;&gt;437. 路径总和 III&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/path-sum-iii/&quot;&gt;https://leetcode-cn.com/problems/path-sum-iii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;这个解题思路比较简单，通过递归处理，之前使用 List，后来改成 int 数组&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49574116/&quot;&gt;https://leetcode-cn.com/submissions/detail/49574116/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟其他人的解法基本类似&lt;/p&gt;

&lt;h2 id=&quot;441-排列硬币&quot;&gt;441. 排列硬币&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/arranging-coins/&quot;&gt;https://leetcode-cn.com/problems/arranging-coins/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法很简单，就是迭代除以当前的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt;值，直到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt;为 0，或者比&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt;小，返回结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49780183/&quot;&gt;https://leetcode-cn.com/submissions/detail/49780183/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看到使用公式&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k(k+1) /2 = n&lt;/code&gt;可以直接返回结果&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(int)(Math.sqrt(2) * Math.sqrt(n + 0.125) - 0.5)&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;443-压缩字符串&quot;&gt;443. 压缩字符串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/string-compression/&quot;&gt;https://leetcode-cn.com/problems/string-compression/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始没有看好题目，只是返回结果，没有在原位进行压缩，后面修改了一个版本，但是关于多位数的情况一致没有处理好&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49793427/&quot;&gt;https://leetcode-cn.com/submissions/detail/49793427/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了官方题解，使用双指针，同时使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(char c: (&quot;&quot; + (read - anchor + 1)).toCharArray())&lt;/code&gt;处理多位计数问题&lt;/p&gt;

&lt;h2 id=&quot;447-回旋镖的数量&quot;&gt;447. 回旋镖的数量&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/number-of-boomerangs/&quot;&gt;https://leetcode-cn.com/problems/number-of-boomerangs/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始打算使用暴力穷举法，但是发现整体数量太多，计算量太大，看了题解后发现应该是用 Hash 表查表的方法&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49782559/&quot;&gt;https://leetcode-cn.com/submissions/detail/49782559/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用 Hash 查表法，找出距离相等的点集合即可&lt;/p&gt;

&lt;h2 id=&quot;448-找到所有数组中消失的数字&quot;&gt;448. 找到所有数组中消失的数字&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-all-numbers-disappeared-in-an-array/&quot;&gt;https://leetcode-cn.com/problems/find-all-numbers-disappeared-in-an-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;想了很久没有找到不需要额外空间的方法，知道需要在原数组中进行操作，但是没有想到好的解决方法&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49953561/&quot;&gt;https://leetcode-cn.com/submissions/detail/49953561/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了官方题解后发现，题目说明数组中元素都为正数，那么可以通过将元素置为负数的方法来标记。从而实现原地操作&lt;/p&gt;

&lt;h2 id=&quot;453-最小移动次数使数组元素相等&quot;&gt;453. 最小移动次数使数组元素相等&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/minimum-moves-to-equal-array-elements/&quot;&gt;https://leetcode-cn.com/problems/minimum-moves-to-equal-array-elements/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;看了题目后，没能很好地 get 到题目的点，后来看了题解发现相关的逻辑，通过排序后计算解答了题目&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49979574/&quot;&gt;https://leetcode-cn.com/submissions/detail/49979574/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;题解提到了动态规划和数学法解答（只需要将所有的数都减到最小的数即可），通过计算元素总和 moves，并减去最小值即可&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;moves - min * nums.length&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;455-分发饼干&quot;&gt;455. 分发饼干&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/assign-cookies/&quot;&gt;https://leetcode-cn.com/problems/assign-cookies/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用了一个非常复杂的解法，思路就是给剩余的孩子分配尽可能大的饼干，先分配了正好相等的部分，然后按照胃口从大到小，饼干也从大到小分配，直到最后&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/49976632/&quot;&gt;https://leetcode-cn.com/submissions/detail/49976632/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;正确的应该是使用贪心算法，通过对两个数组进行排序，然后每次分配只关注未分配饼干的最小胃口的小朋友即可&lt;/p&gt;

&lt;h2 id=&quot;459-重复的子字符串&quot;&gt;459. 重复的子字符串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/repeated-substring-pattern/&quot;&gt;https://leetcode-cn.com/problems/repeated-substring-pattern/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解题方法相对比较简单，循环遍历整个字符串，然后加长比对字符串的长度，然后跟字符循环比对，优化点有两个，一个是只需要&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c&amp;lt;s.length() + 1&lt;/code&gt;，另外一个是子字符串必须能被字符长度整除&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/50260614/&quot;&gt;https://leetcode-cn.com/submissions/detail/50260614/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看到题解里面有个很高端的暴力解法，通过多次“移位和换行”来解决问题&lt;/p&gt;

&lt;h2 id=&quot;461-汉明距离&quot;&gt;461. 汉明距离&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/hamming-distance/&quot;&gt;https://leetcode-cn.com/problems/hamming-distance/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始看到位比较就想到使用异或运算，但是结果没有对，后来发现需要对异或结果进行位 1 的计数&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/50248944/&quot;&gt;https://leetcode-cn.com/submissions/detail/50248944/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Integer.bitCount&lt;/code&gt;对数字的 1 位数进行统计&lt;/p&gt;

&lt;h2 id=&quot;463-岛屿的周长&quot;&gt;463. 岛屿的周长&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/island-perimeter/&quot;&gt;https://leetcode-cn.com/problems/island-perimeter/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过看图找到规律，按照图形情况，如果 1 周围上下左右是 0 则边数加 1:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;上边界：如果是第 0 行则加 1，否则判断&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i-1&lt;/code&gt;为 0 则边数+1&lt;/li&gt;
  &lt;li&gt;下边界：如果是最后一行则加 1，否则判断&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i+1&lt;/code&gt;为 0 则边数+1&lt;/li&gt;
  &lt;li&gt;左边界：如果是第 0 列则加 1，否则判断&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;j-1&lt;/code&gt;为 0 则边数+1&lt;/li&gt;
  &lt;li&gt;右边界：如果是最后一列则加 1，否则判断&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;j+1&lt;/code&gt;为 0 则边数+1&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/50263413/&quot;&gt;https://leetcode-cn.com/submissions/detail/50263413/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看到题解才发现，由于岛屿内没有湖,所以只需要求出 北面(或南面) + 西面(或东面)的长度再乘 2 即可&lt;/p&gt;

&lt;h2 id=&quot;475-供暖器&quot;&gt;475. 供暖器&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/heaters/&quot;&gt;https://leetcode-cn.com/problems/heaters/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的思路是查找供暖器跟房屋的距离，然后找出距离最最小中最大的供暖器即为结果，但是没有写出来，参考了一下题解&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/50477855/&quot;&gt;https://leetcode-cn.com/submissions/detail/50477855/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用二分法找到每个房屋离加热器的最短距离（即找出离房屋最近的加热器），然后在所有距离中选出最大的一个即为结果。&lt;/p&gt;

&lt;h2 id=&quot;476-数字的补数&quot;&gt;476. 数字的补数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/number-complement/&quot;&gt;https://leetcode-cn.com/problems/number-complement/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;想到需要使用位操作一位位比较后加上，但是对位操作实在是不熟悉&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/50475527/&quot;&gt;https://leetcode-cn.com/submissions/detail/50475527/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;拿到一个位数和 num 一样切所有位都为 1 的数就好了&lt;/p&gt;

&lt;h2 id=&quot;482-密钥格式化&quot;&gt;482. 密钥格式化&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/license-key-formatting/&quot;&gt;https://leetcode-cn.com/problems/license-key-formatting/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-20&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始对题目理解有问题，后来重新写了一下，从后往前取字母，然后在遇到 K 的时候插入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-&lt;/code&gt;，注意处理最后的一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/50362485/&quot;&gt;https://leetcode-cn.com/submissions/detail/50362485/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;感觉跟其他人的解法类似，但是我写得还是有点复杂的&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-03-02T15:51:08+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/deploy-ghost-3-on-heroku.html</loc>
        <lastmod>2020-02-28T16:06:50+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>在 Heroku 上部署 Ghost 3.x</title>
                <content>
&lt;p&gt;之前的另外一个博客是托管在 Farbox 上，但是因为没有什么流量，也没有怎么去折腾，一直也就没有怎么管，某天突然想起，就想到要看看，结果发现 Farbox 已经快过期了，而且还没得续费。&lt;/p&gt;

&lt;p&gt;考虑到几个需求：自定义域名、发布简单，想想不想再折腾回 Jekyll，又想到 MWeb 支持直接发布到 Ghost，就打算折腾回 Ghost，但是又不想去搞什么 VPS 部署啥的，流量不大，就想起了 Heroku。&lt;/p&gt;

&lt;p&gt;虽然在海外，但是可以通过 CDN 加速解决一下访问问题，剩下的就是怎么部署还要解决存储问题，折腾了一轮，输出点踩过点坑和经验吧。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;博客地址：http://view.yourtion.com&lt;/li&gt;
  &lt;li&gt;项目 GitHub：https://github.com/yourtion/ghost-on-heroku&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;假设你已经有 Heroku 账号并了解一些基本的操作，如果不懂的话可能你就不需要往下看了。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;有条件的绑定个信用卡以提升 Free Dyno Hours，详见 &lt;a href=&quot;https://devcenter.heroku.com/articles/free-dyno-hours#usage&quot;&gt;free-dyno-hours&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;初始化并添加相关服务&quot;&gt;初始化并添加相关服务&lt;/h2&gt;

&lt;p&gt;在 Heroku 上“Create New App”，设置好应用名等东西后，添加 “JawsDB MySQL” 和 “Mailgun” 两个服务。如下图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2020/02/deploy-ghost-3-on-heroku-1.jpg&quot;&gt;&lt;img src=&quot;/images/2020/02/deploy-ghost-3-on-heroku-1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;因为 Heroku 对于环境每次部署都会初始化，所以 Ghost 需要通过 MySQL 保存应用的数据，同时使用 Mailgun 进行邮件发送。&lt;/p&gt;

&lt;p&gt;因为 “JawsDB MySQL” 有 5M 的容量大小限制，如果你的博客非常大可能就要考虑付费或者使用其他 MySQL 了，我的博客相对内容比较少，初期评估 5M 基本还是够用的。&lt;/p&gt;

&lt;h2 id=&quot;环境变量配置&quot;&gt;环境变量配置&lt;/h2&gt;

&lt;p&gt;配置完服务后，需要在 Heroku 的“Settings”的“Config Vars”中配置下面的环境变量。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2020/02/deploy-ghost-3-on-heroku-2.jpg&quot;&gt;&lt;img src=&quot;/images/2020/02/deploy-ghost-3-on-heroku-2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;APP_PUBLIC_URL&lt;/code&gt;：对外访问 Ghost 的地址（如果没有绑定自定义域名，就用 Heroku 的地址）&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;QN_BUCKET&lt;/code&gt;：七牛的 bucket&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;QN_DOMAIN&lt;/code&gt;：七牛的 CDN 地址（http://cdn.view.yourtion.com）&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;QN_KEY&lt;/code&gt;：七牛的 AccessKey&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;QN_SEC&lt;/code&gt;：七牛的 SecretKey&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;配置文件生成&quot;&gt;配置文件生成&lt;/h2&gt;

&lt;p&gt;因为 Ghost 的配置文件中，有很多配置依赖于运行的环境变量，但是新版本的 Ghost 好像已经不支持使用 js 文件作为配置文件，所以只能在项目根目录下新建&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.profile&lt;/code&gt;文件，让 Heroku 在启动前帮我们生成需要的配置文件。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.profile&lt;/code&gt;内容很简单：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bin/create-config&lt;/code&gt;，也就是执行&lt;a href=&quot;https://github.com/yourtion/ghost-on-heroku/blob/master/bin/create-config&quot;&gt;create-config&lt;/a&gt;这个脚本。&lt;/p&gt;

&lt;h2 id=&quot;拷贝主题文件&quot;&gt;拷贝主题文件&lt;/h2&gt;

&lt;p&gt;同时在构建镜像时候，需要通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postinstall&lt;/code&gt;执行&lt;a href=&quot;https://github.com/yourtion/ghost-on-heroku/blob/master/bin/copy-themes.sh&quot;&gt;copy-themes.sh&lt;/a&gt;，将主题文件拷贝到对应的目录，否则会找不到主题文件。&lt;/p&gt;

&lt;h2 id=&quot;使用七牛做为文件存储&quot;&gt;使用七牛做为文件存储&lt;/h2&gt;

&lt;p&gt;测试了一轮，找到一个比较可用的七牛存储适配器，其他的适配器好像有些老，执行总是不正常，但是因为 Heroku 在海外，从服务器端调用七牛云存储还是有些慢的（有时候要 20s 才能上传完成），要有点耐心。&lt;/p&gt;

&lt;p&gt;同时需要把适配器链接到：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;content/adapters/storage/qiniu&lt;/code&gt;（详见：目录结构）&lt;/p&gt;

&lt;p&gt;最后记得去七牛申请 bucket，让获取相关的信息，配置在环境变量上。（详见：环境变量配置）&lt;/p&gt;

&lt;h2 id=&quot;部署&quot;&gt;部署&lt;/h2&gt;

&lt;p&gt;最后只要把项目 push 上 Heroku 就可以了。类似这样：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git push heroku master&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;然后就可以访问你的项目了。&lt;/p&gt;

&lt;p&gt;或者你也可以克隆我的项目，修改修改，推到你的 Heroku 上。&lt;/p&gt;

&lt;h2 id=&quot;项目目录结构&quot;&gt;项目目录结构&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&quot;language-tree&quot;&gt;├── .gitignore
├── .profile            // 启动前触发生成配置
├── Procfile            // 启动脚本
├── bin
│   ├── copy-themes.sh  // 拷贝主题
│   └── create-config   // 根据环境变量生成配置
├── config.development.json     //开发配置
├── content             // 默认content文件夹（必须有）
│   ├── adapters
│   │   └── storage     // 七牛存储适配器
│   │       └── qiniu -&amp;gt; ../../../node_modules/qiniu-store/
│   ├── data            // 默认数据文件夹（必须有）
│   │   └── .gitkeep
│   └── themes          // 默认主题文件夹（必须有）
│       └── .gitkeep
├── package.json
└── server.js           // 启动脚本
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;参考&quot;&gt;参考&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;https://github.com/snathjr/ghost-on-heroku&lt;/li&gt;
  &lt;li&gt;https://b.log.ci/host-ghost-on-heroku/&lt;/li&gt;
&lt;/ul&gt;
</content>
                 <tag>Heroku</tag> 
                 <tag>Node.js</tag> 
                <pubTime>2020-02-28T16:06:50+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/2020-blog-change-new-theme.html</loc>
        <lastmod>2020-02-24T11:55:09+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>2020为博客更换新主题</title>
                <content>
&lt;p&gt;为博客更换一个新主题的计划其实已经想了很久，从去年就有这样的想法，趁着这个假期一直宅在家，就索性开干了。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2020/02/2020-blog-change-new-theme-1.jpg&quot;&gt;&lt;img src=&quot;/images/2020/02/2020-blog-change-new-theme-1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;之前的主题是自己从几个模版里面参考了好几个部分，然后自己使用Bootstrap拼凑起来的，虽然感觉自己写的比较特别，但因为自己审美不行，前端水平也菜，所以一直觉得博客不够好，所以这次就不献丑了。&lt;/p&gt;

&lt;p&gt;首先是选择一个比较简洁的基础模版，找了一圈，确定了使用 @artemsheludko 的 &lt;a href=&quot;https://github.com/artemsheludko/flexible-jekyll&quot;&gt;flexible-jekyll&lt;/a&gt; ，简洁明了，同时有移动端自动适应，整体比较符合我的需求，所以就打算基于这个主题进行改造。&lt;/p&gt;

&lt;h2 id=&quot;主要改造内容&quot;&gt;主要改造内容&lt;/h2&gt;

&lt;p&gt;首先是更新了一下主题依赖的normalize，主要是考虑到兼容性等问题。其次是把原来示例中的图片和文章之类的删除，清理了一些文件等内容，这样基本的布局什么都完成。&lt;/p&gt;

&lt;p&gt;因为之前的博客文档都有一个``的头，用于处理文档中的变量等内容，所以这次依然还是需要将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JB&lt;/code&gt;相关目录和文件更新上，虽然不再使用“Jekyll Bootstrap API”，但是为了减少改动，同时保证之前博文中关于图片的处理也正常。&lt;/p&gt;

&lt;p&gt;最后是根据之前的经验和套路，添加了博客统计相关的代码，修改了文件头中关于博客描述的内容，还有就是根据需求，汉化了部分的主题中的表述。&lt;/p&gt;

&lt;p&gt;至此，主题的更新就基本完成，重新导入之前的文章，修复一些问题，改造基本完成。&lt;/p&gt;

&lt;h2 id=&quot;文章头图处理&quot;&gt;文章头图处理&lt;/h2&gt;

&lt;p&gt;在一个博客页面，特别是主页，如果都是文字，没有一些图片点缀，看起来就非常单调，但是作为一个技术博客，确实也比较难每次都去找一个头图，思考了一番，觉得使用一个比较取巧的方法。&lt;/p&gt;

&lt;p&gt;使用文章的主题目录或者标签作为文章的头图，用于展示，因为我写的博客内容比较杂，所以应该也不会特别重复。&lt;/p&gt;

&lt;p&gt;首先收集并处理好一批图片，放置在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;assets/img/head&lt;/code&gt;下，然后在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_data/images.yaml&lt;/code&gt;中按照 Key-Value 的形式，放置目录和标签对应的图片路径。&lt;/p&gt;

&lt;p&gt;其次修改模版内容，在首页获取头图部分的，添加相应代码，详见：&lt;a href=&quot;https://github.com/yourtion/yourtion.github.io/blob/c8f04a2f15901bdb43980e7bbfadd9dc04ee5e99/_includes/head_meta.html&quot;&gt;index_image.html&lt;/a&gt; 。处理逻辑如下：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;如果有头图使用头图&lt;/li&gt;
  &lt;li&gt;尝试使用 category 对应的图片作为头图&lt;/li&gt;
  &lt;li&gt;尝试使用 tags 对应的图片作为头图&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;至此，就完成了对文章头图的添加。&lt;/p&gt;

&lt;h2 id=&quot;添加lightbox等细节&quot;&gt;添加LightBox等细节&lt;/h2&gt;

&lt;p&gt;还有最后的需要处理的一点细节，那就是文章中的图片LightBox效果还有一些链接的处理，具体内容详见：&lt;a href=&quot;https://github.com/yourtion/yourtion.github.io/blob/c8f04a2f15901bdb43980e7bbfadd9dc04ee5e99/_includes/js_post.html&quot;&gt;_includes/js_post.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;大概的逻辑包括几块：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;处理文章中的链接，如果不是自己的域名链接，添加“nofollow”和“_blank”&lt;/li&gt;
  &lt;li&gt;处理文章中的图片，添加“data-lightbox”和“data-title”，用于LightBox识别&lt;/li&gt;
  &lt;li&gt;针对表格，添加“table table-hover”的类&lt;/li&gt;
  &lt;li&gt;如果文章中有图片，动态引入LightBox的css和js文件&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;总结&quot;&gt;总结&lt;/h2&gt;

&lt;p&gt;至此，博客主题更新就基本完成，还有更多细节就看具体代码吧。&lt;/p&gt;
</content>
                 <tag>Jekyll</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2020-02-24T11:55:09+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-06.html</loc>
        <lastmod>2020-02-23T15:48:28+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 06</title>
                <content>
&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;更多地审题并认真确认题目中隐含的条件&lt;/li&gt;
  &lt;li&gt;更多实践二分法解题，准确把握判断条件和赋值&lt;/li&gt;
  &lt;li&gt;对于数组问题，多考虑双指针解法&lt;/li&gt;
  &lt;li&gt;要仔细看清楚题目的要求和限制&lt;/li&gt;
  &lt;li&gt;注意一道题目的多种解题方法&lt;/li&gt;
  &lt;li&gt;可以通过出现调用函数并颠倒参数顺序实现对特定参数的依赖（如长短）&lt;/li&gt;
  &lt;li&gt;可以使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;new int[26]&lt;/code&gt;替代Map&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;二进制求和&quot;&gt;二进制求和&lt;/h3&gt;

&lt;p&gt;计算二进制值相加： 5—101，7—111&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;第一步：相加各位的值，不算进位，得到010，二进制每位相加就相当于各位做异或操作，101^111。&lt;/li&gt;
  &lt;li&gt;第二步：计算进位值，得到1010，相当于各位进行与操作得到101，再向左移一位得到1010，(101&amp;amp;111)«1。&lt;/li&gt;
  &lt;li&gt;第三步重复上述两步，各位相加 010^1010=1000，进位值为100=(010 &amp;amp; 1010)«1。&lt;/li&gt;
  &lt;li&gt;继续重复上述两步：1000^100 = 1100，进位值为0，跳出循环，1100为最终结果。&lt;/li&gt;
  &lt;li&gt;结束条件：进位为0，即a为最终的求和结果。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;263-丑数&quot;&gt;263. 丑数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/ugly-number/&quot;&gt;https://leetcode-cn.com/problems/ugly-number/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;根据题目描述，在输入能被5整除的情况下不断除5，3和2同理，最后如果为1则证明能被2、3、5整除&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47721163/&quot;&gt;https://leetcode-cn.com/submissions/detail/47721163/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;解题方法于大家的题解基本一致&lt;/p&gt;

&lt;h2 id=&quot;268-缺失数字&quot;&gt;268. 缺失数字&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/missing-number/&quot;&gt;https://leetcode-cn.com/problems/missing-number/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;思路上比较简单，就是循环一遍，找到最大值，同时用异或计算，最后再用所以应该有的整数异或一次，求出结果。&lt;/p&gt;

&lt;p&gt;第一次解题还忘了最大数就是缺失的情况。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47722646/&quot;&gt;https://leetcode-cn.com/submissions/detail/47722646/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了官方题解，位运算的方法根本没有必要那么麻烦，只需要一开始将最大值假定为missing，然后循环执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;missing ^= i ^ nums[i];&lt;/code&gt;即可，没有那么复杂的逻辑。同时我那个计算max也是多此一举的。&lt;/p&gt;

&lt;p&gt;还有更为巧妙的是数学公式法，先算出应该有的和后减去现在数组元素，即可得到结果&lt;/p&gt;

&lt;h2 id=&quot;278-第一个错误的版本&quot;&gt;278. 第一个错误的版本&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/first-bad-version/&quot;&gt;https://leetcode-cn.com/problems/first-bad-version/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始就想到使用二分查找，重新梳理了一下思路和逻辑，总算写出了应该正确的版本。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47724236/&quot;&gt;https://leetcode-cn.com/submissions/detail/47724236/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了官方题解的二分法解答，感觉自己写的二分查找依然不够完整，正确的应该是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;right = mid&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;left = mid + 1&lt;/code&gt;，不需要再去判断什么最后结果&lt;/p&gt;

&lt;h2 id=&quot;283-移动零&quot;&gt;283. 移动零&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/move-zeroes/&quot;&gt;https://leetcode-cn.com/problems/move-zeroes/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;考虑到要把0移动到最后，所以决定从后向前移动，遇到0就不断交换位置移动到最后面，解题时间好像有些长，没想到更加少移动方式到套路。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47903543/&quot;&gt;https://leetcode-cn.com/submissions/detail/47903543/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解非常巧妙，使用双指针法，当遇到一个非零元素时，交换当前指针和慢速指针指向的元素，然后前进两个指针。如果它是零元素，我们只前进当前指针。&lt;/p&gt;

&lt;h2 id=&quot;290-单词规律&quot;&gt;290. 单词规律&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/word-pattern/&quot;&gt;https://leetcode-cn.com/problems/word-pattern/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过HashMap记录字母对应的单词，如果单词不对应或者一个单词对应多个字母都返回false&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47905865/&quot;&gt;https://leetcode-cn.com/submissions/detail/47905865/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟题解中大家的解法类似&lt;/p&gt;

&lt;h2 id=&quot;292-nim-游戏&quot;&gt;292. Nim 游戏&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/nim-game/&quot;&gt;https://leetcode-cn.com/problems/nim-game/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;梳理了一下题目的情况，只要数量n不能被4整除，就可以保证赢&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47906413/&quot;&gt;https://leetcode-cn.com/submissions/detail/47906413/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方题解一致&lt;/p&gt;

&lt;h2 id=&quot;299-猜数字游戏&quot;&gt;299. 猜数字游戏&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/bulls-and-cows/&quot;&gt;https://leetcode-cn.com/problems/bulls-and-cows/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;首先假设猜中Bulls为0，全部猜中Cows，&lt;/li&gt;
  &lt;li&gt;遍历两个字符串，如果位置和数字都一致，Bulls++、Cows–，同时记录字母情况在table上&lt;/li&gt;
  &lt;li&gt;遍历table，只要table上有正数，就是没有猜中Cows&lt;/li&gt;
  &lt;li&gt;输出结果&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;注：因为如果猜中位置和数字，在table上值会抵消，如果没有猜中Cows，对应的位即为负值&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48171063/&quot;&gt;https://leetcode-cn.com/submissions/detail/48171063/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟题解中的解法基本思路一致&lt;/p&gt;

&lt;h2 id=&quot;303-区域和检索---数组不可变&quot;&gt;303. 区域和检索 - 数组不可变&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/range-sum-query-immutable/&quot;&gt;https://leetcode-cn.com/problems/range-sum-query-immutable/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;感觉题目很简单，就是记录数组，然后输出结果，但是提交后跑出来的结果很差&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48176901/&quot;&gt;https://leetcode-cn.com/submissions/detail/48176901/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了题解才明白，题目的重点的怎么优化会“多次调用 sumRange 方法”这个点，正确的方式映射在初始化时候计算好sum数组，在调用时候直接返回结果（重点在缓存与如何优化缓存上）&lt;/p&gt;

&lt;h2 id=&quot;326-3的幂&quot;&gt;326. 3的幂&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/power-of-three/&quot;&gt;https://leetcode-cn.com/problems/power-of-three/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;还是使用暴力解法解答的，只是参考了之前“2的幂”中题解的代码，对比了二进制位，没有想到解题思路，只能暴力解答。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48171936/&quot;&gt;https://leetcode-cn.com/submissions/detail/48171936/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解里面提到了三种解法：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;基准转换，只要把数字转换为以三为底的数，并判断是否1开头，后面为0即可：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Integer.toString(n, 3).matches(&quot;^10*$&quot;)&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;使用数学公式（类似于）：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(Math.log10(n) / Math.log10(3)) % 1 == 0&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;利用整数限制，整数范围内最大为3的19次幂，算出来是“1162261467”，最后只要返回&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n &amp;gt; 0 &amp;amp;&amp;amp; 1162261467 % n == 0&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;342-4的幂&quot;&gt;342. 4的幂&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/power-of-four/&quot;&gt;https://leetcode-cn.com/problems/power-of-four/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过“3的幂”，决定使用最简单暴力的方法，先穷举出32位整数内所有结果，直接返回&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48342287/&quot;&gt;https://leetcode-cn.com/submissions/detail/48342287/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解又要新方案：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;不用硬编码，先在init的时候预计算结果，比起硬编码更加优雅&lt;/li&gt;
  &lt;li&gt;通过数学运算：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(num &amp;gt; 0) &amp;amp;&amp;amp; (Math.log(num) / Math.log(2) % 2 == 0)&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;位运算：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(num &amp;gt; 0) &amp;amp;&amp;amp; ((num &amp;amp; (num - 1)) == 0) &amp;amp;&amp;amp; ((num &amp;amp; 0xaaaaaaaa) == 0)&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;位运算+数学运算：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(num &amp;gt; 0) &amp;amp;&amp;amp; ((num &amp;amp; (num - 1)) == 0) &amp;amp;&amp;amp; (num % 3 == 1)&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;344-反转字符串&quot;&gt;344. 反转字符串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/reverse-string/&quot;&gt;https://leetcode-cn.com/problems/reverse-string/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用双指针，从头到尾和从尾到头，如果char不一样则交换。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48344838/&quot;&gt;https://leetcode-cn.com/submissions/detail/48344838/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法基本一致，官方使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;left++&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;right--&lt;/code&gt;，更为优雅&lt;/p&gt;

&lt;h2 id=&quot;345-反转字符串中的元音字母&quot;&gt;345. 反转字符串中的元音字母&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/reverse-vowels-of-a-string/&quot;&gt;https://leetcode-cn.com/problems/reverse-vowels-of-a-string/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始没有很好理解到题目，后面跑测试失败，重新审题发现问题，参考“反转字符串”使用双指针解题&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48367912/&quot;&gt;https://leetcode-cn.com/submissions/detail/48367912/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;其他人的解法中，在循环内直接使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;while (left &amp;lt; right &amp;amp;&amp;amp; !isVowel(arr[left]))&lt;/code&gt;可以减少外层循环的次数&lt;/p&gt;

&lt;h2 id=&quot;349-两个数组的交集&quot;&gt;349. 两个数组的交集&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/intersection-of-two-arrays/&quot;&gt;https://leetcode-cn.com/problems/intersection-of-two-arrays/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过两个集合，记录出现过的数字，如果已经出现，就添加到结果Set中&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48479316/&quot;&gt;https://leetcode-cn.com/submissions/detail/48479316/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法一跟我的解法基本一致，而且还有一个使用内部函数&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set1.retainAll(set2)&lt;/code&gt;的方法，确实简洁很多&lt;/p&gt;

&lt;h2 id=&quot;350-两个数组的交集-ii&quot;&gt;350. 两个数组的交集 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/intersection-of-two-arrays-ii/&quot;&gt;https://leetcode-cn.com/problems/intersection-of-two-arrays-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用一个HashMap记录数字的出现次数，然后遍历另外一个数组，找到就次数减1并记录到数组，最后输出&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48481283/&quot;&gt;https://leetcode-cn.com/submissions/detail/48481283/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方第一个解法跟我的基本一致，还添加了处理长短数组的方法。还讲到可以通过排序法处理，也是一个很不错的方法，不需要额外空间，原地排序和比对&lt;/p&gt;

&lt;h2 id=&quot;367-有效的完全平方数&quot;&gt;367. 有效的完全平方数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/valid-perfect-square/&quot;&gt;https://leetcode-cn.com/problems/valid-perfect-square/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;本来是使用暴力解法，但是时间超出了限制，没想到别的方法，只能去找了牛顿法相关的参数，完成了题目&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48545129/&quot;&gt;https://leetcode-cn.com/submissions/detail/48545129/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解中提到二分法和牛顿法，主要都是减少查找次数，牛顿法迭代计算&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x = (x + num / x) / 2&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;371-两整数之和&quot;&gt;371. 两整数之和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/sum-of-two-integers/&quot;&gt;https://leetcode-cn.com/problems/sum-of-two-integers/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;大概知道需要用位运算解题，但不是很熟悉，直接用函数糊弄过去。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48676433/&quot;&gt;https://leetcode-cn.com/submissions/detail/48676433/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;通过二进制的异或和与运算完成求和&lt;/p&gt;

&lt;h2 id=&quot;374-猜数字大小&quot;&gt;374. 猜数字大小&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/guess-number-higher-or-lower/&quot;&gt;https://leetcode-cn.com/problems/guess-number-higher-or-lower/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;还是简单的使用二分法，但是感觉结果不怎样&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48777799/&quot;&gt;https://leetcode-cn.com/submissions/detail/48777799/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方题解的二分法差不多，官方题解还有三分法，但最坏情况下比二分法差&lt;/p&gt;

&lt;h2 id=&quot;383-赎金信&quot;&gt;383. 赎金信&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/ransom-note/&quot;&gt;https://leetcode-cn.com/problems/ransom-note/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;想法比较简单，就是把 magazine 放到Map中并计数，最后比对需要得到的结果，从map中不断取值&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48779165/&quot;&gt;https://leetcode-cn.com/submissions/detail/48779165/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了一下解法中的比较快的方法，通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;new int[26]&lt;/code&gt;保存字母位置，然后通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;magazine.indexOf&lt;/code&gt;不断向后取值，性能更好，而且空间需求也少&lt;/p&gt;

&lt;h2 id=&quot;387-字符串中的第一个唯一字符&quot;&gt;387. 字符串中的第一个唯一字符&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/first-unique-character-in-a-string/&quot;&gt;https://leetcode-cn.com/problems/first-unique-character-in-a-string/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;思路相对比较简单，只要这个字符没有出现过，同时后面不再出现，即可判断这个是唯一的&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48906493/&quot;&gt;https://leetcode-cn.com/submissions/detail/48906493/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方的题解思路类似&lt;/p&gt;

&lt;h2 id=&quot;389-找不同&quot;&gt;389. 找不同&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/find-the-difference/&quot;&gt;https://leetcode-cn.com/problems/find-the-difference/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;通过对一个计数表进行操作，一个++一个–，最后得到-1的那个位置的字符便是结果&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48902867/&quot;&gt;https://leetcode-cn.com/submissions/detail/48902867/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看到一个解法非常巧妙，直接对一个整数进行操作即可&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;res += tt[i] - ss[i]&lt;/code&gt;，不需要使用计数表&lt;/p&gt;

&lt;h2 id=&quot;392-判断子序列&quot;&gt;392. 判断子序列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/is-subsequence/&quot;&gt;https://leetcode-cn.com/problems/is-subsequence/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-20&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;这个解法主要是对后续挑战中大规模比对进行的，首先在初始化时讲T系列通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getSourceMap&lt;/code&gt;转换为一个表（字母：字母在T中位置列表）。&lt;/p&gt;

&lt;p&gt;执行判断时，根据当前字母和当前位置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index&lt;/code&gt;，在map中查找大于index的该字母的位置，能找到就继续，否则返回&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;false&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getIndex&lt;/code&gt;还有两个优化点：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;使用二分查找法进一步提升查找性能&lt;/li&gt;
  &lt;li&gt;通过一个位置记录表，记录某个字母现在已经查找过的位置，加速二分查找过程&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/48908020/&quot;&gt;https://leetcode-cn.com/submissions/detail/48908020/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;比较快的解法就说通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;t.indexOf&lt;/code&gt;进行查找，跟我之前的思路类似&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-02-23T15:48:28+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-05.html</loc>
        <lastmod>2020-02-16T10:37:28+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 05</title>
                <content>
&lt;h1 id=&quot;leetcode-手记-05&quot;&gt;LeetCode 手记 05&lt;/h1&gt;

&lt;h2 id=&quot;本周收获&quot;&gt;本周收获&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;【SQL】自身联表执行内容删除&lt;/li&gt;
  &lt;li&gt;【SQL】使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DATEDIFF()&lt;/code&gt;函数辅助&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JOIN&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;进一步梳理学习动态规划相关的内容&lt;/li&gt;
  &lt;li&gt;可以使用伪节点或者哨兵节点简化操作&lt;/li&gt;
  &lt;li&gt;使用厄拉多塞筛法进行质数计算&lt;/li&gt;
  &lt;li&gt;没有必要做计数或者其他数据保存可以直接使用 Set&lt;/li&gt;
  &lt;li&gt;尽可能不要使用暴力法，可能的情况下通过空间换时间（特别是差异大的情况下）&lt;/li&gt;
  &lt;li&gt;了解关于 2 的 n 次幂的位运算&lt;/li&gt;
  &lt;li&gt;在已知特定长度列表的情况下，使用计数器表（&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;new int[26]&lt;/code&gt;）而不是 HashMap&lt;/li&gt;
  &lt;li&gt;对于题目和测试条件要更多的把握边界情况&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;196-删除重复的电子邮箱&quot;&gt;196. 删除重复的电子邮箱&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/delete-duplicate-emails/&quot;&gt;https://leetcode-cn.com/problems/delete-duplicate-emails/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;之前的想法是通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delete&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;where in&lt;/code&gt;的方法，但是发现子查询不能包含当前表，查了一下文档，发现要通过联表再通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;where&lt;/code&gt;删除。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46547020/&quot;&gt;https://leetcode-cn.com/submissions/detail/46547020/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方的题解解法一致，如果要通过 select 查询的话，需要保存到另外一个临时表上&lt;/p&gt;

&lt;h2 id=&quot;197-上升的温度&quot;&gt;197. 上升的温度&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/rising-temperature/&quot;&gt;https://leetcode-cn.com/problems/rising-temperature/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的想法就通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;join&lt;/code&gt;自己然后进行比较，但是一开始使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;id&lt;/code&gt;进行，但是结果发现测试用例并不是按照 id 排序的。看了题解才发现可以通过 DATEDIFF()来进行。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46606247/&quot;&gt;https://leetcode-cn.com/submissions/detail/46606247/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用函数协助 Join&lt;/p&gt;

&lt;h2 id=&quot;198-打家劫舍&quot;&gt;198. 打家劫舍&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/house-robber/&quot;&gt;https://leetcode-cn.com/problems/house-robber/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-2&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始觉得很简单，就是从 0 开始抢还是从 1 开始抢的问题，但是发现不是那么简单，因为可能还存在跨多个房屋的情况，后来看了题解，发现还是要用动态规划。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46670365/&quot;&gt;https://leetcode-cn.com/submissions/detail/46670365/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;通过动态规划，计算：“抢第三个房子，将数额与第一个房子相加。不抢第三个房子，保持现有最大数额。”两种情况的最大值&lt;/p&gt;

&lt;h2 id=&quot;202-快乐数&quot;&gt;202. 快乐数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/happy-number/&quot;&gt;https://leetcode-cn.com/problems/happy-number/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-3&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;使用递归与循环，10 以外的数最终会被转换成 10 以内的，10 以内的数除了 1 和 7，其他都为 false&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46694710/&quot;&gt;https://leetcode-cn.com/submissions/detail/46694710/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;题解中的方法都是通过快慢指针的形式避免陷入死循环，比起我写死判断条件更为优雅，虽然计算量可能会稍大一些&lt;/p&gt;

&lt;h2 id=&quot;203-移除链表元素&quot;&gt;203. 移除链表元素&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/remove-linked-list-elements/&quot;&gt;https://leetcode-cn.com/problems/remove-linked-list-elements/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-4&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法思路还是比较简单的，对于中间的节点通过循环删除，对于头节点，则通过递归方式进行删除。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46697675/&quot;&gt;https://leetcode-cn.com/submissions/detail/46697675/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解使用哨兵节点将被用于伪头，简化了整个操作的流程&lt;/p&gt;

&lt;h2 id=&quot;204-计数质数&quot;&gt;204. 计数质数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/count-primes/&quot;&gt;https://leetcode-cn.com/problems/count-primes/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-5&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的思路很简单，就是使用暴力法计算是否是质数，然后累加结果，但是提交后发现超时了，看了题解优化了质数计算的循环位&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;for (int i = 2; i * i &amp;lt;= n; i++)&lt;/code&gt;，但是计算结果还是超时，只能使用质数筛法&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46854603/&quot;&gt;https://leetcode-cn.com/submissions/detail/46854603/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;通过暴力的解法因为时间太长基本都会超时，使用厄拉多塞筛，简单的逻辑就是找到一个质数，那么他的倍数就都不可能是质数了。在这个基础上仔进行内存和计算的优化&lt;/p&gt;

&lt;h2 id=&quot;205-同构字符串&quot;&gt;205. 同构字符串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/isomorphic-strings/&quot;&gt;https://leetcode-cn.com/problems/isomorphic-strings/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-6&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的思路比较简单清晰，首先计算两个字符串每位的差，然后判断跟之前的结果是否一致，同时是否存在重复映射的问题。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46855193/&quot;&gt;https://leetcode-cn.com/submissions/detail/46855193/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;网友解法中确实提到了一个很简单的解法：只需要判断“同一个位置的字符在本串中第一次出现的位置相同”，后来发现确实如此，相当简洁明了&lt;/p&gt;

&lt;h2 id=&quot;206-反转链表&quot;&gt;206. 反转链表&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/reverse-linked-list/&quot;&gt;https://leetcode-cn.com/problems/reverse-linked-list/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-7&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法使用循环来做，保留前一个节点和下一个节点，循环地将当前节点的 next 指向上一个节点即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46855033/&quot;&gt;https://leetcode-cn.com/submissions/detail/46855033/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;虽然解法通过了，但是总是感觉解法很不优雅，需要保留三个临时变量，看了官方的迭代解法也是如此。递归的话需要更多栈空间，还是迭代更简单&lt;/p&gt;

&lt;h2 id=&quot;217-存在重复元素&quot;&gt;217. 存在重复元素&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/contains-duplicate/&quot;&gt;https://leetcode-cn.com/problems/contains-duplicate/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-8&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;思路比较简单，有之前题目的经验，直接使用一个 HashMap 保存遇到的整数，如果已经存在就返回即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47001381/&quot;&gt;https://leetcode-cn.com/submissions/detail/47001381/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了一下官方题解，方法类似，只是用 HashSet，明白了确实没有用 Map 的必要&lt;/p&gt;

&lt;h2 id=&quot;219-存在重复元素-ii&quot;&gt;219. 存在重复元素 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/contains-duplicate-ii/&quot;&gt;https://leetcode-cn.com/problems/contains-duplicate-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-9&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;这个的想法跟之前的有不一样，觉得有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k&lt;/code&gt;的存在，不需要 HashMap 了，直接暴力穷尽即可，当然效果不是很理想&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47001458/&quot;&gt;https://leetcode-cn.com/submissions/detail/47001458/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了官方题解才发现用暴力法是会超时的，可能是我运气好吧，正确的方法还是要用 HashSet，并在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;size()&amp;gt;k&lt;/code&gt;的时候执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set.remove(nums[i - k])&lt;/code&gt;，才是正道&lt;/p&gt;

&lt;h2 id=&quot;225-用队列实现栈&quot;&gt;225. 用队列实现栈&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/implement-stack-using-queues/&quot;&gt;https://leetcode-cn.com/problems/implement-stack-using-queues/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-10&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;因为栈和队列不一样，一开始在 push 的时候使用一个临时队列来保存，后来想到使用两个队列，轮流倒数据的方法，感觉整体还是比较简洁的&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47001540/&quot;&gt;https://leetcode-cn.com/submissions/detail/47001540/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;在官方题解中发现一个更加牛的操作，跟我用两个队列方式一样，但是直接用一个队列，并且使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;q1.add(q1.remove())&lt;/code&gt;这样的操作完成队列倒序&lt;/p&gt;

&lt;h2 id=&quot;226-翻转二叉树&quot;&gt;226. 翻转二叉树&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/invert-binary-tree/&quot;&gt;https://leetcode-cn.com/problems/invert-binary-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-11&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解题思路比较简单，直接递归转换每个子树的左右即可&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47222494/&quot;&gt;https://leetcode-cn.com/submissions/detail/47222494/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解也有基于深度优先搜索（Breadth-fist Search, BFS）推入队列后循环的解法&lt;/p&gt;

&lt;h2 id=&quot;231-2-的幂&quot;&gt;231. 2 的幂&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/power-of-two/&quot;&gt;https://leetcode-cn.com/problems/power-of-two/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-12&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始的想法是从 2 开始向上乘，但是发现这样会解答超时，后来只能转换思路，把输入不断向下除 2 并判断是否是奇数。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47224067/&quot;&gt;https://leetcode-cn.com/submissions/detail/47224067/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解答中除了我这种解法（而且写得非常简单优雅）外，还有基于位运算的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(x &amp;amp; (-x)) == x&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(x &amp;amp; (x - 1)) == 0&lt;/code&gt;解答方法。&lt;/p&gt;

&lt;h2 id=&quot;232-用栈实现队列&quot;&gt;232. 用栈实现队列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/implement-queue-using-stacks/&quot;&gt;https://leetcode-cn.com/problems/implement-queue-using-stacks/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-13&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解题思路跟之前使用队列实现栈类似，但是不需要护换栈，只需要一个临时的栈用于倒数据&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47224795/&quot;&gt;https://leetcode-cn.com/submissions/detail/47224795/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;感觉跟官方的解法类似，但是官方还保存了队首的元素，感觉好像没什么必要&lt;/p&gt;

&lt;h2 id=&quot;234-回文链表&quot;&gt;234. 回文链表&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/palindrome-linked-list/&quot;&gt;https://leetcode-cn.com/problems/palindrome-linked-list/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-14&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始有思考怎么在 O(n) 时间复杂度和 O(1) 空间复杂度解题，但是想出来的几个方案都被否决了，所以只能借助一个栈临时保存后半部分链表，然后 pop 出来比较。&lt;/p&gt;

&lt;p&gt;后来想到可以保存前半部分，跟后半部分比较，更加简单。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47351520/&quot;&gt;https://leetcode-cn.com/submissions/detail/47351520/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了官方的题解，递归确实非常简洁和巧妙，还有更加容易理解的是翻转后半部分链表，当时确实没有考虑到。&lt;/p&gt;

&lt;h2 id=&quot;235-二叉搜索树的最近公共祖先&quot;&gt;235. 二叉搜索树的最近公共祖先&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-search-tree/&quot;&gt;https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-search-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-15&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;思路相对比较简单， 首先从二叉搜索树性质可以知道左边值小于右边，所以只要找到夹在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;p&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;q&lt;/code&gt;中间的节点即可。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47351540/&quot;&gt;https://leetcode-cn.com/submissions/detail/47351540/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解的递归解法跟我类似，只是判断的条件有些差异。但是比较有意思的是迭代的解法，思路于递归一致，但是可能更好理解一些。&lt;/p&gt;

&lt;h2 id=&quot;237-删除链表中的节点&quot;&gt;237. 删除链表中的节点&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/delete-node-in-a-linked-list/&quot;&gt;https://leetcode-cn.com/problems/delete-node-in-a-linked-list/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-16&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;思路很简单，就是把当前节点的值跟下个节点交换&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47356966/&quot;&gt;https://leetcode-cn.com/submissions/detail/47356966/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方题解一致&lt;/p&gt;

&lt;h2 id=&quot;242-有效的字母异位词&quot;&gt;242. 有效的字母异位词&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/valid-anagram/&quot;&gt;https://leetcode-cn.com/problems/valid-anagram/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-17&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;依赖一个外部的 Map，然后两个字符串循环后按字母对 Map 中的元素去做加减，最后 Map 中都是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0&lt;/code&gt;则证明字母都相等。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47528023/&quot;&gt;https://leetcode-cn.com/submissions/detail/47528023/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法中还是有排序的解法，另外的跟我解法类似的使用了一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;new int[26]&lt;/code&gt;的计数器表（使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;table[s.charAt(i) - 'a']++&lt;/code&gt;操作），确实没有使用 Map 的必要的样子&lt;/p&gt;

&lt;h2 id=&quot;257-二叉树的所有路径&quot;&gt;257. 二叉树的所有路径&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/binary-tree-paths/&quot;&gt;https://leetcode-cn.com/problems/binary-tree-paths/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-18&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解法依然还是使用递归的方式，当遇到叶子节点的时候加入数组，否则将路径加上当前节点后递归调用。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47529127/&quot;&gt;https://leetcode-cn.com/submissions/detail/47529127/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法的递归方法跟我的类似，但没有使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StringBuilder&lt;/code&gt;，感觉好像也没有太大必要，使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StringBuilder&lt;/code&gt;反而增加了复杂度的样子。迭代的方法需要两个栈，感觉写起来有些复杂&lt;/p&gt;

&lt;h2 id=&quot;258-各位相加&quot;&gt;258. 各位相加&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/add-digits/&quot;&gt;https://leetcode-cn.com/problems/add-digits/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-19&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;一开始先使用了一个比较笨的办法，按照循环的逻辑写了一个版本，验证了正确性，同时输出了 1 到 100 的结果，发现了规律&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;num % 9&lt;/code&gt;，当余数是 0 的时候需要返回 9。但是在提交后发现了忘了考虑 0 的情况。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/47530139/&quot;&gt;https://leetcode-cn.com/submissions/detail/47530139/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;题解中还有一个人的解法更加巧妙，只需要一行即可，连三元判断都不需要&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(num - 1) % 9 + 1&lt;/code&gt;&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-02-16T10:37:28+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-04.html</loc>
        <lastmod>2020-02-09T13:12:28+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 04</title>
                <content>
&lt;h1 id=&quot;leetcode-手记-04&quot;&gt;LeetCode 手记 04&lt;/h1&gt;

&lt;h2 id=&quot;本周收获与反思&quot;&gt;本周收获与反思&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;多从整体的角度上思考，看看如何巧妙解答&lt;/li&gt;
  &lt;li&gt;通过画图帮忙扩展思路，找出一些突破点&lt;/li&gt;
  &lt;li&gt;深入了解 char 相关内容&lt;/li&gt;
  &lt;li&gt;深入了解熟悉位操作&lt;/li&gt;
  &lt;li&gt;需要更多地去分析理解题目中的内容&lt;/li&gt;
  &lt;li&gt;【SQL】需要了解临时表的使用&lt;/li&gt;
  &lt;li&gt;【SQL】熟悉 HAVING 的用法&lt;/li&gt;
  &lt;li&gt;深入了解和熟悉二进制数字和位运算&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;boyer-moore-算法&quot;&gt;Boyer-Moore 算法&lt;/h3&gt;

&lt;p&gt;Boyer-Moore 就是找&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nums&lt;/code&gt;的一个后缀&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;suf&lt;/code&gt;，其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;suf[0]&lt;/code&gt;就是后缀中的众数。&lt;/p&gt;

&lt;p&gt;我们维护一个计数器，如果遇到一个我们目前的候选众数，就将计数器加一，否则减一。只要计数器等于 0 ，我们就将 nums 中之前访问的数字全部 忘记 ，并把下一个数字当做候选的众数。&lt;/p&gt;

&lt;p&gt;我们可以放心地遗忘前面的数字，并继续求解剩下数字中的众数。最后，总有一个后缀满足计数器是大于 0 的，此时这个后缀的众数就是整个数组的众数。&lt;/p&gt;

&lt;h2 id=&quot;112-路径总和&quot;&gt;112. 路径总和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/path-sum/&quot;&gt;https://leetcode-cn.com/problems/path-sum/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;解题的思路还是比较简单的&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;判断当前节点为 null 就返回 false&lt;/li&gt;
  &lt;li&gt;如果 sum 已经是 0 并且是已经是叶子节点，则说明已经找到解，返回 true&lt;/li&gt;
  &lt;li&gt;其他情况则递归处理左右子树，同时将 sum 减去当前节点值&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/45468638/&quot;&gt;https://leetcode-cn.com/submissions/detail/45468638/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;解法跟官方题解的递归解法一致，官方提供的迭代解法还是不太能理解，感觉整体上也没有递归那么简洁与易理解，同时也没有性能上的优势。&lt;/p&gt;

&lt;h2 id=&quot;118-杨辉三角&quot;&gt;118. 杨辉三角&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/pascals-triangle/&quot;&gt;https://leetcode-cn.com/problems/pascals-triangle/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-1&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;通过简单的循环计算每行的元素，推入结果数组即可，其中：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;每行的第一个和最后一个元素是 1&lt;/li&gt;
  &lt;li&gt;其他元素等于上一行的当前 index-1 的值加上上一行的当前 index 的值&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/45478330/&quot;&gt;https://leetcode-cn.com/submissions/detail/45478330/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方题解的方法基本一致，但是感觉官方解法中的代码太过于啰嗦的感觉，不如我写的版本那么简单。&lt;/p&gt;

&lt;h2 id=&quot;119-杨辉三角-ii&quot;&gt;119. 杨辉三角 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/pascals-triangle-ii/&quot;&gt;https://leetcode-cn.com/problems/pascals-triangle-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-2&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;没有想到具体的数学解法，还是跟上面的方法类似，只是不需要保存整个数据，只需要保留上一层的数据用于计算。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/45481754/&quot;&gt;https://leetcode-cn.com/submissions/detail/45481754/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;公式法是把它看成一个组合数：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n!/(k!(n−k)!)=(n∗(n−1)∗(n−2)∗...(n−k+1))/k!&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;121-买卖股票的最佳时机&quot;&gt;121. 买卖股票的最佳时机&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/&quot;&gt;https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-3&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;一直陷在两次循环的套路里面，只是简单地想到去掉一些不必要的循环，还是暴力解题的思路&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/45615367/&quot;&gt;https://leetcode-cn.com/submissions/detail/45615367/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;其实有个最简单的方法，就是循环一遍，找出最小值后找出其后的最大值，也就是找到最小的谷之后的最大的峰。&lt;/p&gt;

&lt;h2 id=&quot;122-买卖股票的最佳时机-ii&quot;&gt;122. 买卖股票的最佳时机 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii/&quot;&gt;https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-4&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;解题的思路比较简单，通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;j&lt;/code&gt;两个指针进行循环：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;如果后面的值&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;j&lt;/code&gt;比当前买入价格&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt;还小，则 i 继续累加&lt;/li&gt;
  &lt;li&gt;如果当前值比之前的值小，那么就在上一次卖出，累计收益，同时把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt;买入指针置为当前位置&lt;/li&gt;
  &lt;li&gt;记得处理最后一个位置卖出的情况&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/45654435/&quot;&gt;https://leetcode-cn.com/submissions/detail/45654435/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了官方题解，我的方法使用了两次循环，跟题解的“峰谷法”类似。&lt;/p&gt;

&lt;p&gt;但是“方法三：简单的一次遍历”的方法非常巧妙，通过转换每次计算峰谷转换成连续峰和谷的高度之差，使用一次遍历就完成了。遇到类似的问题，可以通过画图帮忙扩展思路。&lt;/p&gt;

&lt;h2 id=&quot;125-验证回文串&quot;&gt;125. 验证回文串&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/valid-palindrome/&quot;&gt;https://leetcode-cn.com/problems/valid-palindrome/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-5&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt;两个指针&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;j&lt;/code&gt;，通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;charAt()&lt;/code&gt;原位比较：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Character.isLetterOrDigit&lt;/code&gt;判断字母和数字&lt;/li&gt;
  &lt;li&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Character.toLowerCase&lt;/code&gt;进行大小写转换&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/45675166/&quot;&gt;https://leetcode-cn.com/submissions/detail/45675166/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用了 java 类库而不是对 char 直接进行大小比较，可能会对性能有一定影响，但是在使用现成的类库比起自己造轮子更好呢？&lt;/p&gt;

&lt;h2 id=&quot;136-只出现一次的数字&quot;&gt;136. 只出现一次的数字&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/single-number/&quot;&gt;https://leetcode-cn.com/problems/single-number/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-6&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;解法相对比较暴力，没有使用额外的存储空间，需要循环整个数组多次，如果找到另外一个数字就把两个位置置为 0，直到整个数组处理完。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/45764062/&quot;&gt;https://leetcode-cn.com/submissions/detail/45764062/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;一直没有想到线性时间解决的方法（考虑过 hash 表，但是想到要额外的空间），大概有个思路，但是没想到位操作的方法，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a⊕b⊕a=(a⊕a)⊕b=0⊕b=b&lt;/code&gt;，其实只要循环一次，使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;res ^= num[i]&lt;/code&gt;即可。&lt;/p&gt;

&lt;p&gt;还有另外一个方法也值得学习&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2∗(a+b+c)−(a+a+b+b+c)=c&lt;/code&gt;，只要返回&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2 * sum(set(nums)) - sum(nums)&lt;/code&gt;，虽然需要多一倍多空间，但是也比暴力法好。&lt;/p&gt;

&lt;h2 id=&quot;141-环形链表&quot;&gt;141. 环形链表&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/linked-list-cycle/&quot;&gt;https://leetcode-cn.com/problems/linked-list-cycle/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-7&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;用来一个取巧的方法，其实准确来说可能还是错误的（只是样例测试不出来），将遍历过的节点设置为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Integer.MAX_VALUE&lt;/code&gt;，如果再遇到就认为有环。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/45844979/&quot;&gt;https://leetcode-cn.com/submissions/detail/45844979/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;其实正确的方法应该是使用快慢双指针法，通过快慢双指针的移动，快指针（两倍速）必然先到尾部，否则两个指针必然相遇。还一个使用 HashSet 的方法，之前也没考虑到。&lt;/p&gt;

&lt;h2 id=&quot;155-最小栈&quot;&gt;155. 最小栈&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/min-stack/&quot;&gt;https://leetcode-cn.com/problems/min-stack/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-8&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;思路还是比较简单，对于栈就还是使用 Java 提供的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Stack&lt;/code&gt;，主要考虑下面几个点：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;min&lt;/code&gt;保存当前最小值，使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;minCount&lt;/code&gt;保存当前最小值有几个&lt;/li&gt;
  &lt;li&gt;因为有可能有多个最小值，需要保证最小值被&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pop&lt;/code&gt;后不需要重新计算一次&lt;/li&gt;
  &lt;li&gt;当最小值都被&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pop&lt;/code&gt;了，需要重新计算一次最小值和数量&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/45852682/&quot;&gt;https://leetcode-cn.com/submissions/detail/45852682/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;可能更加好的一个实现是通过一个两个值（当前值，当前最小值）的链表（或者两个栈）来保存，虽然牺牲了一些存储空间，但是性能也要更强（通过空间换时间）。&lt;/p&gt;

&lt;h2 id=&quot;160-相交链表&quot;&gt;160. 相交链表&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/intersection-of-two-linked-lists/&quot;&gt;https://leetcode-cn.com/problems/intersection-of-two-linked-lists/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-9&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;首先想出了最暴力最简单的写法，同时也是验证一下测试样例和方法的正确性，性能很差。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/45931791/&quot;&gt;https://leetcode-cn.com/submissions/detail/45931791/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;接下来使用了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HashSet&lt;/code&gt;进行哈希存储，总体感觉还行，但是没用想到不使用额外存储空间同时为线性时间的解法。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/45934723/&quot;&gt;https://leetcode-cn.com/submissions/detail/45934723/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法中的双指针法确实非常巧妙，通过将较长的链表指针指向较短链表头部，从而消除了两个链表的长度差，只要两者相等即为相交，否则两个指针同时到达尾部&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;null&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;167-两数之和-ii---输入有序数组&quot;&gt;167. 两数之和 II - 输入有序数组&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/&quot;&gt;https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-10&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;一看到是有序数组就想到使用二分法，但是没用出很好的解法，只能通过二分法加快暴力搜索的速度，答案其实不是特别满意。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/45971242/&quot;&gt;https://leetcode-cn.com/submissions/detail/45971242/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-10&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解的双指针法确实非常巧妙，充分利用了题目中有序数组还有唯一解的性质，从前后两端移动指针，直到找到唯一解。&lt;/p&gt;

&lt;h2 id=&quot;168-excel-表列名称&quot;&gt;168. Excel 表列名称&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/excel-sheet-column-title/&quot;&gt;https://leetcode-cn.com/problems/excel-sheet-column-title/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-11&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;其实思路很简单，就是简单的进制转换，记得处理当没用余数的情况。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/45980629/&quot;&gt;https://leetcode-cn.com/submissions/detail/45980629/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-11&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法基本一致，但是不懂得通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;char&lt;/code&gt;的特性简化操作&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(char)('A' + c - 1)&lt;/code&gt;，该有就是使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sb.insert(0, x)&lt;/code&gt;从前面插入。&lt;/p&gt;

&lt;h2 id=&quot;169-多数元素&quot;&gt;169. 多数元素&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/majority-element/&quot;&gt;https://leetcode-cn.com/problems/majority-element/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-12&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;没有想到很好的方法，只能通过哈希计数的方式解题，通过空间换时间的方法，但是跑出来的结果却是不怎样。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46063801/&quot;&gt;https://leetcode-cn.com/submissions/detail/46063801/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-12&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法提出了很多种，除了暴力解法和我使用的哈希表，我认为最有启发的是“排序法”（直接排序数组，返回中间的元素）。&lt;/p&gt;

&lt;p&gt;还有“Boyer-Moore 投票算法”，通过遗忘前面的非众数从而得到结果，非常巧妙。&lt;/p&gt;

&lt;h2 id=&quot;171-excel-表列序号&quot;&gt;171. Excel 表列序号&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/excel-sheet-column-number/&quot;&gt;https://leetcode-cn.com/problems/excel-sheet-column-number/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-13&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;跟之前的 Excel 序号问题一样，也是进制转换的问题：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;通过从后往前循环并使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s.charAt(i) - 'A'&lt;/code&gt;获得当前位的乘数&lt;/li&gt;
  &lt;li&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k *= 26&lt;/code&gt;在循环中不断增长当前位的底数&lt;/li&gt;
  &lt;li&gt;计算&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int b = n &amp;gt;= 26 ? 0 : 1&lt;/code&gt;解决进位过程的问题&lt;/li&gt;
  &lt;li&gt;最后将每位字母的结果累加即可&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46068259/&quot;&gt;https://leetcode-cn.com/submissions/detail/46068259/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-13&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了别人的题解后发现，其实从前往后累加计算才是更加简单的解法，只需要&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ans = ans * 26 + num&lt;/code&gt;即可。&lt;/p&gt;

&lt;h2 id=&quot;172-阶乘后的零&quot;&gt;172. 阶乘后的零*&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/factorial-trailing-zeroes/&quot;&gt;https://leetcode-cn.com/problems/factorial-trailing-zeroes/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-14&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;看了一下数据，一开始觉得主要计算乘的过程会有多少 2 和 5 出现即可，但是写代码的过程考虑错误，直接返回了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n / 5&lt;/code&gt;，结果一直没有结果，最后看了题解才有了思路。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46075012/&quot;&gt;https://leetcode-cn.com/submissions/detail/46075012/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-14&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;对于题目还是要多研究验证，通过多个方法进行对比，可以写出更多测试样例更好，方便找规律。&lt;/p&gt;

&lt;p&gt;解法：先把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt;更新&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n = n / 5&lt;/code&gt;，然后再累加计算&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n / 5&lt;/code&gt;即可。&lt;/p&gt;

&lt;h2 id=&quot;175-组合两个表&quot;&gt;175. 组合两个表&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/combine-two-tables/solution/zu-he-liang-ge-biao-by-leetcode/&quot;&gt;https://leetcode-cn.com/problems/combine-two-tables/solution/zu-he-liang-ge-biao-by-leetcode/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-15&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;这是一道 SQL 的题目，比较简单，就用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LEFT JOIN&lt;/code&gt;连接两个表。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46211212/&quot;&gt;https://leetcode-cn.com/submissions/detail/46211212/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-15&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方题解一致&lt;/p&gt;

&lt;h2 id=&quot;176-第二高的薪水&quot;&gt;176. 第二高的薪水*&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/second-highest-salary/submissions/&quot;&gt;https://leetcode-cn.com/problems/second-highest-salary/submissions/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-16&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;还是一道 SQL 的题目，基本的方法是做了，但是一直解决不了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;null&lt;/code&gt;的问题（不存在的情况下要输出 null），最后发现需要使用临时表。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46212160/&quot;&gt;https://leetcode-cn.com/submissions/detail/46212160/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-16&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;不管是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IFNULL&lt;/code&gt;或者是临时表，都是需要将原来写出来的查询作为一个子查询的。&lt;/p&gt;

&lt;h2 id=&quot;181-超过经理收入的员工&quot;&gt;181. 超过经理收入的员工&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/employees-earning-more-than-their-managers/&quot;&gt;https://leetcode-cn.com/problems/employees-earning-more-than-their-managers/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-17&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;一开始就想到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JOIN&lt;/code&gt;，还想用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HAVING&lt;/code&gt;，其实&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;join&lt;/code&gt;后只要用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;where&lt;/code&gt;查一下就可以了。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46214869/&quot;&gt;https://leetcode-cn.com/submissions/detail/46214869/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-17&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;更加简单的方法是直接&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;select&lt;/code&gt;两个表，通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;where&lt;/code&gt;组合一下就 OK 了&lt;/p&gt;

&lt;h2 id=&quot;182-查找重复的电子邮箱&quot;&gt;182. 查找重复的电子邮箱&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/duplicate-emails/&quot;&gt;https://leetcode-cn.com/problems/duplicate-emails/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-18&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;一开始想使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HAVING&lt;/code&gt;，但是没用对，使用了临时表子查询的方法。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46213242/&quot;&gt;https://leetcode-cn.com/submissions/detail/46213242/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-18&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;写出来的 SQL 还是没有题解的那么优雅，总算明白了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HAVING&lt;/code&gt;的使用方式。&lt;/p&gt;

&lt;h2 id=&quot;183-从不订购的客户&quot;&gt;183. 从不订购的客户&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/customers-who-never-order/&quot;&gt;https://leetcode-cn.com/problems/customers-who-never-order/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-19&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;想到使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NOT IN&lt;/code&gt;解题，还是比较简单的，直接把订单表的客户 ID 查出来，然后用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NOT IN&lt;/code&gt;查一下就可以了。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46215817/&quot;&gt;https://leetcode-cn.com/submissions/detail/46215817/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-19&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方解法一致。&lt;/p&gt;

&lt;h2 id=&quot;189-旋转数组&quot;&gt;189. 旋转数组&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/rotate-array/&quot;&gt;https://leetcode-cn.com/problems/rotate-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;解题的思路比较简单，首先是不使用额外的空间，所以都是原地进行替换，但是没有想到怎么样才能不需要循环&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k&lt;/code&gt;次的方法，所以解题效果不是很理想&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46418437/&quot;&gt;https://leetcode-cn.com/submissions/detail/46418437/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-20&quot;&gt;反思&lt;/h3&gt;

&lt;h2 id=&quot;190-颠倒二进制位&quot;&gt;190. 颠倒二进制位&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/reverse-bits/&quot;&gt;https://leetcode-cn.com/problems/reverse-bits/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思考-1&quot;&gt;思考&lt;/h3&gt;

&lt;p&gt;不懂怎么进行二进制操作，直接把它转换成字符串，然后反转，第一次解答错了，因为忘记在后面补 0。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46430183/&quot;&gt;https://leetcode-cn.com/submissions/detail/46430183/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-21&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;应该使用二进制操作解题，用一个变量&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;res&lt;/code&gt;去存储结果，依次得到要转换数字的低位，然后依次保存到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;res&lt;/code&gt;中。&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;res&lt;/code&gt;每得到一位后进行左移腾出位置保存下一位。&lt;/p&gt;

&lt;h2 id=&quot;191-位-1-的个数&quot;&gt;191. 位 1 的个数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/number-of-1-bits/&quot;&gt;https://leetcode-cn.com/problems/number-of-1-bits/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-20&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;还是使用字符串的解法，通过转换成字符串在计算 1 的个数&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/46432096/&quot;&gt;https://leetcode-cn.com/submissions/detail/46432096/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-22&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;应该通过二进制解法将数字跟掩码&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt;进行逻辑与运算，都可以让我们获得这个数字的最低位。检查下一位时，我们将掩码左移一位。&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-02-09T13:12:28+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-03.html</loc>
        <lastmod>2020-01-19T22:12:28+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 03</title>
                <content>
&lt;h2 id=&quot;本周收获与反思&quot;&gt;本周收获与反思&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;需要熟悉双指针类型的解法&lt;/li&gt;
  &lt;li&gt;加强做题耐心与技巧，仔细发现规律&lt;/li&gt;
  &lt;li&gt;需要加强对于树这种数据结构的学习&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;88-合并两个有序数组&quot;&gt;88. 合并两个有序数组&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/merge-sorted-array/&quot;&gt;https://leetcode-cn.com/problems/merge-sorted-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;直接原位复制，从后往前复制数组元素，直到两个列表都复制完成，需要考虑两个数组的其中一个甚至两个数组都是空数组的情况。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/43345599/&quot;&gt;https://leetcode-cn.com/submissions/detail/43345599/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;我的解法跟官方解法第三种的“双指针/从后往前”逻辑是一致的，但是感觉官方示例代码更加优雅一些。&lt;/p&gt;

&lt;h2 id=&quot;100-相同的树&quot;&gt;100. 相同的树&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/same-tree/&quot;&gt;https://leetcode-cn.com/problems/same-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-1&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;比对两个节点（不为null且val相等，或者都为null），然后递归比对左右子树。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/43348978/&quot;&gt;https://leetcode-cn.com/submissions/detail/43348978/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方的解法一致，但是感觉官方那么写更好理解&lt;/p&gt;

&lt;h2 id=&quot;101-对称二叉树&quot;&gt;101. 对称二叉树&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/symmetric-tree/&quot;&gt;https://leetcode-cn.com/problems/symmetric-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-2&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;直接对比左子树的右子树和右子树的左子树，然后循环比对。实现上代码还是有些细节没考虑到。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/43352474/&quot;&gt;https://leetcode-cn.com/submissions/detail/43352474/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;跟官方的解法一致，但是初始条件没有考虑到可以像官方解法一样使用两个root，导致出了一些问题和逻辑错误。&lt;/p&gt;

&lt;h2 id=&quot;104-二叉树的最大深度&quot;&gt;104. 二叉树的最大深度&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/&quot;&gt;https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-3&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;还是通过递归和一个辅助函数完成计算，如果节点不为null则深度加一，然后递归处理左右子树取最大值。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/43478449/&quot;&gt;https://leetcode-cn.com/submissions/detail/43478449/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方DFS深度搜索的方法更为简洁，对于树的操作还需要加强啊。&lt;/p&gt;

&lt;h2 id=&quot;107-二叉树的层次遍历-ii&quot;&gt;107. 二叉树的层次遍历 II&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/binary-tree-level-order-traversal-ii/&quot;&gt;https://leetcode-cn.com/problems/binary-tree-level-order-traversal-ii/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-4&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;通过递归执行，将结果存入Map保存，最后还原为数组&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/43605297/&quot;&gt;https://leetcode-cn.com/submissions/detail/43605297/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;题解使用DFS或者BFS进行遍历，使用的存储空间会更少&lt;/p&gt;

&lt;h2 id=&quot;108-将有序数组转换为二叉搜索树&quot;&gt;108. 将有序数组转换为二叉搜索树&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/convert-sorted-array-to-binary-search-tree/&quot;&gt;https://leetcode-cn.com/problems/convert-sorted-array-to-binary-search-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-5&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;从中间节点作为根节点开始，不断递归构造子树，最后得到目标二叉搜索树。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/43610263/&quot;&gt;https://leetcode-cn.com/submissions/detail/43610263/&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;110-平衡二叉树&quot;&gt;110. 平衡二叉树&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/balanced-binary-tree/&quot;&gt;https://leetcode-cn.com/problems/balanced-binary-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-6&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;思考了蛮久，没有想到一个好的方案，只能暴力穷举，效果很不理想&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/43734212/&quot;&gt;https://leetcode-cn.com/submissions/detail/43734212/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;相对我上面的暴力法的O(N^2)，题解中“从底至顶（提前阻断法）”，可以很有效的减少重复计算，通过做深度优先遍历DFS，只要发现不平衡的情况，直接终止。&lt;/p&gt;

&lt;h2 id=&quot;70-爬楼梯&quot;&gt;70. 爬楼梯*&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/climbing-stairs/&quot;&gt;https://leetcode-cn.com/problems/climbing-stairs/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-7&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;思考了蛮久，一直没有想到思路，只能参考题解了。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/43846697/&quot;&gt;https://leetcode-cn.com/submissions/detail/43846697/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;使用基于缓存的穷举法，其实还是比较简单，但是一直思路都没对，其实一开始也有考虑过动态规划和找规律，但是没仔细做下去，用斐波那契数列去解，耐心各方面都不够。&lt;/p&gt;

&lt;p&gt;而且官方解法还有更加高端的“Binets 方法”和“斐波那契公式“&lt;/p&gt;

&lt;h2 id=&quot;111-二叉树的最小深度&quot;&gt;111. 二叉树的最小深度*&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/&quot;&gt;https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-8&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;思考了蛮久，尝试了几种解法，都没有找到正确的解答，参考了题解做出来了&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/43886662/&quot;&gt;https://leetcode-cn.com/submissions/detail/43886662/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;我使用的是最简单的“递归”也就是“深度优先搜索”，此外还有“深度优先搜索迭代”和“深度优先搜索迭代”。准确的讲，这几个方法我都没有很好的掌握，所以遇到问提才会一直走弯路。&lt;/p&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-01-19T22:12:28+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-02.html</loc>
        <lastmod>2020-01-12T19:43:24+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 02</title>
                <content>
&lt;h2 id=&quot;本周收获与反思&quot;&gt;本周收获与反思&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;需要考虑元素移动的操作成本，通过与最后的元素交换获得更好性能&lt;/li&gt;
  &lt;li&gt;认真学习KMP算法&lt;/li&gt;
  &lt;li&gt;重新认真对二分法进行实践&lt;/li&gt;
  &lt;li&gt;了解动态规划与动态规划算法&lt;/li&gt;
  &lt;li&gt;了解一些基础的学习方法，如“牛顿法”&lt;/li&gt;
  &lt;li&gt;加强操作列表的结点指针的能力，包括循环条件的设置&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;二分查找法模板&quot;&gt;二分查找法模板&lt;/h3&gt;

&lt;p&gt;核心思想：“排除法”，每一轮循环排除一半以上的元素，使用对数时间复杂度把区间收缩到只剩1个数。把对单个值是否是目标数值的判断留在最后做，甚至有时连最后一步都省去了。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;前提:分析清楚左右边界，不要漏掉目标值，日标值很可能在边界&lt;/li&gt;
  &lt;li&gt;中位数先写&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int mid = (eft + right) &amp;gt;&amp;gt;&amp;gt; 1;&lt;/code&gt;等循环里分支的逻辑写完，再回来做调整&lt;/li&gt;
  &lt;li&gt;先写逻辑上容易想到的分支逻辑，这个分支遭辑通常是排除中位数的逻辑&lt;/li&gt;
  &lt;li&gt;循环内只写两个分支，一个分支排除中位数，另个分支不排除中位数，循环中不单独对中位数作判断&lt;/li&gt;
  &lt;li&gt;根据分支逻辑选择中位数，可能是左中位数，也可能是右中位数，选择的标准是避免循环&lt;/li&gt;
  &lt;li&gt;退出循环的时候，可能需要对“夹逼“剩下的那个数单独做一次判断，这一步称之为“后处理”&lt;/li&gt;
  &lt;li&gt;取中位数的时候，要避免在计算上出现整型溢出;（Java中。一定要使用无符号右移»&amp;gt;）&lt;/li&gt;
  &lt;li&gt;编码一旦出现死循环，输出必要的变量值、分支逻辑是调试的重要方法。&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;分治法解决问题的模板&quot;&gt;分治法解决问题的模板&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;定义基本情况。&lt;/li&gt;
  &lt;li&gt;将问题分解为子问题并递归地解决它们。&lt;/li&gt;
  &lt;li&gt;合并子问题的解以获得原始问题的解。&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;27-移除元素&quot;&gt;27. 移除元素&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/remove-element/&quot;&gt;https://leetcode-cn.com/problems/remove-element/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;这道题目的解决方法跟上一道题移除重复元素一致，就是通过指针把当前的不等于所需移除的数字移到指针所在位置即可。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/42506804/&quot;&gt;https://leetcode-cn.com/submissions/detail/42506804/&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解的第一个方法跟我的基本一致，我还多余地判断了一次，没有必要。&lt;/p&gt;

&lt;p&gt;看到第二个解法“双指针 —— 当要删除的元素很少时”时，明白了在解答时候需要考虑移动元素的次数，如果需要删除的元素较少时，直接交换最后一个元素，可以获得很高效率，减少交换的次数。&lt;/p&gt;

&lt;h2 id=&quot;28-实现-strstr&quot;&gt;28. 实现 strStr()&lt;/h2&gt;

&lt;h3 id=&quot;思路-1&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;方法比较简单粗暴，直接遍历haystack，查找needle的第一个值，找到后继续查找needle下面的结果，判断结果。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/42526981/&quot;&gt;https://leetcode-cn.com/submissions/detail/42526981/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;字符串查找有 KMP、BM、Horspool、Sunday 等算法，很多东西还是要好好认真学习的。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;KMP 算法永不回退 txt 的指针 i，不走回头路（不会重复扫描 txt），而是借助 dp 数组中储存的信息把 pat 移到正确的位置继续匹配，时间复杂度只需 O(N)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;35-搜索插入位置&quot;&gt;35. 搜索插入位置&lt;/h2&gt;

&lt;h3 id=&quot;思路-2&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;一开始是打算用二分法查找，但是写了五六次没有写出来，心累，所以直接遍历数组找了结果。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/42656284/&quot;&gt;https://leetcode-cn.com/submissions/detail/42656284/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看了一下题解，才发现之前二分法的写法和思路整个都是错的。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;首先把循环可以进行的条件写成 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;while(left &amp;lt; right)&lt;/code&gt;，在退出循环的时候，一定有 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;left == right&lt;/code&gt; 成立，此时返回 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;left&lt;/code&gt; 或者 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;right&lt;/code&gt; 都可以。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;38-外观数列&quot;&gt;38. 外观数列&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/count-and-say/&quot;&gt;https://leetcode-cn.com/problems/count-and-say/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-3&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;解题思路还是比较简单的，就是判断每个字符串跟之前一个是不是一样，一样就计数加一，否则把计数数量和字符拼接上去。其实可以使用递归让代码更加优雅，但是懒得写，直接使用了循环代替。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/42782259/&quot;&gt;https://leetcode-cn.com/submissions/detail/42782259/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看到题解也没有什么特别大的差别，但是有个JS的解法使用正则也是非常新颖：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;prev = prev.replace(/(\d)\1*/g, item =&amp;gt;&lt;/code&gt;${item.length}${item[0]}&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;)&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;53-最大子序和&quot;&gt;53. 最大子序和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/maximum-subarray/&quot;&gt;https://leetcode-cn.com/problems/maximum-subarray/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-4&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;一开始看到题目其实也没有想到很好的方法，没有想到题目中O(N)的方法是怎么做的，只能用最笨的方法通过两层循环完成比对。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/42789278/&quot;&gt;https://leetcode-cn.com/submissions/detail/42789278/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;题解中使用“贪心”算法有效地在O(N)时间完成题解，而且整个方法非常优雅。而分治法可以很好的用递归和多线程甚至分布式进行问题求解。&lt;/p&gt;

&lt;p&gt;“动态规划（Kadane 算法）”则有些复杂，对于动态规划还是要好好再学一学。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;每一步都选择最佳方案，到最后就是全局最优的方案&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;58-最后一个单词的长度&quot;&gt;58. 最后一个单词的长度&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/length-of-last-word/&quot;&gt;https://leetcode-cn.com/problems/length-of-last-word/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-5&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;用了比较坑的解法，直接split，再取最后一个。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/42908226/&quot;&gt;https://leetcode-cn.com/submissions/detail/42908226/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;正确的方法应该是从字符尾部开始遍历，直到遇到空格（注意一些边界条件，还有最后一个是空格的情况）&lt;/p&gt;

&lt;h2 id=&quot;66-加一&quot;&gt;66. 加一&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/plus-one/&quot;&gt;https://leetcode-cn.com/problems/plus-one/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-6&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;处理方法比较简单，从最后一位开始加一后判断是否为10，如果是10则置为0同时继续循环，否则返回结果。需要注意考虑全部为9进位的情况。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/42910443/&quot;&gt;https://leetcode-cn.com/submissions/detail/42910443/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;大部分解法类似，他们会使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;% 10&lt;/code&gt; 来判断并处理变为10的情况。&lt;/p&gt;

&lt;h2 id=&quot;67-二进制求和&quot;&gt;67. 二进制求和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/add-binary/&quot;&gt;https://leetcode-cn.com/problems/add-binary/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-7&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;解题思路还是比较简单直接，通过一个变量确定是否需要进位，然后通过判断字符串进行计算，最后输出结果，注意处理最后的进位的情况，还有循环函数的流程&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/42922249/&quot;&gt;https://leetcode-cn.com/submissions/detail/42922249/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;题解中的解法使用0补齐的方法，整体看情况比我写的循环更加简洁&lt;/p&gt;

&lt;h2 id=&quot;69-x-的平方根&quot;&gt;69. x 的平方根&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/sqrtx/&quot;&gt;https://leetcode-cn.com/problems/sqrtx/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-8&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;解题比较暴力，直接返回&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(int) Math.floor(Math.sqrt(x))&lt;/code&gt;，其实这样是不对的，直接用函数库的方法&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/43039291/&quot;&gt;https://leetcode-cn.com/submissions/detail/43039291/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-8&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;题解中讲了“二分法”和“牛顿法”，之前有听说过牛顿法求平方根，但是根本不知道这个解法的原理。还是要认真打一下基础才行。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;使用二分查找法搜索，注意特值对搜索边界的影响&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;83-删除排序链表中的重复元素&quot;&gt;83. 删除排序链表中的重复元素&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list/&quot;&gt;https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-9&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;解题方法跟之前删除有序数组重复元素一致，但是一开始还是忽略了一些边界条件&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/43153054/&quot;&gt;https://leetcode-cn.com/submissions/detail/43153054/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-9&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解解法中的方法比起我写的代码简洁非常多，通过两个条件的while循环加上判断，很好地解决问题。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;可以通过定义“循环不变式”来证明此代码的正确性。循环不变式是在循环的每次迭代之前和之后为真的条件。&lt;/p&gt;
&lt;/blockquote&gt;
</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-01-12T19:43:24+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/leetcode-java-01.html</loc>
        <lastmod>2020-01-05T12:43:24+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>LeetCode 手记 01</title>
                <content>
&lt;h2 id=&quot;本周收获与反思&quot;&gt;本周收获与反思&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;charAt()&lt;/code&gt; 进行字符串遍历与操作，减少额外内存占用&lt;/li&gt;
  &lt;li&gt;使用“双指针”简化代码&lt;/li&gt;
  &lt;li&gt;考虑如何使用额外的空间极大降低代码时间复杂度&lt;/li&gt;
  &lt;li&gt;对解题方法要举一反三&lt;/li&gt;
  &lt;li&gt;多注意溢出等边界条件与问题&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;1-两数之和&quot;&gt;1. 两数之和&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/two-sum/&quot;&gt;https://leetcode-cn.com/problems/two-sum/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;做题的时候就是想到最简单的暴力穷举的方法，通过两层循环不断测试与目标答案是否符合，最终写出了解决方法。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/41919022/&quot;&gt;https://leetcode-cn.com/submissions/detail/41919022/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;但是看到官方提供的题解，发现自己从一开始思考时候忽略了解题的一个突破口，通过空间换时间，通过“哈希表”可以完成快速查找所需结果是否存在于给定数列中。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;通过将数字加入map，然后将目标减去当前数字，并查找结果是否存在与map中&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;7-整数反转&quot;&gt;7. 整数反转&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/reverse-integer/&quot;&gt;https://leetcode-cn.com/problems/reverse-integer/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-1&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;这道题想到的也还是很简单的想到了转换到字符串数组，然后翻转字符串数组的解题方法，同时记得处理了负数的情况。&lt;/p&gt;

&lt;p&gt;但是第一次提交答案没有通过，因为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int&lt;/code&gt;溢出了，所以通过简单地加个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;trycatch&lt;/code&gt;解决了。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/41919035/&quot;&gt;https://leetcode-cn.com/submissions/detail/41919035/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-1&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;看到官方的题解，发现通过巧妙的数学方法“弹出”和“推入”数字可以快速解决问题，这个方法从来没想到，自己模拟了一下才大致明白解法的思路。&lt;/p&gt;

&lt;p&gt;同时对于数字溢出也没有很好掌握，只是简单通过trycatch解决问题。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;弹出（x % 10）和推入（rev * 10 + pop）数字 &amp;amp; 溢出前进行检查（一个是大于整数最大值MAX_VALUE，另一个是小于整数最小值MIN_VALUE）&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;9-回文数&quot;&gt;9. 回文数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/palindrome-number/&quot;&gt;https://leetcode-cn.com/problems/palindrome-number/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-2&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;一上来解决思路很简单，就是转换成字符串，然后循环进行头尾数字对比，但是做题过程很粗心，最简单的边界条件也没有整好，测试也没有好好跑就去提交答案，还错了三次。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/41956263/&quot;&gt;https://leetcode-cn.com/submissions/detail/41956263/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-2&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方题解与上一个题目翻转数字解法类似，通过翻转一半数字的方法，处理问题。（&lt;strong&gt;对于问题的解决方法要知道举一反三&lt;/strong&gt;）&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;将原始数字除以 10，然后给反转后的数字乘上 10，所以，当原始数字小于反转后的数字时，就意味着我们已经处理了一半位数的数字。（通过 revertedNumber/10 去除处于中位的数字）&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;13-罗马数字转整数&quot;&gt;13. 罗马数字转整数&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/roman-to-integer/&quot;&gt;https://leetcode-cn.com/problems/roman-to-integer/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-3&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;先通过特殊类型的字典，计算六种特殊类型的组合，然后在拆开字符串通过字典查找进行加和，最终返回结果。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/42078580/&quot;&gt;https://leetcode-cn.com/submissions/detail/42078580/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-3&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;从精选题解看到解法也类似，但是感觉我自己写的看起来代码更加清晰，但是因为使用了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;contains&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;replace&lt;/code&gt;，带来了不必要的内存损耗，看到比较好的方法是比较前后结果。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;每次比较后一个和前一个的值的大小关系，前值小于后值，减去前值，反之加上前值&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;14-最长公共前缀&quot;&gt;14. 最长公共前缀&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/longest-common-prefix&quot;&gt;https://leetcode-cn.com/problems/longest-common-prefix&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-4&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;解题一开始思路比较直接，通过找出最短的长度，然后每个单词去遍历，直到发现不不同。但是解决过程非常粗心，忽略了非常多的边界条件，结果错误了五次，结果性能看起来还是比较不错的。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/42194822/&quot;&gt;https://leetcode-cn.com/submissions/detail/42194822/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-4&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;该问题叫做LCP问题，题解中讲了好几种解决方式，包括介绍了Trie(前缀树)，官方的解法中关于分治还有二分查找的方法确实很让我受启发，代码也简洁很多。&lt;/p&gt;

&lt;h2 id=&quot;20-有效的括号&quot;&gt;20. 有效的括号&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/valid-parentheses&quot;&gt;https://leetcode-cn.com/problems/valid-parentheses&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-5&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;最开始想到的解法就是使用栈来进行，看到左括号入栈，看到右括号比对并出栈，不匹配直接返回。一开始使用String，后面使用Character，但是都还是用了Java自带的Stack，总体实现过程还是有些粗心，一些边界情况没有考虑。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/42223358/&quot;&gt;https://leetcode-cn.com/submissions/detail/42223358/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-5&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;我的解法跟官方解法逻辑一致，但是官方提供的代码比我的简洁很多。&lt;/p&gt;

&lt;h2 id=&quot;21-合并两个有序链表&quot;&gt;21. 合并两个有序链表&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/merge-two-sorted-lists&quot;&gt;https://leetcode-cn.com/problems/merge-two-sorted-lists&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-6&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;一开始的想法就是遍历两个有序链表，根据当前值不断插入到新的链表上，但是一开始解决的思路有点偏，写了非常多的判断和临时变量，后来重新构思并重构了代码整体逻辑还是比较清楚的。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/42265463/&quot;&gt;https://leetcode-cn.com/submissions/detail/42265463/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-6&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方提供递归写法看起来很优雅，这个是之前没有考虑的。&lt;/p&gt;

&lt;p&gt;我的解法跟官方迭代的解法逻辑一致，但是官方提供的代码比我的简洁很多，多余创建的判断其实可以通过巧妙的方法解决，同时官方的解法没有创建新的节点，都是直接使用原有链表的节点对象，只是创建了一个新的根节点。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;官方解法会破坏原链表，我的解法不会&lt;/strong&gt;&lt;/p&gt;

&lt;h2 id=&quot;26-删除排序数组中的重复项&quot;&gt;26. 删除排序数组中的重复项&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array//&quot;&gt;https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;思路-7&quot;&gt;思路&lt;/h3&gt;

&lt;p&gt;思路还是比较简单的，因为是一个有序数组，直接从第一个开始，只要跟前面的不同，就把它放到数组里面游标当前位置，同时游标加一，最后返回游标即为不同元素的数量。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/submissions/detail/42328969/&quot;&gt;https://leetcode-cn.com/submissions/detail/42328969/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;反思-7&quot;&gt;反思&lt;/h3&gt;

&lt;p&gt;官方解法类似，但是官方使用双指针法，不需要像我那样依赖一个临时变量保存当前值，解法更为优雅。&lt;/p&gt;

</content>
                 <tag>LeetCode</tag>  <tag>Java</tag> 
                 <tag>学习</tag> 
                <pubTime>2020-01-05T12:43:24+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/nexus6p-sideload.html</loc>
        <lastmod>2018-09-18T18:00:31+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Nexus6P SideLoad</title>
                <content>
&lt;ol&gt;
  &lt;li&gt;官方下载最新版本的原厂镜像： https://developers.google.com/android/ota，将下载回来的 zip 景象文件（不要解压）放到 adb.exe 所在的目录（ adb 下载： https://developer.android.com/studio/releases/platform-tools.html ）；&lt;/li&gt;
  &lt;li&gt;手机连电脑，然后 CMD 命令行进入该目录，执行命令：adb devices，看到手机序列号，说明链接成功；&lt;/li&gt;
  &lt;li&gt;执行命令：adb reboot recovery，让手机重启进入 recovery （手机上会看到一个绿色的机器人），按住电源键不放，按一下音量加，此时会出现一堆菜单。松开电源键，使用音量减来移动菜单到 Apply update from ADB 这一行，按一下电源键确认；&lt;/li&gt;
  &lt;li&gt;执行命令：adb sideload ota_file.zip ，其中 ota_file.zip 就是你第一步下载回来的那个 zip ；&lt;/li&gt;
  &lt;li&gt;等待命令行的进度到 100%，手机最底部会显示 Install from ADB complete，此时按音量加键，选择 Reboot system now，按一下电源键确认，手机重启；&lt;/li&gt;
  &lt;li&gt;重启过程比较漫长，耐心等候，等进入桌面后，检查 update，如果发现不是 8.1，退出来，过 1 分钟进去再看。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;注意：这种升级方法是 Google 镜像下载网页上推荐的，整个过程很顺利，而且不会丢失原有数据。&lt;/p&gt;
</content>
                 <tag>Android</tag> 
                 <tag>Android</tag> 
                <pubTime>2018-09-18T18:00:31+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/auth-user-from-smtp-on-nodejs.html</loc>
        <lastmod>2018-05-07T14:54:34+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用SMTP服务进行用户登录认证</title>
                <content>
&lt;p&gt;公司一般都会带有企业邮箱，那么能不能利用企业邮箱账号来做登录验证，这样就能降低内部系统的登录验证成本，同时也让员工信息数据同步。其实通过 SMTP 协议就可以简单的完成。&lt;/p&gt;

&lt;h2 id=&quot;smtp-协议&quot;&gt;SMTP 协议&lt;/h2&gt;

&lt;p&gt;我们来看一下 SMTP 协议，可以使用简单的 telnet 客户端来进行登录操作&lt;/p&gt;

&lt;p&gt;首先获得经过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;base64&lt;/code&gt;encode 的用户名和密码：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;用户名：dGVzdEBleHRtYWlsLm9yZw==&lt;/li&gt;
  &lt;li&gt;密码：dGVzdA==&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-console highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;go&quot;&gt;// 登录 smtp.163.com 端口号为 25
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;telnet smtp.163.com 25
&lt;span class=&quot;go&quot;&gt;Trying 202.108.44.205...
Connected to smtp.163.com (202.108.44.205).
Escape character is '^]'.
220 163.com Anti-spam GT for Coremail System (163com[20141201])
// 与服务器打招呼，并告知客户端使用的机器名字
HELO localhost
250 OK
// 使用身份认证登录指令
AUTH LOGIN  
334 dXNlcm5hbWU6
// 输入已经 base64_encode() 过的用户名.
cmVkc29zMw== 
334 UGFzc3dvcmQ6
// 输入已经 base64_encode() 过的密码
dGVzdA==
235 Authentication successful
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;原理&quot;&gt;原理&lt;/h2&gt;

&lt;p&gt;从上面 Telnet 的例子就可以看出，SMTP协议的实现是比较简单的，建立连接后通过特定的操作符并提交响应的参数，就会返回相应的结果，这里我们只是需要进行简单的身份验证，就不去多讲邮件发送相关的操作，有兴趣的同学可以自己去看 &lt;a href=&quot;https://tools.ietf.org/html/rfc821&quot;&gt;RF281&lt;/a&gt; 或者相关语言实现的库。&lt;/p&gt;

&lt;p&gt;对于进行身份验证来说，主要执行三个操作：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;发送  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HELO localhost&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;发送 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AUTH LOGIN&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;发送用户名和密码（使用 base64 编码）&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;最后校验返回的结果是不是 “235 Authentication successful”。&lt;/p&gt;

&lt;h2 id=&quot;nodejs-实现&quot;&gt;Node.js 实现&lt;/h2&gt;

&lt;p&gt;既然使用 Telnet 就能进行登录认证，那么就可以使用 Node.js 提供的 net 模块来完成操作，代码也很简单，先来个最简单的 Demo：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;net&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;net&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;COMMAMD&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;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;HELO localhost&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AUTH LOGIN&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;cmVkc29zMw==&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;dGVzdA==&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;QUIT&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;reverse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conn&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;net&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;smtp.163.com&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;conn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;comm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;COMMAMD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;comm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;conn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;comm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;输出结果如下：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;220 163.com Anti-spam GT for Coremail System (163com[20141201])

HELO localhost
250 OK

AUTH LOGIN
334 dXNlcm5hbWU6

dGVzdC5vcmc=
334 UGFzc3dvcmQ6

dGVzdA==
235 Authentication successful

QUIT
221 Bye
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;可以看到这个结果就跟使用 Telnet 的结果一样，只需要进行简单的封装就可以了。&lt;/p&gt;

&lt;h3 id=&quot;node-smtp-auth&quot;&gt;node-smtp-auth&lt;/h3&gt;

&lt;p&gt;经过封装的代码放在：&lt;a href=&quot;https://github.com/yourtion/node-smtp-auth&quot;&gt;https://github.com/yourtion/node-smtp-auth&lt;/a&gt; 项目，并发布到 NPM：&lt;a href=&quot;http://npmjs.org/package/smtp-auth&quot;&gt;smtp-auth&lt;/a&gt; 。&lt;/p&gt;

&lt;p&gt;通过：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm install smtp-auth --save&lt;/code&gt; 安装即可。&lt;/p&gt;

&lt;p&gt;使用方法：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;SMTPAuth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;smtp-auth&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;SMTPAuth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;smtp.163.com&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;25&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;nx&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;auth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;test@extmail.org&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;login success&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;k&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;login fail: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;返回成功的信息就是验证通过，就是这样简单。有什么问题或者意见建议欢迎给我提 &lt;a href=&quot;https://github.com/yourtion/node-smtp-auth/issues/new&quot;&gt;issues&lt;/a&gt;&lt;/p&gt;

</content>
                 <tag>Node.js</tag> 
                 <tag>开发笔记</tag> 
                <pubTime>2018-05-07T14:54:34+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/mysql-like-search-ordering.html</loc>
        <lastmod>2018-01-09T09:44:26+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>MySQL对Like搜索结果按照匹配程度排序</title>
                <content>
&lt;p&gt;最近项目上遇到一个需求，在原来项目的管理后台上，有一个通过用户昵称进行模糊搜索的功能，但是用户反映说有时候搜索关键字的结果比较多的话，准确匹配的结果没有排在前面。&lt;/p&gt;

&lt;p&gt;检查了一下后端的代码，发现 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;like&lt;/code&gt; 的语句是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LIKE %keyword%&lt;/code&gt; ，然后排序的就是按照默认的方式，结果如下：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2018/01/mysql-like-1.jpg&quot;&gt;&lt;img src=&quot;/images/2018/01/mysql-like-1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;可以发现确实完整匹配 “阳光” 关键字的结果是分散的，找了一下解决方案，结果在 stackoverflow 找到这样的一个答案：&lt;a href=&quot;https://stackoverflow.com/questions/18725941/mysql-order-by-best-match&quot;&gt;MySQL order by “best match”&lt;/a&gt;，里面提出了几个解决方案，经过测试，在其中一个的基础上做了一些修改，得到比较好的结果。&lt;/p&gt;

&lt;p&gt;更新后的 SQL 如下：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SELECT nickname
FROM customer
WHERE nickname LIKE '%阳光%'
ORDER BY
  CASE
    WHEN nickname LIKE '阳光' THEN 0
    WHEN nickname LIKE '阳光%' THEN 1
    WHEN nickname LIKE '%阳光' THEN 3
    ELSE 2
  END
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;结果如下：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2018/01/mysql-like-2.jpg&quot;&gt;&lt;img src=&quot;/images/2018/01/mysql-like-2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ORDER BY&lt;/code&gt; 并通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CASE&lt;/code&gt; 进行判断，来返回排序结果，这样的方法从性能上可能存在问题，但是本身通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;%keyword%&lt;/code&gt; 查找就没有办法使用索引，而且管理后台的查询量就相对较少，通过上述方法可以很好的解决问题，最重要的是知道了 MySQL 上 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ORDER&lt;/code&gt; 语句的一个新特性。&lt;/p&gt;

&lt;h2 id=&quot;参考&quot;&gt;参考&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/18725941/mysql-order-by-best-match&quot;&gt;MySQL order by “best match”&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
                 <tag>MySQL</tag> 
                 <tag>解决问题</tag> 
                <pubTime>2018-01-09T09:44:26+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/fix-log4js-with-pm2-not-work.html</loc>
        <lastmod>2017-09-05T10:51:53+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>log4js在PM2的cluster模式下大坑</title>
                <content>
&lt;p&gt;之前一直使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;debug&lt;/code&gt; 还有 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;console.log&lt;/code&gt; 去打日志，或者使用文件日志模块，之前用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;log4js&lt;/code&gt; 也主要为了把日志传输到 ELK 上。新的项目上决定使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;log4js&lt;/code&gt; 来全面统一项目中的日志，所以统一构建了一个日志配置。&lt;/p&gt;

&lt;p&gt;在本地调试还有早期测试服务器部署都工作正常，多个配置项也输出正常，但是在部署到正式服的时候，发现日志不输出了，文件也没了记录，在生产环境使用 node 运行跟配置一致的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;log4js&lt;/code&gt; 也工作正常。&lt;/p&gt;

&lt;p&gt;一开始以为是权限问题，对日志目录做了权限调整，切换到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/tmp&lt;/code&gt; 目录都无济于事，百般无奈的情况下只好重新认真地跑去读API文档。&lt;/p&gt;

&lt;p&gt;结果在文档 &lt;a href=&quot;https://nomiddlename.github.io/log4js-node/api.html&quot;&gt;log4js-api&lt;/a&gt; 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Configuration Object&lt;/code&gt; 段中，居然看到了下面的内容：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;pm2 (boolean) (optional)&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;set this to true if you’re running your app using pm2, otherwise logs will not work (you’ll also need to install pm2-intercom)&lt;/li&gt;
  &lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;原来还有这个配置，而且不开启的话就会工作不正常？但是我之前在测试服务器的时候工作得好好的啊～&lt;/p&gt;

&lt;p&gt;对比了一下部署环境，原来生产环境下使用了 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cluster&lt;/code&gt; 模式，但是在测试环境中只启动一个进程所以用了 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fork&lt;/code&gt; 模式，在生产环境切换到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fork&lt;/code&gt; 果然就正常了～&lt;/p&gt;

&lt;p&gt;解决办法，通过变量指定了一下部署环境，在生产环境对 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;log4js&lt;/code&gt; 对配置添加 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pm2: true&lt;/code&gt; 的选项。&lt;/p&gt;

&lt;p&gt;示例（我是通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NODE_ENV === 'production'&lt;/code&gt; 进行判断）：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;log4js&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;log4js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;log4js&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;configure&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;appenders&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;na&quot;&gt;out&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;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;stdout&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;app&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;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;application.log&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;na&quot;&gt;categories&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;na&quot;&gt;default&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;na&quot;&gt;appenders&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;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;level&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;debug&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;nl&quot;&gt;pm2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;NODE_ENV&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;production&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;nx&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;log4js&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;但是对于后面说的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pm2-intercom&lt;/code&gt; 模块，我测试中就是没有安装也可以正常工作，看了一下这个模块，是一个内部进程通讯的模块：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Simple inter process communication for processes managed by PM2. Require PM2 &amp;gt; 16.0.0.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;我估计是 log4js 用在多个 cluster 进程中协调文件日志的吧。&lt;/p&gt;

&lt;p&gt;由此可见，认真看文档很重要，认真看文档很重要，认真看文档很重要！！！&lt;/p&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>Node.js</tag> 
                <pubTime>2017-09-05T10:51:53+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/graceful-reload-express-with-pm2.html</loc>
        <lastmod>2017-08-29T10:27:48+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用PM2的GracefulReload无停机更新Express应用</title>
                <content>
&lt;p&gt;最近的项目上遇到一个问题，在 API 服务中，有些请求是先返回了结果，然后在后面继续处理一些异步操作，但是如果这时候重启了服务，因为部分操作没执行成功，就会导致数据不一致的情况。&lt;/p&gt;

&lt;p&gt;很早之前就知道了 PM2 的 GracefulReload，而且在实际项目中也有使用，但是基本都是以连接断开为标记，这次就顺便研究了一下怎么样更优雅的实现无停机更新。&lt;/p&gt;

&lt;h2 id=&quot;最简单的版本&quot;&gt;最简单的版本&lt;/h2&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;http&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createServer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3000&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;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Express is listening on 3000&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;SIGINT&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Closing server...&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Server closed !!! &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exit&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;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;简单的说就是跟 PM2 的官网说的一样，接收 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SIGINT&lt;/code&gt; 参数，然后通过执行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;server.close&lt;/code&gt; 方法，不再接收新的连接，并等待旧的连接响应完成才回调回来。&lt;/p&gt;

&lt;p&gt;这样的版本并不能解决在回调后还有异步处理的问题。所以就有了下面的扩展版。&lt;/p&gt;

&lt;h2 id=&quot;扩展升级版本&quot;&gt;扩展升级版本&lt;/h2&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;http&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createServer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3000&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;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Express is listening on 3000&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;SIGINT&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cleanUp&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;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;redis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;end&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;nx&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Stop after 10 secs&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;cleanUp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exit&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;mi&quot;&gt;10000&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;c1&quot;&gt;// Force close server after 15 secs&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Forcing server close !!!&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;cleanUp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;15000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这个版本添加了对 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mysql&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;redis&lt;/code&gt; 资源的释放，同时在连接断开后等待 10 秒，让异步的请求执行完（&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;requert&lt;/code&gt; 上的超时为 5s，所有 10s 应该是足够了）。&lt;/p&gt;

&lt;h2 id=&quot;效果测试&quot;&gt;效果测试&lt;/h2&gt;

&lt;p&gt;在启动的时候加上 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kill-timeout&lt;/code&gt; 参数，或者在 json 文件中中设置，同时注意使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cluster&lt;/code&gt; 模式启动。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pm2 start app.js &lt;span class=&quot;nt&quot;&gt;--kill-timeout&lt;/span&gt; 15000
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;经过测试，这样的配置运行良好，可以从下面的日志看出来：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;PM2        | Starting execution sequence in -cluster mode- for app name:Express id:1
PM2        | App name:Express id:1 online
1| Express | 08-29 10:44:51: Express is listening on 3000
PM2        | -softReload- New worker listening
PM2        | Stopping app:Express id:_old_1
PM2        | App name:Express id:_old_1 disconnected
PM2        | App [Express] with id [_old_1] and pid [24262], exited with code [0] via signal [SIGINT]
PM2        | pid=24262 msg=process killed
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;可以看出，在执行了 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;startOrGracefulReload&lt;/code&gt; 之后，PM2 会马上启动一个新的进程处理新进的请求，同时等待原有的进程停止后删除退出。至此，应该算是大功告成了。&lt;/p&gt;

&lt;h2 id=&quot;参考&quot;&gt;参考&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://pm2.keymetrics.io/docs/usage/signals-clean-restart/&quot;&gt;Graceful restart/reload/stop&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.acuriousanimal.com/2017/08/27/graceful-shutdown-node-processes.html&quot;&gt;Graceful shutdown NodeJS HTTP server when using PM2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content>
                 <tag>解决问题</tag> 
                 <tag>Node.js</tag> 
                <pubTime>2017-08-29T10:27:48+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/fastlane-ios-build-multiple-apple-id.html</loc>
        <lastmod>2017-07-07T14:35:34+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Fastlane构建多个AppleID的IPA包</title>
                <content>
&lt;p&gt;最近在做一个基于 Fastlane 的构建脚本，但是因为有一个 iOS 的项目有基于多个 AppleID 发布的包，也就是多个影子项目，你懂的，那么能不能简单地基于一个配置构建多个 IPA 输出呢，研究了一下 Fastlane 的文档，实现起来还是很简单。&lt;/p&gt;

&lt;h2 id=&quot;准备工作&quot;&gt;准备工作&lt;/h2&gt;

&lt;p&gt;首先对项目添加多个 target，这样方便管理各个影子APP的图标等内容，这里就不赘述了，可以参考下面两篇文章实现。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.jianshu.com/p/a29a4fbe781d&quot;&gt;《Xcode —— 使用Multi-Target管控相似 App》&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.csdn.net/ysysbaobei/article/details/10951991&quot;&gt;《iOS开发时，在Xcode中添加多个targets进行版本控制》&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;假设添加后就有两个 target 和 scheme 分别为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;project&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;projectClone&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;applefile配置&quot;&gt;Applefile配置&lt;/h2&gt;

&lt;p&gt;首先配置好一个简单的 Fastlane，假设 AppleIDMaster 是主要的 AppleID，包括内部发布测试也是主要用这个，那么 Appfile 的内容一开始如下：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;app_identifier&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;com.yourtion.project&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;apple_id&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;AppIDMaster@yourtion.com&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;team_id&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;XXXXXXXXX&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后添加一个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;for_lane&lt;/code&gt; 字段，加入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppleIDClone&lt;/code&gt; 这个打影子包的 ID，根据 Fastlane 的文档，这样针对特定的 lane 就会使用这个特定的信息，Appfile 更新如下：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;app_identifier&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;com.yourtion.project&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;apple_id&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;AppIDMaster@yourtion.com&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;team_id&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;XXXXXXXXX&quot;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;for_lane&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:releaseClone&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;app_identifier&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;com.yourtion.projectClone&quot;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;apple_id&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;AppIDClone@yourtion.com&quot;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;team_id&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;XXXXXXXXX&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;fastfile配置&quot;&gt;Fastfile配置&lt;/h2&gt;

&lt;p&gt;最简单的配置就是在把原有 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;release&lt;/code&gt; 配置复制一份，改名为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;releaseClone&lt;/code&gt;，然后把 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;scheme&lt;/code&gt; 改了就好了，但是这很不优雅，这里直接贴出我的解决方法，根据时间日期将打包文件放入特定目录，方便管理，发布的是 AppleStore 的包。&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;打包 App Store 版本&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;使用方法 `fastlane release scheme:[project | projectClone]`&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;private_lane&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:release&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;scheme&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:scheme&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;date&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;strftime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;%Y%m%d-%H%M&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;gym&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;scheme: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scheme&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
      &lt;span class=&quot;ss&quot;&gt;output_directory: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;../build/&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scheme&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;output_name: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scheme&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.ipa&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;clean: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;silent: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;include_symbols: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;export_method&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:'app-store'&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;sh&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;open ../../build/&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scheme&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;打包 App Store 版本&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;lane&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:releaseMaster&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;release&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;scheme: &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'project'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;打包 App Store Clone版本&quot;&lt;/span&gt;  
&lt;span class=&quot;n&quot;&gt;lane&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:releaseClone&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;release&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;scheme: &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'projectClone'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其实也没有什么好注释的了，把上面内容放入 Fastfile 就好了，这样就可以进行不同的打包，通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;private_lane&lt;/code&gt; 建立一个通用的 AppleStore 的打包过程，同时完成打包文件的路径文件命名，具体参考文档就OK了。&lt;/p&gt;

&lt;h2 id=&quot;使用&quot;&gt;使用&lt;/h2&gt;

&lt;p&gt;通过上面的配置，就可以简单的使用下面两个命令构建出不同帐号下面的发布包（通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fastlane list&lt;/code&gt; 也可以看到）：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;打包正常版本：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fastlane releaseMaster&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;打包影子版本：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fastlane releaseClone&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;有更多的包也可以如法炮制，Fastlane 确实是一个很好用的命令行工具。&lt;/p&gt;

&lt;h2 id=&quot;参考资料&quot;&gt;参考资料&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Advanced.md&quot;&gt;Advanced fastlane&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Appfile.md&quot;&gt;Fastlane Appfile&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
                 <tag>CI</tag>  <tag>Fastlane</tag> 
                 <tag>iOS</tag> 
                <pubTime>2017-07-07T14:35:34+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/flow-ci-fir-get-last-commit-message.html</loc>
        <lastmod>2017-07-03T16:40:53+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>flow.ci使用最后的commit信息作为Fir日志</title>
                <content>
&lt;p&gt;最近开始使用 flow.ci 进行客户端的自动构建并发布测试版本到 Fir 方便测试人员尽快测试反馈，好处不用说，不再需要每天手动打包并上传到 Fir。&lt;/p&gt;

&lt;h2 id=&quot;自动构建&quot;&gt;自动构建&lt;/h2&gt;

&lt;p&gt;进行自动构建的方法这里不再赘述，直接看 flow.ci 博客：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.flow.ci/ci-weekly170609/&quot;&gt;iOS 持续集成快速入门指南&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.flow.ci/practice_language_android_emulator/&quot;&gt;使用 flow.ci 实现 Android 自动化测试与持续集成&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;网上也有很多相关的文章，而且操作也很简单，直接导入项目，然后按照步骤配置后就可以完成自动构建，自动发布也很简单，参考&lt;a href=&quot;http://blog.flow.ci/practices-ios-automatic-build-kit/&quot;&gt;《iOS自动构建套件 - flow.ci + fir.im + Coding》&lt;/a&gt;就OK了。&lt;/p&gt;

&lt;h2 id=&quot;自定义fir日志&quot;&gt;自定义Fir日志&lt;/h2&gt;

&lt;p&gt;因为 flow.ci 是通过构建时候的环境变量对各个工作流进行配置，参考&lt;a href=&quot;http://blog.flow.ci/how-to-add-firim-version-updatelog-in-flowci/&quot;&gt;《如何在 flow.ci 中添加 fir.im 版本更新日志？》&lt;/a&gt;可以自定义 Fir 的更新日志，无非就是两部（看新UI下截图）：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;在 “fir.im 上传插件” 前面添加一个 “自定义脚本” 插件&lt;/li&gt;
  &lt;li&gt;在 “自定义脚本” 插件中 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;export&lt;/code&gt; 一个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FLOW_FIR_CHANGELOG&lt;/code&gt; 变量&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;如：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;export FLOW_FIR_CHANGELOG=&quot;update at $(date) flow.ci&quot;&lt;/code&gt;，然后保存就OK了。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2017/07/flowci-fir-1.png&quot;&gt;&lt;img src=&quot;/images/2017/07/flowci-fir-1.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;使用git的最后commit内容&quot;&gt;使用git的最后commit内容&lt;/h2&gt;

&lt;p&gt;虽然自定义了更新日志，但是内容只有个更新日期是没什么用的，测试时候不知道版本更新的内容就不知道测试的重点，最好就是把 git 上最后的commit message 作为日志，这样又简单又高效。&lt;/p&gt;

&lt;p&gt;既然是 bash 环境变量就好办了，使用这个命令就能拿到最后一条 commit 内容：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git log --oneline -n 1&lt;/code&gt;，具体的用法可以看 git 的文档，把这个命令的返回值赋给 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FLOW_FIR_CHANGELOG&lt;/code&gt; 就OK啦。&lt;/p&gt;

&lt;p&gt;所以上面的“自定义脚本”的内容就变成了： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;export FLOW_FIR_CHANGELOG=$(git log --oneline -n 1)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2017/07/flowci-fir-2.png&quot;&gt;&lt;img src=&quot;/images/2017/07/flowci-fir-2.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;官方文档给出更好的版本：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;export FLOW_FIR_CHANGELOG=$(git log --pretty=format:&quot;%s&quot; -1 $describe)&lt;/code&gt;，这也就只有文字内容了&lt;/p&gt;

&lt;h2 id=&quot;效果&quot;&gt;效果&lt;/h2&gt;

&lt;p&gt;这样就大功告成，效果如下：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2017/07/flowci-fir-3.png&quot;&gt;&lt;img src=&quot;/images/2017/07/flowci-fir-3.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;参考资料&quot;&gt;参考资料&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://git-scm.com/docs/git-log&quot;&gt;git-log&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.flow.ci/&quot;&gt;flow.ci博客&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
                 <tag>iOS</tag>  <tag>Android</tag>  <tag>CI</tag> 
                 <tag>解决问题</tag> 
                <pubTime>2017-07-03T16:40:53+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/run-python-on-spss.html</loc>
        <lastmod>2017-05-05T17:05:25+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用Python操作SPSS</title>
                <content>
&lt;p&gt;因为最近需要在 SPSS 的输出中提取出相应表格的内容数据并进行相应的计算，以便自动化处理输出的结果，所以开始研究了一下 SPSS 上的 Python 操作，使用 SpssClient 对输出进行处理。&lt;/p&gt;

&lt;p&gt;首先讲一下怎样在 SPSS 上运行 Python 脚本。&lt;/p&gt;

&lt;h2 id=&quot;使用-python&quot;&gt;使用 Python&lt;/h2&gt;

&lt;p&gt;使用 Python 脚本之前需要确保你安装了 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Python Essentials&lt;/code&gt;，有两种方式调用 Python 脚本（Python2 和 Python3 类似）。&lt;/p&gt;

&lt;h3 id=&quot;通过脚本运行&quot;&gt;通过脚本运行&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;编辑好了一个python脚本文件（*.py）&lt;/li&gt;
  &lt;li&gt;打开【运行脚本】对话框以后，直接选择打开并运行&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;在-syntax-中插入&quot;&gt;在 syntax 中插入&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;将 Python 代码插入到 syntax 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BEGIN PROGRAM&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;END PROGRAM&lt;/code&gt; 之间&lt;/li&gt;
  &lt;li&gt;选中所编写的代码以后，点击工具栏上面的绿色三角形，就可以运行&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;spssclient-入门&quot;&gt;SpssClient 入门&lt;/h2&gt;

&lt;p&gt;使用 Python 控制 SPSS 的时候，我们必须在使用 SPSS 的任何功能前，先启动 SPSS Client，这就是用到了 SpssClient 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StartClient&lt;/code&gt; 方法。&lt;/p&gt;

&lt;p&gt;假如我们完成了所有 SPSS 的工作，这时候我们就可以使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StopClient&lt;/code&gt; 方法来结束 SPSS Client 进程。&lt;/p&gt;

&lt;p&gt;假设在 syntax 中运行下面代码：&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;BEGIN&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PROGRAM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 导入 SpssClient 模块
&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;SpssClient&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 启动 SPSS Client
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SpssClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StartClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 打印当前工作目录
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SpssClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GetCurrentDirectory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 结束 SPSS Client
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SpssClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StopClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;END&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PROGRAM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;点击运行后就能看到相应的输出（根据系统还有版本会有不同）&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/Applications/IBM/SPSS/Statistics/24/SPSSStatistics.app/Contents
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;/images/2017/05/spss-1.png&quot;&gt;&lt;img src=&quot;/images/2017/05/spss-1.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;关于-spssclient&quot;&gt;关于 SpssClient&lt;/h2&gt;

&lt;p&gt;从下图可以看到 SpssClient 有五大功能类别：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DataDocList&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SyntaxDocsList&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OutputDocsList&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SpssServerConfList&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SpssScriptContext&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2017/05/spss-2.png&quot;&gt;&lt;img src=&quot;/images/2017/05/spss-2.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;datadoclist&quot;&gt;DataDocList&lt;/h3&gt;

&lt;p&gt;获取 SPSS 的数据文件列表。用它来读取、修改、操作数据，数据文件的后缀名是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sav&lt;/code&gt;。&lt;/p&gt;

&lt;h3 id=&quot;syntaxdocslist&quot;&gt;SyntaxDocsList&lt;/h3&gt;

&lt;p&gt;获取 SPSS 的 syntax 文件列表。里面都是 syntax 代码，或者可能掺杂有 Python 代码，它用于读取、修改、操作 syntax 代码，syntax 文件的后缀名是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sps&lt;/code&gt;。&lt;/p&gt;

&lt;h3 id=&quot;outputdocslist&quot;&gt;OutputDocsList&lt;/h3&gt;

&lt;p&gt;获取 SPSS 的统计结果输出文件列表。里面存放着 SPSS 的统计结果，我们可以在 Python 中使用该类来修改、操作结果数据，结果输出文件的后缀名是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;spv&lt;/code&gt;。&lt;/p&gt;

&lt;h3 id=&quot;spssserverconflist&quot;&gt;SpssServerConfList&lt;/h3&gt;

&lt;p&gt;该类用于 SPSS Server，也就是 SPSS 服务器。&lt;/p&gt;

&lt;h3 id=&quot;spssscriptcontext&quot;&gt;SpssScriptContext&lt;/h3&gt;

&lt;p&gt;该类用于返回脚本文件的环境。&lt;/p&gt;

&lt;h2 id=&quot;预告&quot;&gt;预告&lt;/h2&gt;

&lt;p&gt;下面的文章主要讨论和使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DataDocList&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OutputDocsList&lt;/code&gt;，用于获取数据文件还有输出的内容，特别是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OutputDocs&lt;/code&gt; 中 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OutputItem&lt;/code&gt; 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PivotTable&lt;/code&gt;， 用于获取输出数据中的表格。&lt;/p&gt;

</content>
                 <tag>SPSS</tag>  <tag>Python</tag> 
                 <tag>Python</tag> 
                <pubTime>2017-05-05T17:05:25+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/vue-require-remote-js.html</loc>
        <lastmod>2017-02-15T10:14:17+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Vue引入远程JS文件</title>
                <content>
&lt;h2 id=&quot;问题&quot;&gt;问题&lt;/h2&gt;

&lt;p&gt;最近在使用 Vue 做东西，用到钉钉扫描登录的功能，这里需要引入远程的 js 文件，因为 Vue 的方式跟之前的不太一样，又不想把文件下载到本地应用，找了一下解决的方法，貌似都需要引入第三方的库，最后找到了解决方案，分享之。&lt;/p&gt;

&lt;h2 id=&quot;思路&quot;&gt;思路&lt;/h2&gt;

&lt;p&gt;一开始的思路是在 Vue 加载完 Dom 之后（&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mounted&lt;/code&gt;），使用 JavaScript 脚本在 body 中插入远程的脚本文件。&lt;/p&gt;

&lt;p&gt;后来发现了 Vue 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;createElement&lt;/code&gt; 方法，简单的封装一个组件解决问题。&lt;/p&gt;

&lt;h2 id=&quot;解决方法&quot;&gt;解决方法&lt;/h2&gt;

&lt;p&gt;第一版代码（直接在操作 Dom ）如下：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;mounted&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;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;text/javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;https://g.alicdn.com/dingding/dinglogin/0.0.2/ddLogin.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;s&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;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;createElement&lt;/code&gt; 方法：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;components&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;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;dingtalk&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createElement&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
          &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;na&quot;&gt;attrs&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;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;text/javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
              &lt;span class=&quot;na&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;https://g.alicdn.com/dingding/dinglogin/0.0.2/ddLogin.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;p&quot;&gt;},&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;p&quot;&gt;},&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;c1&quot;&gt;// 使用 &amp;lt;dingtalk&amp;gt;&amp;lt;/dingtalk&amp;gt; 在页面中调用&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;终极方案&quot;&gt;终极方案&lt;/h2&gt;

&lt;p&gt;通过封装一个组件 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;remote-js&lt;/code&gt; 实现：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;components&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;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;remote-js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createElement&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;na&quot;&gt;attrs&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;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;text/javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;src&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;na&quot;&gt;props&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;na&quot;&gt;src&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;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&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;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;使用方法：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;remote-js&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;https://g.alicdn.com/dingding/dinglogin/0.0.2/ddLogin.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/remote-js&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;因为刚开始学习 Vue 有什么问题欢迎大家指出，大家一起讨论讨论。&lt;/p&gt;

&lt;h2 id=&quot;参考资料&quot;&gt;参考资料&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://vuejs.org/v2/guide/render-function.html&quot;&gt;Vue - Render Functions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
                 <tag>解决问题</tag>  <tag>JavaScript</tag> 
                 <tag>Vue</tag> 
                <pubTime>2017-02-15T10:14:17+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/install-x-pack-for-elasticsearch-and-kibana.html</loc>
        <lastmod>2016-12-12T12:03:20+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>给Elasticsearch和Kibana安装X-Pack</title>
                <content>
&lt;p&gt;刚刚把之前的 ELK 集群化，想到还是做一下监控比较好，因为已经都升级到了 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;5.x&lt;/code&gt;，所以决定使用官方的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X-Pack&lt;/code&gt; 来，因为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X-Pack&lt;/code&gt; 在免费授权里面提供了监控功能（也指提供了监控功能）。&lt;/p&gt;

&lt;p&gt;上个图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/12/x-pack-1.png&quot;&gt;&lt;img src=&quot;/images/2016/12/x-pack-1.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ELK 都通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yum&lt;/code&gt; 安装在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CentOS 7.2&lt;/code&gt; 的机器上。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Elasticsearch&lt;/code&gt; 被安装在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/share/elasticsearch&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Kibana&lt;/code&gt; 被安装在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/share/kibana/&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;下载&quot;&gt;下载&lt;/h2&gt;

&lt;p&gt;因为在国内直接通过网络安装速度实在是太慢了（你懂的），无法忍受，所以先把 X-Pack 下载到本地的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/tmp&lt;/code&gt; 目录。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;wget wget https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-5.1.1.zip /tmp
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样就能直接离线安装了。&lt;/p&gt;

&lt;h2 id=&quot;安装&quot;&gt;安装&lt;/h2&gt;

&lt;p&gt;直接安装下载到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/tmp/x-pack-5.1.1.zip&lt;/code&gt; 的安装包。&lt;/p&gt;

&lt;h3 id=&quot;elasticsearch&quot;&gt;Elasticsearch&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;注意：集群中的每台 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Elasticsearch&lt;/code&gt; 都是需要安装的&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;/usr/share/elasticsearch/bin/elasticsearch-plugin &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;file:///tmp/x-pack-5.1.1.zip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;kibana&quot;&gt;Kibana&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;注意：只需要安装在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Kibana&lt;/code&gt; 对应的机器上&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;/usr/share/kibana/bin/kibana-plugin &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;file:///tmp/x-pack-5.1.1.zip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;配置&quot;&gt;配置&lt;/h2&gt;

&lt;p&gt;因为打算使用免费授权来进行监控，所以一开始就只打开 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Monitoring&lt;/code&gt; 直接关掉了其他免费授权不提供的功能，例如：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Security&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Graph&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Watche&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Reporting&lt;/code&gt;。&lt;/p&gt;

&lt;h3 id=&quot;elasticsearch-1&quot;&gt;Elasticsearch&lt;/h3&gt;

&lt;p&gt;给 Elasticsearch 的配置文件添加下面的内容：&lt;/p&gt;

&lt;p&gt;&lt;em&gt;路径： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/elasticsearch/elasticsearch.yml&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# x-pack&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;xpack.security.enabled&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;xpack.monitoring.enabled&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;xpack.graph.enabled&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;xpack.watcher.enabled&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;kibana-1&quot;&gt;Kibana&lt;/h3&gt;

&lt;p&gt;给 Kibana 的配置文件添加下面的内容：&lt;/p&gt;

&lt;p&gt;&lt;em&gt;路径： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/kibana/kibana.yml&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# x-pcak&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;xpack.security.enabled&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;xpack.monitoring.enabled&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;xpack.graph.enabled&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;xpack.reporting.enabled&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;重启服务&quot;&gt;重启服务&lt;/h3&gt;

&lt;p&gt;现在安装和配置都已经完成，只需要重启服务就OK了。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;注意：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Kibana&lt;/code&gt; 重启时间比较长，貌似需要生成静态文件缓存&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;systemctl restart elasticsearch
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;systemctl restart kibana
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h2 id=&quot;授权&quot;&gt;授权&lt;/h2&gt;

&lt;p&gt;虽然只是使用免费授权，还是需要去注册才能拿到授权文件，直接在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Kibana&lt;/code&gt; 中进入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/app/monitoring&lt;/code&gt; 应该会看到试用授权过期时间的提示，点击进入后：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/12/x-pack-3.png&quot;&gt;&lt;img src=&quot;/images/2016/12/x-pack-3.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;可以在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Get Base&lt;/code&gt; 进入网站完成注册，最后会给你的邮箱发一个邮件，下载对应的 json 文件即可，假设下载的文件为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;license.json&lt;/code&gt; 放在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/tmp/license.json&lt;/code&gt; 中。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;注意：集群中的每台 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Elasticsearch&lt;/code&gt; 都是需要执行，同时记得文件前面的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@&lt;/code&gt; 符号&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;curl &lt;span class=&quot;nt&quot;&gt;-XPUT&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; elastic &lt;span class=&quot;s1&quot;&gt;'http://SID-HZ-ES1:9200/_xpack/license?acknowledge=true'&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; @/tmp/license.json
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;因为是免费授权，才需要加上 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;acknowledge=true&lt;/code&gt; 参数。&lt;/p&gt;

&lt;p&gt;享受你的 Monitoring 之旅吧。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/12/x-pack-2.png&quot;&gt;&lt;img src=&quot;/images/2016/12/x-pack-2.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>ELK</tag> 
                 <tag>服务器</tag> 
                <pubTime>2016-12-12T12:03:20+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/use-gitlab-ci-for-nodejs-project.html</loc>
        <lastmod>2016-11-01T15:24:36+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用 GitLab-CI 自动化 Node.js 项目测试</title>
                <content>
&lt;p&gt;很久前就更新了新版本的 GitLab，新版本一早就支持了 CI/CD 的功能，之前也部署过 GitLab 的 Runner，但是没有真正的用起来，最近就想把新的项目的 CI 与 CD 功能一起做起来，先从 Node.js 的项目开始，接下来一步步来吧。&lt;/p&gt;

&lt;h2 id=&quot;开启-pipelines&quot;&gt;开启 Pipelines&lt;/h2&gt;

&lt;p&gt;Gitlab CI Runner 的创建和配置就不多说了，网上的教程很多，接下来的文章就假定你已经有了一个使用 Docker 的 Runner。为什么使用 Docker 的 Runner ？因为这样可以兼容各种运行的环境，同时可以链接其他服务（例如：MySQL、MongoDB、Redis…）。&lt;/p&gt;

&lt;p&gt;如果你已经有 Share 的 Runner 同时项目默认也开启了 Builds 的功能，那么在项目主页应该可以看到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Pipelines&lt;/code&gt;  的选项，没有开启的话，可以在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Edit Project&lt;/code&gt; 的  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Feature Visibility&lt;/code&gt; 中设置 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Builds&lt;/code&gt; 为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Only team members&lt;/code&gt; （如下图）。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/11/gitlab-enable-builds.JPG&quot;&gt;&lt;img src=&quot;/images/2016/11/gitlab-enable-builds.JPG&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;最简单的测试&quot;&gt;最简单的测试&lt;/h2&gt;

&lt;p&gt;开启后，就是简单的问题了，你的 Node.js 项目一般都有 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test&lt;/code&gt; （没有测试做个毛线 CI ）。在项目的根目录下添加 ` .gitlab-ci.yml` 文件。内容如下：&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;node:6&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;before_script&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;npm install&lt;/span&gt;
  
&lt;span class=&quot;na&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;npm test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最简单的测试就完成，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;commit&lt;/code&gt; 并且 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;push&lt;/code&gt; 之后，就能看到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Pipelines&lt;/code&gt; 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Builds&lt;/code&gt; 中出现了在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;running&lt;/code&gt; 的项目，如果测试没问题，那么状态就会变成 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;passed&lt;/code&gt; 。&lt;/p&gt;

&lt;h2 id=&quot;链接外部服务&quot;&gt;链接外部服务&lt;/h2&gt;

&lt;p&gt;在项目重要用到外部服务（如：Redis、MongoDB）也很简单，通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;services&lt;/code&gt; 字段添加需要依赖服务的 Docker 镜像就可以了，如下：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-yams&quot;&gt;services:
  - mongo:3.2
  - redis:3-alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;在代码内就可以通过 hostname： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;redis&lt;/code&gt; 跟 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mongo&lt;/code&gt; 访问到 Redis 和 MongoDB 的服务（端口为默认端口号）&lt;/p&gt;

&lt;h2 id=&quot;加快速度&quot;&gt;加快速度&lt;/h2&gt;

&lt;p&gt;未来加快 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm&lt;/code&gt; 的安装速度，使用淘宝的镜像，把 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;before_script&lt;/code&gt; 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm install&lt;/code&gt; 改为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm install --registry=https://registry.npm.taobao.org&lt;/code&gt; 。&lt;/p&gt;

&lt;p&gt;同时可以缓存安装后的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;node_modules&lt;/code&gt; ，通过添加 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cache&lt;/code&gt; 字段：&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;paths&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;node_modules/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样在 build 成功的情况下，就能看到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Created cache&lt;/code&gt; ，下次运行就不需要安装那么多模块了。&lt;/p&gt;

&lt;h2 id=&quot;添加代码测试覆盖度&quot;&gt;添加代码测试覆盖度&lt;/h2&gt;

&lt;p&gt;Node.js 可以通过添加 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;istanbul&lt;/code&gt; 模块，为现有项目添加 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;coverage&lt;/code&gt; 功能，不需要改动原有的测试，只需要安装 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;istanbul&lt;/code&gt; 模块：&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;istanbul &lt;span class=&quot;nt&quot;&gt;--save-dev&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后把原来的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mocha&lt;/code&gt; 改成 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./node_modules/.bin/istanbul cover _mocha&lt;/code&gt; 就可以了。&lt;/p&gt;

&lt;p&gt;接下来只要修改 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CI/CD Pipelines&lt;/code&gt; 中的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Test coverage parsing&lt;/code&gt; 的内容为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;^Statements\s+:\s(\d+(?:\.\d+)?%)&lt;/code&gt; 就可以让 GitLab 自动获取到代码测试覆盖度的情况。如下图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/11/gitlab-test.JPG&quot;&gt;&lt;img src=&quot;/images/2016/11/gitlab-test.JPG&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;下方有获取对应分支 status 的代码。&lt;/p&gt;

&lt;h2 id=&quot;总结&quot;&gt;总结&lt;/h2&gt;

&lt;p&gt;最终的 ` .gitlab-ci.yml` 如下：&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;node:6&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;paths&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;node_modules/&lt;/span&gt;
  
&lt;span class=&quot;na&quot;&gt;services&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mongo:3.2&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;redis:3-alpine&lt;/span&gt;
  
&lt;span class=&quot;na&quot;&gt;before_script&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;npm install --registry=https://registry.npm.taobao.org&lt;/span&gt;
  
&lt;span class=&quot;na&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;./node_modules/.bin/istanbul cover _mocha&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;README&lt;/code&gt; 中加入相关的 status 后如下图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/11/gitlab-ststus-show.png&quot;&gt;&lt;img src=&quot;/images/2016/11/gitlab-ststus-show.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;还有其他的问题欢迎大家一起讨论。&lt;/p&gt;
</content>
                 <tag>Node.js</tag> 
                 <tag>GitLab</tag> 
                <pubTime>2016-11-01T15:24:36+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/fix-jekyll-bootstrap-build-warning.html</loc>
        <lastmod>2016-08-04T10:56:31+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>解决 JekyllBootstrap 中 theme.name 出错问题</title>
                <content>
&lt;h2 id=&quot;起源&quot;&gt;起源&lt;/h2&gt;

&lt;p&gt;自从 GitHub Pages 升级 3.1 之后，我使用 jekyll-bootstrap 的博客在每一次 push 都会收到 GitHub 的 “Page build warning” 邮件，内容如下：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The page build completed successfully, but returned the following warning:&lt;/p&gt;

  &lt;p&gt;You are currently using the Jekyll Bootstrap framework which has a known incompatibility with Jekyll v3.1. To fix this incompatibility, change &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;page.theme.name&lt;/code&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_includes/JB/setup&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;layout.theme.name&lt;/code&gt;.&lt;/p&gt;

  &lt;p&gt;Your site may not build properly until this change has been applied. For more information, see http://jekyllrb.com/docs/upgrading/2-to-3/#layout-metadata.&lt;/p&gt;

  &lt;p&gt;For information on troubleshooting Jekyll see:&lt;/p&gt;

  &lt;p&gt;https://help.github.com/articles/troubleshooting-jekyll-builds&lt;/p&gt;

  &lt;p&gt;If you have any questions you can contact us by replying to this email.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;疑惑&quot;&gt;疑惑&lt;/h2&gt;

&lt;p&gt;上面的邮件让我感到很疑惑，因为我在原有的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_includes/JB/setup&lt;/code&gt; 甚至整个项目就根本没有找到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;page.theme.name&lt;/code&gt; 甚至相关的配置，原来的配置如下：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% capture &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;jbcache&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;%}
  {% if site.JB.setup.provider == &quot;custom&quot; %}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% include &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;custom&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setup&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;%}
  {% else %}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% if &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;safe&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;JB&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;BASE_PATH&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;JB&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;BASE_PATH&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% assign &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;BASE_PATH&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;JB&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;BASE_PATH&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;%}
      {% assign HOME_PATH = site.JB.BASE_PATH %}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% else &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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% assign &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;BASE_PATH&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;%}
      {% assign HOME_PATH = &quot;/&quot; %}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% endif &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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% if &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;JB&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ASSET_PATH&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;%}
      {% assign ASSET_PATH = site.JB.ASSET_PATH %}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% elsif &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;safe&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;%}
      {% capture ASSET_PATH %}&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cdn_url&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;assets&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;sx&quot;&gt;% endcapture &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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% else &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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% capture &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ASSET_PATH&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;%}{{ BASE_PATH }&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;assets&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;sx&quot;&gt;% endcapture &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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% endif &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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% if &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;JB&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;IMAGE_PATH&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;%}
      {% assign IMAGE_PATH = site.JB.IMAGE_PATH %}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% elsif &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;safe&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;%}
      {% capture IMAGE_PATH %}&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cdn_url&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;images&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;sx&quot;&gt;% endcapture &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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% else &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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% capture &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;IMAGE_PATH&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;%}{{ BASE_PATH }&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;images&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;sx&quot;&gt;% endcapture &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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% endif &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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% endif &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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% endcapture &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;sx&quot;&gt;% assign &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;jbcache&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;%}

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;可以看到根本没有相关的配置，找了很多资料，最后终于找到了解决的方法。&lt;/p&gt;

&lt;h2 id=&quot;解决&quot;&gt;解决&lt;/h2&gt;

&lt;p&gt;原来在 jekyll-bootstrap 项目有人提交了一个 pull request ： &lt;a href=&quot;https://github.com/plusjade/jekyll-bootstrap/commit/8579232806a9f553aed95c85f9888b7e3ac3f76a&quot;&gt;Update setup to use layout.theme.name instead of page.theme.name if it exists&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;其中可以看到，原来的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;site.JB.ASSET_PATH&lt;/code&gt; 中的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;else&lt;/code&gt; 部分加入了下面代码：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% if &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;theme&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;%}
  {% capture ASSET_PATH %}&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{{&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;BASE_PATH&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;assets&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;themes&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;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;theme&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}}{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% endcapture &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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% else &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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% capture &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ASSET_PATH&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;%}{{ BASE_PATH }&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;assets&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;themes&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;n&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;theme&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}}{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% endcapture &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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;% end &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;根据上面修改我的配置后，GitHub 就没有给我发 warning 邮件了。修改记录： &lt;a href=&quot;https://github.com/yourtion/yourtion.github.io/commit/4b5ddb61fbf852c91eeada399792517472d0a779&quot;&gt;update setup&lt;/a&gt;&lt;/p&gt;

</content>
                 <tag>Jekyll</tag> 
                 <tag>解决问题</tag> 
                <pubTime>2016-08-04T10:56:31+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ios-custom-description-when-require-privacy.html</loc>
        <lastmod>2016-08-03T17:56:05+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>iOS自定义获取权限时的描述</title>
                <content>
&lt;p&gt;最近刚好遇到一个关于请求 iOS 用户摄像头权限时候提示的问题，想起之前在哪里看到过可以自定义访问地理位置时候权限描述的内容，但是 Google 了很久，没找到头绪。&lt;/p&gt;

&lt;p&gt;最后终于找到了 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSLocationAlwaysUsageDescription&lt;/code&gt; 这个 key，继续搜寻，终于在苹果的官方文档（&lt;a href=&quot;https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html&quot;&gt;Cocoa Keys&lt;/a&gt; ）中找到相关的内容，不敢独享，希望对你有帮助。&lt;/p&gt;

&lt;h2 id=&quot;使用方法&quot;&gt;使用方法&lt;/h2&gt;

&lt;p&gt;使用方法很简单，在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Info&lt;/code&gt; 中添加相关的 Key 即可（见下图）：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/08/privacy0.png&quot;&gt;&lt;img src=&quot;/images/2016/08/privacy0.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;或者使用代码的方式添加到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Info.plist&lt;/code&gt;，类似这样：&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;NSCameraUsageDescription&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;Yourtion need to access your camera&lt;span class=&quot;nt&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;效果&quot;&gt;效果&lt;/h2&gt;

&lt;p&gt;定义获取摄像头权限的描述为 ： “Yourtion need to access your camera”&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/08/privacy1.png&quot;&gt;&lt;img src=&quot;/images/2016/08/privacy1.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;权限描述&quot;&gt;权限描述&lt;/h2&gt;

&lt;p&gt;总结一下权限提示相关的内容：&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;权限 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Key&lt;/code&gt;&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Info 中的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;name&lt;/code&gt;&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;使用场景&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSBluetoothPeripheralUsageDescription&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;“Privacy - Bluetooth Peripheral Usage Description”&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;蓝牙设备权限用途描述&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSCalendarsUsageDescription&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;“Privacy - Calendars Usage Description”&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;日历权限用途描述&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSCameraUsageDescription&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;“Privacy - Camera Usage Description”&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;摄像头权限用途描述&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSContactsUsageDescription&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;“Privacy - Contacts Usage Description”&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;联系人权限用途描述&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSLocationAlwaysUsageDescription&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;“NSLocationAlwaysUsageDescription”&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;一直开启定位服务用途描述&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSLocationWhenInUseUsageDescription&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;“NSLocationWhenInUseUsageDescription”&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;需要时开启定位服务用途描述&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSLocationUsageDescription&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;“Privacy - Location Usage Description”&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;定位服务权限用途描述&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSMicrophoneUsageDescription&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;“Privacy - Microphone Usage Description”&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;麦克风权限用途描述&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSMotionUsageDescription&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;“Privacy - Motion Usage Description”&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;运动传感器权限用途描述&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSPhotoLibraryUsageDescription&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;“Privacy - Photo Library Usage Description”&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;相册权限用途描述&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSRemindersUsageDescription&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;“Privacy - Reminders Usage Description”&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;备忘录权限用途描述&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;具体的情节，支持的平台，请看苹果官方文档：&lt;a href=&quot;https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html&quot;&gt;Cocoa Keys&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>移动开发</tag>  <tag>解决问题</tag> 
                 <tag>iOS</tag> 
                <pubTime>2016-08-03T17:56:05+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/fix-reactnative-use-cameraroll-undefined.html</loc>
        <lastmod>2016-07-18T17:37:24+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>解决ReactNative使用CameraRoll时undefined错误</title>
                <content>
&lt;p&gt;最近在学习 ReactNative ，写到 CameraRoll 相关的 &lt;a href=&quot;https://github.com/yourtion/LearningReactNative/blob/master/DemoAPIs/CameraRollDemo.js&quot;&gt;CameraRoll Demo&lt;/a&gt; 时候，一直出现 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cannot read property 'getPhotos' of undefined&lt;/code&gt; 错误。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/07/RN_CameraRoll_0.png&quot;&gt;&lt;img src=&quot;/images/2016/07/RN_CameraRoll_0.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;这里 return 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RCTCameraRollManager.getPhotos(params);&lt;/code&gt; 是一个原生的模块 :&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/07/RN_CameraRoll_1.png&quot;&gt;&lt;img src=&quot;/images/2016/07/RN_CameraRoll_1.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;RCTCameraRollManager&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;NativeModules&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CameraRollManager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;研究了一下工程，发现根本没有相关的项目，只好手动添加，步骤如下：&lt;/p&gt;

&lt;p&gt;将 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RCTCameraRoll.xcodeproj&lt;/code&gt; 工程添加到现有工程中：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/07/RN_CameraRoll_2.png&quot;&gt;&lt;img src=&quot;/images/2016/07/RN_CameraRoll_2.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;路径位于 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;node_modules/react-native/Libraries/CameraRoll&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/07/RN_CameraRoll_3.png&quot;&gt;&lt;img src=&quot;/images/2016/07/RN_CameraRoll_3.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;添加静态库依赖：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/07/RN_CameraRoll_4.png&quot;&gt;&lt;img src=&quot;/images/2016/07/RN_CameraRoll_4.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/07/RN_CameraRoll_5.png&quot;&gt;&lt;img src=&quot;/images/2016/07/RN_CameraRoll_5.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;大功告成：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/07/RN_CameraRoll_6.png&quot;&gt;&lt;img src=&quot;/images/2016/07/RN_CameraRoll_6.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>React Native</tag>  <tag>iOS</tag> 
                 <tag>解决问题</tag> 
                <pubTime>2016-07-18T17:37:24+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/update-react-native-029-bug.html</loc>
        <lastmod>2016-07-08T16:13:03+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>升级 ReactNative 0.29 踩坑</title>
                <content>
&lt;p&gt;今天看到 ReactNative 0.29 可以升级，就打算给我最近在写的 &lt;a href=&quot;https://github.com/yourtion/ReactNative-SuperID&quot;&gt;ReactNative-SuperID&lt;/a&gt; 也升级一下。&lt;/p&gt;

&lt;p&gt;一升级后发现 Android 的 Sample 项目运行不了，出现下面的错误：&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;FATAL&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;EXCEPTION:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;
&lt;span class=&quot;nl&quot;&gt;Process:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;yourtion&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;superid_rn&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;PID:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8729&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;RuntimeException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Unable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;activity&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ComponentInfo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;yourtion&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;superid_rn&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;yourtion&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;superid_rn&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;SuperIDRNActivity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;}:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ClassCastException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Application&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cannot&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;be&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cast&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;facebook&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;react&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ReactApplication&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;performLaunchActivity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2298&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;handleLaunchActivity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2360&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;access&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;144&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;$H&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;handleMessage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1278&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Handler&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;dispatchMessage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Handler&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;102&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Looper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Looper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;135&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5221&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;reflect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;invoke&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Native&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;reflect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;invoke&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;372&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;internal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ZygoteInit&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;$MethodAndArgsCaller&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ZygoteInit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;899&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;internal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ZygoteInit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ZygoteInit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;694&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;Caused&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;by:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ClassCastException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Application&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cannot&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;be&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cast&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;facebook&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;react&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ReactApplication&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;facebook&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;react&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ReactActivity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getReactNativeHost&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ReactActivity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;79&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;facebook&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;react&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ReactActivity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;onCreate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ReactActivity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;107&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Activity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;performCreate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Activity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5933&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Instrumentation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;callActivityOnCreate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Instrumentation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1105&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;performLaunchActivity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2251&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;handleLaunchActivity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2360&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;access&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;144&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;$H&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;handleMessage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1278&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Handler&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;dispatchMessage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Handler&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;102&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Looper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Looper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;135&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ActivityThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5221&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;reflect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;invoke&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Native&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;reflect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;invoke&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;372&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;internal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ZygoteInit&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;$MethodAndArgsCaller&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ZygoteInit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;899&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;internal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ZygoteInit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ZygoteInit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;694&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;原来，升级后需要对原有项目进行如下升级 （参考：&lt;a href=&quot;https://github.com/facebook/react-native/releases/tag/v0.29.0&quot;&gt;Releases 0.29.0&lt;/a&gt;）：&lt;/p&gt;

&lt;p&gt;创建 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MainApplication.java&lt;/code&gt; 并按照 &lt;a href=&quot;https://github.com/facebook/react-native/blob/0.29-stable/local-cli/generator-android/templates/package/MainApplication.java&quot;&gt;这个&lt;/a&gt; 修改：&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&amp;gt;;&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;android.app.Application&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;android.util.Log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;com.facebook.react.ReactApplication&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;com.facebook.react.ReactInstanceManager&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;com.facebook.react.ReactNativeHost&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;com.facebook.react.ReactPackage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;com.facebook.react.shell.MainReactPackage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.util.Arrays&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.util.List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MainApplication&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Application&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReactApplication&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReactNativeHost&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mReactNativeHost&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReactNativeHost&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getUseDeveloperSupport&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BuildConfig&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;DEBUG&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ReactPackage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getPackages&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Arrays&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ReactPackage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;asList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
          &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;MainReactPackage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;};&lt;/span&gt;

  &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReactNativeHost&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getReactNativeHost&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mReactNativeHost&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;按照 &lt;a href=&quot;https://github.com/facebook/react-native/blob/0.29-stable/local-cli/generator-android/templates/package/MainActivity.java&quot;&gt;这个&lt;/a&gt; 更新 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MainActivity.java&lt;/code&gt; ：&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&amp;gt;;&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;com.facebook.react.ReactActivity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MainActivity&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReactActivity&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;cm&quot;&gt;/**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getMainComponentName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;%= name %&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;更新 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AndroidManifest.xml&lt;/code&gt; 添加 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;android:name=&quot;.MainApplication&quot;&lt;/code&gt; ：&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;application&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;+&lt;/span&gt;   &lt;span class=&quot;na&quot;&gt;android:name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.MainApplication&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;android:allowBackup=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;true&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;android:label=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;@string/app_name&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;android:icon=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;@mipmap/ic_launcher&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;android:theme=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;@style/AppTheme&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样更新后，项目就可以正常运行啦～&lt;/p&gt;
</content>
                 <tag>Android</tag> 
                 <tag>ReactNative</tag> 
                <pubTime>2016-07-08T16:13:03+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/base64-in-url.html</loc>
        <lastmod>2016-06-14T17:21:56+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>关于Base64在URL的编码问题</title>
                <content>
&lt;p&gt;前段在做AES的加密框架，对加密后的 NSData 进行 base64 编码后发起网络请求，但是因为 url 编码问题，会导致转换后的 base64 字符串在服务端解析一直失败。&lt;/p&gt;

&lt;p&gt;为此特地又研究了一下 base64 编码规范（&lt;a href=&quot;https://zh.wikipedia.org/wiki/Base64&quot;&gt;Wiki:Base64&lt;/a&gt;）发现了原来针对 URL 这样特定的环境，对编码的字符可以有特定的修改版本。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;标准的Base64并不适合直接放在URL里传输，因为URL编码器会把标准Base64中的“/”和“+”字符变为形如“%XX”的形式，而这些“%”号在存入数据库时还需要再进行转换，因为ANSI SQL中已将“%”号用作通配符。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;为解决此问题，可采用一种用于URL的改进Base64编码，它不在末尾填充’=’号，并将标准Base64中的“+”和“/”分别改成了“-”和“_”，这样就免去了在URL编解码和数据库存储时所要作的转换，避免了编码信息长度在此过程中的增加，并统一了数据库、表单等处对象标识符的格式。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;也就是说，针对 URL 请求的场景，使用“-”和“_”替代规范中的“+”和“/”，同时“＝”可以省略，测试了一下，发现确实可行，&lt;/p&gt;

&lt;p&gt;可以使用下面的函数进行 encode 和 decode ：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nf&quot;&gt;base64URLencode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nv&quot;&gt;source&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;source&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;stringByReplacingOccurrencesOfString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;/&quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;withString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;_&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stringByReplacingOccurrencesOfString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;+&quot;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;withString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;-&quot;&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;k&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nf&quot;&gt;base64URLdecode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nv&quot;&gt;source&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;source&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;stringByReplacingOccurrencesOfString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;_&quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;withString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stringByReplacingOccurrencesOfString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;-&quot;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;withString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;+&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;原有 Objective－C 下的 base64 生成代码就变成了下面的样子：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;@implementation&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;NSData&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;Encryption&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Base64EncodingTable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;64&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;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;sc&quot;&gt;'A'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'B'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'C'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'D'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'E'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'F'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'G'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'H'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'I'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'J'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'K'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'L'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'M'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'N'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'O'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'P'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;sc&quot;&gt;'Q'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'R'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'S'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'T'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'U'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'V'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'W'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'X'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'Y'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'Z'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'a'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'b'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'c'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'d'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'e'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'f'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;sc&quot;&gt;'g'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'h'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'i'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'j'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'k'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'l'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'m'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'n'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'o'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'p'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'q'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'r'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'s'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'t'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'u'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'v'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;sc&quot;&gt;'w'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'x'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'y'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'z'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'1'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'2'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'3'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'4'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'5'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'6'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'7'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'8'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'9'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'-'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'_'&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;n&quot;&gt;base64String&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ixtext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lentext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ctremaining&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;short&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;charsonline&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;ctcopy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;raw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSMutableString&lt;/span&gt; &lt;span class=&quot;o&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;span class=&quot;n&quot;&gt;lentext&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;n&quot;&gt;self&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lentext&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&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;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;@&quot;&quot;&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;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;n&quot;&gt;NSMutableString&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;stringWithCapacity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lentext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;raw&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;n&quot;&gt;self&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;ixtext&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;true&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;ctremaining&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lentext&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ixtext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ctremaining&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&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;k&quot;&gt;break&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;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&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;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ix&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ixtext&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ix&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lentext&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;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;i&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;raw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ix&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;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;i&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;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;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xFC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&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;n&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x03&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&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;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xF0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0F&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&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;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xC0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&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;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x3F&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;ctcopy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ctremaining&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;k&quot;&gt;case&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;ctcopy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;case&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;n&quot;&gt;ctcopy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;break&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;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ctcopy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&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;p&quot;&gt;{&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;nf&quot;&gt;appendString&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;NSString&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;stringWithFormat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;@&quot;%c&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Base64EncodingTable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;i&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;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ctcopy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&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;p&quot;&gt;{&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;nf&quot;&gt;appendString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;@&quot;=&quot;&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;ixtext&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;charsonline&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        
        &lt;span class=&quot;n&quot;&gt;NSUInteger&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;length&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;n&quot;&gt;self&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&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;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;charsonline&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;length&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;charsonline&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&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;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;@end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>iOS</tag> 
                 <tag>解决问题</tag> 
                <pubTime>2016-06-14T17:21:56+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/is-osx-app-enable-http.html</loc>
        <lastmod>2016-06-12T12:01:01+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>判断Mac应用是否开放HTTP权限</title>
                <content>
&lt;p&gt;之前写过关于在 iOS 应用上判断是非开启 HTTP 请求权限的文章&lt;a href=&quot;/is-ios-app-enable-http.html&quot;&gt;《判断iOS应用是否开放HTTP权限》&lt;/a&gt;。最近在把 &lt;a href=&quot;https://github.com/yourtion/HTTPDNS-OC&quot;&gt;HTTPDNS&lt;/a&gt; 的库进行 OSX 上的兼容。发现 Mac 上的 app 也会有 HTTP 权限的问题。&lt;/p&gt;

&lt;p&gt;解决方法参考（操作是一致的）：&lt;a href=&quot;/ios9-http-blocked.html&quot;&gt;《解决iOS9下blocked cleartext HTTP》&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app’s Info.plist file.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;判断的方法类似，分享之：&lt;/p&gt;

&lt;h3 id=&quot;获取-mac-版本&quot;&gt;获取 Mac 版本&lt;/h3&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;NSDictionary&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;systemVersionDictionary&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;n&quot;&gt;NSDictionary&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;dictionaryWithContentsOfFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;@&quot;/System/Library/CoreServices/SystemVersion.plist&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;systemVersion&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;n&quot;&gt;systemVersionDictionary&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;objectForKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;ProductVersion&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;判断-osx-版本是否大于-1011&quot;&gt;判断 OSX 版本是否大于 10.11&lt;/h3&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;systemVersion&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;compare&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;10.11&quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSNumericSearch&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;NSOrderedAscending&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;判断-http-权限&quot;&gt;判断 HTTP 权限&lt;/h3&gt;

&lt;p&gt;权限判断方法跟 iOS 的一致：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;NSDictionary&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;systemVersionDictionary&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;n&quot;&gt;NSDictionary&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;dictionaryWithContentsOfFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;/System/Library/CoreServices/SystemVersion.plist&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;systemVersionDictionary&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;objectForKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;ProductVersion&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;compare&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;10.11&quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSNumericSearch&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;NSOrderedAscending&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSDictionary&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;infoDict&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;n&quot;&gt;NSBundle&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;mainBundle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;infoDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;infoDict&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;objectForKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;NSAppTransportSecurity&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;objectForKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;NSAllowsArbitraryLoads&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;boolValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;ios-与-osx-统一的判断方法&quot;&gt;iOS 与 OSX 统一的判断方法&lt;/h3&gt;

&lt;p&gt;想判断系统版本：iOS 大于 9.0 或者 OSX 大于 10.11，再去 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;info.plist&lt;/code&gt; 判断 &lt;a href=&quot;https://gist.github.com/yourtion/9349476b151ffa035200af37cbeb1a3a&quot;&gt;Gist&lt;/a&gt;：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BOOL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;needTransportSecurity&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;#if TARGET_OS_IPHONE
&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIDevice&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;currentDevice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;systemVersion&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;compare&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;9.0&quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSNumericSearch&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;NSOrderedAscending&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;YES&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;cp&quot;&gt;#elif TARGET_OS_MAC
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;NSDictionary&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;systemVersionDictionary&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;n&quot;&gt;NSDictionary&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;dictionaryWithContentsOfFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;/System/Library/CoreServices/SystemVersion.plist&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;systemVersionDictionary&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;objectForKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;ProductVersion&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;compare&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;10.11&quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSNumericSearch&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;NSOrderedAscending&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;YES&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;cp&quot;&gt;#endif
&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;NO&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;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BOOL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isHTTPEnable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;needTransportSecurity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]){&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;NSDictionary&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;infoDict&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;n&quot;&gt;NSBundle&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;mainBundle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;infoDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;infoDict&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;objectForKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;NSAppTransportSecurity&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;objectForKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;NSAllowsArbitraryLoads&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;boolValue&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>Mac</tag> 
                <pubTime>2016-06-12T12:01:01+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/is-ios-app-enable-http.html</loc>
        <lastmod>2016-03-23T13:59:49+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>判断iOS应用是否开放HTTP权限</title>
                <content>
&lt;p&gt;从 iOS9 起，新特性要求 App 访问网络请求，要采用 HTTPS 协议。但是能不能判断开发者是否允许 HTTP 的请求，这样就不会在发起请求时候失败同时弹出以下信息：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app’s Info.plist file.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;这个需求其实是最近在弄 HTTPDNS 相关的一些东西，只能通过 HTTP 接口请求，但是希望能判断应用是否允许了 HTTP 的访问，如果允许才开启 HTTPDNS 相关的功能。&lt;/p&gt;

&lt;p&gt;解决方法比较简单，其实就是读取 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;info.plist&lt;/code&gt; 看看 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSAppTransportSecurity&lt;/code&gt; 是否为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;YES&lt;/code&gt;。&lt;/p&gt;

&lt;h2 id=&quot;objective-c-实现&quot;&gt;Objective-C 实现&lt;/h2&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BOOL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isHTTPEnable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIDevice&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;currentDevice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;systemVersion&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;compare&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;9.0&quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSNumericSearch&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;NSOrderedAscending&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSDictionary&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;infoDict&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;n&quot;&gt;NSBundle&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;mainBundle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;infoDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;infoDict&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;objectForKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;NSAppTransportSecurity&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;objectForKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;NSAllowsArbitraryLoads&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;boolValue&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;使用方法：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;isHTTPEnable&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;NSLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;HTTP enable&quot;&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;k&quot;&gt;else&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;@&quot;HTTP disable&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;swift-实现&quot;&gt;Swift 实现&lt;/h2&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;isHTTPEnable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Bool&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;flag&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIDevice&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;currentDevice&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;systemVersion&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;compare&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;9.0.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;NSStringCompareOptions&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;NumericSearch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;flag&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;OrderedAscending&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;k&quot;&gt;guard&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;infoDict&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;NSBundle&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mainBundle&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;infoDictionary&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;guard&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;appTransportSecurity&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;infoDict&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;NSAppTransportSecurity&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;guard&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;allowsArbitraryLoads&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;appTransportSecurity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;NSAllowsArbitraryLoads&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;guard&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;allowsArbitraryLoads&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as!&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Bool&lt;/span&gt; 
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;使用方法：&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;isHTTPEnable&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;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;HTTP enable&quot;&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;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;HTTP disable&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>iOS</tag> 
                <pubTime>2016-03-23T13:59:49+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/install-swift-and-solve-library-not-loaded.html</loc>
        <lastmod>2016-03-21T19:00:04+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Swift开发环境搭建及问题解决</title>
                <content>
&lt;p&gt;最近打算研究一下使用 Swift 写服务器端代码，折腾了一下在 Mac 上安装 Dev 版本的 Swift，结果还踩了很大的一个坑，安装完成后一直显示&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dyld: Library not loaded: @rpath/libswiftCore.dylib&lt;/code&gt;，找了很多资料都是在工程中的解决方法，摸索了好一段时间终于解决了问题。&lt;/p&gt;

&lt;h2 id=&quot;安装swift&quot;&gt;安装Swift&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;从 Swift 的官方网站下载最新的 Swift 的开发版”Latest Development Snapshots“&lt;/li&gt;
  &lt;li&gt;点击安装，安装完成后 Xcode toolchain 位于 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/Library/Developer/Toolchains/ &lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;添加 Swift toolchain 到 PATH 上：在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.bashrc&lt;/code&gt;末尾添加:
 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:$PATH&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;重新打开终端，输入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swift --version&lt;/code&gt;可以看到如下信息就是安装已经完成。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;swift &lt;span class=&quot;nt&quot;&gt;--version&lt;/span&gt;
Apple Swift version 3.0-dev &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;LLVM 699a786c15, Clang 77080f2c03, Swift d22638766e&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Target: x86_64-apple-macosx10.9

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;解决-dyld-library-not-loaded&quot;&gt;解决 dyld: Library not loaded&lt;/h2&gt;

&lt;p&gt;安装完 Swift 的“Xcode Swift Development Snapshot”后，在终端行执行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swift build --help&lt;/code&gt; 出现下列错误：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;swift build &lt;span class=&quot;nt&quot;&gt;--help&lt;/span&gt;
dyld: Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-16-a.xctoolchain/usr/bin/swift-build
  Reason: image not found
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1]    14293 trace &lt;span class=&quot;nb&quot;&gt;trap  &lt;/span&gt;swift build &lt;span class=&quot;nt&quot;&gt;--help&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;意思大概是指找不到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libswiftCore.dylib&lt;/code&gt;。网上很多的解决&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dyld: Library not loaded&lt;/code&gt;的文章都是说在工程中如何解决这个问题，对于在终端运行的问题没有相关的答案。&lt;/p&gt;

&lt;p&gt;研究了一番，解决问题的关键在于 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libswiftCore&lt;/code&gt; 的文件位置查找，在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.bashrc&lt;/code&gt;末尾添加：&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;export DYLD_LIBRARY_PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/lib/swift/macosx:$DYLD_LIBRARY_PATH&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;将动态库的查找位置添加到环境变量中即可。&lt;/p&gt;

&lt;p&gt;此时重新执行``，会看到如下输出就是工作已经正常：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;swift build &lt;span class=&quot;nt&quot;&gt;--help&lt;/span&gt;
OVERVIEW: Build sources into binary products

USAGE: swift build &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;options]

MODES:
  &lt;span class=&quot;nt&quot;&gt;--configuration&lt;/span&gt; &amp;lt;value&amp;gt;        Build with configuration &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;debug|release&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--clean&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[=&lt;/span&gt;&amp;lt;mode&amp;gt;]               Delete artefacts &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;build|dist&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--init&lt;/span&gt; &amp;lt;mode&amp;gt;                  Creates a new Swift package &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;executable|library&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--fetch&lt;/span&gt;                        Fetch package dependencies
  &lt;span class=&quot;nt&quot;&gt;--generate-xcodeproj&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&amp;lt;path&amp;gt;]  Generates an Xcode project &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;this package &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;

OPTIONS:
  &lt;span class=&quot;nt&quot;&gt;--chdir&lt;/span&gt; &amp;lt;value&amp;gt;    Change working directory before any other operation &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;v]              Increase verbosity of informational output
  &lt;span class=&quot;nt&quot;&gt;-Xcc&lt;/span&gt; &amp;lt;flag&amp;gt;        Pass flag through to all C compiler instantiations
  &lt;span class=&quot;nt&quot;&gt;-Xlinker&lt;/span&gt; &amp;lt;flag&amp;gt;    Pass flag through to all linker instantiations
  &lt;span class=&quot;nt&quot;&gt;-Xswiftc&lt;/span&gt; &amp;lt;flag&amp;gt;    Pass flag through to all Swift compiler instantiations
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;测试编译&quot;&gt;测试编译&lt;/h2&gt;

&lt;p&gt;创建 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Hello&lt;/code&gt; 工程：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;Hello
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;Hello
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;touch &lt;/span&gt;Package.swift
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;创建 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sources/&lt;/code&gt; 目录并添加 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;main.swift&lt;/code&gt; 文件：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;Sources
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;Sources
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;touch &lt;/span&gt;main.swift
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;open main.swift
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;main.swift&lt;/code&gt; 文件中输入并保存：&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Hello, world!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;回到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Hello&lt;/code&gt; 目录并执行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swift build&lt;/code&gt; 命令：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; ..
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;swift build
Compiling Swift Module &lt;span class=&quot;s1&quot;&gt;'Hello'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1 sources&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Linking .build/debug/Hello
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;执行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.build/debug/Hello&lt;/code&gt;：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;.build/debug/Hello
Hello, world!
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;看到 “Hello, world!” 就是没问题啦。&lt;/p&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>Mac</tag> 
                <pubTime>2016-03-21T19:00:04+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/extract-weichat-data-without-jailbreak.html</loc>
        <lastmod>2016-03-17T13:06:37+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>不越狱导出iPhone微信数据教程</title>
                <content>
&lt;p&gt;最近打算研究微信群聊的数据，想从 iPhone 上导出微信的数据，然后可以直接拿到微信的数据库，因为 iOS 上微信的数据库没有加密。这也就省去了研究怎么解密的烦恼。&lt;/p&gt;

&lt;p&gt;如果 iPhone 已经越狱（越狱了你就有各种工具破除沙盒限制）或者你是使用 Windows 那么操作就相对简单（我记得 Windows 上有现成的导出工具）。&lt;/p&gt;

&lt;p&gt;但是我不想因为这件事去把 iPhone 越狱，也懒得去折腾 Windows（你懂的）。最后找到了在 Mac 上从 iTunes 备份中提取微信数据（不止是微信，其他 APP 也可以）的方法，下面一步步跟我来操作。&lt;/p&gt;

&lt;h2 id=&quot;备份数据&quot;&gt;备份数据&lt;/h2&gt;

&lt;p&gt;把手机连接上电脑并打开 iTunes，找到手机的选项卡，如下图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/03/backup0.png&quot;&gt;&lt;img src=&quot;/images/2016/03/backup0.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;在 Backups 栏中，去掉 “Encrypt iPhone backup” 的勾选，千万不能加密备份，否则你拿到的数据所有文件都是 iTunes 加密过的，没办法正常打开；&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/03/backup1.png&quot;&gt;&lt;img src=&quot;/images/2016/03/backup1.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;点击 ”Back Up Now“ 把你的 iPhone 备份到你的 Mac 上，再次确认 ”Don’t Encrypt“；&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/03/backup2.png&quot;&gt;&lt;img src=&quot;/images/2016/03/backup2.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;等待 iPhone 备份完成（漫长的等待，64G也有不好的地方），你可以看到 ”Latest Backups” 里面已经有今天的备份在你的电脑上了。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/03/backup3.png&quot;&gt;&lt;img src=&quot;/images/2016/03/backup3.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;提取数据&quot;&gt;提取数据&lt;/h2&gt;

&lt;p&gt;经过上面的备份步骤，你的 Mac 上已经有一份 iPhone 数据的存档，接下来就是在备份中导出需要的数据。&lt;/p&gt;

&lt;p&gt;你可以手工去 iTunes 的备份目录找文件，解析 plist 等，也有相关的教程（请自行Google），但是我觉得太麻烦了，还是找个工具好了。&lt;/p&gt;

&lt;p&gt;这时候祭出神器 ”iPhone / iPod Touch Backup Extractor“ 下载地址：&lt;a href=&quot;http://supercrazyawesome.com/&quot;&gt;http://supercrazyawesome.com/&lt;/a&gt;，这只是众多提取工具中的一个，用它的主要原因是简单、免费、功能单一。&lt;/p&gt;

&lt;p&gt;打开软件后选择 ”Read Backups“&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/03/extract1.png&quot;&gt;&lt;img src=&quot;/images/2016/03/extract1.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;找到你手机最新的备份（我只有一个就不需要找了）&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/03/extract2.png&quot;&gt;&lt;img src=&quot;/images/2016/03/extract2.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;打开后就能看的你手机中安装的 APP 的数据备份列表，我们要找的微信的 ”Application Name“ 是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;com.tencent.xin&lt;/code&gt;，其他的 APP 的名字也基本可以猜出来，这个可以自己把玩。&lt;/p&gt;

&lt;p&gt;选择后点击 ”Extract“，选择导出到你本地的慢慢来就 OK 了。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/03/extract3.png&quot;&gt;&lt;img src=&quot;/images/2016/03/extract3.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;导出完成后目录会自己打开（如下图），熟悉 iOS 开发的朋友就发现了，这两个文件夹就是 APP 的沙盒中的内容。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2016/03/extract4.png&quot;&gt;&lt;img src=&quot;/images/2016/03/extract4.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;数据导出来了，接下来就是怎么样用，怎么分析了。&lt;/p&gt;

&lt;p&gt;欲知后事如何，请听下回分解。&lt;/p&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>Mac</tag> 
                <pubTime>2016-03-17T13:06:37+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/solve-dismissviewcontroller-blink.html</loc>
        <lastmod>2016-03-14T13:44:09+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>巧妙化解dismissViewController闪烁问题</title>
                <content>
&lt;h2 id=&quot;问题描述&quot;&gt;问题描述&lt;/h2&gt;

&lt;p&gt;最近项目里面涉及到一个解锁的界面，这个提示解锁界面在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;present&lt;/code&gt; 一个人脸解锁的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ViewController&lt;/code&gt; ，人脸解锁完成后会有一个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delegate&lt;/code&gt; 回调人脸验证结果，并且人脸验证界面自动 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dismiss&lt;/code&gt; 掉。&lt;/p&gt;

&lt;p&gt;如果解锁成功的话，逻辑上人脸验证界面一 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dismiss&lt;/code&gt; 掉就应该显示 app 的主界面，相对于提示解锁界面在人脸验证 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dismiss&lt;/code&gt; 同时应该消失。而人脸验证失败的话，提示解锁界面就应该继续覆盖在主界面上，给用户更多提示并引导进一步的操作。&lt;/p&gt;

&lt;p&gt;这里面就涉及到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ViewController&lt;/code&gt; 生命周期的问题，由提示解锁界面 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;present&lt;/code&gt; 的人脸验证界面没有完全 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dismiss&lt;/code&gt; 之前是没办法 dismiss 掉解锁界面的，否则就可能出现空指针等问题。&lt;/p&gt;

&lt;p&gt;同时使用的SDK并没有回调 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;viewWillDisappear&lt;/code&gt; 事件，所以 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delegate&lt;/code&gt; 回调跟 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;viewWillDisappear&lt;/code&gt; 的关系与顺序是不可预测的。如果在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delegate&lt;/code&gt; 回调中执行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dismiss&lt;/code&gt;，那么在人脸验证界面消失的时候就会看到提示解锁界面闪了一下。&lt;/p&gt;

&lt;p&gt;本来打算使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIView&lt;/code&gt; 来解决这个问题，但是因为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIView&lt;/code&gt; 没有办法接受 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delegate&lt;/code&gt; 回调，就会引入更多奇怪的问题。最后终于想到了一个不算特别优雅，但是很巧妙的方式解决这个问题。分享之，希望对你有帮助。&lt;/p&gt;

&lt;h2 id=&quot;解决思路&quot;&gt;解决思路&lt;/h2&gt;

&lt;p&gt;既然不能直接 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dismiss&lt;/code&gt;，那么是否可以将这个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ViewController&lt;/code&gt; 透明呢，也就是在人脸验证界面 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;present&lt;/code&gt; 完成后，将提示解锁界面变成透明的，然后如果回调结果不是，马上设置提示解锁界面为原来的值。&lt;/p&gt;

&lt;p&gt;经过查找资料和做了简单的原型验证后，发行这个方法可行，也很简单，下面以 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Swift&lt;/code&gt; 代码简单进行演示&lt;/p&gt;

&lt;h2 id=&quot;解决方法&quot;&gt;解决方法&lt;/h2&gt;

&lt;p&gt;首先在显示解锁提示页面设置相关的属性，这里以 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Segue&lt;/code&gt; 实现为例。&lt;/p&gt;

&lt;p&gt;主要设置两个参数：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;modalPresentationStyle&lt;/code&gt; 设置为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OverCurrentContext&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.modalTransitionStyle&lt;/code&gt; 设置为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CrossDissolve&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;prepareForSegue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;segue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIStoryboardSegue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;AnyObject&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;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;segue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;identifier&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;ShowLockVC&quot;&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;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lockedVC&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;LockedViewController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;segue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;destinationViewController&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as!&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;LockedViewController&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;lockedVC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;modalPresentationStyle&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;OverCurrentContext&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;lockedVC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;modalTransitionStyle&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;CrossDissolve&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;接下来当人脸验证界面 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;present&lt;/code&gt; 完成后将当前界面（解锁提示）的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;alpha&lt;/code&gt; 设置为 0，让界面透明：&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;presentViewController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;faceVerifyView&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as!&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIViewController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;animated&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;completion&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;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Void&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;view&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;alpha&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最后就是处理人脸验证回调结果，如果成功则 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dismiss&lt;/code&gt; 解锁提示界面（人脸验证界面会自动 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dismiss&lt;/code&gt;）：&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;superID&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SuperID&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;n&quot;&gt;faceVerifyResponse&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SIDFACEVerifyState&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;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;state&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SIDFACEVerifyState&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;SIDFaceVerifySucceed&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;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dismissViewControllerAnimated&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;completion&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;nil&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;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;view&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;alpha&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;问题就这样解决了。&lt;/p&gt;

&lt;h3 id=&quot;参考&quot;&gt;参考&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/PresentingaViewController.html&quot;&gt;《Presenting a View Controller》&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.csdn.net/chaoyuan899/article/details/38390507&quot;&gt;《关于presentViewController的后的background变黑的问题》&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>iOS</tag> 
                <pubTime>2016-03-14T13:44:09+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/static-code-analysis-ios-using-oclint.html</loc>
        <lastmod>2016-02-29T12:27:17+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用OClint进行iOS项目的静态代码扫描</title>
                <content>
&lt;p&gt;最近需要一个静态分析代码工具，帮助我们发布运行应用前找到代码潜在的问题。&lt;/p&gt;

&lt;p&gt;其实对于iOS开发，我们的日常开发上已经用到了这样一个静态分析的工具，那就是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Clang&lt;/code&gt;， &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Clang&lt;/code&gt; 是支持 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C++&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Objective-C&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Swift&lt;/code&gt; 的一个前端编译工具，他将 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OC&lt;/code&gt; 或者 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Swift&lt;/code&gt; 的代码输出抽象语法树(Abstract Syntax Tree)，然后编译成 LLVM 的 bitcode，最后由 LLVM 编译成 machine code。这个工具支撑着我们日常的开发和调试。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OCLint&lt;/code&gt; 就是一个建立在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Clang&lt;/code&gt; 上的工具,能够发现代码中潜在的问题。具体的功能请见&lt;a href=&quot;http://docs.oclint.org/en/stable/&quot;&gt;官方文档&lt;/a&gt;，这里主要介绍的是其安装与使用。&lt;/p&gt;

&lt;h2 id=&quot;安装软件&quot;&gt;安装软件&lt;/h2&gt;

&lt;h3 id=&quot;xctool&quot;&gt;XCtool&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;xctool
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;oclint&quot;&gt;OClint&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;brew tap oclint/formulae
brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;oclint
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;测试&quot;&gt;测试&lt;/h2&gt;

&lt;p&gt;进入项目目录(以 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SuperLogger&lt;/code&gt; 为例)，&lt;/p&gt;

&lt;p&gt;下载项目切换到有问题的位置（），并进入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SuperLoggerDemo&lt;/code&gt; 目录：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone https://github.com/yourtion/SuperLogger.git
cd SuperLogger
git checkout 0e64637459996ed91e0dd15718efb5d7200a9971
cd SuperLoggerDemo
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;测试执行：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# Cleanup before building
rm -f compile_commands.json
xctool -project SuperLoggerDemo.xcodeproj -scheme SuperLoggerDemo clean

# Build Project
xctool build \
	-project SuperLoggerDemo.xcodeproj -scheme SuperLoggerDemo \
	-reporter json-compilation-database:compile_commands.json

# Analyze Project
oclint-json-compilation-database -e Pods -- \
	-max-priority-1=100000 \
	-max-priority-2=100000 -max-priority-3=100000 \
   	-disable-rule=InvertedLogic \
   	-disable-rule=CollapsibleIfStatements \
 	-disable-rule=UnusedMethodParameter \
	-disable-rule=LongLine \
	-disable-rule=LongVariableName \
	-disable-rule=ShortVariableName \
	-disable-rule=UselessParentheses \
	-disable-rule=IvarAssignmentOutsideAccessorsOrInit | sed 's/\(.*\.\m\{1,2\}:[0-9]*:[0-9]*:\)/\1 warning:/'

# Final cleanup
rm -f compile_commands.json
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;输出&quot;&gt;输出&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;OCLint Report

Summary: TotalFiles=14 FilesWithViolations=4 P1=0 P2=2 P3=6

SuperLoggerPreviewView.m:77:37: warning: replace with container literal [migration|P3]
SuperLogerListView.m:206:37: warning: empty catch statement [empty|P2]
SuperLogerListView.m:25:15: warning: empty if statement [empty|P2]
SuperLogerListView.m:119:1: warning: long method [size|P3] Method with 92 lines exceeds limit of 50
SuperLogerListView.m:171:41: warning: replace with container literal [migration|P3]
SuperLogerListView.m:110:21: warning: replace with object subscripting [migration|P3]
SuperLogger.m:60:30: warning: replace with object subscripting [migration|P3]
SuperLogger.m:108:31: warning: replace with object subscripting [migration|P3]

[OCLint (http://oclint.org) v0.10.2]

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;具体问题可以参考：http://docs.oclint.org/en/stable/rules/index.html&lt;/p&gt;

&lt;h2 id=&quot;修复后&quot;&gt;修复后&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;OCLint Report

Summary: TotalFiles=14 FilesWithViolations=0 P1=0 P2=0 P3=0


[OCLint (http://oclint.org) v0.10.2]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;大概的功能就是这样，使用过程有什么问题欢迎大家一起交流&lt;/p&gt;
</content>
                 <tag>代码质量</tag> 
                 <tag>iOS</tag> 
                <pubTime>2016-02-29T12:27:17+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/temporary-fix-cocoapod-error-on-ruby-23.html</loc>
        <lastmod>2015-12-31T17:13:17+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>临时解决 Ruby2.3 上 CocoaPods 出错问题</title>
                <content>
&lt;p&gt;前段时间 Ruby 发布了 2.3 ，手贱就直接升级了一下，结果 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gem&lt;/code&gt; 全部都要重装，但是这并不是最坑的。最麻烦的是安装完 cocoapods 之后，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pod install&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pod update&lt;/code&gt;，都会报错 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NoMethodError - undefined method 'to_ary'&lt;/code&gt;，这个可是出大问题。&lt;/p&gt;

&lt;p&gt;报错堆栈如下：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;NoMethodError - undefined method `to_ary' for #&amp;lt;Pod::Specification name=&quot;ReactiveCocoa&quot;&amp;gt;
Did you mean?  to_query
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/resolver/lazy_specification.rb:14:in `method_missing'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/resolver.rb:64:in `flatten'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/resolver.rb:64:in `block in resolve'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/resolver.rb:63:in `tap'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/resolver.rb:63:in `resolve'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/installer/analyzer.rb:539:in `block in resolve_dependencies'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/user_interface.rb:59:in `section'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/installer/analyzer.rb:537:in `resolve_dependencies'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/installer/analyzer.rb:70:in `analyze'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:213:in `analyze'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:136:in `block in resolve_dependencies'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/user_interface.rb:59:in `section'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:135:in `resolve_dependencies'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:105:in `install!'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/command/project.rb:71:in `run_install_with_update'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/command/project.rb:101:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/claide-0.9.1/lib/claide/command.rb:312:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/command.rb:47:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/bin/pod:44:in `&amp;lt;top (required)&amp;gt;'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `&amp;lt;main&amp;gt;'
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;搜索一下发现这个问题已经很多人提上了issue（&lt;a href=&quot;https://github.com/CocoaPods/CocoaPods/issues/4345&quot;&gt;issues#4345&lt;/a&gt;）而且在作者回复说在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;master&lt;/code&gt;上已经解决，但是还没正式发布。&lt;/p&gt;

&lt;p&gt;没办法，又不想降级回 2.2，研究了一下修复方案&lt;a href=&quot;https://github.com/CocoaPods/CocoaPods/pull/4368&quot;&gt;[Resolver] Fix resolution on Ruby 2.3&lt;/a&gt;，其实就是加了一个方法，决定手动改本地的文件。&lt;/p&gt;

&lt;p&gt;使用 vim 或者你熟悉的编辑工具打开 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lazy_specification.rb&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vim /usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-0.39.0/lib/cocoapods/resolver/lazy_specification.rb
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在第16行也就是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;subspec_by_name &lt;/code&gt; 的方法上面加入下面代码：&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;respond_to_missing?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;include_all&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;specification&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;respond_to?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;include_all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样就搞定了！！！&lt;/p&gt;

</content>
                 <tag>解决问题</tag> 
                 <tag>Mac</tag> 
                <pubTime>2015-12-31T17:13:17+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/enable-http2-on-tengine.html</loc>
        <lastmod>2015-12-30T21:45:50+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>在Tengine中开启HTTP/2</title>
                <content>
&lt;p&gt;今天看到淘宝的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Tengine&lt;/code&gt; 发布了2.1.2版本，看了一下 CHANGES 发现已经支持HTTP/2，支持向后兼容SPDY。马上动手进行更新，为现在的服务器加上帅气的HTTP/2。&lt;/p&gt;

&lt;h2 id=&quot;关于-http2&quot;&gt;关于 HTTP/2&lt;/h2&gt;

&lt;p&gt;HTTP/2的重要特性完全源自SPDY。(详见：&lt;a href=&quot;http://www.w3ctech.com/topic/1563&quot;&gt;使用HTTP/2提升性能的7个建议&lt;/a&gt;)&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;HTTP/2是二进制（而文本）协议，因此更简洁高效；&lt;/li&gt;
  &lt;li&gt;它针对每个域只使用一个多路复用的连接，而不是每个文件一个连接；&lt;/li&gt;
  &lt;li&gt;首部使用特制的HPACK协议（而非SPDY中使用的gzip）压缩；&lt;/li&gt;
  &lt;li&gt;HTTP/2设计了复杂的优先级排定规则，帮助浏览器首先请求最急需的文件，而NGINX已经支持（SPDY的方案要简单一些）。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;性能表现参照：&lt;a href=&quot;http://www.infoq.com/cn/news/2015/02/https-spdy-http2-comparison&quot;&gt;HTTPS、SPDY和HTTP/2的性能比较&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;tengine-开启-http2-步骤&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Tengine&lt;/code&gt; 开启 HTTP/2 步骤&lt;/h2&gt;

&lt;p&gt;首先 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clone&lt;/code&gt; 或者 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pull&lt;/code&gt; 更新 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Tengine&lt;/code&gt; 最新代码并 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;checkout&lt;/code&gt; 到 2.1.2&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone https://github.com/alibaba/tengine.git
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;tengine
&lt;span class=&quot;c&quot;&gt;# 或者在已有目录 ： git pull&lt;/span&gt;
git checkout 2.1.2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;配置开启 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http_v2_module&lt;/code&gt; 并 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;make&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./configure &lt;span class=&quot;nt&quot;&gt;--with-http_ssl_module&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--with-http_v2_module&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 如果需要其他模块请参考：./configure --help&lt;/span&gt;
make
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;检测编译结果：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;objs/nginx &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt;
Tengine version: Tengine/2.1.2 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;nginx/1.6.2&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 如果看到 Tengine/2.1.2 就证明版本编译对了&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;objs/nginx &lt;span class=&quot;nt&quot;&gt;-V&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 结果中有 ngx_http_v2_module (static) 就是 HTTP/2 模块正常&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;更新 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Tengine&lt;/code&gt; 或替换现有的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Nginx&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 查看现有 Nginx 的目录&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;which nginx
/usr/sbin/nginx
&lt;span class=&quot;c&quot;&gt;# 替换 Nginx&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo cp&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; objs/nginx /usr/sbin/nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Nginx&lt;/code&gt; 配置中启用站点对 HTTP/2 的支持&lt;/p&gt;

&lt;p&gt;在配置文件中移除所有 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;listen&lt;/code&gt; 命令包含的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;spdy&lt;/code&gt;模块变量，然后在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;listen&lt;/code&gt; 时加上 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http2&lt;/code&gt; 就可以了，例如：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;listen 443 ssl http2 fastopen=3;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;检测现有 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Nginx&lt;/code&gt; 配置并重启&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;nginx &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt;
the configuration file /etc/nginx/nginx.conf syntax is ok
configuration file /etc/nginx/nginx.conf &lt;span class=&quot;nb&quot;&gt;test &lt;/span&gt;is successful
&lt;span class=&quot;c&quot;&gt;# 如果显示 ok 以及 successful 就是没问题了&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;service nginx restart
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;至此你的网站就已经有了 HTTP/2 了。&lt;/p&gt;

&lt;p&gt;检验是否启用也很简单，在 Chrome 的开发者工具的 Network 选择卡，刷新网站就能看到相关的请求的 Protocol 从 http/1.1 变成了 h2 。&lt;/p&gt;

&lt;h3 id=&quot;相关内容&quot;&gt;相关内容&lt;/h3&gt;

&lt;p&gt;2.1.2的更新日志如下（详见：&lt;a href=&quot;https://github.com/alibaba/tengine/blob/tengine-2.1.2/CHANGES.cn&quot;&gt;CHANGES.cn&lt;/a&gt;）：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Feature: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ngx_http_reqstat_module&lt;/code&gt; 模块可以跟踪记录请求的内部重定向&lt;/li&gt;
  &lt;li&gt;Feature: 支持HTTP/2，支持向后兼容SPDY&lt;/li&gt;
  &lt;li&gt;Feature: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ngx_debug_pool&lt;/code&gt; 模块协助分析内存状况&lt;/li&gt;
  &lt;li&gt;Feature: 支持 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$upstream_cookie&lt;/code&gt; 变量&lt;/li&gt;
  &lt;li&gt;Bugfix: 修复 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ngx_http_dyups_module&lt;/code&gt; 模块对相同后端服务器合并的问题&lt;/li&gt;
  &lt;li&gt;Bugfix: 修复不能编译 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lua-upstream-nginx-module&lt;/code&gt; 模块的问题&lt;/li&gt;
  &lt;li&gt;Bugfix: 修复 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ngx_http_concat_module&lt;/code&gt; 模块对javascript无效的问题&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;参考&quot;&gt;参考&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://imququ.com/post/nginx-http2-patch.html&quot;&gt;Nginx 开始支持 HTTP/2 了&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.infoq.com/cn/news/2015/02/https-spdy-http2-comparison&quot;&gt;HTTPS、SPDY和HTTP/2的性能比较&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.w3ctech.com/topic/1563&quot;&gt;使用HTTP/2提升性能的7个建议&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
                 <tag>Nginx</tag> 
                 <tag>服务器</tag> 
                <pubTime>2015-12-30T21:45:50+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ns_enum_to_nsstring.html</loc>
        <lastmod>2015-12-23T23:05:28+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>快速将 NS_ENUM 转换成 NSString</title>
                <content>
&lt;p&gt;在项目中经常会用到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NS_ENUM&lt;/code&gt; 来保存枚举数据，但是做网络请求时候可能又需要相应的字符串来作为参数，一开始使用一个方法，把枚举传入后进行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;switch case&lt;/code&gt;，但是实现起来不优雅又容易出错，这里分享一个简单的方法，希望对你有帮助。&lt;/p&gt;

&lt;p&gt;假设枚举类型 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TestType&lt;/code&gt; 定义如下：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;NS_ENUM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSInteger&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TestType&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;TestTypeA&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;TestTypeB&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;TestTypeC&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;原有转换方法：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nf&quot;&gt;getTestTypeString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TestType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&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;nb&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&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;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TestTypeA&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;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;@&quot;TypeA&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TestTypeB&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;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;@&quot;TypeB&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TestTypeC&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;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;@&quot;TypeC&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;default:&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;s&quot;&gt;@&quot;unknown&quot;&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;k&quot;&gt;return&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;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;通过定义一个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;const NSString&lt;/code&gt;，可以将转换方法简化如下：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TestTypeDescription&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;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;TestTypeA&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;s&quot;&gt;@&quot;TypeA&quot;&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;nf&quot;&gt;TestTypeB&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;s&quot;&gt;@&quot;TypeB&quot;&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;nf&quot;&gt;TestTypeC&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;s&quot;&gt;@&quot;TypeC&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nf&quot;&gt;getTestTypeString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TestType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TestTypeDescription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>移动开发</tag> 
                 <tag>iOS</tag> 
                <pubTime>2015-12-23T23:05:28+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/fix-qzone-share-addsharewithparams-deprecated.html</loc>
        <lastmod>2015-12-16T18:56:38+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>解决addShareWithParams接口弃用问题</title>
                <content>
&lt;p&gt;最近因为需要把项目升级到 Xcode7 和 iOS9，所以旧版本的 ShareSDK 需要升级，下载了最新的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;v2.12.1&lt;/code&gt; 替换后，发现原有使用的QQ空间分享接口 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;addShareWithParams&lt;/code&gt; 找不到了，找了很多资料，都说这个接口已经弃用。官方的说法如下：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;分享到QQ空间的接口用于取代老的分享接口addShareWithParams（该接口已经废弃）。&lt;a href=&quot;http://wiki.connect.qq.com/ios_sdk_api_%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E&quot;&gt;《iOS_SDK_API_使用说明》&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;但是很多没有给出具体的更新方案，研究了一下，终于把原有的项目调试通过，分享之，希望对你有帮助。&lt;/p&gt;

&lt;p&gt;原有的分享代码如下：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BOOL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;shareMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nv&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;summary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nv&quot;&gt;summary&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;imageUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nv&quot;&gt;imageUrl&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;TCAddShareDic&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;params&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;n&quot;&gt;TCAddShareDic&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;dictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageUrl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;summary&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;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;paramTitle&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;paramSummary&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;summary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;paramImages&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageUrl&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;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;paramSummary&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;paramTitle&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;summary&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;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;paramSite&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;@&quot;分享网站&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;paramFromurl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;@&quot;http://yourtion.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;n&quot;&gt;BOOL&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;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;oauth&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;addShareWithParams&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&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;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;新的QQ空间分享接口文档及示例在&lt;a href=&quot;http://wiki.connect.qq.com/ios_sandbox1#2.2.E5.88.86.E4.BA.AB.E5.88.B0QQ.E7.A9.BA.E9.97.B4&quot;&gt;《ios_sandbox1 2.2 分享到QQ空间》&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;根据新接口，更新后代码如下：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BOOL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;shareMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nv&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;summary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nv&quot;&gt;summary&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;imageUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nv&quot;&gt;imageUrl&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;webUrl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;@&quot;http://yourtion.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;QQApiNewsObject&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;newsObj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageUrl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;summary&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;newsObj&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;n&quot;&gt;QQApiNewsObject&lt;/span&gt;
                   &lt;span class=&quot;nl&quot;&gt;objectWithURL:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSURL&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;URLWithString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;webUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
                   &lt;span class=&quot;nl&quot;&gt;title:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;
                   &lt;span class=&quot;nl&quot;&gt;description:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;summary&lt;/span&gt;
                   &lt;span class=&quot;nl&quot;&gt;previewImageURL:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSURL&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;URLWithString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageUrl&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;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;newsObj&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;n&quot;&gt;QQApiNewsObject&lt;/span&gt;
                   &lt;span class=&quot;nl&quot;&gt;objectWithURL:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSURL&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;URLWithString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;webUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
                   &lt;span class=&quot;nl&quot;&gt;title:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;
                   &lt;span class=&quot;nl&quot;&gt;description:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;
                   &lt;span class=&quot;nl&quot;&gt;previewImageURL:&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nil&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;SendMessageToQQReq&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;req&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;n&quot;&gt;SendMessageToQQReq&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;reqWithContent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;newsObj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;QQApiSendResultCode&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sent&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;n&quot;&gt;QQApiInterface&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;SendReqToQZone&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;NO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样就基本完成了旧接口的迁移，更多详细设置和参数，还是参考官方的文档。&lt;/p&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>iOS</tag> 
                <pubTime>2015-12-16T18:56:38+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/use-plantuml-on-mac.html</loc>
        <lastmod>2015-12-14T21:39:35+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>在 Mac 上使用 PlantUML 高效画图</title>
                <content>
&lt;p&gt;刚刚看了 kamidox 写的 &lt;a href=&quot;http://www.jianshu.com/p/e92a52770832&quot;&gt;《使用 Sublime + PlantUML 高效地画图》&lt;/a&gt;，心痒痒的，马上进行尝试，因为作者是在 Windows 上搭建的环境，我主要是用 Mac，大概研究了一下，搭建起来还是蛮简单的。&lt;/p&gt;

&lt;h2 id=&quot;plantuml&quot;&gt;PlantUML&lt;/h2&gt;

&lt;p&gt;PlantUML 是一个画图脚本语言，用它可以快速地画出：时序图、流程图、用例图、状态图、组件图。&lt;/p&gt;

&lt;p&gt;简单地讲，我们使用 visio 或者 Omni Graffle 画图时需要一个一个图去画，但使用 PlantUML 只需要用文字表达出图的内容，然后就可以直接生成图片。&lt;/p&gt;

&lt;p&gt;如下图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2015/12/palntuml-demo1.png&quot;&gt;&lt;img src=&quot;/images/2015/12/palntuml-demo1.png&quot; alt=&quot;PlantUML-Demo1&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;可以通过下面文本生成：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;@startuml

start
:&quot;步骤1处理&quot;;
:&quot;步骤2处理&quot;;
if (&quot;条件1判断&quot;) then (true)
    :条件1成立时执行的动作;
    if (&quot;分支条件2判断&quot;) then (no)
        :&quot;条件2不成立时执行的动作&quot;;
    else
        if (&quot;条件3判断&quot;) then (yes)
            :&quot;条件3成立时的动作&quot;;
        else (no)
            :&quot;条件3不成立时的动作&quot;;
        endif
    endif
    :&quot;顺序步骤3处理&quot;;
endif

if (&quot;条件4判断&quot;) then (yes)
:&quot;条件4成立的动作&quot;;
else
    if (&quot;条件5判断&quot;) then (yes)
        :&quot;条件5成立时的动作&quot;;
    else (no)
        :&quot;条件5不成立时的动作&quot;;
    endif
endif
stop

@enduml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;是不是很方便，很想要，事不宜迟，马上开始动手吧！&lt;/p&gt;

&lt;h2 id=&quot;基础环境&quot;&gt;基础环境&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Java&lt;/li&gt;
  &lt;li&gt;Graphviz&lt;/li&gt;
  &lt;li&gt;Sublime Text 2 or 3&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Java&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sublime Text&lt;/code&gt; 就不用说了，大家都知道怎么安装了（或者本来系统就有的），主要说一下 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Graphviz&lt;/code&gt; 这个开源的图片渲染库。我是执行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;brew install graphviz&lt;/code&gt; 直接安装的。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;如果不知道 Homebrew 已经怎么安装 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;brew&lt;/code&gt; 请参考&lt;a href=&quot;http://brew.sh&quot;&gt;brew.sh&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;sublime-text-配置&quot;&gt;Sublime Text 配置&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sublime Text&lt;/code&gt; 的集成使用的是 &lt;a href=&quot;https://github.com/jvantuyl/sublime_diagram_plugin&quot;&gt;sublime_diagram_plugin&lt;/a&gt; 因为默认的包管理中没有，所以需要自己添加源。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Command-Shift-P&lt;/code&gt; 打开 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Command Palette&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;输入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;add repository&lt;/code&gt; 找到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Package Control:Add Repository&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;在下方出现的输入框中输入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://github.com/jvantuyl/sublime_diagram_plugin.git&lt;/code&gt; 然后回车&lt;/li&gt;
  &lt;li&gt;等待添加完成后再次使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Command-Shift-P&lt;/code&gt; 打开 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Command Palette&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;输入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;install package&lt;/code&gt; 找到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Package Control:Install Package&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;等待列表加载完毕，输入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;diagram&lt;/code&gt; 找到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sublime_diagram_plugin&lt;/code&gt; 安装&lt;/li&gt;
  &lt;li&gt;重启 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sublime Text&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;重启后可以在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Preferences -&amp;gt; Packages Setting&lt;/code&gt; 看到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Diagram&lt;/code&gt;，默认绑定的渲染快捷键是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;super + m&lt;/code&gt; 也就是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Command + m&lt;/code&gt; 如果不冲突直接使用即可。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;如果不知道怎么开启 Sublime Text 的 Package Control 请参考： &lt;a href=&quot;https://packagecontrol.io/installation&quot;&gt;https://packagecontrol.io/installation&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;简单使用&quot;&gt;简单使用&lt;/h2&gt;

&lt;p&gt;使用的话比较简单，绘图的内容需要包含在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@startuml&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@enduml&lt;/code&gt; 中，不然会报错。&lt;/p&gt;

&lt;p&gt;在文本中输入以下内容：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;@startuml
Bob -&amp;gt; Alice : Hello, how are you
Alice -&amp;gt; Bob : Fine, thank you, and you?
@enduml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;按 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Command + m&lt;/code&gt; 会在当前工作目录下生成这个图片文件，同时自动弹出窗口显示如下图片。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2015/12/palntuml-demo.png&quot;&gt;&lt;img src=&quot;/images/2015/12/palntuml-demo.png&quot; alt=&quot;PlantUML-Demo&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;样例可以参考kamidox 写的 &lt;a href=&quot;http://www.jianshu.com/p/e92a52770832&quot;&gt;《使用 Sublime + PlantUML 高效地画图》&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;更多使用方法参考官方中文文档：&lt;a href=&quot;http://translate.plantuml.com/zh&quot;&gt;http://translate.plantuml.com/zh&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;参考&quot;&gt;参考&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.jianshu.com/p/e92a52770832&quot;&gt;使用 Sublime + PlantUML 高效地画图&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/jvantuyl/sublime_diagram_plugin&quot;&gt;sublime_diagram_plugin&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</content>
                 <tag>Mac</tag> 
                 <tag>电脑技巧</tag> 
                <pubTime>2015-12-14T21:39:35+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/public-frameworks-with-carthage.html</loc>
        <lastmod>2015-12-14T00:20:05+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用Carthage发布Framework</title>
                <content>
&lt;p&gt;最近开始尝试使用 Carthage 来管理 Swift 项目中的依赖包，对于这种去中心化的包管理还是比较喜欢的，因为很多时候项目的依赖就比较简单，虽然 CocoaPods 提供更多的功能，但是在现有的网络环境下，下载或者更新一次还是比较麻烦的。&lt;/p&gt;

&lt;p&gt;因为 Carthage 旨在用最简单的方式添加 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;frameworks&lt;/code&gt; 到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cocoa&lt;/code&gt; 应用，所以官方只支持 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Dynamic frameworks&lt;/code&gt; 。&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Dynamic frameworks&lt;/code&gt; 在 OSX 上支持任何版本，iOS 上只支持 iOS8 及以上版本。&lt;/p&gt;

&lt;p&gt;加上最近在写一个 HTTPDNS 的库，就想尝试一下使用 Carthage 来发布相应的包。&lt;/p&gt;

&lt;h2 id=&quot;创建-framework-工程&quot;&gt;创建 Framework 工程&lt;/h2&gt;

&lt;p&gt;由于 Carthage 没有中心化的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;package list&lt;/code&gt;，没有项目说明格式，大部分 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;frameworks&lt;/code&gt; 应该自动构建。 &lt;a href=&quot;https://github.com/yourtion/HTTPDNS-Swift&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HTTPDNS&lt;/code&gt;&lt;/a&gt; 项目一开始使用的还是之前 CocoaPods 的开发思维，没有创建一个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Dynamic frameworks&lt;/code&gt; ，所以切换到 Carthage 的第一步就是将工程转换成 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Dynamic frameworks&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;转换的方式其实也不复杂，就是新建一个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Project&lt;/code&gt;，并选择 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Framework &amp;amp; Library&lt;/code&gt; 中的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cocoa Touch Framework&lt;/code&gt;，其他的设置跟新建其他项目一致，新建完项目后就把原有的代码放到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Framework&lt;/code&gt; 工程中，能 Build 成功就基本没问题了。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2015/12/create-framework-project.JPG&quot;&gt;&lt;img src=&quot;/images/2015/12/create-framework-project.JPG&quot; alt=&quot;create-framework-project&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;carthage-对于-framework-的特定要求&quot;&gt;Carthage 对于 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;framework&lt;/code&gt; 的特定要求&lt;/h2&gt;

&lt;h3 id=&quot;分享你的-xcode-schemes&quot;&gt;分享你的 Xcode schemes&lt;/h3&gt;

&lt;p&gt;Carthage 只构建从 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.xcodeproj&lt;/code&gt; 分享出来的 Xcode schemes。可以通过运行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;carthage build --no-skip-current&lt;/code&gt; 来检测所有的 intended schemes 是否构建成功，然后检查 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Carthage/Build&lt;/code&gt; 文件夹。&lt;/p&gt;

&lt;p&gt;如果运行命令的时候，一个重要的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;scheme&lt;/code&gt; 没有构建成功，打开 Xcode 在构建菜单选择 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Manage Schemes&lt;/code&gt; （如下图）&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2015/12/manage-schemes.JPG&quot;&gt;&lt;img src=&quot;/images/2015/12/manage-schemes.JPG&quot; alt=&quot;manage-schemes&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;对于需要构建的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;scheme&lt;/code&gt; 勾选 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Shared&lt;/code&gt; （如下图）&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2015/12/add-scheme-shared.JPG&quot;&gt;&lt;img src=&quot;/images/2015/12/add-scheme-shared.JPG&quot; alt=&quot;add-scheme-shared&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;这样 Carthage 可以发现它。&lt;/p&gt;

&lt;h3 id=&quot;解决构建失败&quot;&gt;解决构建失败&lt;/h3&gt;

&lt;p&gt;如果运行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;carthage build --no-skip-current&lt;/code&gt; 时遇到构建失败，尝试运行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xcodebuild -scheme SCHEME -workspace WORKSPACE build&lt;/code&gt; 或者 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xcodebuild -scheme SCHEME -project PROJECT build (用具体值)&lt;/code&gt; 看是否出现同样的错误。这很有可能提供足够的信息来解决问题。&lt;/p&gt;

&lt;p&gt;&lt;em&gt;如果 Apple developer tools 安装有多个版本(比如安装了Xcode beta)，使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xcode-select&lt;/code&gt; 来选择 Carthage 最终使用哪个版本。&lt;/em&gt;&lt;/p&gt;

&lt;h3 id=&quot;给稳定版本打标签&quot;&gt;给稳定版本打标签&lt;/h3&gt;

&lt;p&gt;Carthage 通过搜索发布到仓库中的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tag&lt;/code&gt; 来决定 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;framework&lt;/code&gt; 的哪个版本是可用的，并试着将每个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tag&lt;/code&gt; 翻译成 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;semantic version&lt;/code&gt;。比如，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tag v1.2&lt;/code&gt;，语义版本是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1.2.0&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;没有数字版本号的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tag&lt;/code&gt;，或者 有任何字符跟在数字版本号后边（比如：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1.2-alpha-1&lt;/code&gt; ）目前是不支持的，将会被忽略。&lt;/p&gt;

&lt;h3 id=&quot;将预构建的-frameworks-归档到-zip-文件&quot;&gt;将预构建的 frameworks 归档到 zip 文件&lt;/h3&gt;

&lt;p&gt;如果依附于一个 GitHub Release，Carthage 自动使用预构建 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;framework&lt;/code&gt;，而不是从头构建。&lt;/p&gt;

&lt;p&gt;为了给预构建 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;framework&lt;/code&gt; 提供一个指定的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tag&lt;/code&gt;，所有支持的平台的二进制文件被压缩成一个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;archive&lt;/code&gt;，这个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;archive&lt;/code&gt; 依附于一个发布的响应那个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tag&lt;/code&gt; 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Release&lt;/code&gt;。附件应该包含 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.framework&lt;/code&gt; 在它们的名字（比如：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ReactiveCocoa.framework.zip&lt;/code&gt; ），来表明 Carthage 它包含了二进制包。&lt;/p&gt;

&lt;h3 id=&quot;声明你的兼容性&quot;&gt;声明你的兼容性&lt;/h3&gt;

&lt;p&gt;如果想声明你的项目支持 Carthage，可用添加一个兼容性的 badge 到 README文件，只需简单插入如下 Markdown：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;carthagekit&quot;&gt;CarthageKit&lt;/h3&gt;

&lt;p&gt;Carthage 大部分的功能都被打包到一个称作 CarthageKit 的 framework 中了。
如果喜欢使用 Carthage 作为另一个工具的一部分，或者扩展 Carthage 的功能，看一下 CarthageKit 源码中的 API 是否符合你的需求。&lt;/p&gt;

&lt;h2 id=&quot;参考&quot;&gt;参考：&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Carthage/Carthage/blob/master/README.md&quot;&gt;Carthage README&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://devtian.me/2015/08/11/translate-carthage-readme/&quot;&gt;(译)Carthage 使用说明&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
</content>
                 <tag>Carthage</tag> 
                 <tag>iOS</tag> 
                <pubTime>2015-12-14T00:20:05+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/swift-uiimage-fix-orientation.html</loc>
        <lastmod>2015-11-13T19:36:48+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Swift修正UIImage图像方向</title>
                <content>
&lt;p&gt;在 iOS 或者 Mac 的开发中，会发现使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIImagePicker&lt;/code&gt; 调用手机相机拍照或者图库中的照片，到了 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIImage&lt;/code&gt; 中显示都是横七竖八的，这样导致显示到 View 或者上传到服务器的图片跟实际的不一样。&lt;/p&gt;

&lt;p&gt;解决这个问题就需要借助 EXIF 记录的图片的 Orientation 信息进行修正，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIImage&lt;/code&gt; 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;imageOrientation&lt;/code&gt; 值提供了想要正常观看图像时应该旋转的方式。&lt;/p&gt;

&lt;p&gt;在iOS的设备中也是包含了这样的方向传感器，它也采用了同样的方式来保存照片的方向信息到 EXIF 中。但是它默认的照片方向并不是竖着拿手机时的情况，而是横向，即 Home 键在右侧&lt;/p&gt;

&lt;p&gt;在 Objective-C 中关于修正的方法已经很多，这里就不多讲，可以参考这个：&lt;a href=&quot;https://gist.github.com/yourtion/82d01afea8e1db012aab&quot;&gt;https://gist.github.com/yourtion/82d01afea8e1db012aab&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;这里主要分享一下在 Swift 上的实现：&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIImage&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;fixOrientation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIImage&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageOrientation&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Up&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;transform&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGAffineTransformIdentity&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageOrientation&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;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Down&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;kt&quot;&gt;DownMirrored&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGAffineTransformTranslate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGAffineTransformRotate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGFloat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;M_PI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      
    &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Left&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;kt&quot;&gt;LeftMirrored&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGAffineTransformTranslate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;transform&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGAffineTransformRotate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGFloat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;M_PI_2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      
    &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Right&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;kt&quot;&gt;RightMirrored&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGAffineTransformTranslate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGAffineTransformRotate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGFloat&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;kt&quot;&gt;M_PI_2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      
    &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageOrientation&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;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;UpMirrored&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;kt&quot;&gt;DownMirrored&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGAffineTransformTranslate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;transform&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGAffineTransformScale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transform&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;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;LeftMirrored&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;kt&quot;&gt;RightMirrored&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGAffineTransformTranslate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;transform&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGAffineTransformScale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transform&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;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;k&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ctx&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGBitmapContextCreate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
      &lt;span class=&quot;kt&quot;&gt;CGImageGetBitsPerComponent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;CGImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&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;kt&quot;&gt;CGImageGetColorSpace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;CGImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
      &lt;span class=&quot;kt&quot;&gt;CGImageGetBitmapInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;CGImage&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;rawValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;CGContextConcatCTM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageOrientation&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;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Left&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;kt&quot;&gt;LeftMirrored&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;kt&quot;&gt;Right&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;kt&quot;&gt;RightMirrored&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;kt&quot;&gt;CGContextDrawImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGRectMake&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;CGImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      
    &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;kt&quot;&gt;CGContextDrawImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGRectMake&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;CGImage&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;c1&quot;&gt;// And now we just create a new UIImage from the drawing context&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cgimg&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CGBitmapContextCreateImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;CGImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cgimg&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;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;通过创建一个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIImage&lt;/code&gt; 的扩展方法 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fixOrientation&lt;/code&gt;，调用的时候就很方便的了，对于一个已有的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIImage&lt;/code&gt;，只需要执行下面代码即可：&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fixedImage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;fixOrientation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;附 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;imageOrientation&lt;/code&gt; 值与 EXIF 位置方向图：&lt;/p&gt;

&lt;p&gt;EXIF 位置值&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2015/11/exif-orientation-eight-values.png&quot;&gt;&lt;img src=&quot;/images/2015/11/exif-orientation-eight-values.png&quot; alt=&quot;EXIF-orientation-eight-values&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;EXIF 拍摄方向&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2015/11/exif-orientation-value.png&quot;&gt;&lt;img src=&quot;/images/2015/11/exif-orientation-value.png&quot; alt=&quot;EXIF-orientation-value&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;EXIF 与 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;imageOrientation&lt;/code&gt; 对应表&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;EXIF value&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Orientation&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;imageOrientation&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Up&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;UIImageOrientationUp&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Down&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;UIImageOrientationDown&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;5&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Left&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;UIImageOrientationLeft&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;7&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Right&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;UIImageOrientationRight&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;UpMirror&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;UIImageOrientationUpMirrored&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;DownMirror&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;UIImageOrientationDownMirrored&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;6&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;LeftMirror&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;UIImageOrientationLeftMirrored&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;8&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;RightMirror&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;UIImageOrientationRightMirrored&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
</content>
                 <tag>Swift</tag> 
                 <tag>iOS</tag> 
                <pubTime>2015-11-13T19:36:48+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/get-current-language-on-ios9.html</loc>
        <lastmod>2015-09-30T00:28:09+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>iOS9正确获取用户语言设置</title>
                <content>
&lt;p&gt;升级 iOS9 后，发现很多应用都变成了英文的，这是因为 iOS9 对语言的标识进行升级，导致一些程序原有的语言判断出错，针对这个情况，在兼容原有系统的基础上对语言的判断进行升级，让功能更加完善，分享之~&lt;/p&gt;

&lt;h2 id=&quot;获取语言方法&quot;&gt;获取语言方法&lt;/h2&gt;

&lt;div class=&quot;language-obj-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentLanguage&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;n&quot;&gt;NSLocale&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;preferredLanguages&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;objectAtIndex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&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;NSLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;currentlanguage = %@&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentLanguage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;原有判断逻辑为&quot;&gt;原有判断逻辑为&lt;/h2&gt;

&lt;p&gt;之前的中文使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zh-Hans&lt;/code&gt; 直接判断相等即可：&lt;/p&gt;

&lt;div class=&quot;language-obj-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentLanguage&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;isEqualToString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;zh-Hans&quot;&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;NSLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;zh-Hans&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;兼容判断逻辑&quot;&gt;兼容判断逻辑&lt;/h2&gt;

&lt;p&gt;iOS升级后 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zh-Hans&lt;/code&gt; 变成了 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zh-Hans-CN&lt;/code&gt; ，估计是按照 “RFC 4646” 进行进一步规范，为了兼容原有的系统，对判断逻辑进行如下升级：&lt;/p&gt;

&lt;div class=&quot;language-obj-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentLanguage&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;containsString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;zh-Hans&quot;&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;NSLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;zh-Hans&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;同理，繁体中文的变成：&lt;/p&gt;

&lt;div class=&quot;language-obj-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentLanguage&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;containsString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;zh-Hant&quot;&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;NSLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;zh-Hant&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;后记&quot;&gt;后记&lt;/h2&gt;

&lt;p&gt;一开始以为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zh-Hans-CN&lt;/code&gt; 是个奇怪的写法，不明白为什么苹果要做这样的改动，后来发现原来在 “通用” -&amp;gt; “语言与地区” 里面修改 “区域格式” 中的 “地区” ，例如从 “中国” 修改为 “美国” ，那么相应的数值就会从 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zh-Hans-CN&lt;/code&gt; 变成  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zh-Hans-US&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;所以要让程序仅仅根据语言判断，需要严格按照上面的方法使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;containsString&lt;/code&gt; 来，否则就可能出现用户切换区域后语言显示不正确的情况。&lt;/p&gt;

&lt;h2 id=&quot;关于兼容性&quot;&gt;关于兼容性&lt;/h2&gt;

&lt;p&gt;因为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;containsString&lt;/code&gt; 在 iOS8 以上才有，如果需要兼容 iOS7 参考以下代码：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;if ([currentLanguage rangeOfString:@&quot;zh-Hans&quot;].location != NSNotFound) {
  NSLog(@&quot;zh-Hans&quot;);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;中文相关标签&quot;&gt;中文相关标签&lt;/h2&gt;

&lt;p&gt;参考： http://www.ruanyifeng.com/blog/2008/02/codes_for_language_names.html&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;tag&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Lang&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;zh-Hans&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;简体中文&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;zh-Hans-CN&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;大陆地区使用的简体中文&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;zh-Hans-HK&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;香港地区使用的简体中文&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;zh-Hans-MO&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;澳门使用的简体中文&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;zh-Hans-SG&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;新加坡使用的简体中文&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;zh-Hans-TW&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;台湾使用的简体中文&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;zh-Hant&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;繁体中文&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;zh-Hant-CN&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;大陆地区使用的繁体中文&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;zh-Hant-HK&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;香港地区使用的繁体中文&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;zh-Hant-MO&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;澳门使用的繁体中文&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;zh-Hant-SG&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;新加坡使用的繁体中文&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;zh-Hant-TW&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;台湾使用的繁体中文&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

</content>
                 <tag>移动开发</tag> 
                 <tag>iOS</tag> 
                <pubTime>2015-09-30T00:28:09+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/wordpress-to-jekyll.html</loc>
        <lastmod>2015-09-26T02:02:04+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>迁移WordPress到Jekyll</title>
                <content>
&lt;p&gt;之前发布了 &lt;a href=&quot;http://blog.yourtion.com/blog-from-wordpress-to-jekyll.html&quot;&gt;《博客正式从Wordpress迁移到Jekyll》&lt;/a&gt; 有网友问到迁移过程，我也就大概整理一下，发上，希望对大家能有帮助，如果有什么疑问也欢迎大家提出来，我会详细解答。&lt;/p&gt;

&lt;h2 id=&quot;搭建jekyll本机环境&quot;&gt;搭建Jekyll本机环境&lt;/h2&gt;

&lt;p&gt;主要是用于在迁移过程中对主题，文档，链接等进行测试，不需要每点更改都 Push 到 GitHub Pages 。&lt;/p&gt;

&lt;p&gt;安装过程参考：http://jekyllcn.com/docs/installation/&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;安装 RubyGems ： http://rubygems.org/pages/download&lt;/li&gt;
  &lt;li&gt;安装 Jekyll ： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gem install jekyll&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;创建博客 ： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll new blog&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;运行 ： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cd blog &amp;amp;&amp;amp; jekyll serve&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;这样你就在本机运行了 Jekyll ，通过 http://localhost:4000/ 访问&lt;/p&gt;

&lt;h2 id=&quot;导出wordpress数据&quot;&gt;导出WordPress数据&lt;/h2&gt;

&lt;p&gt;首先，在 WordPress 后台 -&amp;gt; 工具 -&amp;gt; 导出。即可导出并下载包含全部文章、页面、评论、自定义栏目、分类目录和标签的 xml 文件。&lt;/p&gt;

&lt;p&gt;将原有 WordPress 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;uploads&lt;/code&gt; 目录下载到本地。&lt;/p&gt;

&lt;h2 id=&quot;将xml转成markdown&quot;&gt;将xml转成Markdown&lt;/h2&gt;

&lt;p&gt;使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;exitwp&lt;/code&gt; https://github.com/yourtion/exitwp ，这个是我根据自己需求修改过的版本，主要添加：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;在导出 Markdown 文件头部加入 ``&lt;/li&gt;
  &lt;li&gt;将 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;pre&amp;gt;&lt;/code&gt; 标签 转换为三个 ` （也就是 Markdown 中的源码标识）&lt;/li&gt;
  &lt;li&gt;将原有图片绝对链接&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;'http://blog.yourtion.com/wp-content/uploads/'&lt;/code&gt; 转成 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;'/images/'&lt;/code&gt; 标识（用于CDN等配置）&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;如果你不需要这些更改，可以使用原版 ：https://github.com/thomasf/exitwp&lt;/p&gt;

&lt;p&gt;然后将导出的 xml 放入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wordpress-xml&lt;/code&gt; 目录中，运行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;python exitwp.py&lt;/code&gt; 即可将 xml 转成 Markdown&lt;/p&gt;

&lt;h2 id=&quot;迁移数据到jekyll&quot;&gt;迁移数据到Jekyll&lt;/h2&gt;

&lt;p&gt;将导出的文章 Markdown 文件放入刚刚新建的 blog 目录下的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_posts&lt;/code&gt; 中，WordPress 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;uploads&lt;/code&gt; 改名为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;images&lt;/code&gt; 放入 blog 的根目录。运行即可看到文章已经迁移成功。&lt;/p&gt;

&lt;p&gt;关于图片的路径问题，如果你使用我的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;exitwp&lt;/code&gt; 进行转换，可以参考我博客的源码 ：https://github.com/yourtion/yourtion.github.io/blob/master/_includes/JB/setup&lt;/p&gt;

&lt;p&gt;创建 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_includes/JB/setup&lt;/code&gt; 文件，加入以下代码：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
{% capture jbcache %}
  {% if site.JB.IMAGE_PATH %}
    {% assign IMAGE_PATH = site.JB.IMAGE_PATH %}
  {% else %}
    {% capture IMAGE_PATH %}{{ BASE_PATH }}/images/{% endcapture %}
  {% endif %}
{% endcapture %}
{% assign jbcache = nil %}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;部署到github&quot;&gt;部署到GitHub&lt;/h2&gt;

&lt;p&gt;参考 ：http://jekyllcn.com/docs/github-pages/&lt;/p&gt;

&lt;p&gt;当然，迁移后最好是先在本地进行测试，修正一些转换过程中的问题再 Push 到 GitHub 上比较好。&lt;/p&gt;
</content>
                 <tag>WordPress</tag>  <tag>Jekyll</tag> 
                 <tag>Jekyll</tag> 
                <pubTime>2015-09-26T02:02:04+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/run-react-native-on-device.html</loc>
        <lastmod>2015-09-20T08:07:06+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>React Native真机调试</title>
                <content>
&lt;p&gt;最近在尝试使用 React Native 做一些东西，发现真机调试还是有一些坑存在的。&lt;/p&gt;

&lt;h2 id=&quot;ios-真机调试&quot;&gt;iOS 真机调试&lt;/h2&gt;

&lt;p&gt;首先，你要让调试用电脑和你的手机必须处于相同的 WiFi 网络中下&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;打开 iOS 项目的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppDelegate.m&lt;/code&gt; 文件&lt;/li&gt;
  &lt;li&gt;更改 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jsCodeLocation&lt;/code&gt; 中的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost&lt;/code&gt; 改成你电脑的局域网IP地址&lt;/li&gt;
  &lt;li&gt;在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Xcode&lt;/code&gt; 中，选择你的手机作为目标设备，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Run&lt;/code&gt; 即可&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;可以通过晃动设备来打开开发菜单(重载、调试等)&lt;/strong&gt;&lt;/p&gt;

&lt;h2 id=&quot;android-真机调试&quot;&gt;Android 真机调试&lt;/h2&gt;

&lt;p&gt;在 Android 设备上打开 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;USB debugging&lt;/code&gt; 并连接上电脑启动调试。&lt;/p&gt;

&lt;p&gt;在真机上运行的方法与在模拟器上运行一致，都是通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;react-native run-android&lt;/code&gt; 来安装并且运行你的 React Native 应用。&lt;/p&gt;

&lt;p&gt;如果不是 Android 5.0+ (API 21) ，那么就没办法通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adb reverse&lt;/code&gt; 进行调试，需要通过 WiFi 来连接上你的开发者服务器&lt;/p&gt;

&lt;p&gt;让调试用电脑和你的手机必须处于相同的 WiFi 网络中下&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;打开震动菜单 (摇动设备)&lt;/li&gt;
  &lt;li&gt;前往 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Dev Settings&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;选择 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Debug server host for device&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;输入调试用电脑的局域网IP&lt;/li&gt;
  &lt;li&gt;点击 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Reload JS&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;xcode7上运行报错解决方法&quot;&gt;Xcode7上运行报错解决方法&lt;/h2&gt;

&lt;p&gt;在 Xcode7 指定真机运行，结果报出如下错误：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Undefined symbols for architecture arm64:
  &quot;_RCTSetLogFunction&quot;, referenced from:
      -[PropertyFinderTests testRendersWelcomeScreen] in PropertyFinderTests.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;一开始以为的 React Native 库的问题，查找了一下资料，研究了一下，原来在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Build Setting&lt;/code&gt; 中设置 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Dead Code Stripping&lt;/code&gt; 为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;No&lt;/code&gt; （如下图）就可以解决了&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2015/09/React-Native-Dead-Code-Stripping.JPG&quot;&gt;&lt;img src=&quot;/images/2015/09/React-Native-Dead-Code-Stripping.JPG&quot; alt=&quot;React-Native-Dead-Code-Stripping&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

</content>
                 <tag>Xcode</tag>  <tag>React Native</tag>  <tag>解决问题</tag> 
                 <tag>React</tag> 
                <pubTime>2015-09-20T08:07:06+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ios9-http-blocked.html</loc>
        <lastmod>2015-08-31T05:11:51+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>解决iOS9下blocked cleartext HTTP</title>
                <content>
&lt;p&gt;使用Xcode7编写iOS9应用时，如果获取http://数据时会报如下错误：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app’s Info.plist file.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;原因：从iOS9起，新特性要求App访问网络请求，要采用 HTTPS 协议。&lt;/p&gt;

&lt;p&gt;如果仍想要使用HTTP协议，解决办法如下，修改项目的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Info.plist&lt;/code&gt; 文件，增加以下内容：&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;NSAppTransportSecurity&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;dict&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;NSAllowsArbitraryLoads&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;nt&quot;&gt;&amp;lt;true/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/dict&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;如果觉得直接修改文件太麻烦，可以在项目的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Info&lt;/code&gt; 直接通过界面添加配置：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Info&lt;/code&gt; 中添加 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSAppTransportSecurity&lt;/code&gt; 类型 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Dictionary&lt;/code&gt; ;&lt;/li&gt;
  &lt;li&gt;在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSAppTransportSecurity&lt;/code&gt; 下添加 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSAllowsArbitraryLoads&lt;/code&gt; 类型 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Boolean&lt;/code&gt; ，值设为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;YES&lt;/code&gt; ;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;完成后如下图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2015/08/NSAppTransportSecurity.JPG&quot;&gt;&lt;img src=&quot;/images/2015/08/NSAppTransportSecurity.JPG&quot; alt=&quot;NSAppTransportSecurity&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

</content>
                 <tag>解决问题</tag> 
                 <tag>iOS</tag> 
                <pubTime>2015-08-31T05:11:51+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/solve-xcode7-build-failed.html</loc>
        <lastmod>2015-08-18T23:58:33+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>解决Xocde7编译失败问题</title>
                <content>
&lt;p&gt;升级了Xcode7-beta之后，原来正常编译打包的项目都出了问题，提示出错信息如下：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;ld: ‘ShareSDK/UI/ShareSDKShareActionSheet.framework/ShareSDKShareActionSheet’ does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;这个 “You must rebuild it with bitcode enabled” 中的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bitcode&lt;/code&gt; 又是个什么东西？查了一下，原来：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Bitcode is an intermediate representation of a compiled program. Apps you upload to iTunes Connect that contain bitcode will be compiled and linked on the App Store. Including bitcode will allow Apple to re-optimize your app binary in the future without the need to submit a new version of your app to the store.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;说的是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bitcode&lt;/code&gt; 是被编译程序的一种中间形式的代码。包含 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bitcode&lt;/code&gt; 配置的程序将会在 App Store 上被编译和链接。&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bitcode&lt;/code&gt; 允许苹果在后期重新优化我们程序的二进制文件，而不需要我们重新提交一个新的版本到 App Store 上。&lt;/p&gt;

&lt;p&gt;解决上面遇到的错误，要么让第三方库支持，要么关闭 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;target&lt;/code&gt; 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bitcode&lt;/code&gt; 选项。&lt;/p&gt;

&lt;p&gt;实际上在Xcode 7中，我们新建一个iOS程序时，bitcode 选项默认是设置为YES的。我们可以在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Build Settings&lt;/code&gt; -&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Enable Bitcode&lt;/code&gt; 选项中看到这个设置。如下图所示：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2015/08/DisableBitcode.JPG&quot;&gt;&lt;img src=&quot;/images/2015/08/DisableBitcode.JPG&quot; alt=&quot;DisableBitcode&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;不过，对于三个平台：iOS，Mac OS，watchOS，Bitcode的支持的不一样的。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;iOS，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bitcode&lt;/code&gt; 是可选的&lt;/li&gt;
  &lt;li&gt;WatchOS，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bitcode&lt;/code&gt; 是必须的&lt;/li&gt;
  &lt;li&gt;Mac OS，不支持 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bitcode&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;有兴趣的可以移步&lt;a href=&quot;http://llvm.org/docs/BitCodeFormat.html#llvm-bitcode-file-format&quot;&gt;LLVM Bitcode File Format&lt;/a&gt; 进一步了解 bitcode 。&lt;/p&gt;
</content>
                 <tag>Xcode</tag>  <tag>解决问题</tag> 
                 <tag>iOS</tag> 
                <pubTime>2015-08-18T23:58:33+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/mac-use-ramdisk-accelerate.html</loc>
        <lastmod>2015-07-09T00:32:58+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用Ramdisk加速你的Mac</title>
                <content>
&lt;p&gt;还记得之前在Windows上使用过Ramdisk来将32位系统不能识别的内存转成磁盘，存放临时文件什么的。突发奇想在Mac是不是也能用内存来放Cache呢？虽然有SSD，但是考虑到寿命问题，加上速度，内存盘也还是很有优势的。&lt;/p&gt;

&lt;p&gt;找了一下，最简单的方法是下载一个APP，或者执行下面的脚本：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;diskutil erasevolume HFS+ RamDisk &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;hdiutil attach &lt;span class=&quot;nt&quot;&gt;-nomount&lt;/span&gt; ram://&lt;span class=&quot;k&quot;&gt;$((&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;但是这样并不够优雅，很容易不小心就把RamDisk给Eject了，有寻思了一番，决定采用脚本形式，而且是创建隐藏的RamDisk，同时支持注销自动备份~事不宜迟，马上动手。&lt;/p&gt;

&lt;h2 id=&quot;创建ramdisk脚本&quot;&gt;创建RamDisk脚本&lt;/h2&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/&lt;/code&gt;下创建&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ramdisk&lt;/code&gt;目录，用来存放相关文件&lt;/p&gt;

&lt;h3 id=&quot;initramdisksh&quot;&gt;initramdisk.sh&lt;/h3&gt;

&lt;p&gt;创建&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/Ramdisk/initramdisk.sh&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/sh&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 设置内存盘的名称&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;DISK_NAME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;RamDisk
&lt;span class=&quot;nv&quot;&gt;MOUNT_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/Volumes/&lt;span class=&quot;nv&quot;&gt;$DISK_NAME&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 设置备份文件的保存路径&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;WORK_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/etc/Ramdisk
&lt;span class=&quot;nv&quot;&gt;BAK_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$WORK_PATH&lt;/span&gt;/&lt;span class=&quot;nv&quot;&gt;$DISK_NAME&lt;/span&gt;.tar.gz
&lt;span class=&quot;c&quot;&gt;# 设置分配给内存盘的空间大小(MB)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;DISK_SPACE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1024

&lt;span class=&quot;c&quot;&gt;# 创建Ramdisk&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$MOUNT_PATH&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;k&quot;&gt;then
    &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dev&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;hdid &lt;span class=&quot;nt&quot;&gt;-nomount&lt;/span&gt; ram://&lt;span class=&quot;k&quot;&gt;$((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$DISK_SPACE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;))&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;cut&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;' '&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f1&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;partition&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dev&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;s1
    &lt;span class=&quot;nv&quot;&gt;rdev&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$dev&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'s/disk/rdisk/'&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;rpartition&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$partition&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'s/disk/rdisk/'&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;y | fdisk &lt;span class=&quot;nt&quot;&gt;-ia&lt;/span&gt; hfs &lt;span class=&quot;nv&quot;&gt;$dev&lt;/span&gt;
    newfs_hfs &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$DISK_NAME&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$partition&lt;/span&gt;
    hdiutil mount &lt;span class=&quot;nt&quot;&gt;-nobrowse&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$rdev&lt;/span&gt;
    hdiutil mount &lt;span class=&quot;nt&quot;&gt;-nobrowse&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$rpartition&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 恢复备份&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$BAK_PATH&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;k&quot;&gt;then
    &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-zxf&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$BAK_PATH&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$MOUNT_PATH&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;syncramdisksh&quot;&gt;syncramdisk.sh&lt;/h3&gt;

&lt;p&gt;创建&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/Ramdisk/syncramdisk.sh&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/sh&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 设置内存盘的名称&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;DISK_NAME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;RamDisk
&lt;span class=&quot;nv&quot;&gt;MOUNT_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/Volumes/&lt;span class=&quot;nv&quot;&gt;$DISK_NAME&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 设置备份文件的保存路径&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;WORK_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/etc/Ramdisk
&lt;span class=&quot;nv&quot;&gt;BAK_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$WORK_PATH&lt;/span&gt;/&lt;span class=&quot;nv&quot;&gt;$DISK_NAME&lt;/span&gt;.tar.gz
&lt;span class=&quot;nv&quot;&gt;LISTFILE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$WORK_PATH&lt;/span&gt;/list

&lt;span class=&quot;c&quot;&gt;# 设置最大的cache大小(MB)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;MAX_CACHE_SIZE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;50

&lt;span class=&quot;c&quot;&gt;# 备份Ramdisk内容，超过50M的目录直接不再保存&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$MOUNT_PATH&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;declare&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; fa
&lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0
&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;file &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;du&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; Caches/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sort&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;do
  &lt;/span&gt;fa[&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;let &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;i+1
&lt;span class=&quot;k&quot;&gt;done
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$((&lt;/span&gt;i/2&lt;span class=&quot;k&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;file number:&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$size&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$WORK_PATH&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;.?*&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$LISTFILE&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;i&amp;lt;&lt;span class=&quot;nv&quot;&gt;$size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;i++&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;do
  if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;fa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$((&lt;/span&gt;i&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&amp;lt;&lt;span class=&quot;o&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$MAX_CACHE_SIZE&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;1024&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;2&lt;span class=&quot;o&quot;&gt;))&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;k&quot;&gt;then
    &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;add:&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;fa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$((&lt;/span&gt;i&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;else
    &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;fa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$((&lt;/span&gt;i&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$LISTFILE&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;fi

done
if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$MOUNT_PATH&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;k&quot;&gt;then
    &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$MOUNT_PATH&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--exclude-from&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$LISTFILE&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-czf&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$BAK_PATH&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;设置登录和注销hook&quot;&gt;设置登录和注销hook&lt;/h3&gt;

&lt;p&gt;在终端下执行：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 登录时执行initramdisk.sh&lt;/span&gt;
defaults write com.apple.loginwindow LoginHook /etc/Ramdisk/initramdisk.sh

&lt;span class=&quot;c&quot;&gt;# 注销时执行syncramdisk.sh&lt;/span&gt;
defaults write com.apple.loginwindow LogoutHook /etc/Ramdisk/syncramdisk.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;迁移目录到ramdisk&quot;&gt;迁移目录到RamDisk&lt;/h2&gt;

&lt;h3 id=&quot;转移cache目录&quot;&gt;转移Cache目录&lt;/h3&gt;

&lt;p&gt;在终端下继续执行：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 删除Cahces&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rf&lt;/span&gt; ~/Library/Caches

&lt;span class=&quot;c&quot;&gt;# 在RamDisk创建Caches目录并链接&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /Volumes/RamDisk/Caches 
&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /Volumes/RamDisk/Caches ~/Library/Caches
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;转移chrome缓存&quot;&gt;转移Chrome缓存&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mv&lt;/span&gt; ~/Library/Application&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;Support/Google/Chrome /Volumes/RamDisk/
&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /Volumes/RamDisk/Chrome ~/Library/Application&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;Support/Google/Chrome
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其他需要移到RamDisk的东西也可以如法炮制。&lt;/p&gt;

</content>
                 <tag>Mac</tag> 
                 <tag>Mac</tag> 
                <pubTime>2015-07-09T00:32:58+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ubuntu-server-add-shadowsocks-proxy.html</loc>
        <lastmod>2015-06-08T18:24:58+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>UbuntuServer配置ShadowSocks代理</title>
                <content>
&lt;p&gt;最近遇到一个问题，需要在服务器上配置科学上网，因为自己一直都是用ShadowSocks，所以打算在服务器上也直接上SS，研究了一下，感觉还是蛮简单的。&lt;/p&gt;

&lt;h2 id=&quot;安装shadowsocks客户端&quot;&gt;安装ShadowSocks客户端&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;python-pip
pip &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;shadowsocks
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;创建配置文件&quot;&gt;创建配置文件&lt;/h3&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/&lt;/code&gt;位置下创建配置文件：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;vim /etc/shadowsocks.json
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;配置文件大致如下(其中的服务器地址、密码、端口号等自行修改配置)：&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;server&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;my_server_ip&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;server_port&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8388&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;local_address&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;127.0.0.1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;local_port&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1080&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;password&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;mypassword&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;timeout&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;method&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;aes-256-cfb&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;fast_open&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;启动shadowsocks&quot;&gt;启动ShadowSocks&lt;/h3&gt;

&lt;p&gt;然后运行以下命令&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sslocal &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; /etc/shadowsocks.json
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;出现如下提示既表示命令成功运行，可是开始畅游网络了。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;INFO: loading config from /etc/shadowsocks.json
2015-02-17 00:00:22 INFO loading libcrypto from libcrypto.so.1.0.0
2015-02-17 00:00:22 INFO starting local at 127.0.0.1:1080
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;将shadowsocks转换成http代理&quot;&gt;将ShadowSocks转换成HTTP代理&lt;/h2&gt;

&lt;p&gt;先启动了ShadowSocks后，安装polipo，并把ShadowSocks设置为polipo的后端&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;polipo
service polipo stop
polipo &lt;span class=&quot;nv&quot;&gt;socksParentProxy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;localhost:1080
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;简单使用代理&quot;&gt;简单使用代理&lt;/h3&gt;

&lt;p&gt;最简单的只是使用请求代理&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;http_proxy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;http://localhost:8123 apt-get update

&lt;span class=&quot;nv&quot;&gt;http_proxy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;http://localhost:8123 curl www.google.com

&lt;span class=&quot;nv&quot;&gt;http_proxy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;http://localhost:8123 wget www.google.com

git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; http.proxy 127.0.0.1:8123
git clone https://github.com/xxx/xxx.git
git xxx
git xxx
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--unset-all&lt;/span&gt; http.proxy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;配置全局代理服务&quot;&gt;配置全局代理服务&lt;/h3&gt;

&lt;p&gt;编辑&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/environment&lt;/code&gt;文件：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vim /etc/environment
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;添加以下内容：&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;py&quot;&gt;http_proxy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://127.0.0.1:8123/&quot;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;https_proxy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://127.0.0.1:8123/&quot;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;ftp_proxy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://127.0.0.1:8123/&quot;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;no_proxy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;localhost,127.0.0.1,localaddress,.localdomain.com&quot;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;HTTP_PROXY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://127.0.0.1:8123/&quot;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;HTTPS_PROXY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://127.0.0.1:8123/&quot;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;FTP_PROXY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://127.0.0.1:8123/&quot;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;NO_PROXY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;localhost,127.0.0.1,localaddress,.localdomain.com&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;保存即可。&lt;/p&gt;

&lt;h3 id=&quot;配置apt-get-aptitude代理&quot;&gt;配置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;apt-get&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aptitude&lt;/code&gt;代理&lt;/h3&gt;

&lt;p&gt;创建&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/apt/apt.conf.d/95proxies&lt;/code&gt;文件：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vim /etc/apt/apt.conf.d/95proxies
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;添加以下内容：&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;Acquire::http::proxy&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;http://127.0.0.1:8123/&quot;&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;Acquire::ftp::proxy&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;ftp://127.0.0.1:8123/&quot;&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;Acquire::https::proxy&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;https://127.0.0.1:8123/&quot;&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;自动启动代理服务&quot;&gt;自动启动代理服务&lt;/h2&gt;

&lt;h3 id=&quot;使用supervisor运行shadowsocks&quot;&gt;使用Supervisor运行Shadowsocks&lt;/h3&gt;

&lt;p&gt;上面通过命令行启动ShadowSocks后，重启需要手动重启，而且如果SS的进程挂了也不知道，官方推荐用Supervisor来运行，配置也是很简单：&lt;/p&gt;

&lt;p&gt;安装：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;supervisor
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;编辑&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/supervisor/conf.d/shadowsocks.conf&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vim /etc/supervisor/conf.d/shadowsocks.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;添加下面内容：&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;[program:shadowsocks]&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;sslocal -c /etc/shadowsocks.json&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;autorestart&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;nobody&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;重启执行supervisor就大功告成了：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;service supervisor start
supervisorctl reload
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;配置polipo&quot;&gt;配置polipo&lt;/h3&gt;

&lt;p&gt;编辑&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/polipo/config&lt;/code&gt;，添加以下内容：&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;py&quot;&gt;socksParentProxy&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;localhost:1080&quot;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;socksProxyType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;socks5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;启动polipo服务就大功告成了：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;service polipo start
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>Ubuntu</tag> 
                 <tag>服务器</tag> 
                <pubTime>2015-06-08T18:24:58+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/solve-library-missing-required-architecture-x86_64.html</loc>
        <lastmod>2015-05-21T22:44:01+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>解决静态库 missing required architecture x86_64问题</title>
                <content>
&lt;p&gt;最近在使用自己编译的静态库做项目之后发现一个问题，没办法在本机的iPhone6等模拟器上运行项目，提示“missing required architecture x86_64”，在iPhone5的模拟器上是正常的，研究了一下，原来跟我生成静态库的工程有关。解决了问题，分享之。&lt;/p&gt;

&lt;p&gt;我的静态库是使用脚本完成编译的，编译模拟器对应的库是使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xcodebuild&lt;/code&gt;脚本进行编译的，脚本如下：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;xcodebuild &lt;span class=&quot;nt&quot;&gt;-target&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$CONFIGURATION&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
			&lt;span class=&quot;nt&quot;&gt;-configuration&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$CONFIGURATION&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
			&lt;span class=&quot;nt&quot;&gt;-sdk&lt;/span&gt; iphonesimulator &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
			&lt;span class=&quot;nt&quot;&gt;-arch&lt;/span&gt; i386
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这个是我很早前就在用的脚本，那时候还没有iPhone5s和iPhone6这些64位架构的机器，所以&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-arch i386&lt;/code&gt;是没问题的，现在有了这些机器，自然模拟器的库就没有对应的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x86_64&lt;/code&gt;的库。&lt;/p&gt;

&lt;p&gt;参考&lt;a href=&quot;https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/64bitPorting/building/building.html&quot;&gt;苹果官方文档&lt;/a&gt;后，在静态库工程中的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VALID_ARCHS&lt;/code&gt;添加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x86_64&lt;/code&gt;，如下图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2015/05/2015-05-21_1.JPG&quot;&gt;&lt;img src=&quot;/images/2015/05/2015-05-21_1.JPG&quot; alt=&quot;Set_VALID_ARCHS&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;这样正常Archive的库就是支持64位模拟器的了，如果是跟我一样使用脚本，脚本修改如下：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;xcodebuild &lt;span class=&quot;nt&quot;&gt;-target&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$CONFIGURATION&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
			&lt;span class=&quot;nt&quot;&gt;-configuration&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$CONFIGURATION&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
			&lt;span class=&quot;nt&quot;&gt;-sdk&lt;/span&gt; iphonesimulator &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
			&lt;span class=&quot;nt&quot;&gt;-arch&lt;/span&gt; i386 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
			&lt;span class=&quot;nt&quot;&gt;-arch&lt;/span&gt; x86_64
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>iOS</tag> 
                <pubTime>2015-05-21T22:44:01+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ubuntu-smooth-from-nginx-to-tengine.html</loc>
        <lastmod>2015-04-17T19:27:32+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Ubuntu下从Nginx平滑升级到Tengine</title>
                <content>
&lt;p&gt;Tengine是由淘宝网发起的Web服务器项目。它在Nginx的基础上，针对大访问量网站的需求，添加了很多高级功能和特性。Tengine的性能和稳定性已经在大型的网站如淘宝网，天猫商城等得到了很好的检验。它的最终目标是打造一个高效、稳定、安全、易用的Web平台。&lt;/p&gt;

&lt;p&gt;考虑到我们业务的场景和大压力访问需求，所以考虑将原来的Nginx升级到Tengine，同时可以使用相关的监控功能，由于是线上的业务，所以要做好快速平滑升级，试了一下，分享之。&lt;/p&gt;

&lt;h2 id=&quot;升级过程&quot;&gt;升级过程&lt;/h2&gt;

&lt;h3 id=&quot;查看原有nginx版本&quot;&gt;查看原有Nginx版本&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;nginx &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt;
nginx version: nginx/1.6.3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;下载tengine并编译安装使用git方式&quot;&gt;下载Tengine并编译安装(使用Git方式)&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;原有Nginx安装在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/sbin/nginx&lt;/code&gt;，配置文件在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/nginx/nginx.conf&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Clone tengine&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clone https://github.com/alibaba/tengine
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;tengine
&lt;span class=&quot;c&quot;&gt;# 切换到最新Releases&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout tengine-2.1.0

&lt;span class=&quot;c&quot;&gt;# 根据服务器原有的配置进行configure&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;./configure &lt;span class=&quot;nt&quot;&gt;--prefix&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/sbin/nginx &lt;span class=&quot;nt&quot;&gt;--conf-path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/etc/nginx/nginx.conf
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;make

&lt;span class=&quot;c&quot;&gt;# 备份Nginx并将Tengine拷贝到对应目录&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo mv&lt;/span&gt; /usr/sbin/nginx /usr/sbin/nginx.old
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo cp &lt;/span&gt;objs/nginx /usr/sbin/
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo chmod&lt;/span&gt; +x /usr/sbin/nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;查看tengine是否安装成功&quot;&gt;查看Tengine是否安装成功&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# 检测Tengine版本
$ nginx -v
Tengine version: Tengine/2.1.0 (nginx/1.6.2)

# 检测原有配置
$ sudo nginx -t
the configuration file /etc/nginx/nginx.conf syntax is ok
configuration file /etc/nginx/nginx.conf test is successful

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;重启服务完成升级&quot;&gt;重启服务完成升级&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;service nginx restart
 &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; Restarting nginx nginx &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; OK &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样升级就完成了，可以查看网站的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ResponseHeader&lt;/code&gt;，就可以看到：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Server:Tengine&lt;/code&gt;&lt;/p&gt;
</content>
                 <tag>Nginx</tag>  <tag>Ubuntu</tag> 
                 <tag>服务器</tag> 
                <pubTime>2015-04-17T19:27:32+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/solve-automator-filepath-with-space-error.html</loc>
        <lastmod>2015-04-08T04:02:04+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>解决Automator输入文件路径存在空格出错</title>
                <content>
&lt;p&gt;之前做了&lt;a href=&quot;https://github.com/yourtion/AutomatorGenerateICON&quot;&gt;AutomatorGenerateICON&lt;/a&gt;一个批量生成图标的Automator，一开始自己团队的人用着也没问题，后来有用户反馈说在10.10.3下面会出错，自己试了好多次都是正常的。&lt;/p&gt;

&lt;p&gt;用户反馈说解决了，原来是存放图片的文件夹名称包含空格，所以就出错了，查了好些资料和文章，试了上面说的各种方法，最后终于解决了这个问题，修复了bug（&lt;a href=&quot;https://github.com/yourtion/AutomatorGenerateICON/commit/8fdcdae9239fb92cd4c4ba6e0c7867aad0411845&quot;&gt;Commit#8fdcdae&lt;/a&gt;）&lt;/p&gt;

&lt;p&gt;解决方法也蛮简单的，之前是使用输入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;as arguments&lt;/code&gt;，然后使用下面方法历遍：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;f &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
	&lt;span class=&quot;c&quot;&gt;# do someting with $f&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这个方法就会遇到文件路径有空格的问题。&lt;/p&gt;

&lt;p&gt;把输入改成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;to stdin&lt;/code&gt;，然后换用下面的方法进行历遍&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;OLDIFS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$IFS&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;IFS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;$'&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;read &lt;/span&gt;f&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
	&lt;span class=&quot;c&quot;&gt;# do someting with $f&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样就解决了文件路径空格的问题。&lt;/p&gt;

&lt;p&gt;欢迎大家使用&lt;a href=&quot;https://github.com/yourtion/AutomatorGenerateICON&quot;&gt;AutomatorGenerateICON&lt;/a&gt; 并反馈问题。&lt;/p&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>Mac</tag> 
                <pubTime>2015-04-08T04:02:04+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/cpp-write-vector-to-file-and-read.html</loc>
        <lastmod>2015-04-02T08:03:06+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>C++将vector写入文件并重新读取</title>
                <content>
&lt;p&gt;最近在写node的addon，涉及到将vector写入文件并重新读取，包括字符串和自定义struct构成的vector。研究了各种方法，有蛮多坑，将用到的方法共享之，作为备忘，同时也希望对你有帮助。&lt;/p&gt;

&lt;h3 id=&quot;需要引入的头文件&quot;&gt;需要引入的头文件&lt;/h3&gt;

&lt;div class=&quot;language-cpp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include &amp;lt;iostream&amp;gt;
#include &amp;lt;fstream&amp;gt;
#include &amp;lt;iterator&amp;gt;
#include &amp;lt;string&amp;gt;
#include &amp;lt;vector&amp;gt;
#include &amp;lt;fstream&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;将vectorstring写入文件&quot;&gt;将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vector&amp;lt;string&amp;gt;&lt;/code&gt;写入文件&lt;/h3&gt;

&lt;div class=&quot;language-cpp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;vector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;push_back&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;item1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;push_back&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;item2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;push_back&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;item3&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 写入&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;std&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ofstream&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;output_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;lists.txt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;std&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ostream_iterator&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;std&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;output_iterator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;output_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;std&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;copy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;output_iterator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;从文件读取数据到vectorstring-names&quot;&gt;从文件读取数据到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vector&amp;lt;string&amp;gt; names&lt;/code&gt;&lt;/h3&gt;

&lt;div class=&quot;language-cpp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;vector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;std&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ifstream&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;lists.txt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 读取&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&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;std&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;std&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;push_back&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;定义structlist_item&quot;&gt;定义&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;struct&lt;/code&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;list_item&lt;/code&gt;&lt;/h3&gt;

&lt;div class=&quot;language-cpp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;list_item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;score&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这里定义了一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;list_item&lt;/code&gt;的结构体，具体使用中你可以使用自己定义的结构体，应该也是没问题的。&lt;/p&gt;

&lt;h3 id=&quot;将vectorlist_item写入文件&quot;&gt;将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vector&amp;lt;list_item&amp;gt;&lt;/code&gt;写入文件&lt;/h3&gt;

&lt;div class=&quot;language-cpp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;vector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;list_item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;list_item&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;item1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;item1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;item1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;score&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;90&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;push_back&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;item1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;list_item&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;item2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;item2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;item2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;score&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;push_back&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;item2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 写入&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ofstream&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;os&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;item_list.db&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ios&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;binary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&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;p&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;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&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;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&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;p&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;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&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;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;size1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sizeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;list_item&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;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;从文件读取数据到vectorlist_item-lists&quot;&gt;从文件读取数据到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vector&amp;lt;list_item&amp;gt; lists&lt;/code&gt;&lt;/h3&gt;

&lt;div class=&quot;language-cpp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;vector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;list_item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 读取&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ifstream&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;item_list.db&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ios&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;binary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;p&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;span class=&quot;kt&quot;&gt;char&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;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;items&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;resize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;p&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;span class=&quot;kt&quot;&gt;char&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;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;size1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sizeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;list_item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;总结与待解决问题&quot;&gt;总结与待解决问题&lt;/h3&gt;

&lt;p&gt;上面的方法都是一次性获取一个vector后写入文件的，如果vector过大，一次性写入可能会有问题，在考虑做一个可以不断追加的方法，这样性能各方面会比较高，有什么好想法欢迎交流。&lt;/p&gt;

</content>
                 <tag>Node.js</tag> 
                 <tag>Node.js</tag> 
                <pubTime>2015-04-02T08:03:06+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/automator-batch-generate-icons.html</loc>
        <lastmod>2015-03-27T01:00:53+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用Automator批量生成图标</title>
                <content>
&lt;p&gt;因为设计师需要在完成图标设计后一次性生成各种尺寸的图标给工程师，使用Sketch虽然可以做到，但是还是很麻烦，所以决定给他写个脚本自动完成这个工作。&lt;/p&gt;

&lt;p&gt;因为工作环境都是Mac，自动化肯定首选&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Automator&lt;/code&gt;，如果使用原生的Crop方法会很麻烦，而且自动化程度不够高，所以就想使用bash脚本，搜索了一下，发现Mac已经自带了图像处理的命令行工具&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sips&lt;/code&gt;，具体用法就不细说了，可以参考官方文档：&lt;a href=&quot;https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/sips.1.html&quot;&gt;sips ManPages&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;大致用法：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sips &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;image-modification-functions] imagefile ... &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--out&lt;/span&gt; result-file-or-dir]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后就祭上&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Automator&lt;/code&gt;，创建一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Service&lt;/code&gt;，选择&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;image files&lt;/code&gt;，然后添加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Utilities&lt;/code&gt;-&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Run Shell Script&lt;/code&gt;，输入下面内容：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;sizes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=(&lt;/span&gt;144 96 72 29&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;f &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do
	for &lt;/span&gt;size &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sizes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[@]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;do	
		&lt;/span&gt;sips &lt;span class=&quot;nt&quot;&gt;-Z&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$size&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$f&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/.png/_&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.png&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;done
done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这个是最基本的版本，可以通过添加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sizes&lt;/code&gt;数组的内容增加需要生成的尺寸。&lt;/p&gt;

&lt;p&gt;后来因为iOS有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@2x&lt;/code&gt;这样的规则，所以又进行了一番修改，生成了特定的版本。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;sizes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=(&lt;/span&gt;144 76 144 120 180 80 160 57 114 40 80 120 29 58 97&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;sizen&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=(&lt;/span&gt;144 76 76@2x 60@2x 60@3x 80 80@2x 57 57@2x 40 40@2x 40@3x 29 29@2x 29@3x&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;f &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; 
&lt;span class=&quot;k&quot;&gt;do
	for &lt;/span&gt;i &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;!sizes[@]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do	
		&lt;/span&gt;sips &lt;span class=&quot;nt&quot;&gt;-Z&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sizes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$f&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/.png/_&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sizen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.png&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;done
done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;保存为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Build icons&lt;/code&gt;，然后在Finder中选中要生成的图标源文件（必须是png哦），选择&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Services&lt;/code&gt;中的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Build icons&lt;/code&gt;就会在源文件同目录生成一批你需要的图标了。&lt;/p&gt;

&lt;p&gt;源码和生成的Automator文件在GitHub：&lt;a href=&quot;https://github.com/yourtion/AutomatorGenerateICON&quot;&gt;https://github.com/yourtion/AutomatorGenerateICON&lt;/a&gt;，点击“Download ZIP”下载压缩包后，解压，双击直接安装就OK了。&lt;/p&gt;

&lt;p&gt;欢迎大家反馈意见建议~&lt;/p&gt;
</content>
                 <tag>插件</tag> 
                 <tag>Mac</tag> 
                <pubTime>2015-03-27T01:00:53+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/cnpm-privite-npm.html</loc>
        <lastmod>2015-03-25T23:25:30+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用CNPM搭建私有NPM</title>
                <content>
&lt;p&gt;最近的Node项目中因为数据模型等问题，需要有一个对各个模块进行统一的管理，如果把私有的模型publish到公共的npm不太合适，所以决定使用cnpm搭建一个私有的npm，同时也可以对项目常用的npm模块做一个缓存，加快部署速度。&lt;/p&gt;

&lt;p&gt;搭建的过程还是比较简单，参考cnpm的&lt;a href=&quot;https://github.com/cnpm/cnpmjs.org/wiki/Deploy&quot;&gt;Deploy&lt;/a&gt;很快搭建起来，给大家分享一下。&lt;/p&gt;

&lt;p&gt;服务器环境：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Ubuntu Server 14.04&lt;/li&gt;
  &lt;li&gt;Node.js v0.12.0&lt;/li&gt;
  &lt;li&gt;MySQL 5.5&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;因为cnpm使用了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--harmony&lt;/code&gt;参数，所以需要Node版本大于0.11.12，所以就直接上了最新的v0.12.0，没有MySQL也没关系，可以直接使用sqlite3。&lt;/p&gt;

&lt;h3 id=&quot;clone源码并导入sql&quot;&gt;Clone源码并导入SQL&lt;/h3&gt;

&lt;p&gt;（MySQL用户名：root 密码：root，数据库名：cnpm，项目和数据放在~/cnpm）&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&lt;span class=&quot;c&quot;&gt;# clone from github&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clone git://github.com/cnpm/cnpmjs.org.git &lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/cnpm
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/cnpmjs

&lt;span class=&quot;c&quot;&gt;# create mysql tables&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;mysql &lt;span class=&quot;nt&quot;&gt;-uroot&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-proot&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'DROP DATABASE IF EXISTS cnpmjs;'&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;mysql &lt;span class=&quot;nt&quot;&gt;-uroot&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-proot&lt;/span&gt;
mysql&amp;gt; use cnpmjs&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
mysql&amp;gt; &lt;span class=&quot;nb&quot;&gt;source &lt;/span&gt;docs/db.sql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;创建并编辑configjs&quot;&gt;创建并编辑&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.js&lt;/code&gt;&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;vim config/config.js
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;nx&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exports&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;na&quot;&gt;debug&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;scopes&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;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;@superid&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;enableCluster&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// enable cluster mode&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;mysqlServers&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;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;localhost&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3306&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;root&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;root&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;mysqlDatabase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;cnpm&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;enablePrivate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// enable private mode&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;admins&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;na&quot;&gt;admin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;yourtion@gmail.com&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;na&quot;&gt;syncModel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;exist&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 'none', 'all', 'exist'&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;安装依赖并启动运行&quot;&gt;安装依赖并启动运行&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;make &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;npm run start
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;检查运行&quot;&gt;检查运行&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#open registry and web&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# registry&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;curl http://localhost:7001
&lt;span class=&quot;c&quot;&gt;# web&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;curl http://localhost:7002
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;看到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;7001&lt;/code&gt;返回json数据，而&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;7002&lt;/code&gt;返回HTML源代码就是运行成功。&lt;/p&gt;

&lt;h3 id=&quot;客户端设置&quot;&gt;客户端设置&lt;/h3&gt;

&lt;p&gt;首先安装cnpm，并设置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.cnpmrc&lt;/code&gt;：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; cnpm

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;vim  ~/.cnpmrc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;设置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;registry=http://127.0.0.1:7001&lt;/code&gt;(&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;127.0.0.1&lt;/code&gt;改为你的服务器ip)&lt;/p&gt;

&lt;p&gt;这样就可以正常的publish私有模块以及使用cnpm的缓存服务了。&lt;/p&gt;

&lt;h3 id=&quot;有几个需要注意的点&quot;&gt;有几个需要注意的点：&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;因为需要创建私有仓库并且保证有权限才能publish模块，所以&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.js&lt;/code&gt;中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;enablePrivate&lt;/code&gt;必须设为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;true&lt;/code&gt;;&lt;/li&gt;
  &lt;li&gt;为了保证私有的库不与公开npm冲突，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.js&lt;/code&gt;中需要设置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;scopes&lt;/code&gt;数组为你的公司名或者项目代号，publish的模块名为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@superid/myModel&lt;/code&gt;；&lt;/li&gt;
&lt;/ol&gt;
</content>
                 <tag>Node.js</tag> 
                 <tag>服务器</tag> 
                <pubTime>2015-03-25T23:25:30+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/blog-from-wordpress-to-jekyll.html</loc>
        <lastmod>2015-03-23T23:49:28+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>博客正式从Wordpress迁移到Jekyll</title>
                <content>
&lt;p&gt;从10年1月开始搭建自己的博客开始，一直都是用WP，随着Wordpress的发展走到了今天，终于受不了WP的臃肿，以前喜欢整天都是在弄所谓插件主题等各种折腾，现在没有那个时间和精力，只是想简简单单的写写博客，记录一下最近在弄的东西，与大家分享实践过程中遇到的问题。&lt;/p&gt;

&lt;p&gt;加上习惯了用Markdown写东西后，很不习惯WP写博客的方式，富媒体编辑器排版，有时候还要自己去编辑一下HTML源代码，实在是受不了。加上自己的WP托管在香港的虚拟主机，速度一般，而且最近经常出状况，一进去post页面就会白屏，很久没弄php懒得去排查什么，所以最终下定决心迁移。&lt;/p&gt;

&lt;p&gt;从二月底三月初开始计划迁移，寻找替代方案，从Ghost、Hexo到Jekyll，从动态博客的可玩性及便捷性中纠结，最后选定了Jekyll这样静态的博客程序，虽然功能没有WP那么强，但是胜在简洁方便，同时使用GitPage托管，省去折腾服务器。&lt;/p&gt;

&lt;p&gt;然后是Jekyll的主题问题，看了挺多人做的主题都不是很满意，要不就是太复杂，要不就是部署各方面太麻烦，最终决定自己用Bootstrap自己写一个兼容桌面与移动客户端的主题，同时使用JQuery来实现一定的动态性，这样就又折腾了一个多星期。&lt;/p&gt;

&lt;p&gt;最后就是折腾数据的导出和到Markdown的转换，考虑到SEO等等问题，希望文章的链接与之前的WP保持一致，所以先从WP导出了所有文章，用脚本转换成了Markdown文件，然后开始漫长的文章整理和重新排版，对之前博客的内容进行筛选，从导出的560篇博文中去掉没有用的转载和跟技术无关的文章，最后精简到现在的240篇，进而整理代码高亮、文章排版等问题。&lt;/p&gt;

&lt;p&gt;最后就是整合调试和部署到Github和GitCafe上，利用七牛的CDN做静态资源的缓存，同时用DNSPod实现国内国外分流访问，具体的迁移过程和细节接下来会进一步写博文分享。&lt;/p&gt;

&lt;p&gt;总而言之，今天正式完成博客的迁移，希望接下来可以更好的写更多东西~欢迎大家访问和提意见！&lt;/p&gt;

</content>
                 <tag>Jekyll</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2015-03-23T23:49:28+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/mongodb-2-6-adduser.html</loc>
        <lastmod>2015-03-02T20:39:14+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>MongoDB2.6添加用户权限方法</title>
                <content>
&lt;p&gt;使用Mongodb数据库，需要为各个数据库增加用户权限，查了一下发现下面代码：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;test2&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addUser&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;na&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
              &lt;span class=&quot;na&quot;&gt;pwd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;admin&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
              &lt;span class=&quot;na&quot;&gt;roles&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;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;readWrite&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;dbAdmin&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;p&quot;&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;执行后发现：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;mongo 192.168.1.111/test2 &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; admin
MyMongo:PRIMARY&amp;gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;Error: 18 { ok: 0.0, errmsg: “auth failed”, code: 18 } at src/mongo/shell/db.js:228&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;检测版本发现&quot;&gt;检测版本发现&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$mongo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--help&lt;/span&gt;
MongoDB shell version: 2.4.9

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;我使用的Mongodb是2.6版本，但是Shell是2.4.9的，感觉是这出现了文问题，所以采用下面方案：&lt;/p&gt;

&lt;h3 id=&quot;删除旧版本的client&quot;&gt;删除旧版本的Client&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get remove mongodb-clients
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get autoremove
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get autoclean

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;安装新的shell&quot;&gt;安装新的Shell&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;mongodb-org-shell&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;2.6.1
&lt;span class=&quot;nv&quot;&gt;$mongo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--help&lt;/span&gt;
MongoDB shell version: 2.6.1

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;使用新的（Mongodb 2.6的代码）添加用户&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;test2&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createUser&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;na&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;pwd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;admin&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;roles&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;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;readWrite&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;test2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$mongo&lt;/span&gt; 192.168.1.111/test2 &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; admin
MyMongo:PRIMARY&amp;gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;登录成功！！！！&lt;/p&gt;
</content>
                 <tag>MongoDB</tag> 
                 <tag>Node.js</tag> 
                <pubTime>2015-03-02T20:39:14+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ios-realtime-uitextfield-contect.html</loc>
        <lastmod>2014-12-21T02:10:21+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>iOS实时检测UITextField内容</title>
                <content>&lt;p&gt;想在用户输入内容的时候同时检测&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UITextField&lt;/code&gt;的输入并根据用户的输入内容响应页面上的事件，在这个例子中是实时检测用户输入的手机号码，当手机号码的位数达到11位同时满足手机号码的格式时，确定按钮变为可用状态。&lt;/p&gt;

&lt;p&gt;代码如下：&lt;/p&gt;

&lt;p&gt;先声明textfield然后添加下面方法：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BOOL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;textField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UITextField&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;nv&quot;&gt;textField&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;shouldChangeCharactersInRange&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSRange&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;replacementString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nv&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;checkString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;11&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;NO&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;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;if&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;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;isEqualToString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;&quot;&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;checkString&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;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;textfield&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;stringByAppendingString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;string&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;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;checkString&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;n&quot;&gt;checkString&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;stringByDeletingLastPathComponent&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;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;isMobileNumber&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;checkString&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;NSLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;号码满足&quot;&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;k&quot;&gt;else&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;@&quot;号码不满足&quot;&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;YES&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;p&quot;&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;手机号码检测使用下面代码：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BOOL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;isMobileNumber&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nv&quot;&gt;mobileNum&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MOBILE&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;@&quot;^((13[0-9])|(14[^4,&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;D])|(15[^4,&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;D])|(18[0-9]))&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;d{8}$|^1(7[0-9])&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;d{8}$&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSPredicate&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;regextestmobile&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;n&quot;&gt;NSPredicate&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;predicateWithFormat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;SELF MATCHES %@&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MOBILE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;regextestmobile&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;evaluateWithObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mobileNum&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;nb&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;YES&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;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;NO&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;p&quot;&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                
                 <tag>iOS</tag> 
                <pubTime>2014-12-21T02:10:21+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ios-custom-textfield-clearbutton.html</loc>
        <lastmod>2014-10-22T16:55:46+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>iOS自定义TextField的clearButton</title>
                <content>&lt;p&gt;因为自定义了 TextField的背景为黑色，所以原生的clearButton就看不到了，查找了一下，可以利用KVO方法进行定制，代码如下：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;UIButton&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clearButton&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;n&quot;&gt;myTextField&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;valueForKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;_clearButton&quot;&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;clearButton&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIImage&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;forState&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIControlStateNormal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Gist：&lt;a href=&quot;https://gist.github.com/yourtion/0c984de3245e52fff5ac&quot;&gt;https://gist.github.com/yourtion/0c984de3245e52fff5ac&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;希望对你有帮助啦！&lt;/p&gt;
</content>
                
                 <tag>iOS</tag> 
                <pubTime>2014-10-22T16:55:46+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/r-trycatch-basic-error-handing.html</loc>
        <lastmod>2014-10-05T13:16:41+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>R语言使用tryCatch进行简单的错误处理</title>
                <content>
&lt;p&gt;最近在看《机器学习：实用案例解析》，做邮件过滤器的时候，参考书中的代码读取邮件文件进行分类器训练，在读取过程中会出现下面的错误：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;seq.default(which(text == &quot;&quot;)[1] + 1, length(text), 1)
: 'from' cannot be NA, NaN or infinite
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;看了一下，应该是读取文件的时候文件编码的问题，具体锁定的代码如下：&lt;/p&gt;

&lt;div class=&quot;language-r highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;get.msg&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;con&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;rt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;latin1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;readLines&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;con&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;seq&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;which&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;con&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;paste&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;collapse&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;懒得去研究是哪里的问题，加上我也是刚刚学习R，最简单的方法就是做一个错误处理，捕获错误然后处理了就OK，最简单的莫过于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tryCatch&lt;/code&gt;了。找了一下，R中的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tryCatch&lt;/code&gt;使用方法如下：&lt;/p&gt;

&lt;div class=&quot;language-r highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tryCatch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;expr&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;warning&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;warning&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;handler&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&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;n&quot;&gt;handler&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;finally&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cleanup&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;接下来就很简单了，把代码修改为下面的形式，问题解决：&lt;/p&gt;

&lt;div class=&quot;language-r highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;get.msg&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;con&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;rt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;latin1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;readLines&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;con&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tryCatch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;seq&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;which&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;con&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;paste&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;collapse&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;总的来说，遇到这个问题我只是用来最简单的方法跳过去了，如果是在真实的项目中，可能就需要去排查具体的问题，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tryCatch&lt;/code&gt;只是用来预防一些极个别的错误情况用的方法。&lt;/p&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>R</tag> 
                <pubTime>2014-10-05T13:16:41+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/use-neon-optimize-clang-example.html</loc>
        <lastmod>2014-09-29T13:53:26+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用Neon优化移动设备上的C语言性能</title>
                <content>
&lt;p&gt;这是很久前就像写的文章，大概一个月了吧，各种忙碌与偷懒，现在终于开始写下来。前段时间主要在做一个C语言程序的移动平台移植，因为设计到性能问题，所以大概看了一下&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Neon&lt;/code&gt;技术。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;ARM® NEON™ 通用 SIMD 引擎可有效处理当前和将来的多媒体格式，从而改善用户体验。
NEON 技术可加速多媒体和信号处理算法（如视频编码/解码、2D/3D 图形、游戏、音频和语音处理、图像处理技术、电话和声音合成），其性能至少为 ARMv5 性能的 3 倍，为 ARMv6 SIMD 性能的 2 倍。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;详细介绍可以看：http://www.arm.com/zh/products/processors/technologies/neon.php&lt;/p&gt;

&lt;p&gt;先贴一下我用来测试的两个简单Demo吧。&lt;/p&gt;

&lt;p&gt;第一个是使用已经iOS或者Android已经封装的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Neon&lt;/code&gt;实现（参考：http://www.verydemo.com/demo_c92_i387648.html）：&lt;/p&gt;

&lt;p&gt;C语言实现：&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;float&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;calc_c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;float&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;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&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;kt&quot;&gt;float&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&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;i&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;sum&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;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Neon的实现（需要引入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Neon&lt;/code&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#include &amp;lt;arm_neon.h&amp;gt;&lt;/code&gt;）：&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;float&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;calc_neon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;float&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;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&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;kt&quot;&gt;float&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;float32x4_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sum_vec&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vdupq_n_f32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&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;i&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;float32x4_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmp_vec&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vld1q_f32&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;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;sum_vec&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vaddq_f32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sum_vec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmp_vec&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;sum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vgetq_lane_f32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sum_vec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;sum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vgetq_lane_f32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sum_vec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;sum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vgetq_lane_f32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sum_vec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;n&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vgetq_lane_f32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sum_vec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;odd&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;odd&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;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;odd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&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;i&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;sum&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;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&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;p&quot;&gt;}&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;第二个是使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Neon&lt;/code&gt;的汇编代码实现除2运算（参考：http://blog.noctua-software.com/arm-asm.html）&lt;/p&gt;

&lt;p&gt;C语言实现：&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;div_by_2c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int16_t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&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;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&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;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&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;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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Neon加汇编（&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ARM assembly&lt;/code&gt;）实现：&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;div_by_2neon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int16_t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&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;asm&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;volatile&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
                  &lt;span class=&quot;s&quot;&gt;&quot;Lloop:                         &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n\t&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;
                  &lt;span class=&quot;s&quot;&gt;&quot;vld1.16    {q0}, [%[x]:128]    &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n\t&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;
                  &lt;span class=&quot;s&quot;&gt;&quot;vshr.s16   q0, q0, #1          &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n\t&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;
                  &lt;span class=&quot;s&quot;&gt;&quot;vst1.16    {q0}, [%[x]:128]!   &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n\t&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;
                  &lt;span class=&quot;s&quot;&gt;&quot;sub        %[n], #8            &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n\t&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;
                  &lt;span class=&quot;s&quot;&gt;&quot;cmp        %[n], #0            &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n\t&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;
                  &lt;span class=&quot;s&quot;&gt;&quot;bne Lloop                      &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n\t&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;
                  &lt;span class=&quot;c1&quot;&gt;// output&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;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;+r&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&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;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;+r&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&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;c1&quot;&gt;// clobbered registers&lt;/span&gt;
                  &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;q0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;memory&quot;&lt;/span&gt;
                  &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;测试程序代码如下：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;test&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;malloc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;sizeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;float&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;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&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;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;i&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;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mo&quot;&gt;0111&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&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;NSDate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmpStartData&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;n&quot;&gt;NSDate&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&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;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;calc_neon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&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;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;deltaTime&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;n&quot;&gt;NSDate&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;timeIntervalSinceDate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tmpStartData&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;@&quot;calc_neon cost time = %f ms&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;deltaTime&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSDate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmpStartData1&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;n&quot;&gt;NSDate&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&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;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;calc_c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&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;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;deltaTime1&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;n&quot;&gt;NSDate&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;timeIntervalSinceDate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tmpStartData1&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;@&quot;calc_c cost time = %f ms&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;deltaTime1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int16_t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;malloc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;sizeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int16_t&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;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;n&quot;&gt;NSDate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmpStartData2&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;n&quot;&gt;NSDate&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&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;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;div_by_2c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&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;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;deltaTime2&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;n&quot;&gt;NSDate&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;timeIntervalSinceDate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tmpStartData2&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;@&quot;div_by_2c cost time = %f ms&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;deltaTime2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;kt&quot;&gt;int16_t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;malloc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;sizeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int16_t&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;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSDate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmpStartData3&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;n&quot;&gt;NSDate&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&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;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;div_by_2neon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&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;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;deltaTime3&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;n&quot;&gt;NSDate&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;timeIntervalSinceDate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tmpStartData3&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;@&quot;div_by_2neon cost time = %f ms&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;deltaTime3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;执行速度对比（测试环境为iPhone5 iOS 8.0.2 Xcode6）：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2014/09/Screen-Shot-2014-09-29-at-1.42.24-PM.png&quot;&gt;&lt;img src=&quot;/images/2014/09/Screen-Shot-2014-09-29-at-1.42.24-PM.png&quot; alt=&quot;iPhone5&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;从测试效果上看，在iPhone5上可以提升1.3倍和16.5倍性能，当然这个只是一个简单的测试应用，具体实现和实践中的效果只有运用到算法中才能体现。&lt;/p&gt;
</content>
                 <tag>Neon</tag> 
                 <tag>iOS</tag> 
                <pubTime>2014-09-29T13:53:26+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/node-js-addon-ues-library.html</loc>
        <lastmod>2014-07-30T16:54:46+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>在Node.js的C++扩展中编译第三方库</title>
                <content>
&lt;p&gt;需要为项目中为Node.js制作一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C++&lt;/code&gt;的Addon，其中用到一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jpg&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lib&lt;/code&gt;，找了很多资料，对于在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;addon&lt;/code&gt;中添加的静态库等的都不能成功，最后自己自己倒腾了一番，成功的将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jpglib&lt;/code&gt;编译到项目中，方法比较简单，共享之。&lt;/p&gt;

&lt;p&gt;主要操作的是“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;binding.gyp&lt;/code&gt;”这个文件，将要引用的库的源码放到一个文件夹，这里是“jpglib”，然后在binging文件添加一个build的选项，最终文件如下：&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;targets&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;'target_name':&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;'jpeg'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;'type':&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;'static_library'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;'sources':&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;jpglib/jcapimin.c&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;jpglib/jcapistd.c&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;jpglib/jccoefct.c&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;jpglib/jccolor.c&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;'include_dirs':&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;jpglib&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;target_name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Test&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;sources&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;test.cc&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;'dependencies':&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;'jpeg'&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jpeg&lt;/code&gt;”的“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sources&lt;/code&gt;”中包含&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jpglib&lt;/code&gt;源码中需要的c文件，这样编译后就会生成一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jpeg.a&lt;/code&gt;的静态库，在最终工程的源码中就能直接使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jpglib&lt;/code&gt;的功能。&lt;/p&gt;
</content>
                 <tag>Addon</tag> 
                 <tag>Node.js</tag> 
                <pubTime>2014-07-30T16:54:46+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ios-object-and-line-animation.html</loc>
        <lastmod>2014-07-27T17:49:15+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>iOS物体与直线动画</title>
                <content>
&lt;p&gt;最近在做产品里面一个界面的交互，需要对一个物体进行移动，同时有一条直线跟随物体运动增长，就像物体是拉着一根线出现，消失的时候就是线拉着物体回去的感觉，大概情况如下面的动画：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2014/07/ScreenShot.gif&quot;&gt;&lt;img src=&quot;/images/2014/07/ScreenShot.gif&quot; alt=&quot;ScreenShot&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;找了挺久的教程，很多动画的路径都是直接显示，或者是不显示，没办法，只能直接动手自己写，完成后与大家共享，希望能帮到大家。&lt;/p&gt;

&lt;p&gt;说说实现的大概思路，具体的代码请看Git的Demo咯，大家有需要的话后期可以抽象成一个类库来。现在只要简单的上下左右移动，可以根据需求修改运动坐标变成任意方向移动，稍后会更新上去。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demo on GitHub：&lt;a href=&quot;https://github.com/yourtion/Demo_LineAnimation&quot;&gt;https://github.com/yourtion/Demo-LineAnimation&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;动画主要由三块组成：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;使用CAKeyframeAnimation进行物体的路径移动；&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;使用UIBezierPath构建路径线及使用CABasicAnimation的stroke完成线的动画；&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;使用CABasicAnimation的opacity进行物体运动过程的透明度变化，让动画更加自然；&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;最后就是使用CAAnimationGroup将动画组合起来，效果就是上面所看到的，具体代码参见GitHub的Demo，欢迎大家Fork项目还有Follow我，有什么问题欢迎一起交流。&lt;/p&gt;

</content>
                 <tag>Animation</tag> 
                 <tag>iOS</tag> 
                <pubTime>2014-07-27T17:49:15+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ghost-add-duo-shuo-comment.html</loc>
        <lastmod>2014-07-16T16:26:23+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Ghost添加多说评论</title>
                <content>
&lt;p&gt;最近整了一个Ghost博客玩了一下：&lt;a href=&quot;http://view.yourtion.com&quot;&gt;http://view.yourtion.com&lt;/a&gt;，在其中集成多说的评论，参考了一些文章，都不是很详细，所以就把我自己集成的过程分享之~&lt;/p&gt;

&lt;p&gt;我的Ghost使用的是&lt;a href=&quot;https://github.com/sethlilly/Vapor&quot;&gt;https://github.com/sethlilly/Vapor&lt;/a&gt; 的主题，其他的主题修改也差不多。&lt;/p&gt;

&lt;p&gt;首先是多说的注册和设置站点，这里就不多讲，进入通用代码页面（如下图）&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2014/07/Duoshuo-code.jpg&quot;&gt;&lt;img src=&quot;/images/2014/07/Duoshuo-code.jpg&quot; alt=&quot;Duoshuo-code&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;在模板的“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;default.hbs&lt;/code&gt;”的&amp;lt;/body&amp;gt;之前添加多说的js代码部分（即&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;包含部分）&lt;a href=&quot;https://github.com/yourtion/Vapor/blob/yourtion/default.hbs&quot;&gt;https://github.com/yourtion/Vapor/blob/yourtion/default.hbs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;然后在“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;page.hbs&lt;/code&gt;”和“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;post.hbs&lt;/code&gt;”的“{{/post}}”标签之前添加多说的评论DIV，这个已经针对Ghost修改：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ds-thread&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-thread-key=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;\{\{id}}&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-title=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;\{\{title}}&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-url=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;\{\{url absolute=&quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&quot;}}&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;参考：&lt;a href=&quot;https://github.com/yourtion/Vapor/blob/yourtion/post.hbs&quot;&gt;https://github.com/yourtion/Vapor/blob/yourtion/post.hbs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;至此集成就完成了，详细效果可以看：&lt;a href=&quot;http://view.yourtion.com&quot;&gt;http://view.yourtion.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;主题的源码已经托管在GitHub：&lt;a href=&quot;https://github.com/yourtion/Vapor/tree/yourtion&quot;&gt;https://github.com/yourtion/Vapor/tree/yourtion&lt;/a&gt;&lt;/p&gt;

</content>
                 <tag>Ghost</tag> 
                 <tag>Node.js</tag> 
                <pubTime>2014-07-16T16:26:23+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/custom-cifilter-qrcode-generator.html</loc>
        <lastmod>2014-06-05T22:13:08+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用CIFilter生成二维码并自定义</title>
                <content>
&lt;p&gt;iOS7之后，可以使用原生的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CIFilter&lt;/code&gt;创建二维码，但是生成的二维码只有黑白，而且大小不好控制，找了一下资料，发现解决的方法，使二维码透明背景，自定义颜色，还能加上阴影效果，方法很简单，直接调用即可，效果如下：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2014/06/IMG_3977.png&quot;&gt;&lt;img src=&quot;/images/2014/06/IMG_3977.png&quot; alt=&quot;CustomQRCodeDemo&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demo地址：&lt;a href=&quot;https://github.com/yourtion/Demo_CustomQRCode&quot;&gt;https://github.com/yourtion/Demo_CustomQRCode&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;首先是二维码的生成，使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CIFilter&lt;/code&gt;很简单，直接传入生成二维码的字符串即可：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CIImage&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;nf&quot;&gt;createQRForString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSString&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;nv&quot;&gt;qrString&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSData&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stringData&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;n&quot;&gt;qrString&lt;/span&gt; &lt;span class=&quot;nf&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;c1&quot;&gt;// 创建filter&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CIFilter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;qrFilter&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;n&quot;&gt;CIFilter&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;filterWithName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;CIQRCodeGenerator&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 设置内容和纠错级别&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;qrFilter&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stringData&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;forKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;inputMessage&quot;&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;qrFilter&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;M&quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;forKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;inputCorrectionLevel&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 返回CIImage&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;qrFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;outputImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;因为生成的二维码是一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CIImage&lt;/code&gt;，我们直接转换成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIImage&lt;/code&gt;的话大小不好控制，所以使用下面方法返回需要大小的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIImage&lt;/code&gt;：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIImage&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;nf&quot;&gt;createNonInterpolatedUIImageFormCIImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CIImage&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;nv&quot;&gt;image&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;withSize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGFloat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGRect&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;extent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGRectIntegral&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;extent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGFloat&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scale&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MIN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGRectGetWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;extent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGRectGetHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;extent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 创建bitmap;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;size_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;width&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGRectGetWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;extent&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;scale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;size_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;height&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGRectGetHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;extent&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;scale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGColorSpaceRef&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGColorSpaceCreateDeviceGray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGContextRef&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bitmapRef&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGBitmapContextCreate&lt;/span&gt;&lt;span class=&quot;p&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;n&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;cs&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;CGBitmapInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;kCGImageAlphaNone&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CIContext&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;context&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;n&quot;&gt;CIContext&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;contextWithOptions&lt;/span&gt;&lt;span class=&quot;p&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;n&quot;&gt;CGImageRef&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bitmapImage&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;n&quot;&gt;context&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;createCGImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;fromRect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;extent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGContextSetInterpolationQuality&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bitmapRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;kCGInterpolationNone&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGContextScaleCTM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bitmapRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGContextDrawImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bitmapRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;extent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bitmapImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 保存bitmap到图片&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGImageRef&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scaledImage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGBitmapContextCreateImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bitmapRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGContextRelease&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bitmapRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGImageRelease&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bitmapImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIImage&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;imageWithCGImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scaledImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;因为生成的二维码是黑白的，所以还要对二维码进行颜色填充，并转换为透明背景，使用遍历图片像素来更改图片颜色，因为使用的是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CGContext&lt;/code&gt;，速度非常快：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ProviderReleaseData&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&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;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;size_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;free&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&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;n&quot;&gt;data&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;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIImage&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;nf&quot;&gt;imageBlackToTransparent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIImage&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;nv&quot;&gt;image&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;withRed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGFloat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;red&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;andGreen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGFloat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;green&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;andBlue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGFloat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageWidth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageHeight&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;size_t&lt;/span&gt;      &lt;span class=&quot;n&quot;&gt;bytesPerRow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageWidth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;uint32_t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rgbImageBuf&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;kt&quot;&gt;uint32_t&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;n&quot;&gt;malloc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bytesPerRow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGColorSpaceRef&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;colorSpace&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGColorSpaceCreateDeviceRGB&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGContextRef&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGBitmapContextCreate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rgbImageBuf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytesPerRow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;colorSpace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                                                 &lt;span class=&quot;n&quot;&gt;kCGBitmapByteOrder32Little&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;kCGImageAlphaNoneSkipLast&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGContextDrawImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGRectMake&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 遍历像素&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pixelNum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageWidth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;uint32_t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pCurPtr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rgbImageBuf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pixelNum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&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;n&quot;&gt;pCurPtr&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;k&quot;&gt;if&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;pCurPtr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xFFFFFF00&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x99999900&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;// 将白色变成透明&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;// 改成下面的代码，会将图片转成想要的颜色&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;uint8_t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ptr&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;kt&quot;&gt;uint8_t&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;n&quot;&gt;pCurPtr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ptr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&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;red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//0~255&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ptr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;green&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ptr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;blue&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;k&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;uint8_t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ptr&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;kt&quot;&gt;uint8_t&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;n&quot;&gt;pCurPtr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ptr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;=&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;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 输出图片&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGDataProviderRef&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dataProvider&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGDataProviderCreateWithData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rgbImageBuf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytesPerRow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ProviderReleaseData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGImageRef&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageRef&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGImageCreate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytesPerRow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;colorSpace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                                        &lt;span class=&quot;n&quot;&gt;kCGImageAlphaLast&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;kCGBitmapByteOrder32Little&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dataProvider&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                                        &lt;span class=&quot;nb&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;kCGRenderingIntentDefault&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGDataProviderRelease&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dataProvider&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;UIImage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;resultUIImage&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;n&quot;&gt;UIImage&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;imageWithCGImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 清理空间&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGImageRelease&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGContextRelease&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGColorSpaceRelease&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;colorSpace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;resultUIImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;经过这样的处理，基本上二维码就成型了，如果还想加上阴影，就在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ImageView&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Layer&lt;/code&gt;上使用下面代码添加阴影：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;ImageView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowOffset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGSizeMake&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;mi&quot;&gt;0&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;p&quot;&gt;);&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;// 设置阴影的偏移量&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ImageView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowRadius&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;c1&quot;&gt;// 设置阴影的半径&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ImageView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowColor&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;n&quot;&gt;UIColor&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;blackColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 设置阴影的颜色为黑色&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ImageView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shadowOpacity&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 设置阴影的不透明度&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样就大功告成，希望能帮到你，欢迎大家一起交流。&lt;/p&gt;
</content>
                 <tag>CIFilter</tag> 
                 <tag>iOS</tag> 
                <pubTime>2014-06-05T22:13:08+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/fix-os-x-10-10-pods-issus.html</loc>
        <lastmod>2014-06-04T17:34:20+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>解决OS X 10.10 Pod 出错问题</title>
                <content>
&lt;p&gt;昨天升级到Mac OS X 10.10 Yosemite，今天用pod添加库的时候发现出现问题了，pod install 出现下面的错误：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- xcodeproj/prebuilt/universal.x86_64-darwin14-2.0.0/xcodeproj_ext (LoadError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.16.1/lib/xcodeproj/ext.rb:6:in `rescue in &amp;lt;top (required)&amp;gt;'
    from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.16.1/lib/xcodeproj/ext.rb:3:in `&amp;lt;top (required)&amp;gt;'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.16.1/lib/xcodeproj.rb:30:in `&amp;lt;top (required)&amp;gt;'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.32.1/lib/cocoapods.rb:2:in `&amp;lt;top (required)&amp;gt;'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.32.1/bin/pod:32:in `&amp;lt;top (required)&amp;gt;'
    from /usr/bin/pod:23:in `load'
    from /usr/bin/pod:23:in `&amp;lt;main&amp;gt;'
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;找了一下，找到解决的方法：&lt;/p&gt;

&lt;p&gt;首先安装Xcode6 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Command Line Tools&lt;/code&gt;，在开发者中心下载&lt;/p&gt;

&lt;p&gt;接下来按照下面步骤操作：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;打开 Xcode 6&lt;/li&gt;
  &lt;li&gt;打开 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Preferences&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;选择 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Locations&lt;/code&gt;选项卡&lt;/li&gt;
  &lt;li&gt;将 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Command Line Tools&lt;/code&gt;选择为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Xcode 6.0&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;卸载 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cocoapods&lt;/code&gt;执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$ sudo gem uninstall cocoapods&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;安装 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xcodeproj&lt;/code&gt;执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$ sudo gem install xcodeproj&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;再安装 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cocoapods&lt;/code&gt;执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$ sudo gem install cocoapods&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;最后运行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pod --version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;就看到Pod正常了。&lt;/p&gt;

&lt;p&gt;&lt;em&gt;参考：&lt;a href=&quot;https://github.com/CocoaPods/CocoaPods/issues/2219#issuecomment-44979127&quot;&gt;https://github.com/CocoaPods/CocoaPods/issues/2219#issuecomment-44979127&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
</content>
                 <tag>Pod</tag> 
                 <tag>iOS</tag> 
                <pubTime>2014-06-04T17:34:20+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/snapshotview-ios6.html</loc>
        <lastmod>2014-04-07T12:57:56+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>snapshotViewAfterScreenUpdates兼容iOS6</title>
                <content>
&lt;p&gt;最近在做一个项目，使用了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FMMoveTableView&lt;/code&gt;，使得&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UITableView&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cell&lt;/code&gt;能够长按拖动。但是在iOS6下出现崩溃的情况，研究一番，发现是库中使用了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;snapshotViewAfterScreenUpdates&lt;/code&gt;，这个API是iOS7特有的，所以就写个兼容方案，让&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FMMoveTableView&lt;/code&gt;可以在iOS6下正常运行。&lt;/p&gt;

&lt;p&gt;原理也很简单，使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIGraphicsGetCurrentContext&lt;/code&gt;，将需要移动的cell进行截图，代替&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;snapshotViewAfterScreenUpdates&lt;/code&gt;，这样效率各方面可能没那么高，到时运行过程基本不能察觉。&lt;/p&gt;

&lt;p&gt;代码如下：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;snapShot&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;n&quot;&gt;UIView&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;alloc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;initWithFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;touchedCell&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;UIGraphicsBeginImageContextWithOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;touchedCell&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;touchedCell&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;renderInContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIGraphicsGetCurrentContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()];&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;UIImage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;viewImage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;UIGraphicsGetImageFromCurrentImageContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;UIGraphicsEndImageContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;UIImageView&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shot&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;n&quot;&gt;UIImageView&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;alloc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;initWithImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;viewImage&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;snapShot&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;addSubview&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;更具体的代码可以参见：&lt;a href=&quot;https://github.com/yourtion/FMMoveTableView/commit/586f5001fbc3d260e3f1dc4b1c7b11ff579bdfb7&quot;&gt;https://github.com/yourtion/FMMoveTableView/commit/586f5001fbc3d260e3f1dc4b1c7b11ff579bdfb7&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;但是作者已经明确说不再支持iOS6了（https://github.com/FlorianMielke/FMMoveTableView/pull/22）。&lt;/p&gt;

&lt;p&gt;需要兼容的同学可以在我的git上拉版本&lt;a href=&quot;https://github.com/yourtion/FMMoveTableView&quot;&gt;https://github.com/yourtion/FMMoveTableView&lt;/a&gt;让FMMoveTableView兼容iOS6。&lt;/p&gt;
</content>
                
                 <tag>iOS</tag> 
                <pubTime>2014-04-07T12:57:56+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ios-photo-360-degree-rotation.html</loc>
        <lastmod>2014-03-03T19:39:27+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>iOS图片360度旋转</title>
                <content>
&lt;p&gt;最近一个项目需要对图片进行不断旋转，实现方法也比较简单，代码分享之~&lt;/p&gt;

&lt;p&gt;利用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CABasicAnimation&lt;/code&gt;添加一个动画层，让图片围绕Z轴旋转，通过不同的图层组合和时间，可以调出各种效果。&lt;/p&gt;

&lt;p&gt;核心的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Function&lt;/code&gt;如下，传入一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIImageView&lt;/code&gt;，会返回一个不断旋转的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIImageView&lt;/code&gt;，可以控制动画时间和长度。唯一的不足是没办法回调或在动画执行过程中得知动画进行的情况。&lt;/p&gt;

&lt;p&gt;先上代码：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIImageView&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;nf&quot;&gt;rotate360DegreeWithImageView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIImageView&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;nv&quot;&gt;imageView&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CABasicAnimation&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;animation&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;n&quot;&gt;CABasicAnimation&lt;/span&gt;
                                   &lt;span class=&quot;nl&quot;&gt;animationWithKeyPath:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;@&quot;transform&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fromValue&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;n&quot;&gt;NSValue&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;valueWithCATransform3D&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CATransform3DIdentity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//围绕Z轴旋转，垂直与屏幕&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;toValue&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;n&quot;&gt;NSValue&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;valueWithCATransform3D&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
                         &lt;span class=&quot;n&quot;&gt;CATransform3DMakeRotation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;M_PI&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&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;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&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;animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;duration&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//旋转效果累计，先转180度，接着再旋转180度，从而实现360旋转&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cumulative&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;repeatCount&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;removedOnCompletion&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;CGRect&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageRrect&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CGRectMake&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;UIGraphicsBeginImageContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageRrect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&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;imageView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;drawInRect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageRrect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;imageView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;UIGraphicsGetImageFromCurrentImageContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;UIGraphicsEndImageContext&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;imageView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;addAnimation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;forKey&lt;/span&gt;&lt;span class=&quot;p&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imageView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;使用方法：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// 开始动画Loding为UIImageView&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Loding&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;n&quot;&gt;self&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;rotate360DegreeWithImageView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Loding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//结束动画&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Loding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;removeAllAnimates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;相关参数解析：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// 旋转方向——顺时针&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;CATransform3DMakeRotation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;M_PI&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&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;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&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;c1&quot;&gt;// 旋转方向——逆时针&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;CATransform3DMakeRotation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;M_PI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 动画无限循环&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;repeatCount&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;c1&quot;&gt;// 动画时间0.4秒&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;duration&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其他的可以自己摸索，比较简单就不上Demo了&lt;/p&gt;
</content>
                 <tag>Animation</tag> 
                 <tag>iOS</tag> 
                <pubTime>2014-03-03T19:39:27+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/solve-warn_unsafe_extraction.html</loc>
        <lastmod>2014-02-20T13:48:19+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Python出现'_warn_unsafe_extraction'解决方法</title>
                <content>
&lt;p&gt;在Python项目中运行出现了“AttributeError: ResourceManager instance has no attribute ‘_warn_unsafe_extraction’”问题，研究了一下，发现是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setuptools&lt;/code&gt;在MacOS下的一个问题（见下图），我出现问题的是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pymongo&lt;/code&gt;的库，需要删除&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pymongo&lt;/code&gt;，然后降级&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setuptools&lt;/code&gt;再重新安装。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2014/02/warn_unsafe_extraction.png&quot;&gt;&lt;img src=&quot;/images/2014/02/warn_unsafe_extraction.png&quot; alt=&quot;warn_unsafe_extraction&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;解决方法：&lt;/p&gt;

&lt;p&gt;1、删除pymongo：&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;easy_install &lt;span class=&quot;nt&quot;&gt;-mxN&lt;/span&gt; pmongo
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;2、降级setuptools：&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;easy_install &lt;span class=&quot;nt&quot;&gt;-mxN&lt;/span&gt; setuptools
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;easy_install &lt;span class=&quot;s2&quot;&gt;&quot;setuptools&amp;lt;0.7&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;3、重装pymongo：&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;easy_install pymongo
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;问题解决！！！！！&lt;/p&gt;

&lt;p&gt;附错误信息：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python /Users/yourtion/Codes/python/knowme/server.py
Traceback (most recent call last):
  File &quot;/Users/yourtion/Codes/python/knowme/server.py&quot;, line 5, in &amp;lt;module&amp;gt;
    from Handler.api import UserHandler
  File &quot;/Users/yourtion/Codes/python/knowme/Handler/api.py&quot;, line 3, in &amp;lt;module&amp;gt;
    from Model.user import User
  File &quot;/Users/yourtion/Codes/python/knowme/Model/user.py&quot;, line 2, in &amp;lt;module&amp;gt;
    from mongoengine import *
  File &quot;build/bdist.macosx-10.9-intel/egg/mongoengine/__init__.py&quot;, line 1, in &amp;lt;module&amp;gt;
  File &quot;build/bdist.macosx-10.9-intel/egg/mongoengine/document.py&quot;, line 4, in &amp;lt;module&amp;gt;
  File &quot;/Library/Python/2.7/site-packages/pymongo-2.6.3-py2.7-macosx-10.8-intel.egg/pymongo/__init__.py&quot;, line 80, in &amp;lt;module&amp;gt;
  File &quot;/Library/Python/2.7/site-packages/pymongo-2.6.3-py2.7-macosx-10.8-intel.egg/pymongo/connection.py&quot;, line 39, in &amp;lt;module&amp;gt;
  File &quot;/Library/Python/2.7/site-packages/pymongo-2.6.3-py2.7-macosx-10.8-intel.egg/pymongo/mongo_client.py&quot;, line 44, in &amp;lt;module&amp;gt;
  File &quot;/Library/Python/2.7/site-packages/pymongo-2.6.3-py2.7-macosx-10.8-intel.egg/bson/__init__.py&quot;, line 41, in &amp;lt;module&amp;gt;
  File &quot;/Library/Python/2.7/site-packages/pymongo-2.6.3-py2.7-macosx-10.8-intel.egg/bson/_cbson.py&quot;, line 7, in &amp;lt;module&amp;gt;
  File &quot;/Library/Python/2.7/site-packages/pymongo-2.6.3-py2.7-macosx-10.8-intel.egg/bson/_cbson.py&quot;, line 4, in __bootstrap__
  File &quot;build/bdist.macosx-10.9-intel/egg/pkg_resources.py&quot;, line 914, in resource_filename
    %s
  File &quot;build/bdist.macosx-10.9-intel/egg/pkg_resources.py&quot;, line 1601, in get_resource_filename
    &quot;&quot;&quot;Retrieve a PEP 302 &quot;importer&quot; for the given path item
  File &quot;build/bdist.macosx-10.9-intel/egg/pkg_resources.py&quot;, line 1629, in _extract_resource
    from pkgutil import get_importer, ImpImporter
  File &quot;build/bdist.macosx-10.9-intel/egg/pkg_resources.py&quot;, line 990, in get_cache_path

AttributeError: ResourceManager instance has no attribute '_warn_unsafe_extraction'

Process finished with exit code 1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
                 <tag>Python</tag> 
                 <tag>电脑技巧</tag> 
                <pubTime>2014-02-20T13:48:19+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ios-radiusavatar-demo.html</loc>
        <lastmod>2014-02-15T11:28:15+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>iOS实现图片圆角及圆形头像效果</title>
                <content>
&lt;p&gt;最近在做一个项目，需要用户头像显示为圆形，研究了一下，写了个简单的Demo，当做一个笔记，也希望能帮到需要的人。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demo：&lt;a href=&quot;https://github.com/yourtion/Demo_iOSRadiusAvatar&quot;&gt;https://github.com/yourtion/Demo_iOSRadiusAvatar&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;思路：使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;view&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;layer&lt;/code&gt;属性，通过设置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cornerRadius&lt;/code&gt;来设置圆角的半径，当&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;view&lt;/code&gt;是正方形同时圆角为边长一般时形成圆形的头像。&lt;/p&gt;

&lt;p&gt;代码如下：&lt;/p&gt;

&lt;div class=&quot;language-objc highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageView1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setCornerRadius&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CGRectGetHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;view&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;bounds&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;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageView1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;masksToBounds&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imageView1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;contents&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;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIImage&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;imageNamed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&quot;image&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;CGImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;更多效果参见Demo。效果如下：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2014/02/iOS-RadiusAvatar-Demo.png&quot;&gt;&lt;img src=&quot;/images/2014/02/iOS-RadiusAvatar-Demo.png&quot; alt=&quot;iOS-RadiusAvatar-Demo&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                
                 <tag>iOS</tag> 
                <pubTime>2014-02-15T11:28:15+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/jquery-request-xhr-restful.html</loc>
        <lastmod>2014-02-14T19:05:57+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>jQuery跨域请求RESTful</title>
                <content>
&lt;p&gt;今天下午有个朋友问起关于用jQuery实现百度BCS的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RESTful&lt;/code&gt;请求，一直提示“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Success&lt;/code&gt;”但是执行不成功，所以研究了一下jQuery的跨域，写了个Demo，希望能帮助到需要的童鞋~~&lt;/p&gt;

&lt;p&gt;因为请求在百度云，所以需要添加跨域，不然会提示拒绝跨域。&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ajax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
	&lt;span class=&quot;na&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;http://bcs.duapp.com/testjsjs/%2Ftwister.txt?sign=MBO:FB414a1be43c6585a6357c4b373b8dab:vrgj4sxtv264xnyQziodKAMTfMo%3D&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;DELETE&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;na&quot;&gt;beforeSend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;xhr&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;nx&quot;&gt;xhr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;overrideMimeType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;text/plain; charset=x-user-defined&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;done&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&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;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&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;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Sample of data:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&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;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;结果如下图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2014/02/jquery-bcs-restful.jpg&quot;&gt;&lt;img src=&quot;/images/2014/02/jquery-bcs-restful.jpg&quot; alt=&quot;jquery-bcs-restful&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

</content>
                 <tag>JavaScript</tag>  <tag>jQuery</tag> 
                 <tag>HTML</tag> 
                <pubTime>2014-02-14T19:05:57+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/twister-stack-smashing-detected-solution.html</loc>
        <lastmod>2014-01-10T10:35:42+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Twister出现stack smashing detected解决方法</title>
                <content>
&lt;p&gt;之前的文章介绍了在《&lt;a href=&quot;/ubuntu-install-twister.html&quot;&gt;Ubuntu安装使用Twister&lt;/a&gt;》，但是安装完成后，特别是加载完&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;block&lt;/code&gt;就经常会出现：&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*** stack smashing detected ***: ./twisterd terminated&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;研究了一下是因为空间分配不足导致内存溢出，是使用了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GCC&lt;/code&gt;的“ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-fstack-protector&lt;/code&gt;“参数导致的。找了一下，解决方法如下：&lt;/p&gt;

&lt;p&gt;在twister的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;src&lt;/code&gt;文件夹，编辑“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;makefile.uni&lt;/code&gt;x”，如果是其他平台请更换&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;makefile&lt;/code&gt;的后缀。&lt;/p&gt;

&lt;p&gt;注释掉“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HARDENING+=-fstack-protector-all -Wstack-protector&lt;/code&gt;”这一行。&lt;/p&gt;

&lt;p&gt;然后用下面命令删除文件并重新编译：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rf&lt;/span&gt; ./obj/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rf&lt;/span&gt; twisterd
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;make &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; makefile.unix
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;之后就可以正常使用了！&lt;/p&gt;

</content>
                 <tag>Twister</tag> 
                 <tag>电脑技巧</tag> 
                <pubTime>2014-01-10T10:35:42+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ubuntu-install-twister.html</loc>
        <lastmod>2014-01-09T13:29:43+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Ubuntu安装使用Twister</title>
                <content>
&lt;p&gt;Twister是什么？&lt;/p&gt;

&lt;p&gt;Twister(&lt;a href=&quot;http://twister.net.co/&quot;&gt;http://twister.net.co/&lt;/a&gt;)是完全去中心化的点对点微博平台，其核心工作原理是基于比特币协议的块链模型。在一个分布式的去中心化平台上，用户如何注册？Freitas借鉴了比特币的块链：&lt;/p&gt;

&lt;p&gt;在比特币协议中，块链记录了所有的交易信息；而在Twister中，块链充当了某种分布式的公证服务，当你注册了一个用户名时系统会分配一对公钥和私钥，这对密钥就是用来验证你的身份，和比特币一样，如果丢失私钥你也就丢失你的用户名。&lt;/p&gt;

&lt;p&gt;Twister 由三部分组成：第一部分就是基于块链的分布式用户注册和验证；第二部分是使用分布式哈希表提供用户资源和位置跟踪的键值存储服务；第三部分是基于 Bittorrent协议，用于近乎即时的在用户之间传递信息。目前Twister客户端尚未提供二进制版本，需要手动编译，Twister网络已有2500个用户名。&lt;/p&gt;

&lt;p&gt;现在我们开始Twister之旅吧！测试安装环境为Ubuntu12.04，其他的系统也类似。&lt;/p&gt;

&lt;p&gt;首先安装依赖：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get git autoconf libtool
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;build-essential libboost-all-dev libssl-dev libminiupnpc-dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;再安装&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Berkeley DB&lt;/code&gt;：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;libdb4.8-dev
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;libdb++-dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;更多相关依赖参见：&lt;a href=&quot;https://github.com/miguelfreitas/twister-core/blob/master/doc/build-unix.md&quot;&gt;UNIX BUILD NOTES&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;接着安装&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libtorrent&lt;/code&gt;：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clone https://github.com/miguelfreitas/twister-core twister
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;twister/libtorrent
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;./bootstrap.sh
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;./configure &lt;span class=&quot;nt&quot;&gt;--enable-logging&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--enable-debug&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--enable-dht&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;make
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;如果是64位的系统，在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./configure&lt;/code&gt; 后添加 “&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--with-boost-libdir=/usr/lib/x86_64-linux-gnu&lt;/code&gt;”&lt;/p&gt;

&lt;p&gt;安装twister：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;src
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;make &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; makefile.unix
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;安装twister-html：&lt;/p&gt;

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

&lt;p&gt;twister-html 必须按照在：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;USERHOME/.twister/html&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;如果需要自定义twister-html的位置，需要添加参数： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-htmldir=directory&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ mkdir ~/.twister
$ cd ~/.twister
$ git clone https://github.com/miguelfreitas/twister-html.git html
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样安装就完成了，使用下面命令启动twister&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./twisterd &lt;span class=&quot;nt&quot;&gt;-daemon&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rpcuser&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;user &lt;span class=&quot;nt&quot;&gt;-rpcpassword&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;pwd&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rpcallowip&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;127.0.0.1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;注意：不要修改“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt;”和“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pwd&lt;/code&gt;”，它们是硬编码到html中的，如果修改会导致服务无法启动&lt;/p&gt;

&lt;p&gt;现在你可以通过：&lt;a href=&quot;http://127.0.0.1:28332/index.html&quot;&gt;http://127.0.0.1:28332/index.html&lt;/a&gt; 访问twister了！&lt;/p&gt;

&lt;p&gt;启动后需要等&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Block&lt;/code&gt;更新完成，如下图就是已经更新完成了。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2014/01/twister-block-update.png&quot;&gt;&lt;img src=&quot;/images/2014/01/twister-block-update.png&quot; alt=&quot;twister-block-update&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;接下来就是，创建用户，如下图，“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Create a new user&lt;/code&gt;”，然后检查用户名是否可用之后就可以创建用户了，创建同时会给你一个“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Secret key&lt;/code&gt;”，千万别弄丢哦，弄丢了就和比特币一样再也找不回帐号了！&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2014/01/twister-add-user.png&quot;&gt;&lt;img src=&quot;/images/2014/01/twister-add-user.png&quot; alt=&quot;twister-add-user&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;用户创建之后不是立即可用的，和比特币一样需要等待其他节点的确认，现在上线的人比较少，需要的时间比较长，只有用户被确认之后才可以更改你的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Profile&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2014/01/twister-wait.png&quot;&gt;&lt;img src=&quot;/images/2014/01/twister-wait.png&quot; alt=&quot;twister-wait&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;我也在艰苦的等待中，欢迎关注我：@yourtion&lt;/p&gt;
</content>
                 <tag>Linux</tag>  <tag>Twister</tag>  <tag>Ubuntu</tag> 
                 <tag>服务器</tag> 
                <pubTime>2014-01-09T13:29:43+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ubuntu-install-docker.html</loc>
        <lastmod>2013-12-27T11:58:31+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Ubuntu安装配置Docker</title>
                <content>
&lt;p&gt;最近很流行Docker这个Linux的容器引擎，抽空研究了一下，还是很不错，对于快速部署很有作用，先分享一下安装过程吧，非常简单！&lt;/p&gt;

&lt;h2 id=&quot;关于docker&quot;&gt;关于Docker&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Docker(&lt;a href=&quot;http://www.docker.io/&quot;&gt;http://www.docker.io/&lt;/a&gt; )是一个开源的应用容器引擎，让开发者可以打包他们的应用以及依赖包到一个可移植的容器中，然后发布到任何流行的 Linux 机器上，也可以实现虚拟化。容器是完全使用沙箱机制，相互之间不会有任何接口（类似 iPhone 的 app）。几乎没有性能开销,可以很容易地在机器和数据中心中运行。最重要的是,他们不依赖于任何语言、框架或包装系统。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Docker 使用 Go 语言编写，用 cgroup 实现资源隔离，容器技术采用 LXC. 提供了能够独立运行Unix进程的轻量级虚拟化解决方案。它提供了一种在安全、可重复的环境中自动部署软件的方式。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;安装docker&quot;&gt;安装Docker&lt;/h2&gt;

&lt;p&gt;安装环境为Ubuntu 12.04，Docker最佳运行环境为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Linux kernel 3.8&lt;/code&gt;，而Ubuntu 12.04 默认的是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3.2 kernel&lt;/code&gt;，我们需要先升级Linux内核&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 安装Linux内核更新&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get update
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;linux-image-generic-lts-raring linux-headers-generic-lts-raring

&lt;span class=&quot;c&quot;&gt;# 重启系统&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;reboot
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;接下来将Docker的key添加到Ubuntu的包管理中：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;sh &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;wget -qO- https://get.docker.io/gpg | apt-key add -&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;sh &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;echo deb http://get.docker.io/ubuntu docker main&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
&amp;gt; /etc/apt/sources.list.d/docker.list&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;更新包列表并安装Docker：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get update
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;lxc-docker
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;现在你就可以检查Docker安装成功了：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;docker version
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;我的输出是（不同版本可能有些差别）：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Client version: 0.7.2
Go version (client): go1.2
Git commit (client): 28b162e
Server version: 0.7.2
Git commit (server): 28b162e
Go version (server): go1.2
Last stable version: 0.7.2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;去除每次sudo使用docker&quot;&gt; 去除每次sudo使用docker&lt;/h2&gt;

&lt;p&gt;在Ubuntu下，在执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Docker&lt;/code&gt;时，每次都要输入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo&lt;/code&gt;，同时输入密码，很累人的，这里微调一下，把当前用户执行权限添加到相应的docker用户组里面。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 添加一个新的docker用户组&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;groupadd docker

&lt;span class=&quot;c&quot;&gt;# 添加当前用户到docker用户组里，注意这里的yourname为ubuntu server登录用户名&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;gpasswd &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; yourname docker

&lt;span class=&quot;c&quot;&gt;# 重启Docker后台监护进程&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;service docker restart

&lt;span class=&quot;c&quot;&gt;# 重启之后，尝试一下，是否生效&lt;/span&gt;
docker version

&lt;span class=&quot;c&quot;&gt;#若还未生效，则系统重启，则生效&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;reboot
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>Docker</tag>  <tag>Linux</tag>  <tag>Ubuntu</tag> 
                 <tag>服务器</tag> 
                <pubTime>2013-12-27T11:58:31+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/migration-mysql-database-position.html</loc>
        <lastmod>2013-12-10T23:21:51+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Ubuntu下迁移MySQL数据库位置</title>
                <content>
&lt;p&gt;考虑到数据安全问题，准备把服务器上的数据库迁移到刚刚挂载的云硬盘上，研究一下，这个方法是最靠谱的，分享之！&lt;/p&gt;

&lt;p&gt;首先建立数据库即将迁移到的目录&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /media/hdb1/db
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;复制linux下原数据到新目录下&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cp&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-dpR&lt;/span&gt; /var/lib/mysql/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; /media/hdb1/db
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;给新目录重命属性&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;mysql:mysql /media/hdb1/db
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;修改文件”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/apparmor.d/usr.sbin.mysqld&lt;/code&gt;”&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;vim /etc/apparmor.d/usr.sbin.mysqld
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;把&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/var/lib/mysql r,
/var/lib/mysql/&lt;span class=&quot;k&quot;&gt;**&lt;/span&gt; rwk,
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;改成&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/media/hdb1/db r,
/media/hdb1/db/&lt;span class=&quot;k&quot;&gt;**&lt;/span&gt; rwk,&amp;lt;/blockquote&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;修改目录&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;vim /etc/mysql/my.cnf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;如&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;datadir = /var/mysql&lt;/code&gt;换成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;datadir = /media/hdb1/db&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;再开服务器&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; /etc/init.d/apparmor restart &lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; /etc/init.d/mysql restart
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;大功告成！！！！&lt;/p&gt;
</content>
                 <tag>MySQL</tag> 
                 <tag>服务器</tag> 
                <pubTime>2013-12-10T23:21:51+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/rsync-client-to-server-backup.html</loc>
        <lastmod>2013-10-17T11:44:41+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>rsync客户端向服务端备份</title>
                <content>
&lt;p&gt;关于rsync的服务器端和客户端一直整不太明白，看到很多都是服务器端向客户端推备份数据，考虑了一下，因为数据分散在很多服务器上，希望简单的配置让各个服务器的数据汇总到备份服务器上，也就是备份服务器作为服务器端，接受来自客户端的数据。&lt;/p&gt;

&lt;p&gt;安装sync：在CentOS服务器，我们可以执行以下命令安装&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;yum &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;rsync
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;对于debian、ubuntu服务器，则是以下命令&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;rsync
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;服务器端的设置&lt;/p&gt;

&lt;p&gt;首先，服务器端（192.168.2.100）及客户端（192.168.2.199）都需要安装rsync，以root用户登录，重点在配置服务器端上；&lt;/p&gt;

&lt;p&gt;需要两个配置，一个是主配置文件&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rsyncd.conf&lt;/code&gt; ，另一个是设定客户端访问服务器端的用户名密码信息的文件，名称任意，只要主配置文件中指定正确即可，这里命名为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rsync.pwd&lt;/code&gt;；&lt;/p&gt;

&lt;p&gt;我们把主配置文件&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rsyncd.conf&lt;/code&gt; 放置在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/&lt;/code&gt;目录下，内容如下：&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Minimal configuration file for rsync daemon
# See rsync(1) and rsyncd.conf(5) man pages for help
# This line is required by the /etc/init.d/rsyncd script
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;pid&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/run/rsyncd.pid&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;uid&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;backup&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;gid&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;root   &lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;chroot&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;read&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;only&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;no &lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;#limit access to private LANs
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;hosts&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;allow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;192.168.2.0/255.255.255.0&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;hosts&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;deny&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&lt;/span&gt;

&lt;span class=&quot;err&quot;&gt;max&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;connections&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;5&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;#This will give you a separate log file
#log file = /var/log/rsync.log
&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#This will log every file transferred - up to 85,000+ per user, per sync
#transfer logging = yes
&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;log&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;%t %a %m %f %b&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;syslog&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;facility&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;local3&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;timeout&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;300&lt;/span&gt;

&lt;span class=&quot;nn&quot;&gt;[files]&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/home/backup/file&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;ignore&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;errors&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;auth&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;backup&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;secrets&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/etc/rsync.pwd&lt;/span&gt;

&lt;span class=&quot;nn&quot;&gt;[data]&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/home/backup/data&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;ignore&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;errors&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;auth&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;backup&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;secrets&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/etc/rsync.pwd&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;另一个文件（&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rsync.pwd&lt;/code&gt;）为客户端向服务器端传输文件时的用户名及口令，我们就将它新建成rsync.pwd便于识别，我也将他放置在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/&lt;/code&gt;目录下；&lt;/p&gt;

&lt;p&gt;内容这样写，前面是用户名，后面是客户端访问的密码&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;backup:backup
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;将两个文件的权限设置为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;600&lt;/code&gt;，如下：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo chmod &lt;/span&gt;600 /etc/rsyncd.conf
&lt;span class=&quot;nb&quot;&gt;sudo chmod &lt;/span&gt;600 /etc/rsync.pwd
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;启动服务器端的rsync：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;rsync &lt;span class=&quot;nt&quot;&gt;--daemon&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;接下来是客户端设置，新建一密码文件&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rsync.pass&lt;/code&gt;，内容写入与主配置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rsync.pwd&lt;/code&gt;内密码一致的内容，即：backup，将此文件放置在/etc目录下&lt;/p&gt;

&lt;p&gt;例如我们需要将客户端目录下的/www/myfile 目录备份至服务器，可以使用如下命令：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rsync &lt;span class=&quot;nt&quot;&gt;-aSvH&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--password-file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/etc/rsync.pass /www/myfile tadu@192.168.2.100::files
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;可以列出传输的文件，待传输完毕，我们去服务器端的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/home/backup/file&lt;/code&gt;目录查看，可以看到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;myfile&lt;/code&gt;目录已经备份过来了。&lt;/p&gt;

</content>
                 <tag>Linux</tag> 
                 <tag>服务器</tag> 
                <pubTime>2013-10-17T11:44:41+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/bae-qrcode-api-cache.html</loc>
        <lastmod>2013-09-22T22:19:45+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>利用BAE实现二维码生成API</title>
                <content>
&lt;p&gt;最近在做一个项目需要一个生成二维码的接口，但是使用第三方的接口经常不稳定，突然想到百度BAE有相关二维码的接口，研究了一下，很简单，顺便整了一下BAE的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cache&lt;/code&gt;也就是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Memcache&lt;/code&gt;的东西。分享之~&lt;/p&gt;

&lt;p&gt;最简单的实现：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;require_once&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'BaeImageService.class.php'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$text&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$_GET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'url'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; 
&lt;span class=&quot;nv&quot;&gt;$baeImageService&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BaeImageService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$params&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;BaeImageConstant&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;QRCODE_SIZE&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;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;BaeImageConstant&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;QRCODE_LEVEL&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;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;BaeImageConstant&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;QRCODE_FOREGROUND&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;s1&quot;&gt;'000000'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$retVal&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$baeImageService&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;applyQRCode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$retVal&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$retVal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'response_params'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$retVal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'response_params'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'image_data'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])){&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Content-type:image/jpg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$imageSrc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;base64_decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$retVal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'response_params'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'image_data'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$imageSrc&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;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'qr encoding failed, error:'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$baeImageService&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;errmsg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&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;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后是加了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Memcache&lt;/code&gt;的版本，必须先在应用里面添加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cache&lt;/code&gt;才有效：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/09/cache.jpg&quot;&gt;&lt;img src=&quot;/images/2013/09/cache.jpg&quot; alt=&quot;cache&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;然后使用以下带缓存的代码，也非常简单：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;require_once&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'BaeImageService.class.php'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;require_once&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'BaeMemcache.class.php'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$text&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_GET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'url'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; 
&lt;span class=&quot;nv&quot;&gt;$key&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;md5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$baeImageService&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BaeImageService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$params&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;BaeImageConstant&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;QRCODE_SIZE&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;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;BaeImageConstant&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;QRCODE_LEVEL&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;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;BaeImageConstant&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;QRCODE_FOREGROUND&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;s1&quot;&gt;'000000'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$mem&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BaeMemcache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$img&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$mem&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$img&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
  	&lt;span class=&quot;nb&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Content-type:image/jpg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  	&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;base64_decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$img&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;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$retVal&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$baeImageService&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;applyQRCode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$retVal&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$retVal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'response_params'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$retVal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'response_params'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'image_data'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])){&lt;/span&gt;
      	&lt;span class=&quot;nb&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Content-type:image/jpg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      	&lt;span class=&quot;nv&quot;&gt;$imgs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$retVal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'response_params'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'image_data'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$imageSrc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;base64_decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$imgs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      	&lt;span class=&quot;nv&quot;&gt;$mem&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$imgs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      	&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$imageSrc&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;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'qr encoding failed, error:'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$baeImageService&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;errmsg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&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;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;使用方法很简单，就是你创建的php文件后加上&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;?url=http://morechou.com&lt;/code&gt;就可以了。&lt;/p&gt;
</content>
                 <tag>百度云</tag> 
                 <tag>云服务</tag> 
                <pubTime>2013-09-22T22:19:45+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ubuntu-open-phps-mail.html</loc>
        <lastmod>2013-09-15T17:00:00+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Ubuntu开启php的mail()并解决速度慢问题</title>
                <content>
&lt;p&gt;如果需要用php的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mail()&lt;/code&gt;函数来发送邮件，是需要服务器安装&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sendmail&lt;/code&gt;组件才能支持的，这个在php的手册中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mail()&lt;/code&gt;函数部分也有介绍到。然后在&lt;/p&gt;

&lt;p&gt;在Ubuntu下安装sendmail的命令：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;sendmail
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;安装好之后，启动&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sendmail&lt;/code&gt;服务：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;service sendmail start
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;有了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sendmail&lt;/code&gt;的支持，就可以在php中用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mail()&lt;/code&gt;函数发送邮件了。&lt;/p&gt;

&lt;p&gt;一般造成在php用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mail()&lt;/code&gt;发送邮件缓慢的原因，是DNS解析慢导致，又常常是因为服务器的hostname不是一个真实可解析的域名。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;vim /etc/hosts
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后按i键，然后就可以修改代码了。在127.0.0.1那段里面添加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost.localdomain&lt;/code&gt;和你的主机别名，改好之后按Esc键退出编辑状态，然后输入‘:wq’保存并退出。&lt;/p&gt;

&lt;p&gt;最后重启下sendmail服务：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;service sendmail restart
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
                 <tag>Linux</tag>  <tag>PHP</tag> 
                 <tag>服务器</tag> 
                <pubTime>2013-09-15T17:00:00+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ubuntu-server-ant-android-apk.html</loc>
        <lastmod>2013-09-11T10:31:26+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>UbuntuServer用ant批量打包apk环境搭建</title>
                <content>
&lt;p&gt;最近在做一个电子书生成的项目，需要根据电子书的内容资源在线添加后自动打包成不同的包名的APK，同时自动添加各个市场渠道等内容信息，由于需要与后端联动，一键生成，所以必须在服务器上进行Android项目的打包生成，因为服务器是UbuntuServer，没有图像界面，所有只能搭建一个命令行环境，直接执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ant&lt;/code&gt;脚本打包，找了一下资料，根据自己的环境配置搭建过程与大家分享&lt;/p&gt;

&lt;h3 id=&quot;ant环境准备&quot;&gt;Ant环境准备&lt;/h3&gt;

&lt;p&gt;最简单的就是使用：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;ant
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;或者是手动安装：&lt;/p&gt;

&lt;p&gt;一、到Apache官网下载最新版本的ant：http://ant.apache.org/ 。解压下载下来的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.tar.gz&lt;/code&gt;文件：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-xf&lt;/span&gt; apache-ant-1.8.2-bin.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;二、将解压出来的文件移动到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/opt/&lt;/code&gt;下：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo mv apache-ant-1.8.2 /opt/&lt;/code&gt; （sudo 不能省，否则没有权限）&lt;/p&gt;

&lt;p&gt;三、配置环境变量：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo vim /etc/profile&lt;/code&gt;，在原来基础上添加以下蓝体字：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ANT_HOME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/opt/apache-ant-1.8.2
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;JAVA_HOME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/lib/jvm/java-6-openjdk
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$JAVA_HOME&lt;/span&gt;/bin:&lt;span class=&quot;nv&quot;&gt;$PATH&lt;/span&gt;:&lt;span class=&quot;nv&quot;&gt;$ANT_HOME&lt;/span&gt;/bin
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CLASSPATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;.:&lt;span class=&quot;nv&quot;&gt;$JAVA_HOME&lt;/span&gt;/lib/dt.jar:&lt;span class=&quot;nv&quot;&gt;$JAVA_HOME&lt;/span&gt;/lib/tools.jar
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;四、验证是否安装成功：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ant &lt;span class=&quot;nt&quot;&gt;-version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Apache Ant(TM) version 1.8.2 compiled on December 20 2010
如此字样，则表示安装成功！&lt;/p&gt;

&lt;h3 id=&quot;android编译环境准备&quot;&gt;Android编译环境准备&lt;/h3&gt;

&lt;p&gt;在http://developer.android.com/sdk/index.html 下载adt-bundle-linux-x86_64-20130729.zip或者相应最新版本，并解压：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;unzip adt-bundle-linux-x86_64-20130729.zip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;将解压后的sdk目录拷贝到/opt/sdk&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cp&lt;/span&gt; ./adt-bundle-linux-x86_64-20130729/sdk/ /opt/sdk
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;设置环境变量：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vim /etc/bash.bashrc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在最下面加上:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ANDROID_SDK_HOME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/opt/sdk/
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$PATH&lt;/span&gt;:&lt;span class=&quot;nv&quot;&gt;$ANDROID_SDK_HOME&lt;/span&gt;/tools:&lt;span class=&quot;nv&quot;&gt;$ANDROID_SDK_HOME&lt;/span&gt;/build-tools/android-4.3:&lt;span class=&quot;nv&quot;&gt;$ANDORID_SDK_HOME&lt;/span&gt;/platforms/android-18/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;保存后运行一下：bash使环境变量生效。&lt;/p&gt;

&lt;p&gt;现在可以通过运行android来测试是否成功了！&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;android create project &lt;span class=&quot;nt&quot;&gt;--target&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;android-18&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--name&lt;/span&gt; APP &lt;span class=&quot;nt&quot;&gt;--path&lt;/span&gt; App &lt;span class=&quot;nt&quot;&gt;--activity&lt;/span&gt; MainActivity &lt;span class=&quot;nt&quot;&gt;--package&lt;/span&gt; com.yourtion.android
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在编译生成APK的时候还需要JRE，可能需要先安装，我安装的是JRE7的&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;openjdk-7-jre openjdk-7-jdk openjdk-7-jre-lib
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样环境就基本OK了，大家使用过程还有什么问题欢迎一起交流！&lt;/p&gt;
</content>
                 <tag>Android</tag>  <tag>Linux</tag>  <tag>Ubuntu</tag> 
                 <tag>服务器</tag> 
                <pubTime>2013-09-11T10:31:26+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ubuntu12-compile-php5-3.html</loc>
        <lastmod>2013-09-10T11:54:09+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Ubuntu12编译PHP5.3</title>
                <content>
&lt;p&gt;最近项目遇到一个坑爹的事情，一个源码必须使用PHP5.3，但是现在Ubuntu上自带的版本是5.4，降级之后会出各种奇怪的问题，最后没办法，只能一步步在Ubuntu12.04server上自己编译PHP5.3，比繁琐，共享之。&lt;/p&gt;

&lt;p&gt;安装Apache2.2&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;apache2 &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后安装MySQL5.5&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;mysql-server-5.5 &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;接着就是编译依赖环境：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;gcc g++ autoconf build-essential &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;相关的lib支持库：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;libxml2 libxml2-dev libevent-1.4-2 libevent-dev bzip2 libbz2-dev libcurl3-gnutls libcurl4-gnutls-dev libpng12-0 libpng12-dev libjpeg62 libjpeg62-dev libfreetype6 libfreetype6-dev libmcrypt4 libmcrypt-dev zlib1g-dev libtidy-dev libmysqlclient-dev  &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;安装：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./configure &lt;span class=&quot;nt&quot;&gt;--prefix&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/local/php &lt;span class=&quot;nt&quot;&gt;--with-mcrypt&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--with-gettext&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--with-mysql&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--with-gd&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--with-jpeg-dir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--with-png-dir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--with-curl&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--with-freetype-dir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--enable-gd-native-ttf&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--enable-mbstring&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--enable-sockets&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--with-pdo-mysql&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--enable-fpm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--with-zlib&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--enable-zip&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--with-bz2&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--enable-bcmath&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--with-tidy&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--with-fpm-user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;daemon &lt;span class=&quot;nt&quot;&gt;--with-fpm-group&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;daemon

&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;make

&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;make &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后安装cli和dev：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;php5-cli php5-dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最后开启Apache2支持：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;libapache2-mod-php5
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最后就大功告成了~&lt;/p&gt;
</content>
                 <tag>Linux</tag>  <tag>PHP</tag> 
                 <tag>服务器</tag> 
                <pubTime>2013-09-10T11:54:09+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ubuntu-htaccess-support.html</loc>
        <lastmod>2013-09-06T22:05:47+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Ubuntu开启.htaccess的支持</title>
                <content>
&lt;p&gt;Ubuntu下启动Apache对&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt; 的支持步骤:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;终端运行&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;a2enmod
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;程序提示可供激活的模块名称，输入：&lt;/p&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rewrite&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;修改&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/apache2/sites-enabled/000-default&lt;/code&gt; (该链接指向的是站点配置文件)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;把（默认的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;www&lt;/code&gt;目录、或者需要应用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt;的目录）下的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AllowOverride&lt;/code&gt; 属性改为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;All&lt;/code&gt;，保存。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;重新加载&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;apache&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; /etc/init.d/apache2 restart
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;附xampp的modrewrite开启方法&quot;&gt;附xampp的ModRewrite开启方法：&lt;/h3&gt;

&lt;p&gt;要开启Mod Rewrite功能其实是很简单的:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;在你的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;XAMPP&lt;/code&gt;安装目录下找到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;httpd.conf&lt;/code&gt; 这个文件( 位于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\etc\httpd.conf&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;用vim或其他文本编辑器打开它&lt;/li&gt;
  &lt;li&gt;找到 “&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AllowOverride None&lt;/code&gt;”, 替换为”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AllowOverride All&lt;/code&gt;“。(修改第一个就可以了)&lt;/li&gt;
  &lt;li&gt;再找到”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#LoadModule rewrite_module modules/mod_rewrite.so&lt;/code&gt;“，把前面的”#”号去掉&lt;/li&gt;
  &lt;li&gt;重启&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;XAMPP&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;然后&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Mod Rewrite&lt;/code&gt;功能就开启了:)&lt;/p&gt;
</content>
                 <tag>PHP</tag> 
                 <tag>服务器</tag> 
                <pubTime>2013-09-06T22:05:47+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/python-install-image-module.html</loc>
        <lastmod>2013-08-29T14:39:31+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Python安装Image模块</title>
                <content>
&lt;p&gt;最近项目使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Python&lt;/code&gt;对输出文件进行处理，需要用到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Image&lt;/code&gt;模块对图片进行处理，默认安装的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Python&lt;/code&gt;是没有带&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Image&lt;/code&gt;库的，安装&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PIL&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Image&lt;/code&gt;库还是很简单的，分享之~&lt;/p&gt;

&lt;p&gt;如果需要&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jpeg&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zlib&lt;/code&gt;支持先安装相应的包&lt;/p&gt;

&lt;p&gt;JPEG：http://www.ijg.org&lt;/p&gt;

&lt;p&gt;最新的版本是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jpegsrc.v9.tar.gz&lt;/code&gt; ，安装&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jpeg&lt;/code&gt;库&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-zxf&lt;/span&gt; jpegsrc.v9.tar.gz 
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;jpegsrc.v9
./configure &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; make &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; make &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; make &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;zlib：http://www.gzip.org/zlib/&lt;/p&gt;

&lt;p&gt;下载&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zlib-1.2.8.tar.gz&lt;/code&gt;支持压缩功能的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zlib&lt;/code&gt;库&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;tar &lt;/span&gt;xfz zlib-1.2.8.tar.gz
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;zlib-1.2.8
./configure &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; make &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; make &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;现在就是安装&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Imagemok&lt;/code&gt;了，先下载：在 http://www.pythonware.com/products/pil/index.htm 下载&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Imaging-1.1.7.tar.gz&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;tar &lt;/span&gt;xfz Imaging-1.1.7.tar.gz
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;Imaging-1.1.7
python setup.py build_ext &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt;
python setup.py bulid
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;python setup.py &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样就安装完成了，接下来就是测试一下：&lt;/p&gt;

&lt;p&gt;运行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;python&lt;/code&gt;，然后“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;import Image&lt;/code&gt;”，如果没有报错应该就OK了&lt;/p&gt;
</content>
                 <tag>Linux</tag> 
                 <tag>服务器</tag> 
                <pubTime>2013-08-29T14:39:31+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/imagemagick-caling-cropping-synthesis.html</loc>
        <lastmod>2013-08-15T10:53:41+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用ImageMagick进行图片缩放、合成与裁剪</title>
                <content>
&lt;p&gt;最近的项目里面需要对书籍的封面进行处理，就是加一条阴影线形成书脊的凹凸感，然后将书脊切出，分成两部分，以便客户端实现打开动画。由于需要在服务器端处理，使用就研究使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;imagemagick&lt;/code&gt;来进行。同时准备封装了一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Node.js&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Python&lt;/code&gt;的方法，主要还是讲一下然后使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;imagemagick&lt;/code&gt;来对图片进行缩放、合成后进行裁剪吧。&lt;/p&gt;

&lt;p&gt;首先素材文件如下（左边未处理封面，右边为需要合成上去的阴影）：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/08/fmsc.png&quot;&gt;&lt;img src=&quot;/images/2013/08/fmsc.png&quot; alt=&quot;fmsc&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;安装&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ImageMagick&lt;/code&gt;的过程就不讲了，可以参考官网的安装方法：http://www.imagemagick.org/script/install-source.php&lt;/p&gt;

&lt;p&gt;首先对封面图片&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;file.png&lt;/code&gt;进行缩放，缩放到高度为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1024&lt;/code&gt;，生成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;newfile.png&lt;/code&gt;方便与阴影图片合成，命令如下：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;convert &lt;span class=&quot;nt&quot;&gt;-resize&lt;/span&gt; x1024 file.png newfile.png
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;convert进行缩放的方法如下：&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;convert -resize 1024 file.jpg newfile.jpg&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;得到图片宽为1024，高根据原始图片比例计算而来&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;convert -resize x768 file.jpg newfile.jpg&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;得到的图片高位768，宽根据原始图片比例计算而来&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;convert -resize 1024x768! file.jpg newfile.jpg&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;固定宽高缩放，不考虑原是图宽高的比例，把图片缩放到指定大小。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;convert -resize &quot;1024x768&amp;gt;&quot; file.jpg newfile.jpg&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;只有当src.jpg的宽大于1024或高大于768时候，才进行缩小处理，否则生成newfile.jpg和file.jpg具有一样的尺寸。&lt;/p&gt;

&lt;p&gt;convert -resize “1024x768&amp;lt;” file.jpg newfile.jpg
只有当src.jpg的宽小于1024或高小于768时候，才进行放大处理，否则生成newfile.jpg和file.jpg具有一样的尺寸。&amp;lt;/blockquote&amp;gt;&lt;/p&gt;

&lt;p&gt;接下来就是将阴影文件合成到封面上（将yy.png从左上角合成到file.png生成newfile.png）：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;composite -gravity northwest yy.png file.png newfile.png
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这里主要解释一下-gravity参数：&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-gravity&lt;/code&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;northwest&lt;/code&gt;指右上角
如果要求在正中间，参数为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;center&lt;/code&gt;
如果要求在右下角，参数为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;southeast&lt;/code&gt;
其他按照方位进行&lt;/p&gt;

&lt;p&gt;合成后效果如下：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/08/fmyy.png&quot;&gt;&lt;img src=&quot;/images/2013/08/fmyy.png&quot; alt=&quot;fmyy&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;最后就是图片的裁剪，将图片分为两部分，阴影部分&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;left.png&lt;/code&gt;和其他部分&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;right.png&lt;/code&gt;：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#left：&lt;/span&gt;
convert file.png &lt;span class=&quot;nt&quot;&gt;-gravity&lt;/span&gt; southwest &lt;span class=&quot;nt&quot;&gt;-crop&lt;/span&gt; 31x1024+0+0 left.png

&lt;span class=&quot;c&quot;&gt;#right：&lt;/span&gt;
convert file.png &lt;span class=&quot;nt&quot;&gt;-gravity&lt;/span&gt; southeast &lt;span class=&quot;nt&quot;&gt;-crop&lt;/span&gt; 737x1024+0+0 right.png
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;裁剪方法的调整如下：&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;convert file.png -crop widthxheight+x+y newfile&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;widthxheight&lt;/code&gt;是目标图片的尺寸，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;+x+y&lt;/code&gt;是原始图片的坐标点，这两组值至少要出现一组，也可以同时存在。另外该命令也可使用gravity来重新定义坐标系统。&lt;/p&gt;

&lt;p&gt;最后成果如下：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/08/fmwc.png&quot;&gt;&lt;img src=&quot;/images/2013/08/fmwc.png&quot; alt=&quot;fmwc&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                
                 <tag>Node.js</tag> 
                <pubTime>2013-08-15T10:53:41+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/easiest-way-backup-linux.html</loc>
        <lastmod>2013-08-13T09:40:43+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>备份UbuntuServer的最简单方法</title>
                <content>
&lt;p&gt;最近因为迁移等问题需要对几台服务器进行备份，服务器跑的是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UbuntuServer&lt;/code&gt;，研究了一下备份方法，找到一个最简单的，同样适用于其他Linux系统，共享之~&lt;/p&gt;

&lt;p&gt;方法的原理也非常简单：将”/”目录下的所有文件打成一个压缩包，需要的是后再解压后覆盖回去。&lt;/p&gt;

&lt;p&gt;备份：&lt;/p&gt;

&lt;p&gt;先转到root用户权限&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;su
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后进入“/”目录&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;执行备份&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;tar &lt;/span&gt;cvpzf backup.tgz &lt;span class=&quot;nt&quot;&gt;--exclude&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/proc &lt;span class=&quot;nt&quot;&gt;--exclude&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/lost+found &lt;span class=&quot;nt&quot;&gt;--exclude&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/backup.tgz &lt;span class=&quot;nt&quot;&gt;--exclude&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/mnt &lt;span class=&quot;nt&quot;&gt;--exclude&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/sys /
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其中tar的cvpzf指的是：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c&lt;/code&gt; - 创建一个新的备份文件&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;v&lt;/code&gt; - 详细模式，将执行过程全部输出到屏幕&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;p&lt;/code&gt; - 保留文件的权限信息以便恢复&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;z&lt;/code&gt; - 使用gzip压缩文件，以便减小体积&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f &amp;lt;filename&amp;gt;&lt;/code&gt; - 指定备份文件的名称&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;这样执行后就会在“/”下面生成一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;backup.tgz&lt;/code&gt;的备份文件，你就可以拷贝下来，以便恢复了。&lt;/p&gt;

&lt;p&gt;恢复方法也非常简单：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;tar &lt;/span&gt;xvpfz backup.tgz &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; /
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;好了，就是这么简单。&lt;/p&gt;

</content>
                 <tag>Linux</tag> 
                 <tag>服务器</tag> 
                <pubTime>2013-08-13T09:40:43+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/solve-cmyk-image-upload-problem.html</loc>
        <lastmod>2013-08-09T10:55:55+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>解决CMYK图片上传后偏色问题</title>
                <content>
&lt;p&gt;最近在做一个资源上传的项目，期间遇到一个问题，因为上传的图片有一些是用于印刷，使用的是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CMYK&lt;/code&gt;，上传到服务器后因为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;web&lt;/code&gt; 展示是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RGB&lt;/code&gt; 的，所以就发生偏色了。最后还是解决了这个上传 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CMYIK&lt;/code&gt; 图片偏色的问题，先上处理结果图，再仔细说具体的实现：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/08/duibi.jpg&quot;&gt;&lt;img src=&quot;/images/2013/08/duibi.jpg&quot; alt=&quot;duibi&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;研究了一下，决定采用服务器进行处理，对上传的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CMYK&lt;/code&gt; 图片进行处理，转换成 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RGB&lt;/code&gt; 再替换原图。转换使用一个比较著名强大的工具集 &lt;a href=&quot;http://www.imagemagick.org/&quot;&gt;ImageMagick（http://www.imagemagick.org/）&lt;/a&gt;，安装过程就不讲了，可以参考官网的安装方法：http://www.imagemagick.org/script/install-source.php&lt;/p&gt;

&lt;p&gt;使用安装后的命令行工具 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Convert&lt;/code&gt; 进行转换，使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Convert&lt;/code&gt; 还要加入颜色的描述文件，使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-profile&lt;/code&gt;` 参数载入，在Adobe官网下了一套各种描述文件的集合：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/08/icc.jpg&quot;&gt;&lt;img src=&quot;/images/2013/08/icc.jpg&quot; alt=&quot;icc&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;经过一轮测试和研究后，发现最通用的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CMYK&lt;/code&gt; 描述文件为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JapanColor2001Coated.icc&lt;/code&gt;，而转换出来的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RGB&lt;/code&gt; 描述文件使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ColorMatchRGB.icc&lt;/code&gt;，因为服务器端使用的是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Node.js&lt;/code&gt;，所以就用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Node.js&lt;/code&gt; 写了一个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Demo&lt;/code&gt; 共享之:&lt;/p&gt;

&lt;p&gt;Git地址：&lt;a href=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;主要的核心 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;function&lt;/code&gt; 如下：&lt;/p&gt;

&lt;p&gt;判断图片是否为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CMYK&lt;/code&gt; ：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ColorSpace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&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;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Start Identfity&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ident&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;exec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;identify -format %[colorspace] ./upload/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stdout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stderr&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;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ident&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;stdout: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stdout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;stderr: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stderr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&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;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;exec error: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;error&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;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ident OK&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stdout&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;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;转换 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CMYK&lt;/code&gt; 为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RGB&lt;/code&gt;：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ConvCMYK&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&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;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conv&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;exec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;convert ./upload/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;filename&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt; -profile ./iccs/JapanColor2001Coated.icc -profile ./iccs/ColorMatchRGB.icc ./upload/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stdout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stderr&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;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;conv&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;stdout: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stdout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;stderr: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stderr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&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;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;exec error: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;error&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;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;OK&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;OK&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其中最核心的就是使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ImageMagick&lt;/code&gt; 的两条命令： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;identify&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;convert&lt;/code&gt;。使用方法如下，使用其他语言的朋友也可以举一反三在自己的项目中使用：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;identify &lt;span class=&quot;nt&quot;&gt;-format&lt;/span&gt; %[colorspace] file

convert file &lt;span class=&quot;nt&quot;&gt;-profile&lt;/span&gt; JapanColor2001Coated.icc &lt;span class=&quot;nt&quot;&gt;-profile&lt;/span&gt; ColorMatchRGB.icc newfile
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;相关的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ICC&lt;/code&gt; 文件什么的都在项目上有，欢迎大家一起讨论一同进步！&lt;/p&gt;

&lt;p&gt;Demo地址： &lt;a href=&quot;https://github.com/yourtion/Demo_CMYKImageUploader&quot;&gt;https://github.com/yourtion/Demo_CMYKImageUploader&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>Node.js</tag> 
                 <tag>Node.js</tag> 
                <pubTime>2013-08-09T10:55:55+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/python-opencv-realtime-face-recognition.html</loc>
        <lastmod>2013-07-30T18:01:36+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Python与OpenCV实时人脸识别</title>
                <content>
&lt;p&gt;刚刚开始使用Python写OpenCV的东西，发现关于使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Python&lt;/code&gt;写&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OpenCV&lt;/code&gt;的还是比较少的，先整了一个人脸识别的最简单实例，与大家共享！&lt;/p&gt;

&lt;p&gt;环境：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Python&lt;/code&gt; 2.7.4、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OpenCV&lt;/code&gt; 2.4.6、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LinuxMint&lt;/code&gt; 15&lt;/p&gt;

&lt;p&gt;最简单代码如下：&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&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;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;pth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dirname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;namedWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;camera&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;det&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CascadeClassifier&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;./haarcascade_frontalface_alt.xml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cam&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;VideoCapture&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cam&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isOpened&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;flag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cam&lt;/span&gt;&lt;span class=&quot;p&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;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;flag&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cvtColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CV_RGB2GRAY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;objs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;det&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;detectMultiScale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rct&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rectangle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;frame&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;rct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;rct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;rct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;n&quot;&gt;rct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]),(&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&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;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CV_AA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imshow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;camera&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;waitKey&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;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;27&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;cam&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;release&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;destroyWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;camera&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;接下来我还增加输出统计人数的功能，还是最简单的方法，统计找到的obj数目，只有在变化的时候才输出，代码如下：&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&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;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;pth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dirname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;namedWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;camera&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;det&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CascadeClassifier&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;./haarcascade_frontalface_alt.xml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cam&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;VideoCapture&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;people&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cam&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isOpened&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;flag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cam&lt;/span&gt;&lt;span class=&quot;p&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;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;flag&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cvtColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CV_RGB2GRAY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;objs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;det&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;detectMultiScale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;objs&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;people&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;people&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;objs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;people&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!=&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;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;people&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rct&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rectangle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;frame&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;rct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;rct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;rct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;n&quot;&gt;rct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]),(&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&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;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CV_AA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imshow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;camera&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;waitKey&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;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;27&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;cam&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;release&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;destroyWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;camera&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;希望对你有帮助，接下来会继续更新相关的东西&lt;/p&gt;
</content>
                 <tag>Python</tag> 
                 <tag>OpenCV</tag> 
                <pubTime>2013-07-30T18:01:36+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/jae-trial-1.html</loc>
        <lastmod>2013-07-27T23:25:01+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>京东云JAE试用感想（1）</title>
                <content>
&lt;p&gt;上周参加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CloudFoundry&lt;/code&gt;的沙龙，拿到京东云擎JAE的内测邀请码，做了个简单的评测，欢迎围观~&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;a href=&quot;/images/2013/07/jae-yaoqing.png&quot;&gt;&lt;img src=&quot;/images/2013/07/jae-yaoqing.png&quot; alt=&quot;jae-yaoqing&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;二、成员commit代码后需要云擎帐号拥有者在相关应用执行“部署”动作后版本才能生效，这样成员间协作相对比较麻烦，上传代码后总是要特定人去执行部署，希望可以上传代码后自动部署，或者协作成员支持应用的部署动作。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/07/jae-appstar.png&quot;&gt;&lt;img src=&quot;/images/2013/07/jae-appstar.png&quot; alt=&quot;jae-appstar&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;三、云数据库在协作成员中无法共享操作，使用mysql时的phpmyadmin管理平台同样需要帐号拥有者进行操作，云存储也存在相同的问题，希望能对云数据库和云存储也启用共享协作功能，这样方便团队协作过程中相关人员的操作，包括云日志等相关的内容也可以给相关团队协助人员查看，方便调试。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/07/jae-log.png&quot;&gt;&lt;img src=&quot;/images/2013/07/jae-log.png&quot; alt=&quot;jae-log&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;四、团队的一个成员因为之前没有京东帐号，使用QQ登录之后加入我共享的群组，之后将他加入代码库，但是在他使用Git管理代码的时候发现他没有相关的密码，登录之后没有设置用户名密码的选项，而且帐号管理界面也没用相关设置密码的地方（至少我没发现，你们有找到相关的地方么？）所以没办法使用Git管理代码，只好重新注册一个，希望接下来能解决。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/07/jae-user.png&quot;&gt;&lt;img src=&quot;/images/2013/07/jae-user.png&quot; alt=&quot;jae-user&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;建议：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;使用第三方平台登录后弹出提示让用户输入邮箱，完善信息，设置密码&lt;/li&gt;
  &lt;li&gt;允许用户针对代码库或者云服务设置专用密码&lt;/li&gt;
  &lt;li&gt;在用户界面增加修改密码选项，方便用户修改密码、修改用户名、头像等&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;接下来会进一步测试相关的功能等，敬请期待&lt;/p&gt;

</content>
                 <tag>京东云</tag> 
                 <tag>云服务</tag> 
                <pubTime>2013-07-27T23:25:01+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/opencv-program-g-compiler.html</loc>
        <lastmod>2013-07-25T13:18:20+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>g++编译opencv程序</title>
                <content>
&lt;p&gt;使用在Ubuntu下使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g++&lt;/code&gt;编译一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;opencv&lt;/code&gt;的项目，用作者写的sh文件编译一直出错，研究了许久，终于找到解决的方法。共享之！&lt;/p&gt;

&lt;p&gt;原来的编译代码如下：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;g++ &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;pkg-config opencv &lt;span class=&quot;nt&quot;&gt;--libs&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--cflags&lt;/span&gt; opencv&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt; tclip.cpp &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; tclip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;编译出错信息如下：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/07/1111.jpg&quot;&gt;&lt;img src=&quot;/images/2013/07/1111-560x502.jpg&quot; alt=&quot;opencv-err&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;研究一番发现是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;opencv&lt;/code&gt;的库没有成功的调用，找了很久文档，发现编译的命令有问题，改成下面的命令就正常了。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;g++ tclip.cpp &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; tclip &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;pkg-config &lt;span class=&quot;nt&quot;&gt;--cflags&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--libs&lt;/span&gt; opencv&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
                
                 <tag>OpenCV</tag> 
                <pubTime>2013-07-25T13:18:20+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/mac-crack-sublimetext2.html</loc>
        <lastmod>2013-07-03T11:25:48+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Mac下SublimeText2的破解</title>
                <content>
&lt;p&gt;因为重装了Mac，所以很多软件都要重新安装，突然想起&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SublimeText2&lt;/code&gt;的破解，记得之前看到的教程是替换&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3342&lt;/code&gt;为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3242&lt;/code&gt;，然后输入一个Key就可以了，但是替换保存后总是提示意外退出，进不去软件。所有重新研究一番，解决了这个问题。&lt;/p&gt;

&lt;p&gt;首先在“应用程序”中找到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SublimeText2&lt;/code&gt;，右键“显示包内容”在包中找到路径“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Contents/MacOS/Sublime Text 2&lt;/code&gt;”文件，复制一份，用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SublimeText2&lt;/code&gt;打开复制的副本：&lt;/p&gt;

&lt;p&gt;查找替换所有“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3342 3032&lt;/code&gt;”为“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3242 3032&lt;/code&gt;”保存退出&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SublimeText2&lt;/code&gt;，将复制保存的版本替换回原来的“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sublime Text 2&lt;/code&gt;”文件。&lt;/p&gt;

&lt;p&gt;重新启动&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sublime Text 2&lt;/code&gt;，在菜单“Help”选择“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Enter License&lt;/code&gt; ”输入下面注册码，然后点击“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Use&lt;/code&gt;”即完成破解。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/07/SublimeText2.png&quot;&gt;&lt;img src=&quot;/images/2013/07/SublimeText2.png&quot; alt=&quot;SublimeText2&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;License列表：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;—–BEGIN LICENSE—–
USA
Unlimited User License
EA7E-1640
763D05839CA08BDA7B0103B5BABF0150
195EE53CC33B569858AFD553F080A9BC
1F678C88A1342AC92CA596FE775E7014
5A0EE55DC2F8DE3C4ED6B5B02FD4DB3C
493FCE3EE61FC0588CDAFAAD731BB47F
FD047777D02A5BE92202B3D3EB59A696
A69DFEF6687D16FCD4443556912A1F62
82DA125263C5BC270CEE7664B5D0CEB9
—–END LICENSE—–

—–BEGIN LICENSE—–
A
Unlimited User License
EA7E-20708
A7281D6781626F2A37D6355121079ACA
DF60119B9D27D4CBDA75FA63D633A671
9521D96D375D8DD95DF3F89231E38F8D
459374CC62D1C1B410C0BDFD2503670E
603BB1DCA7D20E85B0AF19BAE0A59822
F7B1F83659D4D7787C4F040FE9402FCD
B9608A9012BDA8B65524B4DEDE4C00D0
76461448E2AAEC027060C26B038D502B
—–END LICENSE—–

—–BEGIN LICENSE—–
B
Unlimited User License
EA7E-13207
B5C54DD7413302E87A9ED4155E90D5E0
684F7A34714D278ABE2731F0270034E2
9722AEC71E04043C0E9D4496D1DA161B
D76CE81501A247F3E03F57D6EC1E76AE
12BE9CD453D1E651AF4BD187CC10FEB0
EB24FBAB7511F2F37E5F745D13D0641F
7D1BEEE98A9646A02B616BF98EB43F84
B04029D72C610086A666DB318A526A2F
—–END LICENSE—–

—–BEGIN LICENSE—–
Love
Unlimited User License
EA7E-8441
918381ACA844A0379CCAC729059720A4
BC9D409098618744BB45FF23E67568DB
82B926D92157127DB3B4054834D0477F
DD9C2B251A57F2E3259E04AD9B7DB8B8
1778C37C1D3B494671C5F4ECFBD2B519
361CD9624A56C21F54F8DD51F5BDF799
68F9537ED74680494853423904F032BA
3E896607B4D398E8C897A4DD1A8CB449
—–END LICENSE—–

—–BEGIN LICENSE—–
NightM
Unlimited User License
EA7E-5177
8125006DCD9E513CD4F1C217CAD3801D
E72D3130CA1F04CFEDF3696C0F68553D
DC42B172E38962890A87035FCE26049F
15EFA09D4BCC811617915165959A499F
402866AFC08E72615336D863968B60FB
C9167F72F4B25ED5E8E593D2E19F43E7
C7EC9F459EA62F1DD1757DC9967C4801
8E48683A4F0F9CAC3CC0621F2D48292F
—–END LICENSE—–
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>Mac</tag> 
                 <tag>电脑技巧</tag> 
                <pubTime>2013-07-03T11:25:48+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/nodejs-convert-pdf-to-html.html</loc>
        <lastmod>2013-07-02T14:38:02+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Node.js实现PDF文件转HTML</title>
                <content>
&lt;p&gt;最近在做一个富媒体项目，希望将原有的PDF文件直接生成HTML数据流，方便进行排版编辑，研究了一下大家的解决方案，决定采用基于 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xpdf&lt;/code&gt; 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Poppler&lt;/code&gt; 进行处理。因为服务器端使用的是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Node.js&lt;/code&gt;，没有现成的调用源码，所以使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;express&lt;/code&gt; 实现了上传转换输出。与大家共享！&lt;/p&gt;

&lt;p&gt;首先安装 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Poppler&lt;/code&gt;，我使用的上 MacOS，Linux 平台也大同小异，就是下载 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Poppler&lt;/code&gt; 的源码进行编译，或者直接使用 Mac 下的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ports&lt;/code&gt; 进行安装。&lt;/p&gt;

&lt;p&gt;Poppler：http://poppler.freedesktop.org/&lt;/p&gt;

&lt;p&gt;安装完成后在终端运行 “pdftohtml” 可以看到下面的提示：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/07/pdftohtml.png&quot;&gt;&lt;img src=&quot;/images/2013/07/pdftohtml.png&quot; alt=&quot;pdftohtml&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;这样就能在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Node.js&lt;/code&gt; 中利用子线程调用转换了，不多说，实现代码如下：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;last&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;exec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;pdftohtml -p -noframes &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;last&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stdout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&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;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;OK!&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;PDF文件上传处理部分：&lt;/p&gt;

&lt;p&gt;jade：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;enctype&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;multipart/form-data&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/upload&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;fieldset&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;legend&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;General&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;p&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;user[pdf]&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Picture&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;pdf&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;buttons&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;submit&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Save&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Node.js：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/upload&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&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;c1&quot;&gt;// 获得文件的临时路径&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;date&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;tmp_path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pdf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;tmp_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 指定文件上传后的目录 - 示例为&quot;images&quot;目录。&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;target_path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./pdf/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pdf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 移动文件&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;rename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;tmp_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;target_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&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;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 删除临时文件夹文件,&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;unlink&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;tmp_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&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;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;//res.send('File uploaded to: ' + target_path + ' - ' + req.files.pdf.size + ' bytes');&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;getData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
                &lt;span class=&quot;c1&quot;&gt;//res.send(data);&lt;/span&gt;
                &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;redirect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pdf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;pdf&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Demo地址： &lt;a href=&quot;https://github.com/yourtion/Demo_PDFtoHTML&quot;&gt;https://github.com/yourtion/Demo_PDFtoHTML&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;功能的实现大致就是这样，要什么问题欢迎大家一起交流！&lt;/p&gt;
</content>
                
                 <tag>Node.js</tag> 
                <pubTime>2013-07-02T14:38:02+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/bae-deployment-nodejs-404-solutions.html</loc>
        <lastmod>2013-06-08T10:57:48+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>BAE部署Nodejs应用404解决方法</title>
                <content>
&lt;p&gt;最近想试一下百度BAE的Nodejs环境，因为以前在BAE上测试环境什么的都是直接新建版本然后在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BAE Code Editor&lt;/code&gt;里面写代码然后发布的，这一次想把本地的应用部署到BAE上面去，结果就遇到了问题，访问一直都是404错误，日志里面没有任何提示，研究了很久，终于解决了问题，特此与大家分享，希望对大家有帮助！&lt;/p&gt;

&lt;p&gt;我一开始使用的是在新建版本时”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;上传Node.js代码包&lt;/code&gt;“。把之前写的一个极其简单的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;express&lt;/code&gt;示例放上去。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/06/pic1.png&quot;&gt;&lt;img src=&quot;/images/2013/06/pic1.png&quot; alt=&quot;版本新建与代码包上传&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;然后将版本上线后一直显示404，日志里面除了访问日志之外没有node的任何提示，研究了很久，把能改的东西都改了，还是没有用，用SVN把代码拉到本地运行完全正常。&lt;/p&gt;

&lt;p&gt;之后突发奇想要试试官方文档中的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;express&lt;/code&gt;示例，又新建了一个版本，用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BAE Code Editor&lt;/code&gt;把官方的示例代码粘进去执行居然一切正常，这让我更加郁闷了，想把代码再拉下来看看，终于发现了问题所在！&lt;/p&gt;

&lt;p&gt;新建版本不上传代码包的目录比上传代码包的目录多了几个文件：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/06/pic2.png&quot;&gt;&lt;img src=&quot;/images/2013/06/pic2.png&quot; alt=&quot;多出来的文件&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;把代码包中的代码拷贝到这个目录，在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;push&lt;/code&gt;上去，居然就没问题了，继续研究一番，终于发现问题在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app.conf&lt;/code&gt;上，文件中有下面一段：&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;handlers:&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;url&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;favicon.ico&lt;/span&gt;
    &lt;span class=&quot;err&quot;&gt;script:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;favicon.ico&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;url&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;(.*)&lt;/span&gt;
    &lt;span class=&quot;err&quot;&gt;script:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$1.nodejs&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;原来上传代码包之后代码包中没有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app.conf&lt;/code&gt;文件，所有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;js&lt;/code&gt;文件没有被正确地处理。&lt;/p&gt;

&lt;p&gt;只要在原来的代码包中加入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app.conf&lt;/code&gt;文件，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app.js&lt;/code&gt;就会正常地启动监听，至此，问题终于解决了！&lt;/p&gt;

&lt;p&gt;希望我的经历对你有帮助。&lt;/p&gt;

</content>
                 <tag>百度云</tag> 
                 <tag>云服务</tag> 
                <pubTime>2013-06-08T10:57:48+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/node-js-judge-android-and-ios.html</loc>
        <lastmod>2013-03-27T15:06:54+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Node.js判断Android与iOS浏览器</title>
                <content>
&lt;p&gt;最近在做微信公众账号相关的一些东西，然后遇到对用户浏览器判断的问题，因为想在服务器端得到相应的结果并返回不同的URL，所以就写了使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;node.js&lt;/code&gt;判断Android与iOS浏览器的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;function&lt;/code&gt;，和大家共享。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;function brows()&lt;/code&gt;还有使用代码如下：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;http&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;brows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//移动终端浏览器版本信息&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;ios&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;nx&quot;&gt;$agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\(&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;[^&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;+;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt; U;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;)?&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt; CPU.+Mac OS X/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//ios终端&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Android&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Linux&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&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;c1&quot;&gt;//android终端或者uc浏览器&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;iPhone&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;iPhone&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Mac&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&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;c1&quot;&gt;//是否为iPhone或者QQHD浏览器&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;iPad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$agent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;iPad&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&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;c1&quot;&gt;//是否iPad&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;nx&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createServer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&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;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;writeHead&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;200&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;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Content-Type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;text/plain&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;$a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;brows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;user-agent&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;$url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;iPad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//当ipad终端时&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http://blog.yourtion.com/ipad&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;iPhone&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//当iphone终端时&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http://blog.yourtion.com/ios/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ios&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//当ios终端时&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http://blog.yourtion.com/ios/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;android&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//当Android终端时&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http://blog.yourtion.com/android/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//否则&lt;/span&gt;
     &lt;span class=&quot;nx&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http://blog.yourtion.com/wap/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$url&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;nx&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1337&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;127.0.0.1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Server running at http://127.0.0.1:1337/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;事实上方法也很简单，就是将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;request.headers['user-agent']&lt;/code&gt;字段传入进行判断就OK了。&lt;/p&gt;
</content>
                 <tag>Android</tag>  <tag>iOS</tag>  <tag>Node.js</tag> 
                 <tag>Node.js</tag> 
                <pubTime>2013-03-27T15:06:54+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/baidu-cloud-storage-bcs-use.html</loc>
        <lastmod>2013-03-24T20:45:33+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>小试百度云存储BCS</title>
                <content>
&lt;p&gt;最近使用百度的云平台BAE做了一些小东西，主要用来给微信公众平台提供API数据接口服务，因为涉及到一部分数据采集，需要将采集的数据保存起来以便以后可以进行数据分析，所以使用了百度的云存储也就是BCS，简单的使用一些功能，也就和大家分享一下，希望对大家有帮助。&lt;/p&gt;

&lt;p&gt;首先当然是注册开发者账号之类的，这里就略过了，然后再云存储中我建立一个叫“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aqidata&lt;/code&gt;”的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;buncket&lt;/code&gt;，再在“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;服务管理&lt;/code&gt;”-“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;我的密钥&lt;/code&gt;”中创建一个密钥对，最后在BAE中加入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BCS&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PHP-SDK&lt;/code&gt;，就可以使用以下代码将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl&lt;/code&gt;的结果存储到BCS上：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;require_once&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'bcs.class.php'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;require_once&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;BaeLog.class.php&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$logger&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;BaeLog&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$host&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'bcs.duapp.com'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ak&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Your Access Key&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$sk&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Your Secure Key&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$bucket&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'aqidata'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$tmp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sys_get_temp_dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$filepath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Ymd&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$filetime&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;H&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;curl_init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;curl_setopt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;CURLOPT_URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;http://xxx.com/1.json&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;curl_setopt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;CURLOPT_RETURNTRANSFER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;nb&quot;&gt;curl_setopt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;CURLOPT_HEADER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;nv&quot;&gt;$output&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;curl_exec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;file_put_contents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tmp&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$filepath&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$filetime&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'.json'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;curl_close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tmp&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$filepath&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$filetime&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'.json'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$filename&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$filepath&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$filetime&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'.json'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$baiduBCS&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BaiduBCS&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ak&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$sk&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$baiduBCS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;create_object&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$filename&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;事实上调用非常简单，就是使用new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BaiduBCS&lt;/code&gt;创建一个对象并使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;create_object&lt;/code&gt;将你的对象保存到BCS上，保存结果如下图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/03/BCS-result.jpg&quot;&gt;&lt;img src=&quot;/images/2013/03/BCS-result-560x473.jpg&quot; alt=&quot;BCS-result&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>百度云</tag> 
                 <tag>云服务</tag> 
                <pubTime>2013-03-24T20:45:33+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/gd-library-generate-text-with-shadow.html</loc>
        <lastmod>2013-03-23T10:15:39+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>GD库生成文字并添加文字阴影</title>
                <content>
&lt;p&gt;最近使用GD库来进行微信公共账号的图片生成，研究了一下GD库文字阴影效果的生成同时也发现了GD库的强大。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;GD库，是php处理图形的扩展库，GD库提供了一系列用来处理图片的API，使用GD库可以处理图片，或者生成图片。 在网站上GD库通常用来生成缩略图，或者用来对图片加水印，或者用来生成汉字验证码，或者对网站数据生成报表等。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;GD库的安装什么的网上都有，现在很多虚拟空间也都支持，这里就不再赘述。下面通过我实际应用代码的实例和相关的注释为大家介绍一下GD库的使用方法。&lt;/p&gt;

&lt;p&gt;原图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/03/3.jpg&quot;&gt;&lt;img src=&quot;/images/2013/03/3.jpg&quot; alt=&quot;原图&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;生成效果图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2013/03/get_pic.jpg&quot;&gt;&lt;img src=&quot;/images/2013/03/get_pic.jpg&quot; alt=&quot;效果图&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;代码如下：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;北京&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$str2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;空气质量：轻度污染&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 通过图片生成一个对象$im&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$im&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;imagecreatefromjpeg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;images/3.jpg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//载入字体zt.ttf&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$fnt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;zt.ttf&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//创建颜色，用于文字字体的白和阴影的黑&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$white&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;imagecolorallocate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$im&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;222&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;229&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;207&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$black&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;imagecolorallocate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$im&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//创建关于相对图片位置的函数，方便调用&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$top&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$left&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$top2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;170&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//在图片中添加文字，imagettftext (image,size,angle, x, y,color,fontfile,text)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;imagettftext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$im&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;41&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;nv&quot;&gt;$left&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&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;nv&quot;&gt;$top&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&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;nv&quot;&gt;$black&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$fnt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;imagettftext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$im&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;41&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;nv&quot;&gt;$left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$top&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$white&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$fnt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;imagettftext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$im&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;43&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;nv&quot;&gt;$left&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&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;nv&quot;&gt;$top2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&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;nv&quot;&gt;$black&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$fnt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$str2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;imagettftext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$im&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;43&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;nv&quot;&gt;$left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$top2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$white&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$fnt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$str2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//将$im输出&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;ImageJpeg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$im&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//销毁$im对象&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;ImageDestroy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$im&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;接下来详细解释一下：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;imagettftext&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;angle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fontfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;imagettftext()&lt;/code&gt; 是将字符串 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;text&lt;/code&gt;画到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;image&lt;/code&gt;所代表的图像上，从坐标 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x&lt;/code&gt;,&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;y&lt;/code&gt;（左上角为 0, 0）开始，角度为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;angle&lt;/code&gt;，颜色为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;color&lt;/code&gt;，使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fontfile&lt;/code&gt; 所指定的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TrueType&lt;/code&gt; 字体文件。&lt;/p&gt;

&lt;p&gt;由 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x&lt;/code&gt;,&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;y&lt;/code&gt; 所表示的坐标定义了第一个字符的基本点大概在字符的左下角。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;angle&lt;/code&gt; 以角度表示，0 度为从左向右阅读文本，更高的值表示逆时针方向（即如果值为 90 则表示从下向上阅读文本）。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fontfile&lt;/code&gt; 是想要使用的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TrueType&lt;/code&gt; 字体的文件名。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;text&lt;/code&gt; 是文本字符串，可以包含 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UTF-8&lt;/code&gt; 字符序列。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;color&lt;/code&gt; 是颜色的索引值。&lt;/p&gt;
</content>
                 <tag>PHP</tag> 
                 <tag>PHP</tag> 
                <pubTime>2013-03-23T10:15:39+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/build-nodejs-on-ubuntu-best-practice.html</loc>
        <lastmod>2013-02-28T20:18:07+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Ubuntu上搭建Node.js环境最佳实践</title>
                <content>
&lt;p&gt;要在Ubuntu的上建立node.js的的开发环境方法很多。像直接下载源代码自己编译，或者是使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;apt-get&lt;/code&gt;来帮你解决这些琐碎的问题。因为Node.js还年轻，常常会有版本的更新。手动安装及更新实在是非常的累人，而且代码在不同版本上执行可能也会有所不同。那么如何快速的安装新版本和在各个版本间切换将成为开发者面临的一大问题。&lt;/p&gt;

&lt;p&gt;现在有了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NVM&lt;/code&gt;（node version management），一切就方便多了。它可以用来安装和管理不同的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Node.js&lt;/code&gt;版本，它有点像&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ruby rvm&lt;/code&gt; ，可以让你快速切换Node的版本来测试你的应用。&lt;/p&gt;

&lt;p&gt;下面我们就开始NVM的安装吧，使用Curl或者Wget&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl https://raw.github.com/creationix/nvm/master/install.sh | sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;或者&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wget &lt;span class=&quot;nt&quot;&gt;-qO-&lt;/span&gt; https://raw.github.com/creationix/nvm/master/install.sh | sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;或者使用Git手动编译安装，先安装&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git-core&lt;/code&gt;，以便从GitHub上获取&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NVM&lt;/code&gt;的最新版本&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 安装 git&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;git-core
&lt;span class=&quot;c&quot;&gt;# 获取最新的NVM&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clone git://github.com/creationix/nvm.git ~/.nvm
&lt;span class=&quot;c&quot;&gt;# 开启快速执行&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;. ~/.nvm/nvm.sh&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样安装就完成了，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NVM&lt;/code&gt;的使用也非常简单。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 安装特定版本的&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;nvm &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;v0.8.12

&lt;span class=&quot;c&quot;&gt;# 设置特定版本为默认版本&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;nvm &lt;span class=&quot;nb&quot;&gt;alias &lt;/span&gt;default v0.8.12

&lt;span class=&quot;c&quot;&gt;# 使用特定版本&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;nvm use 0.8.12
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;nvm run 0.8.12

&lt;span class=&quot;c&quot;&gt;# 列出已经安装的Node&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;nvm &lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样你就可以在多个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Node&lt;/code&gt;环境中自由切换，快速测试了！&lt;/p&gt;
</content>
                 <tag>Node.js</tag> 
                 <tag>Node.js</tag> 
                <pubTime>2013-02-28T20:18:07+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/php5-4-zendoptimizer.html</loc>
        <lastmod>2012-09-27T12:50:24+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PHP5.3、PHP5.4安装ZendOptimizer</title>
                <content>
&lt;p&gt;现在很多PHP程序都需要ZendOptimizer环境，但是ZendOptimizer在PHP5.2之后已经被支持，那怎么办，Zend也不会这么做，原来PHP5.3开始ZendOptimizer正式改为Zend Guard Loader。&lt;/p&gt;

&lt;p&gt;Zend Guard Loader的发布，而且Zend Optimizer不会再更新，并且由于差异很大使用Zend Guard加密代码时将提示你是否使用php5.3，如果使用5.3那么代码就无法在php5.2上运行。&lt;/p&gt;

&lt;p&gt;Zend Guard Loader安装说明&lt;/p&gt;

&lt;p&gt;###下载Zend Guard Loader包&lt;/p&gt;

&lt;p&gt;(官方地址:&lt;a href=&quot;http://www.zend.com/en/products/guard/downloads&quot;&gt;http://www.zend.com/en/products/guard/downloads&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Linux:&lt;/p&gt;

&lt;p&gt;x86:http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz&lt;/p&gt;

&lt;p&gt;x64:http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz&lt;/p&gt;

&lt;p&gt;Windows:&lt;/p&gt;

&lt;p&gt;http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-Windows.zip&amp;lt;/blockquote&amp;gt;&lt;/p&gt;

&lt;p&gt;并提取ZendGuardLoader.so（Linux）或ZendLoader.dll（Windows）上传到服务器。&lt;/p&gt;

&lt;h3 id=&quot;加载zendguardloader配置phpini&quot;&gt;加载ZendGuardLoader,配置PHP.INI&lt;/h3&gt;

&lt;p&gt;例子:&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;py&quot;&gt;zend_extension&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\w&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;eb&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;HP&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;xt&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\Z&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;endLoader.dll&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;zend_loader.enable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;zend_loader.disable_licensing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;zend_loader.obfuscation_level_support&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;zend_loader.license_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;下面逐一说明：&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;注意windows版的只支持NTS(非线程安全)版的PHP5.3,即&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;phpinfo&lt;/code&gt;中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Thread Safety&lt;/code&gt;为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;disabled&lt;/code&gt;的！&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;在你的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php.ini&lt;/code&gt;文件中添加以下行：&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;;Linux和Mac OS X：
&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;zend_extension&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;lt;ZendGuardLoader.so的绝对路径&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;;Windows的非线程安全的：
&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;zend_extension&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;lt;ZendLoader.dll的绝对路径&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;添加下面这行加载zendguardloader&quot;&gt;添加下面这行加载ZendGuardLoader:&lt;/h3&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;;启用加载编码脚本。默认开启
&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;zend_loader.enable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;可选配置zendguardloader&quot;&gt;可选：配置ZendGuardLoader&lt;/h3&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;;禁用检查授权（出于性能原因）
&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;zend_loader.disable_licensing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;;配置混淆水平 0 - 不支持混淆
&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;zend_loader.obfuscation_level_support&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;;配置寻找授权文件的路径
&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;zend_loader.license_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;如果你同时使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Zend debugger&lt;/code&gt;,请保证加载&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Zend guard Loader&lt;/code&gt;后再加载&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Zend debugger&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;如果你同时使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ioncube loader&lt;/code&gt;,请保证加载&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ioncube loader&lt;/code&gt;后再加载&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Zend guard Loader&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;重启Web服务。&lt;/p&gt;

&lt;p&gt;如果在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;phpinfo&lt;/code&gt;中看到如下内容（不同的版本可能会有所不同）：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.4.0, Copyright (c) 1998-2011 Zend Technologies
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;说明安装已经成功！&lt;/p&gt;
</content>
                 <tag>PHP</tag> 
                 <tag>服务器</tag> 
                <pubTime>2012-09-27T12:50:24+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/phpweb-module-package-download.html</loc>
        <lastmod>2012-08-03T11:30:28+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PHPWEB模块安装包下载（安装方法）</title>
                <content>
&lt;p&gt;之前已经介绍了&lt;a href=&quot;/phpweb-crack-to-install-module.html&quot;&gt;《PHPWEB破解安装新模块》&lt;/a&gt;的方法破解。&lt;/p&gt;

&lt;p&gt;我这里再简单的讲一下，结合@天悬星河 找到的在后台添加权限的方法，简化了破解安装的流程。&lt;/p&gt;

&lt;p&gt;首先解密post.php文件并进行修改，下面是我修改好的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;post.php&lt;/code&gt;。替换掉&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;base\admin&lt;/code&gt;下面的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;post.php&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://dl.dbank.com/c0svt1fm14&quot;&gt;post.php (18.27K))&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;在我下面提供的下载链接或到有这个模块的站点拷贝这个模块的文件夹，放到根目录。最后去后台安装这个模块，随便输个用户名和密码，稍后就会提示安装模块成功，在后台也可以看到这个模块。&lt;/p&gt;

&lt;p&gt;接下来就是添加权限，在管理员后台的“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;设置&lt;/code&gt;”-&amp;gt;“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;管理帐户维护&lt;/code&gt;”里对要增加权限的管理员点击“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;修改权限&lt;/code&gt;”。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2012/08/phpweb-model-1.jpg&quot;&gt;&lt;img src=&quot;/images/2012/08/phpweb-model-1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;进入后会看到你新安装的模块前面没有打勾，全部打上勾，再点“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;修改&lt;/code&gt;”就大功告成了！&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2012/08/phpweb-model-2.jpg&quot;&gt;&lt;img src=&quot;/images/2012/08/phpweb-model-2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;各个模块下载地址（那些一定有的新闻图片页面模块就不提供咯）：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://dl.dbank.com/c0ofwvbaxn&quot;&gt;PHPWEB模块下载&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>PHPWEB</tag> 
                 <tag>PHP</tag> 
                <pubTime>2012-08-03T11:30:28+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/phpweb-crack-to-install-module.html</loc>
        <lastmod>2012-07-14T15:01:47+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PHPWEB破解安装新模块</title>
                <content>
&lt;p&gt;因为最近在用PHPWEB做一个站，但是原有的模版站里没有下载模块，在后台安装模块需要验证用户。不甘心，所以研究了一下PHPWEB的模块安装部分，发现验证部分是调用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;base\admin&lt;/code&gt;下面的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;post.php&lt;/code&gt;进行，所以想在这个文件动手脚。研究了一下，成功安装了下载模块。将经验与大家分享，希望大家用得上。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2012/07/phpweb-mokuai.jpg&quot;&gt;&lt;img src=&quot;/images/2012/07/phpweb-mokuai.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;首先解密post.php文件并进行修改，下面是我修改好的post.php&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://gist.github.com/yourtion/58327041cd0a549c193b&quot;&gt;https://gist.github.com/yourtion/58327041cd0a549c193b&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;然后去有这个模块的站点拷贝这个模块的文件夹，我的是下载模块，就是那个down的，最后去后台安装这个模块，随便输个用户名和密码，稍后就会提示安装模块成功，在后台也可以看到这个模块。&lt;/p&gt;

&lt;p&gt;但是你点击进入的话会提示你没有权限操作、&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2012/07/phpweb-down-no.jpg&quot;&gt;&lt;img src=&quot;/images/2012/07/phpweb-down-no.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;这是因为在原有模版站里没有对这个模块的授权，使用phpMyAdmin进入网站数据库，在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_base_adminrights&lt;/code&gt;里面添加这个模块的相应权限，下载模块是160到165，如下图，这样，整个模块就安装完成了！&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2012/07/phpweb-down-sql.jpg&quot;&gt;&lt;img src=&quot;/images/2012/07/phpweb-down-sql.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;接下来我会整理一些模块和相关的权限信息，希望能给大家以帮助！&lt;/p&gt;
</content>
                 <tag>PHPWEB</tag> 
                 <tag>PHP</tag> 
                <pubTime>2012-07-14T15:01:47+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/mysql-orderby-problem-solve.html</loc>
        <lastmod>2012-07-05T23:36:27+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PHP中使用MySQL按照多字段排序及问题解决</title>
                <content>
&lt;p&gt;因为在做一个项目需要筛选掉一部分产品列表中的产品，使其在列表显示时排在最后，但是所有产品都要按照更新时间排序。&lt;/p&gt;

&lt;p&gt;研究了一下系统的数据库结构后，决定将要排除到后面的产品加为粗体，这样在数据库中的“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ifbold&lt;/code&gt;”就会被标记为1，而其他产品就默认标记为0，然后就打算使用MySQL在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Order By&lt;/code&gt;时进行多字段排序。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Order by&lt;/code&gt;的多条件分割一般使用英文逗号分割，所以我测试的SQL如下：&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;P&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_product_con&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;where&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scl&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;order&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;by&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'ifbold'&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;asc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myord&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;limit&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pagelimit&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;但是运行后没有将”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ifbold&lt;/code&gt;“正序，但是单纯正序”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ifbold&lt;/code&gt;“却正常，调试了N久，无意中在phpMyAdmin中运行却发现正常，仔细比对后发现问题原来是来自于”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ifblod&lt;/code&gt;“的引号上。改为下列语句就正常了：&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;P&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_product_con&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;where&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scl&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;order&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;by&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`ifbold`&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;asc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myord&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;limit&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pagelimit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;所以以后大家再程序中写SQL语句时也要注意引号的问题哦！&lt;/p&gt;
</content>
                 <tag>MySQL</tag> 
                 <tag>PHP</tag> 
                <pubTime>2012-07-05T23:36:27+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/china-lu-kaiyuan-mirror-summary.html</loc>
        <lastmod>2012-06-30T10:00:49+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>中国大陆开源镜像站汇总</title>
                <content>
&lt;h2 id=&quot;1企业贡献&quot;&gt;1.企业贡献：&lt;/h2&gt;

&lt;p&gt;搜狐开源镜像站：&lt;a href=&quot;http://mirrors.sohu.com/&quot;&gt;http://mirrors.sohu.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;网易开源镜像站：&lt;a href=&quot;http://mirrors.163.com/&quot;&gt;http://mirrors.163.com/&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;2大学教学&quot;&gt;2.大学教学：&lt;/h2&gt;

&lt;h3 id=&quot;北京理工大学&quot;&gt;北京理工大学：&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://mirror.bit.edu.cn/&quot;&gt;http://mirror.bit.edu.cn&lt;/a&gt; (IPv4 only)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://mirror.bit6.edu.cn/&quot;&gt;http://mirror.bit6.edu.cn&lt;/a&gt; (IPv6 only)&lt;/p&gt;

&lt;p&gt;北京交通大学：
&lt;a href=&quot;http://mirror.bjtu.edu.cn/&quot;&gt;http://mirror.bjtu.edu.cn&lt;/a&gt; (IPv4 only)
&lt;a href=&quot;http://mirror6.bjtu.edu.cn/&quot;&gt;http://mirror6.bjtu.edu.cn&lt;/a&gt; (IPv6 only)
&lt;a href=&quot;http://debian.bjtu.edu.cn/&quot;&gt;http://debian.bjtu.edu.cn&lt;/a&gt; (IPv4+IPv6)&lt;/p&gt;

&lt;h3 id=&quot;兰州大学&quot;&gt;兰州大学：&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://mirror.lzu.edu.cn/&quot;&gt;http://mirror.lzu.edu.cn/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;厦门大学&quot;&gt;厦门大学：&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://mirrors.xmu.edu.cn/&quot;&gt;http://mirrors.xmu.edu.cn/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;上海交通大学&quot;&gt;上海交通大学：&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://ftp.sjtu.edu.cn/&quot;&gt;http://ftp.sjtu.edu.cn/&lt;/a&gt; (IPv4 only)
&lt;a href=&quot;http://ftp6.sjtu.edu.cn/&quot;&gt;http://ftp6.sjtu.edu.cn&lt;/a&gt; (IPv6 only)&lt;/p&gt;

&lt;h3 id=&quot;清华大学&quot;&gt;清华大学：&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://mirrors.tuna.tsinghua.edu.cn/&quot;&gt;http://mirrors.tuna.tsinghua.edu.cn/&lt;/a&gt; (IPv4+IPv6)
&lt;a href=&quot;http://mirrors.6.tuna.tsinghua.edu.cn/&quot;&gt;http://mirrors.6.tuna.tsinghua.edu.cn/&lt;/a&gt; (IPv6 only)
&lt;a href=&quot;http://mirrors.4.tuna.tsinghua.edu.cn/&quot;&gt;http://mirrors.4.tuna.tsinghua.edu.cn/&lt;/a&gt; (IPv4 only)&lt;/p&gt;

&lt;h3 id=&quot;天津大学&quot;&gt;天津大学：&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://mirror.tju.edu.cn/&quot;&gt;http://mirror.tju.edu.cn/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;中国科学技术大学&quot;&gt;中国科学技术大学：&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://mirrors.ustc.edu.cn/&quot;&gt;http://mirrors.ustc.edu.cn/&lt;/a&gt; (IPv4+IPv6)
&lt;a href=&quot;http://mirrors4.ustc.edu.cn/&quot;&gt;http://mirrors4.ustc.edu.cn/&lt;/a&gt;
&lt;a href=&quot;http://mirrors6.ustc.edu.cn/&quot;&gt;http://mirrors6.ustc.edu.cn/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;西南大学&quot;&gt;西南大学：&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://linux.swu.edu.cn/swudownload/Distributions/&quot;&gt;http://linux.swu.edu.cn/swudownload/Distributions/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;东北大学&quot;&gt;东北大学：&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://mirror.neu.edu.cn/&quot;&gt;http://mirror.neu.edu.cn/&lt;/a&gt; (IPv4 only)
&lt;a href=&quot;http://mirror.neu6.edu.cn/&quot;&gt;http://mirror.neu6.edu.cn/&lt;/a&gt; (IPv6 only)&lt;/p&gt;

&lt;h3 id=&quot;电子科技大学&quot;&gt;电子科技大学：&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://ubuntu.uestc.edu.cn/&quot;&gt;http://ubuntu.uestc.edu.cn/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;青岛大学&quot;&gt;青岛大学：&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://mirror.qdu.edu.cn/&quot;&gt;http://mirror.qdu.edu.cn/&lt;/a&gt;&lt;/p&gt;
</content>
                
                 <tag>电脑技巧</tag> 
                <pubTime>2012-06-30T10:00:49+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/appcan-fishjoy.html</loc>
        <lastmod>2012-06-05T23:18:13+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>用APPCAN开发捕鱼达人全平台版</title>
                <content>
&lt;p&gt;最近看到不少人使用HTML5来开发游戏，想到APPCAN就是针对HTML开发APP的，所以就想试一下APPCAN的HTML5游戏性能如何。&lt;/p&gt;

&lt;p&gt;由于AppCan的中间件，致力于解决基于HTML5的WebApp体验差和实用性差的问题，在窗口管理上尤其独特的设计，可以解决多页面切换时闪屏与不流畅的问题。而在移动游戏方面，AppCan对HTML5 Canvas的接口实现了加速，使其运行起来比原生浏览器快上好几倍。&lt;/p&gt;

&lt;p&gt;所以我选择了比较热门的捕鱼达人，在网上找的了一个仿制捕鱼达人的叫“捕鱼大亨”的HTML5源码，稍作修改放到了APPCAN的工程里面，结果在模拟器运行黑屏，抱着试一试的心态拷到真机上，居然可以运行，但是对机器性能要求比较高。&lt;/p&gt;

&lt;p&gt;电脑版演示在这里：&lt;a href=&quot;http://demo.yourtion.com/html5/fishjoy/&quot;&gt;http://demo.yourtion.com/html5/fishjoy/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2012/06/bydh1.jpg&quot;&gt;&lt;img src=&quot;/images/2012/06/bydh1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;我的U9GT2只有20FPS左右，但是我朋友的ME860却可以在50FPS完美运行，不多说了，直接上应用，因为的今晚刚刚弄好，没做任何优化，自己玩玩吧，有想法就回复留言咯。&lt;/p&gt;

&lt;p&gt;二维码下载：&lt;/p&gt;

&lt;p&gt;Android:&lt;a href=&quot;http://vdisk.weibo.com/s/6qApD&quot;&gt;http://vdisk.weibo.com/s/6qApD&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2012/06/bydr-Android.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Iphone:&lt;a href=&quot;http://vdisk.weibo.com/s/6qAFS&quot;&gt;http://vdisk.weibo.com/s/6qAFS&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2012/06/bydr-Iphone.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

</content>
                 <tag>移动开发</tag> 
                 <tag>AppCan</tag> 
                <pubTime>2012-06-05T23:18:13+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/appcan-get-mobile-ip-address-1.html</loc>
        <lastmod>2012-05-12T20:23:43+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>AppCan获取手机客户端的IP地址(1)</title>
                <content>
&lt;p&gt;刚刚在论坛有开发者在问到关于获取手机客户端地址的问题，我想到之前发过一个&lt;a href=&quot;/the-ip-address-areas-and-converter.html&quot;&gt;《IP在线查询位置及转换存储》&lt;/a&gt;的文章，那个是基于PHP和新浪API的，现在网上搜索到的关于获取IP地址那个腾讯的API已经不能用了，&lt;/p&gt;

&lt;p&gt;我又找了一下，先分享，还有一些关于效率和Ajax请求的下一回再写吧。&lt;/p&gt;

&lt;p&gt;解决方案有两个，先讲简单的使用API接口的形式吧。&lt;/p&gt;

&lt;p&gt;方法一（API调用），使用新浪和搜狐的API：&lt;/p&gt;

&lt;p&gt;在你要获取地址的APP的页面中加入：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;text/javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;http://counter.sina.com.cn/ip&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;charset&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;gb2312&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/script&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;text/javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;http://pv.sohu.com/cityjson?ie=utf-8&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/script&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;text/javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//var ILData = new Array(&quot;125.77.19.138&quot;,&quot;中国&quot;, &quot;福建省&quot;, &quot;福州市&quot;, &quot;电信&quot;); if (typeof(ILData_callback) != &quot;undefined&quot;) { ILData_callback(); }  //新浪返回数据，可加IP ?ip=139.256.0.9&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//var returnCitySN = {&quot;cip&quot;: &quot;125.77.19.138&quot;, &quot;cid&quot;: &quot;350100&quot;, &quot;cname&quot;: &quot;福建省福州市&quot;};  //不可加IP，可设置编码&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;(数组)新浪IP地址查询：&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ILData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;lt;br/&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;(json)搜狐IP地址查询：&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;returnCitySN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;returnCitySN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;returnCitySN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;lt;br/&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/script&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;我把两个API写到一起。大家按需调用吧，由于没做Ajax，在真机GPRS时候可能由于速度慢导致失败，下次写个Ajax的版本。&lt;/p&gt;

&lt;p&gt;第二种方法就在自己做服务器程序，直接返回&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$_SERVER[&quot;HTTP_CLIENT_IP&quot;]&lt;/code&gt; （PHP），其他的也差不多。&lt;/p&gt;

&lt;p&gt;还是建议使用API，顺便可以解析地址&lt;/p&gt;
</content>
                 <tag>移动开发</tag> 
                 <tag>AppCan</tag> 
                <pubTime>2012-05-12T20:23:43+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/the-ip-address-areas-and-converter.html</loc>
        <lastmod>2012-05-03T23:08:41+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>IP在线查询位置及转换存储</title>
                <content>
&lt;p&gt;最近在做一个私密聊天的客户端，顺便研究了一下在线查询IP地理位置，基于新浪IP地址信息数据库共享接口，同时研究了关于IP地址在数据库中转存为数值类型的方法，和大家进行分享，基于PHP实现，大家可以举一反三。&lt;/p&gt;

&lt;p&gt;接口地址：http://int.dpool.sina.com.cn/iplookup/iplookup.php?ip=需要查询的ip地址&lt;/p&gt;

&lt;p&gt;使用方法（返回Json并解析处理）：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&amp;amp;ip=&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file_get_contents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&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;nb&quot;&gt;empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$message&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'province'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'city'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'district'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'isp'&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;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'未知地点'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其中返回的各个参数可以自己删减显示，&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;[ret] =&amp;gt; 1表示正常 -1表示内网，-2表示ip地址输入有误&lt;/li&gt;
  &lt;li&gt;[start] =&amp;gt; 地址段起点&lt;/li&gt;
  &lt;li&gt;[end] =&amp;gt; 地址段终点&lt;/li&gt;
  &lt;li&gt;[country] =&amp;gt; 国家&lt;/li&gt;
  &lt;li&gt;[province] =&amp;gt; 省&lt;/li&gt;
  &lt;li&gt;[city] =&amp;gt; 是&lt;/li&gt;
  &lt;li&gt;[district] =&amp;gt;&lt;/li&gt;
  &lt;li&gt;[isp] =&amp;gt;&lt;/li&gt;
  &lt;li&gt;[type] =&amp;gt; 类型&lt;/li&gt;
  &lt;li&gt;[desc] =&amp;gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;关于地址的转换和存储就分享两个function&lt;/p&gt;

&lt;p&gt;IP转整数：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iptolong&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;explode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'.'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$num&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&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;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$num&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;整数转IP：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;longtoip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$num&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;floor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$num&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;floor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$num&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;256&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;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;floor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$num&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;256&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;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&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;nv&quot;&gt;$num&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$num&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&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;256&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;implode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'.'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
                 <tag>PHP</tag> 
                 <tag>PHP</tag> 
                <pubTime>2012-05-03T23:08:41+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/openwrt-samba-share.html</loc>
        <lastmod>2012-04-25T13:48:15+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>OpenWrt下Samba共享设置和Win7共享</title>
                <content>
&lt;p&gt;openwrt下samba设置起作用的机制是这样的：&lt;/p&gt;

&lt;p&gt;openwrt在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/config/&lt;/code&gt;下面有一个samba的设置，注意：这个设置不符合samba软件本身的设置文件规范。openwr启动时，会用这个设置去替换掉相应的模板里的字段，生成一个符合samba设置文件规范的文件放到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/tmp&lt;/code&gt;目录下。&lt;/p&gt;

&lt;p&gt;首先设置OpenWrt下的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Samba&lt;/code&gt;，设置好共享目录并关掉Guest和在允许用户“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt;”。&lt;/p&gt;

&lt;p&gt;然后使用：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;smbpasswd root XXXX
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;注意，这个root是用户名，用户名必须是系统里已经曾在的用户，openwrt好像只有一个root，一个nobody，两个用户如果要添加其他用户， 可以用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;busybox&lt;/code&gt;的用户管理（&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adduser/deluser&lt;/code&gt;，需要在编译时添加此部分功能），或者直接编译&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/passwd&lt;/code&gt;来添加用户，这两个我都没试过，所以，我是直接用root访问samba。&lt;/p&gt;

&lt;p&gt;这样密码访问就正常了。对于vista,win7不能访问samba，解决方法如下：&lt;/p&gt;

&lt;p&gt;运行里输入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secpol.msc&lt;/code&gt;,进入-&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;本地策略&lt;/code&gt;-&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;安全选项&lt;/code&gt;里，选中:&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;网络安全&lt;/code&gt;：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LAN管理器身份验证级别&lt;/code&gt;,选择:&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;发送LM和NTLM,如果已协商，使用ntlmv2回话，立即生效&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;这是由于samba支持的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NTLM&lt;/code&gt;版本低，nt6系统要求支持&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NTLMv2&lt;/code&gt;引起的。&lt;/p&gt;
</content>
                
                 <tag>服务器</tag> 
                <pubTime>2012-04-25T13:48:15+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/appcan-jquery-zy_tmpl-php.html</loc>
        <lastmod>2012-04-13T22:46:32+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>AppCan使用jQuery与zy_tmpl生成下拉菜单(PHP)</title>
                <content>
&lt;p&gt;第一次写关于AppCan开发的文章，有人写了关于jQuery或者原生&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ajax&lt;/code&gt;与&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;json&lt;/code&gt;的交互，那我就稍微写写我开发过程中使用jQuery获取json后使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zy_tmpl&lt;/code&gt;生成下拉菜单的实例吧。&lt;/p&gt;

&lt;p&gt;PHP服务端生成json的那部分就不写那么多了，就是输入一个数组&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$res&lt;/code&gt;,然后&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$_GET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'jsoncallback'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;(&quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在AppCan的模版中，先加入一个下拉菜单，我的菜单是：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;&amp;lt;!--下拉列表开始--&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot; ui-has-label&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;label&lt;/span&gt;  &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ui-select &quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;选择楼群：&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ui-select&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt;  &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ui-btn ui-btn-icon-right ui-btn-corner-all ui-btn-b&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
			&lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ui-btn-inner ui-btn-corner-all&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
				&lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ui-btn-text&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;楼名&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
				&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ui-li-link-alt ui-btn ui-btn-corner-right ui-shadow&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
				&lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ui-icon ui-icon-arrow-d ui-icon-shadow&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
				&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
			&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
			&lt;span class=&quot;nt&quot;&gt;&amp;lt;select&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;lc&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;lc&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;selectedIndex=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;select-choice-0&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;onchange=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;zy_slectmenu(this.id)&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
				数据加载中，请稍候
			&lt;span class=&quot;nt&quot;&gt;&amp;lt;/select&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--下拉列表结束--&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后在&lt;script&gt;&lt;/script&gt;中加入：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getlq&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
	&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http://localhost/json.php?jsoncallback=?&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;tmpl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;option value=&quot;${BuildingId}&quot;&amp;gt;${BuildingName}&amp;lt;/option&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#lc&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#lc&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;zy_tmpl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;tmpl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;zy_tmpl_count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&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;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;onload&lt;/code&gt;或者&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;onchange&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;onclick&lt;/code&gt;时执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getlq()&lt;/code&gt;;就能实现&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;select&lt;/code&gt;的更新。&lt;/p&gt;
</content>
                 <tag>jQuery</tag>  <tag>PHP</tag>  <tag>移动开发</tag> 
                 <tag>AppCan</tag> 
                <pubTime>2012-04-13T22:46:32+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/shlcms-beautify-paging.html</loc>
        <lastmod>2012-04-12T20:48:31+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>SHLCMS美化分页显示代码</title>
                <content>
&lt;p&gt;很久没有写博客了，最近在做一个网站，因为前台页面人家已经写好。我只是负责嵌入，所以要按照要求把页面做得跟设计一样，深喉咙的分页代码太丑了，所以进行了一些美化，效果和代码如下，和大家分享一下：&lt;/p&gt;

&lt;p&gt;效果：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2012/04/SHLCMS-Page.jpg&quot;&gt;&lt;img src=&quot;/images/2012/04/SHLCMS-Page.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;首先修改”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\inc\class.pager.php&lt;/code&gt;“，将&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$style&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;改为&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$style&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后将”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;elseif($style==2)&lt;/code&gt;“花括号中的内容改为：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;elseif&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$style&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&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;nv&quot;&gt;$tpageNum&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;div class=&quot;page&quot;&amp;gt;&amp;lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;&amp;gt;&amp;lt;tr&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;prvNo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cPage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tpageNum&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&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;nv&quot;&gt;$tstart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&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;nv&quot;&gt;$tend&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tpageNum&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&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;p&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; 
	&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$tstart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cPage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tpageNum&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&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;nv&quot;&gt;$tend&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cPage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tpageNum&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&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;nv&quot;&gt;$tstart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tstart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tstart&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$tend&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tend&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;totalPageNo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;totalPageNo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;td&amp;gt;共'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;totalPageNo&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'页&amp;lt;/td&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;prvNo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;td class=&quot;pagespace&quot;&amp;gt;&amp;lt;a href=&quot;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rootpath&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$url&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;prvNo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;anchor&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&quot;&amp;gt;&amp;lt;button class=&quot;btn1&quot;&amp;gt;前一页&amp;lt;/button&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;td class=&quot;pagenum&quot;&amp;gt; '&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tstart&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tend&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&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;nv&quot;&gt;$i&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;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cPage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;a href=&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; class=&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;currentpage&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; &amp;lt;/a&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;' &amp;lt;a href=&quot;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rootpath&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$url&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&quot;&amp;gt;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;anchor&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;/a&amp;gt; '&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;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;/td&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nextNo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;totalPageNo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;td class=&quot;pagespace&quot;&amp;gt;&amp;lt;a href=&quot;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$url&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nextNo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;anchor&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&quot;&amp;gt;&amp;lt;button class=&quot;btn1&quot;&amp;gt;下一页&amp;lt;/button&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nextNo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;totalPageNo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;td class=&quot;pagespace&quot;&amp;gt;&amp;lt;button class=&quot;btn1&quot;&amp;gt; &amp;lt;a href=&quot;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rootpath&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$url&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lastNo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;anchor&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&quot;&amp;gt;最后页&amp;lt;/a&amp;gt;&amp;lt;/button&amp;gt;&amp;lt;/td&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;lt;td&amp;gt;跳转至&amp;lt;select name=&quot;pagerMenu&quot; onChange=&quot;location=\''&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rootpath&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$url&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\'+this.options[this.selectedIndex].value+\''&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;anchor&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\'&quot;;&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&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;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;totalPageNo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&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;nv&quot;&gt;$i&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;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;lt;option value=&quot;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&quot;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cPage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;' selected=&quot;selected&quot;'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;gt;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;/option&amp;gt;'&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;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;lt;/select&amp;gt;页&amp;lt;/td&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$tempStr&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;/div&amp;gt; &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最后在样式表中增加：&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;.pagenum&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;6px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;6px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;_padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;6px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;21px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;solid&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#e4e4e4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.page&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;12px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.btn1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;56px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;21px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;21px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;padding-left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;6px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;text-align&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;url(../images/btnbg.jpg)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;left&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;-104px&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;no-repeat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.btn2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;60px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;22px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;22px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;text-align&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;center&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;url(../images/btnbg.jpg)&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;-56px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;-104px&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;no-repeat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.pagenum&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;.currentpage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;#007dfe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;solid&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#007dfe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;bold&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.pagespace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;padding-left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.page&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;.pagespace&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;30px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;relative&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;15px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;/images/2012/04/btnbg.jpg&quot;&gt;btnbg.jpg在这里&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;希望大家多给意见和建议，让我们一同进步&lt;/p&gt;
</content>
                 <tag>SHLCMS</tag> 
                 <tag>PHP</tag> 
                <pubTime>2012-04-12T20:48:31+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/baidu-maps-ali-cloud-map-geographic-coordinates-difference.html</loc>
        <lastmod>2012-03-18T11:16:49+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>百度地图与阿里云地图地理坐标差异</title>
                <content>
&lt;p&gt;最近在研究手机APP的开发，因为一开始百度地图没有使用异步加载，而且感觉百度地图在手机显示上效果不佳，所以想使用阿里云地图来替代百度地图，因为数据库和后端数据接口是根据百度地图获取的坐标存储，直接调用百度的坐标数据后发现两者的坐标存在很大的差异，所以做了一个页面用来计算两者的差异，算是玩一下吧，大家有兴趣可以看看。&lt;/p&gt;

&lt;p&gt;使用方法：&lt;/p&gt;

&lt;p&gt;访问：&lt;a href=&quot;http://demo.yourtion.com/alimap-baidumap-lonlat.html&quot;&gt;http://demo.yourtion.com/alimap-baidumap-lonlat.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;在左边阿里云地图点击选择一个地点坐标，然后在右边百度地图点选与阿里云地图相同地点，最后点击计算差值。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2012/03/alimap-baidumap-lonlat.jpg&quot;&gt;&lt;img src=&quot;/images/2012/03/alimap-baidumap-lonlat-560x395.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>百度地图</tag> 
                 <tag>HTML</tag> 
                <pubTime>2012-03-18T11:16:49+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ace-ueditor.html</loc>
        <lastmod>2012-03-03T21:21:08+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>阿里云ACE中使用Ueditor——支持图片上传</title>
                <content>
&lt;p&gt;最近在研究阿里云的应用托管即ACE，同时在做公司的ISNC-CMS，感觉Ueditor很不错，就想到把Ueditor放到ACE上面，因为ACE是在一个分布式的环境中，存储与本地不利于平台按处理访问能力决定的服务器自动扩张和回收，也就是不支持文件的上传直接写入，因此ACE提供了storage服务，所以Ueditor的图片上传要通过storage来实现，方法很简单。&lt;/p&gt;

&lt;p&gt;首先将下载的Ueditor解压并用FTP上传到阿里云ACE的ueditor目录。&lt;/p&gt;

&lt;p&gt;修改”server\upload\php“里的up.php，把：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;c1&quot;&gt;//保存图片&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$state&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;SUCCESS&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$tmp_file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_FILES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;picdata&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$path&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;rand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;mi&quot;&gt;10000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;strrchr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tmp_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'.'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;move_uploaded_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_FILES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;picdata&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;tmp_name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&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;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;$state&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;图片保存失败！&quot;&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;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//向浏览器返回数据json数据&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'../'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;//为方便理解，替换掉所有类似../和./等相对路径标识&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;'url':'&quot;.$file.&quot;','title':'&quot;.$title.&quot;','state':'&quot;.$state.&quot;'&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;修改为：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;//保存图片&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$state&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;SUCCESS&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$tmp_file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_FILES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;picdata&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;rand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;mi&quot;&gt;10000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;strrchr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tmp_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'.'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file_exists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_FILES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;picdata&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;tmp_name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])){&lt;/span&gt; 
		&lt;span class=&quot;nv&quot;&gt;$storage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;CEStorage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; 
		&lt;span class=&quot;nv&quot;&gt;$file_url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$storage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;upload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_FILES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;picdata&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;tmp_name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);;&lt;/span&gt;
	  	&lt;span class=&quot;c1&quot;&gt;// $file_url will be XXX.aliapp.com/aliyun_ce_storage/title.jpg&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;nv&quot;&gt;$file_url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'aliyun_ce_storage/'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$file_url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//向浏览器返回数据json数据&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;'url':'&quot;.$file_url.&quot;','title':'&quot;.$title.&quot;','state':'&quot;.$state.&quot;'&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;修改”editor_config.js“，将：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;tmp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;nx&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;lastIndexOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;_examples/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//这里你可以配置成ueditor目录在您网站的相对路径或者绝对路径（指以http开头的绝对路径）&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;UEDITOR_CONFIG&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;na&quot;&gt;imagePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;URL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;server/upload/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//图片文件夹所在的路径，用于显示时修正后台返回的图片url！具体图片保存路径需要在后台设置。！important&lt;/span&gt;
	&lt;span class=&quot;na&quot;&gt;compressSide&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&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;c1&quot;&gt;//等比压缩的基准，确定maxImageSideLength参数的参照对象。0为按照最长边，1为按照宽度，2为按照高度&lt;/span&gt;
	&lt;span class=&quot;na&quot;&gt;maxImageSideLength&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;900&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//上传图片最大允许的边长，超过会自动等比缩放,不缩放就设置一个比较大的值&lt;/span&gt;
	&lt;span class=&quot;na&quot;&gt;relativePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;//是否开启相对路径。开启状态下所有本地图片的路径都将以相对路径形式进行保存.强烈建议开启！&lt;/span&gt;
	&lt;span class=&quot;na&quot;&gt;UEDITOR_HOME_URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//为editor添加一个全局路径&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;修改为：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;tmp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;nx&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;lastIndexOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/ueditor/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//这里你可以配置成ueditor目录在您网站的相对路径或者绝对路径（指以http开头的绝对路径）&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;UEDITOR_CONFIG&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;na&quot;&gt;imagePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;URL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/aliyun_ce_storage/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//图片文件夹所在的路径，用于显示时修正后台返回的图片url！具体图片保存路径需要在后台设置。！important&lt;/span&gt;
	&lt;span class=&quot;na&quot;&gt;compressSide&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&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;c1&quot;&gt;//等比压缩的基准，确定maxImageSideLength参数的参照对象。0为按照最长边，1为按照宽度，2为按照高度&lt;/span&gt;
	&lt;span class=&quot;na&quot;&gt;maxImageSideLength&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;900&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//上传图片最大允许的边长，超过会自动等比缩放,不缩放就设置一个比较大的值&lt;/span&gt;
	&lt;span class=&quot;na&quot;&gt;relativePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;//是否开启相对路径。开启状态下所有本地图片的路径都将以相对路径形式进行保存.强烈建议开启！&lt;/span&gt;
	&lt;span class=&quot;na&quot;&gt;UEDITOR_HOME_URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//为editor添加一个全局路径&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样就大功告成了。&lt;/p&gt;

&lt;p&gt;演示地址：&lt;a href=&quot;http://yourtion.aliyun.com/ueritor/&quot;&gt;http://yourtion.aliyun.com/ueritor/&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>Ueditor</tag>  <tag>阿里云</tag> 
                 <tag>云服务</tag> 
                <pubTime>2012-03-03T21:21:08+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/shlcms-integrated-ueditor.html</loc>
        <lastmod>2012-02-26T00:31:42+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>SHLCMS(深喉咙CMS)集成Ueditor教程</title>
                <content>
&lt;p&gt;最近看到百度出了Uedit编辑器，感觉还不错，所以想把它集成到深喉咙里面，研究了一番，终于搞定了，现在将方法和大家共享，有需要的同学可以举一反三老做一下，刚刚弄好可能不是非常完美，大家有什么意见建议也欢迎提出，互相学习。&lt;/p&gt;

&lt;p&gt;首先下载&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ueditor&lt;/code&gt;并解压到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shl&lt;/code&gt;根目录下，命名为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ueditor&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;之后将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admini\views\system\options&lt;/code&gt;下的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.php&lt;/code&gt;中的：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$editor_arr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'kindeditor'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'KindEditor'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'fckeditor'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'FCKeditor'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;改为：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$editor_arr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'kindeditor'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'KindEditor'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'fckeditor'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'FCKeditor'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'ueditor'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Ueditor'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样在“构建网站”下的“系统设置”里的“编辑器类型：”就有了“Ueditor”的选项。&lt;/p&gt;

&lt;p&gt;然后修改inc目录下的common.php，在&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'fckeditor'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$oFCKeditor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;FCKeditor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$name&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;nv&quot;&gt;$oFCKeditor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$oFCKeditor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Create&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;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;插入以下代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'ueditor'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot; src=&quot;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ROOTPATH&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/ueditor/editor_config.js&quot;&amp;gt;&amp;lt;/script&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;lt;script type=&quot;text/javascript&quot; src=&quot;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ROOTPATH&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/ueditor/editor_all.js&quot;&amp;gt;&amp;lt;/script&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ROOTPATH&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/ueditor/themes/default/ueditor.css&quot;/&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;lt;textarea id=&quot;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$name&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&quot; name=&quot;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$name&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&quot; cols=&quot;100&quot; rows=&quot;8&quot; style=&quot;width:95%;height:400px;&quot;&amp;gt;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$content&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;/textarea&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'    var editor = new baidu.editor.ui.Editor();'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'    editor.render(&quot;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$name&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&quot;);'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;lt;/script&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样编辑器的嵌入就完成了，但是你会发现上传图片这些都打不开，所以接下来修改Uedito目录下的editor_config.js，将：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;//var URL = window.UEDITOR_HOME_URL || '../';&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;no&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;tmp&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lastIndexOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;\/&quot;&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;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;_examples/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//这里你可以配置成ueditor目录在您网站的相对路径或者绝对路径（指以http开头的绝对路径）&lt;/span&gt;
    &lt;span class=&quot;no&quot;&gt;UEDITOR_CONFIG&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;n&quot;&gt;imagePath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;URL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;server/upload/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//图片文件夹所在的路径，用于显示时修正后台返回的图片url！具体图片保存路径需要在后台设置。！important&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;改为：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;c1&quot;&gt;//var URL = window.UEDITOR_HOME_URL || '../';&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;no&quot;&gt;URL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;tmp&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lastIndexOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;\/&quot;&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;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;admini/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;ueditor/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//这里你可以配置成ueditor目录在您网站的相对路径或者绝对路径（指以http开头的绝对路径）&lt;/span&gt;
    &lt;span class=&quot;no&quot;&gt;UEDITOR_CONFIG&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;n&quot;&gt;imagePath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ueditor/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//图片文件夹所在的路径，用于显示时修正后台返回的图片url！具体图片保存路径需要在后台设置。！important&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样上传图片视频等的按键打开就正常了，最后是修改图片上传模块，将ueditor\server\upload\php下的up.php复制到ueditor根目录下，并将&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;uploadPath&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;../uploadfiles/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                          &lt;span class=&quot;c1&quot;&gt;//保存路径&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;fileType&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;.gif&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;.png&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;.jpg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;.jpeg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;.bmp&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;//文件允许格式&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;fileSize&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;                                          &lt;span class=&quot;c1&quot;&gt;//文件大小限制，单位KB&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;改为：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;uploadPath&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'../upload/'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                          &lt;span class=&quot;c1&quot;&gt;//保存路径&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;fileType&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;.gif&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;.png&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;.jpg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;.jpeg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;.bmp&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;//文件允许格式&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;fileSize&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;                                          &lt;span class=&quot;c1&quot;&gt;//文件大小限制，单位KB&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样就大功告成了。&lt;/p&gt;

</content>
                 <tag>SHLCMS</tag>  <tag>Ueditor</tag> 
                 <tag>PHP</tag> 
                <pubTime>2012-02-26T00:31:42+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/sae-chinese-word-segmentation-trial.html</loc>
        <lastmod>2012-02-25T10:31:30+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>SAE中文分词服务试用</title>
                <content>
&lt;p&gt;中文分词(Chinese Word Segmentation)指的是将一个汉字序列切分成一个一个单独的词。中文分词是文本挖掘的基础，对于输入的一段中文，成功的进行中文分词，可以达到电脑自动识别语句含义的效果。SAE分词系统基于隐马模型开发出的汉语分析系統，主要功能包括中文分词、词性标注、命名实体识别、新词识别。&lt;/p&gt;

&lt;p&gt;中文分词服务应用场景：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;对博客标题进行分词，提取其中的名词作为文章关键词。&lt;/li&gt;
  &lt;li&gt;对用户搜索条件进行分词，提取其中关键词语进行搜索。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;如，用户搜索”SAE中文分词服务试用Yourtion”，可分词为”sae”,”中文”,”分词”,”服务”,”试用”,”yourtion”六个关键词来进行搜索，提高搜索成功率。&lt;/p&gt;

&lt;p&gt;使用指南&lt;/p&gt;

&lt;p&gt;在SAE在线管理平台进入应用的“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;分词服务&lt;/code&gt;”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;管理页面&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;启用分词服务&lt;/code&gt;，即可开始使用。代码示例：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;明天是星期天&quot;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$seg&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;SaeSegment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ret&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$seg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;segment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;nb&quot;&gt;print_r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;//输出&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 失败时输出错误码和错误信息&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ret&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;var_dump&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$seg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;errno&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$seg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;errmsg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;我稍微改了一下，做了个测试页面：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://yourtion.sinaapp.com/seg/index.php?title=SAE的中文分词服务试用Yourtion&quot;&gt;http://yourtion.sinaapp.com/seg/index.php?title=SAE的中文分词服务试用Yourtion&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;请求标题词组返回分词字段。&lt;/p&gt;
</content>
                 <tag>新浪SAE</tag> 
                 <tag>云服务</tag> 
                <pubTime>2012-02-25T10:31:30+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/an-an-ace-node-js-hosting-trial.html</loc>
        <lastmod>2012-02-23T16:41:15+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>ACE阿里云引擎Node.js服务托管试用</title>
                <content>
&lt;p&gt;&lt;strong&gt;简介&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Node App Engine是基于Node.js v0.5.5开发的应用托管服务, 可提供node.js应用的在线部署功能.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;使用注意&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;系统node使用v0.5.5版,使用时请注意与0.4.x的功能区别&lt;/li&gt;
  &lt;li&gt;如有日志方面需求请暂时使用标准输出(stdout/stderr)实现, 很快将开发日志操作API&lt;/li&gt;
  &lt;li&gt;ACE托管环境中每个Nodejs应用都会启动一个独立的进程&lt;/li&gt;
  &lt;li&gt;上传的Nodejs应用根目录下必须有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.js&lt;/code&gt;或者&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;package.json&lt;/code&gt;文件&lt;/li&gt;
  &lt;li&gt;启动http服务只能监听10080端口&lt;/li&gt;
  &lt;li&gt;当应用有语法错误或者&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;require&lt;/code&gt;的模块不存在时，应用进程无法启动&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;第三方模块&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;仅支持&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;js-native&lt;/code&gt;的模块.对于c模块暂不支持&lt;/p&gt;

&lt;p&gt;系统默认提供如下模块:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;express&lt;/li&gt;
  &lt;li&gt;connect&lt;/li&gt;
  &lt;li&gt;jade&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;如需使用其他模块请放入$app_home/node_modules即可&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;禁用API&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;child_process&lt;/li&gt;
  &lt;li&gt;net.listenFD()&lt;/li&gt;
  &lt;li&gt;net.listen() 仅支持port与callback参数, 不支持监听unix domain sock与指定监听ip&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;代码示例：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;http&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createServer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&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;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;writeHead&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;200&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;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Content-Type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;text/plain&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Hello World &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;nx&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10080&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Server is running&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;就是把代码放到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.js&lt;/code&gt;，上传上去就Ok。&lt;/p&gt;

&lt;p&gt;演示地址：http://nodes.aliyun.com&lt;/p&gt;
</content>
                 <tag>阿里云</tag> 
                 <tag>云服务</tag> 
                <pubTime>2012-02-23T16:41:15+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/baidu-maps-search-get-lonlat.html</loc>
        <lastmod>2012-01-21T15:52:57+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>百度地图API地点搜索-获取经纬度</title>
                <content>
&lt;p&gt;最近在做公司的自主项目，本来打算使用原来使用的天地图开发，但是考虑到天地图的文档不是非常完善，而且自己的Javascript也不是很扎实，最终决定使用百度地图进行开发，因为他的文档和实例相对比较详细，而且API也相对比较成熟，所以···接下来会慢慢分享自己开发过程遇到的问题和解决方法代码等，希望对大家有帮助~共同学习一同进步。&lt;/p&gt;

&lt;p&gt;第一次就先分享一下地图上的地点搜索和鼠标点击获取地点经纬度，这些都是地图比较基本和实用的代码，其中还包括了根据用户IP进行地图的显示、改变地图上的鼠标样式、启用滚轮缩放等，算是半入门吧，其他的一些可以自己参考百度的地图API。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2012/01/baidutitu-soushuo-jingweiduhuoqu.jpg&quot;&gt;&lt;img src=&quot;/images/2012/01/baidutitu-soushuo-jingweiduhuoqu.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;核心的代码如下：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;container&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//在指定的容器内创建地图实例&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setDefaultCursor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;crosshair&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//设置地图默认的鼠标指针样式&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;enableScrollWheelZoom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//启用滚轮放大缩小，默认禁用。&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;centerAndZoom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;116.124878&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;24.309178&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addControl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;NavigationControl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt; 
&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//地图单击事件&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lonlat&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;lng&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;lat&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;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;iploac&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//根据IP设置地图中心&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cityName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setCenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cityName&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;myCity&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LocalCity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;myCity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;iploac&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sear&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//地图搜索&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LocalSearch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&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;na&quot;&gt;renderOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&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;nx&quot;&gt;local&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;实例请点击&quot;&gt;实例请点击：&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://demo.yourtion.com/BaiduMap/mapSearch_getLonlet.html&quot;&gt;http://demo.yourtion.com/BaiduMap/mapSearch_getLonlet.html&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;源码&quot;&gt;源码：&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/yourtion/BlogCodes/blob/master/baidu-maps-search-get-lonlat.html&quot;&gt;https://github.com/yourtion/BlogCodes/blob/master/baidu-maps-search-get-lonlat.html&lt;/a&gt;&lt;/p&gt;

</content>
                 <tag>百度地图</tag> 
                 <tag>HTML</tag> 
                <pubTime>2012-01-21T15:52:57+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/android-apk-signature.html</loc>
        <lastmod>2012-01-18T20:24:37+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>为你开发的android应用apk签名</title>
                <content>
&lt;p&gt;Apk签名首先要有一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keystore&lt;/code&gt;的签名用的文件。&lt;/p&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keystore&lt;/code&gt;是由jdk自带的工具&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keytool&lt;/code&gt;生成的.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;开始&lt;/code&gt;-&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;运行&lt;/code&gt;-&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cmd&lt;/code&gt;-&amp;gt;cd 到JDK目录&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D:\Java\jdk1.7.0_01\bin&lt;/code&gt;
（当然你也可以将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jdk bin path&lt;/code&gt;添加到环境变量中，这样在任何地方都可以使用keytool了）
然后输入：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;keytool &lt;span class=&quot;nt&quot;&gt;-genkey&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-alias&lt;/span&gt; yourtion.key &lt;span class=&quot;nt&quot;&gt;-keyalg&lt;/span&gt; RSA &lt;span class=&quot;nt&quot;&gt;-validity&lt;/span&gt; 20000 &lt;span class=&quot;nt&quot;&gt;-keystore&lt;/span&gt; yourtion.keystore
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;-alias 后跟的是别名这里是 yourtion.key&lt;/li&gt;
  &lt;li&gt;-keyalg 是加密方式这里是 RSA&lt;/li&gt;
  &lt;li&gt;-validity 是有效期 这里是 20000&lt;/li&gt;
  &lt;li&gt;-keystore 就是要生成的keystore的名称 这里是 yourtion.keystore&lt;/li&gt;
&lt;/ul&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;a href=&quot;/images/2012/01/apk_qianming_1.jpg&quot;&gt;&lt;img src=&quot;/images/2012/01/apk_qianming_1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;运行完可以在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D:\Java\jdk1.7.0_01\bin&lt;/code&gt; 里找到刚才生产的keyStore文件&lt;/p&gt;

&lt;p&gt;接下来开始给apk签名
使用的命令是JDK bin下面的jarsigner
好现在可以在刚才的命令行后继续运行以下命令给APK签名：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;jarsigner &lt;span class=&quot;nt&quot;&gt;-verbose&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-keystore&lt;/span&gt; yourtion.keystore &lt;span class=&quot;nt&quot;&gt;-signedjar&lt;/span&gt; yourtion_signed.apk yourtion.apk yourtion.key
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;-keystore：keystore 的名称&lt;/li&gt;
  &lt;li&gt;yourtion_signed.apk 是签完名后的APK&lt;/li&gt;
  &lt;li&gt;yourtion.apk 是签名前的apk&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;然后按回车：会要求输入刚才设置的密码，输入后按回车就开始签名了。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2012/01/apk_qianming_2.jpg&quot;&gt;&lt;img src=&quot;/images/2012/01/apk_qianming_2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;注意 ：有时会签名失败，因为你有可能使用的是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;eclipse build&lt;/code&gt;出来的apk默认是sign过的，所以请重新使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unsign&lt;/code&gt;的apk.&lt;/p&gt;

&lt;p&gt;右键&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;project&lt;/code&gt; -&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Android Tool&lt;/code&gt;s -&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Export unsigned application package...&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;运行成功后在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D:\Java\jdk1.7.0_01\bin&lt;/code&gt; 目录下会多出一个被签名的apk文件&lt;/p&gt;
</content>
                
                 <tag>Android</tag> 
                <pubTime>2012-01-18T20:24:37+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/sae-vdisk.html</loc>
        <lastmod>2012-01-17T20:03:46+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>SAE推出微盘开放接口</title>
                <content>
&lt;p&gt;微盘Open API是为第三方开发者提供的一套&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;REST&lt;/code&gt;接口,通过该接口任何第三方的公司和个人都可以创建基于微盘的应用,开发者可以将用户的存储需要交给微盘处理。&lt;/p&gt;

&lt;p&gt;该接口具有以下特点：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;基于HTTP协议&lt;/li&gt;
  &lt;li&gt;通过json格式返回数据&lt;/li&gt;
  &lt;li&gt;可以通过任何支持REST的语言调用&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;应用场景&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;论坛插件，存储用户附件&lt;/li&gt;
  &lt;li&gt;浏览器插件，一键保存到微盘&lt;/li&gt;
  &lt;li&gt;终端设备&lt;/li&gt;
  &lt;li&gt;其他各种需要云存储的地方&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;使用指南&lt;/p&gt;

&lt;p&gt;支持基于PHP的SDK开发，更多接口说明，请访问http://vdisk.me/api/doc&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;include_once&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'vdisk.ex.class.php'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$appkey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1234567&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$appsecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'123456739cc20556637a576ea1234567'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$username&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'username@gmail.com'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'123456'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;newvDisk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$appkey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$appsecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$username&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'token'&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;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;keep_token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;upload_share_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'文件.txt'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_quota&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;upload_with_md5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'测试.pdf'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'03d5717869bb075e3bad73b527fabc8a'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_file_info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;219379&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;create_dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'测试一下'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;delete_dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;35647&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;delete_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;123&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;copy_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;219379&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;s1&quot;&gt;'副本.txt'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;move_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;219379&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;s1&quot;&gt;'副本.txt'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;rename_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;219379&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'新的新的新的.z'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;rename_dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3929&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'新的新的新的'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$vdisk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;move_dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3929&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;我的图片们&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;nb&quot;&gt;print_r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>新浪SAE</tag> 
                 <tag>云服务</tag> 
                <pubTime>2012-01-17T20:03:46+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/sae-location.html</loc>
        <lastmod>2012-01-15T16:37:54+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>SAE推出地理信息服务——SAE Location</title>
                <content>
&lt;p&gt;SAE地理信息服务（SAE Location）是SAE为开发者提供给的免费获取地理信息服务。使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LocationFree&lt;/code&gt;，开发者可以很方便的实现以下功能：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;根据起点与终点查询自驾车路线&lt;/li&gt;
  &lt;li&gt;根据起点与终点查询公交车路线&lt;/li&gt;
  &lt;li&gt;根据关键词查询公交线路&lt;/li&gt;
  &lt;li&gt;根据关键词查询公交站点&lt;/li&gt;
  &lt;li&gt;根据IP地址返回地理信息坐标&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;特别注意：地理信息服务部分调用要求参数为关联数组形式，请注意键值的正确选择。&lt;/p&gt;

&lt;h3 id=&quot;应用场景&quot;&gt;应用场景&lt;/h3&gt;

&lt;p&gt;免费地理信息服务为用户提供免费的地理信息基础数据，可用于需要地理信息服务的地方。&lt;/p&gt;

&lt;h3 id=&quot;使用指南&quot;&gt;使用指南&lt;/h3&gt;

&lt;p&gt;目前提供以下的函数支持：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;n&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;__construct&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getDriveRoute&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//根据起点与终点查询自驾车路线&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getBusRoute&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//根据起点与终点查询公交车路线&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getBusLine&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//根据关键词查询公交线路&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getBusStation&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//根据关键词查询公交站点&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getIpToGeo&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//根据IP地址返回地理信息坐标&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;错误码参考&quot;&gt;错误码参考：&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;errno: 0 成功&lt;/li&gt;
  &lt;li&gt;errno: -1 不合法参数&lt;/li&gt;
  &lt;li&gt;errno: -2 错误的参数输入（为空）&lt;/li&gt;
  &lt;li&gt;errno: -3 接口内部错误&lt;/li&gt;
  &lt;li&gt;errno: -4 其他错误&lt;/li&gt;
  &lt;li&gt;errno: 607 服务未初始化&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;服务限制与配额&quot;&gt;服务限制与配额&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;请求数限制为60 次/分钟&lt;/strong&gt;&lt;/p&gt;
</content>
                 <tag>新浪SAE</tag> 
                 <tag>云服务</tag> 
                <pubTime>2012-01-15T16:37:54+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/fix-ie6-png-transparent.html</loc>
        <lastmod>2012-01-11T12:04:07+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>修复IE6下PNG透明问题的官方解决方法</title>
                <content>
&lt;p&gt;做Web前端开发的童鞋们一定都知道PNG是一个相当不错的图片格式，但是这个好的格式却在IE6时代造成了麻烦，IE6会使透明的PNG的透明部分出现#DBEAED的色彩。透明不了。使得在FF下开发表现很好的界面换成IE浏览就惨不忍睹，又逼着换成GIF，而GIF的假透明在变换背景时造成毛边现象。&lt;/p&gt;

&lt;p&gt;最近在做一个有背景像素图的网页，为了让图像背景可以穿透，只能使用PNG-24。&lt;/p&gt;

&lt;p&gt;找了一番，结果发现居然还有官方的解决方案。;)&lt;/p&gt;

&lt;p&gt;核心代码如下：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cm&quot;&gt;/* 
Correctly handle PNG transparency in Win IE 5.5 &amp;amp; 6. 
Copyright 2007 Ignia, LLC 
Based in part on code from from http://homepage.ntlworld.com/bobosola. 

Use in  with DEFER keyword wrapped in conditional comments: 

&amp;lt;script type=&quot;text/javascript&quot; defer=&quot;true&quot; src=&quot;pngfix.js&quot;&amp;gt;&amp;lt;/script&amp;gt; 

*/&lt;/span&gt; 

&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;fixPng&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arVersion&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;navigator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appVersion&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;MSIE&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; 
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;version&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;parseFloat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arVersion&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;version&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;5.5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;version&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;7.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;filters&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;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&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;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;images&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/document.images.length;&amp;gt;      var img = document.images&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; 
&lt;/span&gt;      &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;imgName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;toUpperCase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; 
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;imgName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.PNG&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sizingMethod&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;nx&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;toLowerCase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;scale&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&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;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;scale&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
        &lt;span class=&quot;nx&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;runtimeStyle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;filter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;progid:DXImageTransform.Microsoft.AlphaImageLoader(src='&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;%23&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;%2523&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;%27&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&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;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;', sizingMethod='&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sizingMethod&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;')&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
        &lt;span class=&quot;nx&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;images/blank.gif&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mce_src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;images/blank.gif&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
        &lt;span class=&quot;nx&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
        &lt;span class=&quot;nx&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;height&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;p&quot;&gt;}&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;nx&quot;&gt;fixPng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;使用方法就是把下面压缩包的js和images拷贝到你网站的目录，然后引用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MSIE.PNG.js&lt;/code&gt;，就是这么简单。&lt;/p&gt;

&lt;p&gt;下载地址：&lt;a href=&quot;http://dl.dbank.com/c0yqm9kbbc&quot;&gt;msiepng.rar)&lt;/a&gt;&lt;/p&gt;
</content>
                
                 <tag>HTML</tag> 
                <pubTime>2012-01-11T12:04:07+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/shlcms-auto-add-thumbnails-dt_focus.html</loc>
        <lastmod>2011-12-30T10:18:49+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>SHLCMS自动增加缩略图到首页展示改造2——dt_focus版</title>
                <content>
&lt;p&gt;之前已经介绍了如何让&lt;a href=&quot;/shlcms-automatically-add-thumbnails.html&quot;&gt;《SHLCMS添加文章自动增加缩略图到Flash》&lt;/a&gt;。&lt;/p&gt;

&lt;p&gt;但是之前的改造存在一个极其严重的问题，就是如果文章的图片是直接使用外链的话，那么就不能正常调用。现在SHLCMS升级到4.11。&lt;/p&gt;

&lt;p&gt;而且增加了首页的焦点图功能，最近就索性进行一个升级，解决之前的这个大问题。&lt;/p&gt;

&lt;p&gt;修改方法还是和以前一样，只是代码有所更改。在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;function create()&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;redirect_to($request['p'],’index’);&lt;/code&gt;之前加入以下代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'p'&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;mi&quot;&gt;35&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'p'&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;mi&quot;&gt;36&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'p'&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;mi&quot;&gt;37&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;nv&quot;&gt;$r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;insert_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/?p=&quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'p'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;amp;a=view&amp;amp;r=&quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$pattern&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/&amp;lt;img.*?src=[&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;\'| &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;](.*?(?:[\.gif|\.jpg]))[&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;\'|&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;].*?[\/]?&amp;gt;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$match_times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;preg_match_all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pattern&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$match_times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&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;nv&quot;&gt;$pic&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mb_substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;utf-8&quot;&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;s2&quot;&gt;&quot;ttp&quot;&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;nv&quot;&gt;$pic&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$pic&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;nv&quot;&gt;$sql&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;INSERT &quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;TB_PREFIX&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;
            &lt;span class=&quot;s2&quot;&gt;&quot;flash (id,title,summary,picpath,group_id,url) VALUES ('&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;','&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$title&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;','&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$title&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;','&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pic&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;',4,'&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$n&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;')&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sql&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;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;function edit()&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;redirect_to($request['p'],’index’);&lt;/code&gt;之前加入以下代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'p'&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;mi&quot;&gt;35&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'p'&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;mi&quot;&gt;36&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'p'&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;mi&quot;&gt;37&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;nv&quot;&gt;$n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/?p=&quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'p'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;amp;a=view&amp;amp;r=&quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$pattern&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/&amp;lt;img.*?src=[&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;\'| &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;](.*?(?:[\.gif|\.jpg]))[&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;\'|&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;].*?[\/]?&amp;gt;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$match_times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;preg_match_all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pattern&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$match_times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&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;nv&quot;&gt;$pic&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mb_substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;utf-8&quot;&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;s2&quot;&gt;&quot;ttp&quot;&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;nv&quot;&gt;$pic&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$pic&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;nv&quot;&gt;$sql&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'update '&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;TB_PREFIX&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'flash set picpath=&quot;'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$pic&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&quot;,title=&quot;'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$title&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;
            &lt;span class=&quot;s1&quot;&gt;'&quot;,summary=&quot;'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$title&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&quot; where id='&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'n'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sql&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;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;function destroy()&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;redirect_to($request['p'],’index’);&lt;/code&gt;之前加入以下代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'delete from '&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;TB_PREFIX&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'flash where id='&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'n'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$request['p']==35&lt;/code&gt;等就是你要自动添加图片的频道ID；而&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{$pic}',4,'{$n}&lt;/code&gt;中的“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;4&lt;/code&gt;”就是你要增加的焦点图对应的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;group_id&lt;/code&gt;
这样对&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;list.php&lt;/code&gt;的更改就完成了，还有就是改一下调用代码的部分，&lt;/p&gt;

&lt;p&gt;在SHLCMS的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;content\index&lt;/code&gt;下的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;focus.php&lt;/code&gt;将&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;target=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;_blank&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;img&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_root_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;picpath&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;thumb=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;alt=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;text=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;summary&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;改为&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mb_substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;utf-8&quot;&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;s2&quot;&gt;&quot;http&quot;&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;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&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;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_root_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&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;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;target=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;_blank&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;img&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mb_substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;picpath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;utf-8&quot;&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;s2&quot;&gt;&quot;http&quot;&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;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;picpath&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;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_root_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;picpath&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;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;thumb=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;alt=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;text=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;summary&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$focus_group&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$focus_group&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样就大功告成了····&lt;/p&gt;

&lt;p&gt;大家多多·测试，看看还有什么问题或者需要没有，我会继续改进的。有什么问题大家留意交流咯&lt;/p&gt;
</content>
                 <tag>SHLCMS</tag> 
                 <tag>PHP</tag> 
                <pubTime>2011-12-30T10:18:49+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/sdk-sina-api-delphi.html</loc>
        <lastmod>2011-12-29T19:09:21+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用Delphi开发新浪微博应用</title>
                <content>
&lt;p&gt;最近在看一下Sina的SDK，对于Java和Python还有C都不会，于是找了一下比较熟悉的Delphi。结果居然看到这个基于Delphi 2010的Sina SDK包。&lt;/p&gt;

&lt;p&gt;试用了一下，还不错，发上来和大家共享，还没有深入研究，上几张图，有空再看看有什么具体的功能和使用方法。&lt;/p&gt;

&lt;p&gt;上图先：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/12/delphi-sina-1.jpg&quot;&gt;&lt;img src=&quot;/images/2011/12/delphi-sina-1-560x402.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/12/delphi-sina-2.jpg&quot;&gt;&lt;img src=&quot;/images/2011/12/delphi-sina-2-560x394.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;项目：&lt;a href=&quot;http://code.google.com/p/sinaweibosdk/&quot;&gt;http://code.google.com/p/sinaweibosdk/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dbank下载：&lt;a href=&quot;http://dl.dbank.com/c0rynxhj0h&quot;&gt;http://dl.dbank.com/c0rynxhj0h&lt;/a&gt;&lt;/p&gt;

</content>
                 <tag>Delphi</tag> 
                 <tag>Delphi</tag> 
                <pubTime>2011-12-29T19:09:21+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/sina-api-user_timeline-original.html</loc>
        <lastmod>2011-12-25T13:55:39+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>新浪微博API使用user_timeline获取用户原创微博</title>
                <content>
&lt;p&gt;自己的微博 http://t.yourtion.com 已经荒废好一段时间了，前段时间把Pagecookery升级到0.9.8，支持了新浪微博的同步导入和发布，但是一直没有去弄，趁着有时间，稍微测试和改进了一下他的新浪微博同步部分，只同步原创微博部分，和大家交流一下，大家可以举一反三自己测试，更加熟悉新浪微博的API。&lt;/p&gt;

&lt;p&gt;Pagecookery的微博同步是通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Oauth&lt;/code&gt;认证，之后使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;json&lt;/code&gt;进行数据的抓取，对于抓取用户微博使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user_timeline&lt;/code&gt;的接口，也就是 https://api.weibo.com/2/statuses/user_timeline.json 。我看来一下接口文档，请求参数里面有一个：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;feature&lt;/code&gt;，是用来过滤请求的类型（过滤类型ID，0：全部、1：原创、2：图片、3：视频、4：音乐，默认为0。）由于默认是0，所以会抓取全部微博。&lt;/p&gt;

&lt;p&gt;改造方法，在请求&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;json&lt;/code&gt;的时候带上&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;feature&lt;/code&gt;参数，可以使用 https://api.weibo.com/2/statuses/user_timeline.json?feature=1 。但是我这样改造没有成功，因为他的抓取依赖oauth-&amp;gt;get的类，我在类中加入参数&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$param['feature']=1;&lt;/code&gt;这样抓取时就可以过滤掉非原创的成分。&lt;/p&gt;

&lt;p&gt;关于新浪API的研究还是皮毛阶段，希望各位不要见笑，大家多多交流，共同进步。&lt;/p&gt;

&lt;p&gt;对于Oauth还有疑问的可以看看我之前的：&lt;a href=&quot;/sina-oauth-verification-storage.html&quot;&gt;《新浪微博OAuth认证详解及验证数据储存》&lt;/a&gt;、&lt;a href=&quot;/sina-api-oauth-released-microblog.html&quot;&gt;《新浪微博API使用OAuth认证发布微博实例》&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;关于user_timeline请求参数如下表：&lt;/p&gt;
&lt;table cellpadding=&quot;0&quot; width=&quot;100%&quot; cellspacing=&quot;0&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;

必选
类型及范围
说明
&lt;/tr&gt;
&lt;tr&gt;

&lt;td&gt;source
&lt;/td&gt;

&lt;td&gt;false
&lt;/td&gt;

&lt;td&gt;string
&lt;/td&gt;

&lt;td&gt;采用OAuth授权方式不需要此参数，其他授权方式为必填参数，数值为应用的AppKey。
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;

&lt;td&gt;access_token
&lt;/td&gt;

&lt;td&gt;false
&lt;/td&gt;

&lt;td&gt;string
&lt;/td&gt;

&lt;td&gt;采用OAuth授权方式为必填参数，其他授权方式不需要此参数，OAuth授权后获得。
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;

&lt;td&gt;uid
&lt;/td&gt;

&lt;td&gt;false
&lt;/td&gt;

&lt;td&gt;int64
&lt;/td&gt;

&lt;td&gt;需要查询的用户ID。
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;

&lt;td&gt;screen_name
&lt;/td&gt;

&lt;td&gt;false
&lt;/td&gt;

&lt;td&gt;string
&lt;/td&gt;

&lt;td&gt;需要查询的用户昵称。
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;

&lt;td&gt;since_id
&lt;/td&gt;

&lt;td&gt;false
&lt;/td&gt;

&lt;td&gt;int64
&lt;/td&gt;

&lt;td&gt;若指定此参数，则返回ID比since_id大的微博（即比since_id时间晚的微博），默认为0。
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;

&lt;td&gt;max_id
&lt;/td&gt;

&lt;td&gt;false
&lt;/td&gt;

&lt;td&gt;int64
&lt;/td&gt;

&lt;td&gt;若指定此参数，则返回ID小于或等于max_id的微博，默认为0。
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;

&lt;td&gt;count
&lt;/td&gt;

&lt;td&gt;false
&lt;/td&gt;

&lt;td&gt;int
&lt;/td&gt;

&lt;td&gt;单页返回的记录条数，默认为50。
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;

&lt;td&gt;page
&lt;/td&gt;

&lt;td&gt;false
&lt;/td&gt;

&lt;td&gt;int
&lt;/td&gt;

&lt;td&gt;返回结果的页码，默认为1。
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;

&lt;td&gt;base_app
&lt;/td&gt;

&lt;td&gt;false
&lt;/td&gt;

&lt;td&gt;int
&lt;/td&gt;

&lt;td&gt;是否只获取当前应用的数据。0为否（所有数据），1为是（仅当前应用），默认为0。
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;

&lt;td&gt;feature
&lt;/td&gt;

&lt;td&gt;false
&lt;/td&gt;

&lt;td&gt;int
&lt;/td&gt;

&lt;td&gt;过滤类型ID，0：全部、1：原创、2：图片、3：视频、4：音乐，默认为0。
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;

&lt;td&gt;trim_user
&lt;/td&gt;

&lt;td&gt;false
&lt;/td&gt;

&lt;td&gt;int
&lt;/td&gt;

&lt;td&gt;返回值中user信息开关，0：返回完整的user信息、1：user字段仅返回user_id，默认为0。
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</content>
                
                 <tag>PHP</tag> 
                <pubTime>2011-12-25T13:55:39+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/dede-horizontal-navigation-menu.html</loc>
        <lastmod>2011-12-10T14:58:51+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>DEDE(织梦)CMS水平二级导航菜单制作</title>
                <content>
&lt;p&gt;最近在做一个旅游网站，对方要求使用类似于QQ票务的水平二级导航菜单，由于后台使用DEDE(织梦)CMS系统，所以研究了一下它的水平二级菜单的制作方法，网上的教程不是很详细，总结了一下，把我的制作过程和方法共享一下，希望对你有帮助。&lt;/p&gt;

&lt;p&gt;效果如下：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/12/dede-shuiping-daohang.jpg&quot;&gt;&lt;img src=&quot;/images/2011/12/dede-shuiping-daohang.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;我的dede原有模版的一级导航源码(head.htm)如下：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;&amp;lt;!-- 导航 --&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;nav&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;w1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'{dede:global.cfg_cmsurl/}/'&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;p&amp;gt;&lt;/span&gt;主页&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
      	{dede:channel type='top' row='10' currentstyle=&quot;&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'w1'&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'~typelink~'&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;p&amp;gt;&lt;/span&gt;~typename~&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&quot;}
      	&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;w1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'[field:typeurl/]'&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;field:rel&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;/]&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;p&amp;gt;&lt;/span&gt;[field:typename/]&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
      	{/dede:channel}
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;首先导入原来用于底部友链的javascript文件：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'text/javascript'&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'{dede:global.cfg_cmsurl/}/images/js/dropdown.js'&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后将导航部分代码改为：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;nav&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;w1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'{dede:global.cfg_cmsurl/}/'&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;p&amp;gt;&lt;/span&gt;主页&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
		{dede:channel type='top' row='10'}
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;w1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'[field:typeurl/]'&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;field:rel&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;/]&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;p&amp;gt;&lt;/span&gt;[field:typename/]&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
		{/dede:channel}
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;clear:both;&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
	{dede:channelartlist typeid='top' cacheid='channelsonlist'}
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;dropmenu{dede:field.typeid/}&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;dropMenu&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
		{dede:channel type='son' noself='yes'}  
			&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;dropMenu&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;[field:typelink/]&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;[field:typename/]&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
		{/dede:channel}
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
	{/dede:channelartlist}
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cssdropdown&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;startchrome&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;nav&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最后把下面的CSS代码加到你原有的CSS文件中就大功告成了：&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;.dropMenu&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;url(&quot;img/snav.jpg&quot;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;repeat-x&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;scroll&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;transparent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1024px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;31px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.dropMenu&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;ul&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;li&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;16px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.dropMenu&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;li&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;16px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.dropMenu&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;auto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;block&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;#000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.dropMenu&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;:hover&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;text-decoration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;underline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;希望这个东西对你有帮助，如果有什么问题或者意见建议欢迎留言回复交流。&lt;/p&gt;
</content>
                 <tag>JavaScript</tag> 
                 <tag>HTML</tag> 
                <pubTime>2011-12-10T14:58:51+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/pingyuan-waste-water-process.html</loc>
        <lastmod>2011-12-01T22:05:36+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>平远县水质净化厂工艺流程</title>
                <content>
&lt;p&gt;平远县水质净化厂坐落在大柘镇梅二村，占地面积68亩，采用 “一级强化处理+人工湿地”工艺，总体设计日处理污水2万吨，分两期建设，建成并已投入使用的首期工程日处理污水1万吨。&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;
</content>
                 <tag>水处理</tag> 
                 <tag>杂杂的</tag> 
                <pubTime>2011-12-01T22:05:36+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/meixian-xinchen-waste-water-process.html</loc>
        <lastmod>2011-11-30T23:11:00+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>梅县新城水质净化厂工艺流程</title>
                <content>
&lt;p&gt;梅县新城水质净化厂总设计规模为5万立方米/d，分两期建设。本次见习看到的是已经建成并投入使用的首期工程，设计规模2.5万立方米/d，采用微曝氧化沟处理工艺。&lt;/p&gt;

&lt;p&gt;污水同样进入格栅和沉砂池预处理后进入主体工艺，微曝氧化沟与A/A/O工艺类似，污水与回流污泥首先进入生物生物选择区，随后进入厌氧区，在水下推进器的作用下在池内循环往复运动，增加了污水停留时间，兼性厌氧菌将污水中的易降解有机物转化成VFAs。回流污泥带入的聚磷菌将体内的聚磷分解，此为释磷，所释放的能量一部分可供好氧的聚磷菌在厌氧环境下维持生存，另一部分供聚磷菌主动吸收VFAs，并在体内储存PHB。一部分污水通过穿孔墙进入缺氧区，反硝化细菌就利用混合液回流带入的硝酸盐及进水中的有机物进行反硝化脱氮。&lt;/p&gt;

&lt;p&gt;在其中停留一段时间后进入好氧区，在延时曝气条件下使用带方向控制的曝气和搅动装置，向反应池中的物质传递水平速度，从而使被搅动的液体在闭合式渠道中循环。在好氧区内，聚磷菌除了吸收利用污水中残留的易降解BOD外，主要分解体内储存的PHB产生能量供自身生长繁殖，并主动吸收环境中的溶解磷，此为吸磷，以聚磷的形式在体内储存。&lt;/p&gt;

&lt;p&gt;最后污水来到出水口进入二沉池，混合污泥的污水在辐流式沉淀池中下部四周的穿孔墙进入，经过重力沉降后经过出水堰进入最后的消毒阶段。污水紫外线消毒杀菌后排入程江。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/11/meizhou-xincheng.jpg&quot;&gt;&lt;img src=&quot;/images/2011/11/meizhou-xincheng.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>水处理</tag> 
                 <tag>杂杂的</tag> 
                <pubTime>2011-11-30T23:11:00+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/meixian-south-waste-water-process-cass.html</loc>
        <lastmod>2011-11-25T12:46:05+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>梅县江南水质净化厂工艺流程</title>
                <content>
&lt;p&gt;梅县江南水质净化厂（江南污水处理厂）设计规模为5万吨/日，采用改进的序批式活性污泥法CASS工艺。截流输污工程已于2009年1月20日竣工并运行，日处理水量约3.5万吨，进水浓度70—90毫克/升。&lt;/p&gt;

&lt;p&gt;使用四个污水处理反应池，分别处于SBR的不同阶段，保证污水的处理效率。梅县江南城区的生活污水通过污水管道收集后首先进入泵站加压后送至厂区的进水口，通过格栅后进入沉砂池利用重力沉降将污水中的大颗粒沉淀并通过砂水分离器排沙。&lt;/p&gt;

&lt;p&gt;随后进入反应池，反应池沿池长方向设计为三部分，污水先进入第一个区域即生物选择区，这里对丝状菌的生长起到抑制作用，可有效防止污泥膨胀，进而进入预反应区，即兼氧区，这里除了对污水水质起缓冲作用外还促进微生物对磷的释放和反硝化脱氮作用。&lt;/p&gt;

&lt;p&gt;污水在主反应区中主要是好氧反应，在池中不断曝气，这一阶段主要进行降解有机物和硝化—反硝化过程，污水中污泥浓度约为1000mg/L。经过一段时间的处理后反应池停止曝气，进入沉淀阶段，等待污泥沉淀后启动滗水器，根据中控的设定对沉淀完成的污水进行排水。如果没有下一个进水活动则反应池进入闲置阶段。&lt;/p&gt;

&lt;p&gt;经过反应池处理的污水最后进入消毒工艺，采用投加二氧化氯的方式消毒后排入梅江河。出水口同时连接在线监控的自动水质监测装置，实时测定出水的COD与氨氮并上报省环保局。&lt;/p&gt;

&lt;p&gt;目前，江南污水处理厂及配套的截流输污管网运转正常，出厂水水质稳定达标，排放现场设立了出厂水COD、流量、视频在线监控系统和规范化标志，出厂在线监控系统已与上级环保部门联网，城区生活污水处理率达64%（不含梅县）。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/11/meizhou-jiangnan.jpg&quot;&gt;&lt;img src=&quot;/images/2011/11/meizhou-jiangnan.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>水处理</tag> 
                 <tag>杂杂的</tag> 
                <pubTime>2011-11-25T12:46:05+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/meizhou-water-plant-process.html</loc>
        <lastmod>2011-11-23T16:22:14+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>梅州市西桥自来水厂工艺流程</title>
                <content>
&lt;p&gt;梅州市自来水总公司西桥水厂，位于县城嘉应西路，水源为梅州市清凉山水库，为梅州市城区居民提供20万吨/日的生活用水。&lt;/p&gt;

&lt;p&gt;水厂从水源首先利用提升泵将水抽至位于高处的沉砂池将大颗粒的沙石利用重力沉降去除，在进水的同时投加聚合氯化铝絮凝剂和二氧化氯的复合液，聚合氯化铝具有吸附作用，将水中不易沉淀的胶粒及微小悬浮物（SS、浮渣等）相互聚结，再被吸附架桥，从而形成较大的絮粒，以便稍后从水中分离、沉降。&lt;/p&gt;

&lt;p&gt;水从沉砂池出来后进入一排小池，水从格子中上下左右来回呈S型流动，这些小池子起到慢速搅拌的作用，使水中的细小颗粒形成矾花同时利用水的冲击使二氧化氯的复合液迅速均匀地散于水中，随后进入平流式沉淀池。水流入沉淀池后，沿水区整个截面进行分配，进入沉淀区，最后慢慢地流向出水三角堰。水中的颗粒和絮体在重力作用下慢慢沉于池底，并不断堆积并浓缩，通过刮泥机定期刮泥排至污泥池。&lt;/p&gt;

&lt;p&gt;从沉淀池出来，进入快速滤池，在其中以一米厚的海沙滤料，将水中没有沉淀下来的细小颗粒去除。快速滤池在一定时间通过旁边的反冲洗水塔对滤料进行清洗。&lt;/p&gt;

&lt;p&gt;从快滤池出来后再次进行消毒，目的是除去处理过程中引入的污染，进而进入蓄水池，最后通过变频加压泵将水送出到千家万户。在进水出水的时候还通过养有金鱼的生物观察池对水质进行生物监控。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/11/meizhou-xiqiao.jpg&quot;&gt;&lt;img src=&quot;/images/2011/11/meizhou-xiqiao.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>水处理</tag> 
                 <tag>杂杂的</tag> 
                <pubTime>2011-11-23T16:22:14+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/special-picture-navigation.html</loc>
        <lastmod>2011-11-20T10:02:25+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>一个特别的五页图片导航特效</title>
                <content>
&lt;p&gt;最近在做一个公司的网站，对方要求有北京旅游网(http://www.visitbeijing.com.cn)的首页图片展示效果图，五个标签还有每个标签十张图片的效果，于是在上面把它抠下来，分享给大家，希望对大家有用~~&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/11/bjlyw-jq.jpg&quot;&gt;&lt;img src=&quot;/images/2011/11/bjlyw-jq.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;演示地址：&lt;a href=&quot;http://demo.yourtion.com/jquery/bjlyw/&quot;&gt;点击这里&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;下载：&lt;a href=&quot;http://dl.dbank.com/c0o3w1a4zx&quot;&gt;旅游.rar (740.42K)&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>特效</tag>  <tag>插件</tag> 
                 <tag>HTML</tag> 
                <pubTime>2011-11-20T10:02:25+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/remote-desktop-console-session.html</loc>
        <lastmod>2011-11-09T12:08:46+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用“远程桌面连接”连接到服务器的控制台会话</title>
                <content>
&lt;p&gt;打开命令提示符。&lt;/p&gt;

&lt;p&gt;键入：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mstsc/v:server/console
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Server&lt;/code&gt;：要连接到的服务器的 DNS 名称或 IP 地址&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;注意&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;要打开命令提示符，请单击“开始”，指向“程序”或“所有程序”，指向“附件”，然后单击“命令提示符”。&lt;/p&gt;

&lt;p&gt;也可通过在“远程桌面连接”的“选项”对话框上“常规”选项卡的“计算机”字段中键入服务器名称或 IP 地址时指定“/console”，以连接到该服务器的控制台会话。&lt;/p&gt;

&lt;p&gt;每台计算机只有一个控制台会话。当您远程连接到控制台会话时，其他用户可能无法从本地登录计算机。&lt;/p&gt;

&lt;p&gt;当连接到运行 Windows XP 的远程计算机的控制台会话时，将不会应用某些客户端选项设置。例如，如果客户端已指定某个程序在连接到远程计算机时启动，则当连接到远程计算机的控制台会话时，该程序不会启动。而是显示默认桌面。如果连接到的是控制台会话之外的其他会话，则指定的程序会正常启动。控制台会话是 Windows XP Professional 上唯一可用于远程桌面的会话，所以建立连接时总会出现默认桌面，即使客户端指定了其他程序。&lt;/p&gt;

&lt;p&gt;要查看该命令的完整语法，请在命令提示符下键入：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mstsc /?&lt;/code&gt;&lt;/p&gt;
</content>
                 <tag>服务器</tag> 
                 <tag>服务器</tag> 
                <pubTime>2011-11-09T12:08:46+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/switch-configuration-command-collection.html</loc>
        <lastmod>2011-10-28T10:31:19+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>网络规划设计师常用交换机配置命令集锦——Catalyst 3548</title>
                <content>
&lt;p&gt;1、 进入全局配置模式&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-3548 &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;enable
&lt;/span&gt;Password : &lt;span class=&quot;k&quot;&gt;********&lt;/span&gt;
Switch-3548 &lt;span class=&quot;c&quot;&gt;# config t&lt;/span&gt;
Switch-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;2、 启用交换机的HTTP Server&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# ip http server&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;3、 配置主机名&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# hostname Switch-PHY-3548&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;4、 配置超级用户口令&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# enable secret 5 zzz&lt;/span&gt;
Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# enable password zzz&lt;/span&gt;
Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# enable password 7 zzz&lt;/span&gt;
Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;5、 配置远程登录口令&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# line vty 0 4&lt;/span&gt;
Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-line&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# password 7 zzz&lt;/span&gt;
Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-line&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# password 0 zzz&lt;/span&gt;
Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-line&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;6、 配置系统时间&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;c&quot;&gt;# clock set 23:00:00 29 March 2009&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;7、 配置设备管理地址(IP地址及缺省路由)&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# interface VLAN1&lt;/span&gt;
Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# ip address 203.105.1.62 255.255.255.0&lt;/span&gt;
Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# ip default-gateway 203.105.1.1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;8、 进入端口配置模式&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# interface f0/24&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;9、 配置端口描述信息&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# description To-lib&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;10、配置交换机端口的关闭与开启&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# (no) shutdown&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;11、配置交换机端口的通信方式&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# duplex auto/full/half&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;12、配置交换机端口的传输速率&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# speed 10/100/auto&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;13、配置VTP域名&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# vtp domain pku&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;14、配置VTP工作模式&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# vtp mode server/client/transparent&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;15、进入VLAN配置模式&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;c&quot;&gt;# vlan data&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;16、建立VLAN&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;vlan&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# vlan 1000 name vlan1000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;17、删除VLAN&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;vlan&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# no vlan 1000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;18、修改VLAN&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;vlan&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# vlan 1000 name v1000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;19、为端口分配VLAN&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# switchport access vlan 248&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;20、配置VLAN Trunk模式&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# switchport mode trunk&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;21、封装VLAN协议&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# switchport trunk encapsulation dot1 q/isl/negotiate P&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;22、设置允许中继的VLAN&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# switchport trunk allowed vlan 10,14/10-14/except 100-1000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;23、打开或关闭STP&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# (no) spanning-tree vlan 3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;24、配置根网桥和备份根网桥&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# spanning-tree vlan 3 root primary/secondary&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;25、配置生成树优先级&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# spanning-tree vlan 3 priority 8192&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;26、配置BackboneFast 生成树可选功能&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# spanning-tree backbonefast&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;27、配置UplinkFast 生成树可选功能&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# spanning-tree uplinkfast max-update-rate 32000&lt;/span&gt;
Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# spanning-tree uplinkfast&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;28、配置PortFast 生成树可选功能&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# spanning-tree portfast default&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;29、配置BPDU Filter 生成树可选功能&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Switch-GYX-3548 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# spanning-tree portfast bpdufilter default&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>网络工程</tag> 
                 <tag>网络规划设计</tag> 
                <pubTime>2011-10-28T10:31:19+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/router-configuration-command-collection.html</loc>
        <lastmod>2011-10-27T01:21:48+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>网络规划设计师常用路由器配置命令集锦</title>
                <content>
&lt;p&gt;1、进入特权模式、全局配置模式、接口配置模式、虚拟终端配置模式、RIP路由协议配置模式&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;enable
&lt;/span&gt;Password :
Router &lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
Router &lt;span class=&quot;c&quot;&gt;# configure terminal&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# int f0/12&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# line vty 0 15&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-line&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# router rip&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
2、配置远程登录密码

```bash
Router (config) # line vty 0 15
Router (config-line) # password 7 isncgyx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
3、拷贝配置文件到TFTP Server

```bash
Router # write network
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;4、拷贝running-config 到TFTP Server&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;c&quot;&gt;# copy running-config tftp:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;5、拷贝bootflash 中的配置文件到TFTP Server&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;c&quot;&gt;# copy bootflash : tftp :&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;6、从TFTP Server 拷贝配置文件到路由器&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;c&quot;&gt;# copy tftp : running-config&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;7、将TFTP Server 上的配置文件拷贝到bootflash&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;c&quot;&gt;# copy tftp : bootflash :&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;8、配置路由器的主机名&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#hostname Router-isnc&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;9、配置超级用户口令&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# enable secret isncgyx&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;10、设置系统时钟&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;c&quot;&gt;# calendar set 11:30:00 16 october 2011&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;11、保存配置&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;c&quot;&gt;# write memory&lt;/span&gt;
Router &lt;span class=&quot;c&quot;&gt;# write network tftp&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;12、删除配置&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;c&quot;&gt;# write erase&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;13、基本检测命令(telnet、ping、trace)&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; telnet paris/221.4.8.1
Router &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; ping 192.168.201.64
Router &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; trace 210.38.160.5
Router &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; traceroute www.yourtion.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;14、查看flash、系统时钟、软硬件版本、路由器配置、查看路由表、IP路由协议的详细信息&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; show flash
Router &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; sh clock
Router &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; sh version
Router &lt;span class=&quot;c&quot;&gt;# sh configuration&lt;/span&gt;
Router &lt;span class=&quot;c&quot;&gt;# sh ip route&lt;/span&gt;
Router &lt;span class=&quot;c&quot;&gt;# sh ip protocols&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;15、配置接口描述信息&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# description To-JiaYing University&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;16、配置接口带宽&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# bandwidth 2500,000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;17、配置接口的IP地址&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# ip address 202.112.7.249 255.255.255.252&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;18、接口的开启与关闭&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# shutdown/no shutdown&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;19、不作ARP代理&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# duplex ful&lt;/span&gt;
l# no ip directed-broadcast
&lt;span class=&quot;c&quot;&gt;# no ip proxy-arp&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;20、配置异步串行接口&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# interface a1&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# ip unnumbered ethernet0&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# encapsulation ppp&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# async default ip address 202.112.7.129&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# async dynamic routing&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# async mode interactive&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# no shutdown&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# exit&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# exit&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;21、配置高速同步串行接口&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# interface s1/1&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# description To-shenzhen&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# bandwidth 2048&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# ip address 212.112.41.81 255.255.255.252&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# encapsulation hdlc&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# no ip directed-broadcast&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# no ip proxy-arp&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;22、配置POS接口&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# interface POS3/0&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# description To TianJingDaXue&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# bandwidth 2500,000&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# ip address 212.12.37.18 255.255.255.252&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# crc 32&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# pos framing sdh&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# no ip directed-broadcast&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# pos flag s1 s0 2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;23、loopback 接口的配置&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# int loopback 0&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# ip address 192.167.167.9 255.255.255.255&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# no ip route-cache&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-if&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# no ip mroute-cache&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;24、配置静态路由&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# ip route 192.65.96.0 255.255.240.0 222.112.37.1(静态路由的配置)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;25、进入RIP配置模式&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# router rip&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;26、设置参与RIP协议的网络地址&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# network 159.105.0.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;27、配置RIP的被动接口&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# passive-interface ethernet 0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;28、配置RIP的路由过滤&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# access-list 12 deny any&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# router rip&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# distribute-list 12 in ethernet0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;29、配置RIP的管理距离&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# distance 50&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;30、配置RIP的邻居路由器&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# neighbor 202.112.7.2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;31、配置单个IP地址参与OSPF&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# router ospf 63&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# network 131.107.25.1 0.0.0.0 area 0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;32、网络地址参与OSPF&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# network 133.181.0.0 0.0.255.255 area 0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;33、定义参与OSPF的子网地址&lt;/p&gt;

&lt;p&gt;I&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# area 0 range 212.37.123.0 255.255.255.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;34、配置被动接口(包括路由器和第三层交换机的配置)&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# passive-interface Ethernet 0&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# passive-interface vlan37&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;35、配置路由过滤&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# access-list 12 deny any&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# router ospf 63&lt;/span&gt;
Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# distribute-list 12 in serial 0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;36、配置管理距离&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# distance 10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;37、配置OSPF引入外部路由的花费值&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# redistribute metric 100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;38、配置引入外部路由时缺省的标记值&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# redistribute tag 10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;39、配置引入外部路由时缺省的外部路由类型&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config-router&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# redistribute connected metric-type 1 subnets&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;40、配置IP地址池的名称&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Router &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;config&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# ip dhcp pool ttt/234&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>网络工程</tag> 
                 <tag>网络规划设计</tag> 
                <pubTime>2011-10-27T01:21:48+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ubuntu-11-10-update-source.html</loc>
        <lastmod>2011-10-19T08:48:12+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>国内比较快的Ubuntu 11.10更新源地址列表——更改方法及下载</title>
                <content>
&lt;p&gt;给大家提供更新源的地址，方便大家安装ubuntu11.10后，及时更新源地址。&lt;/p&gt;

&lt;p&gt;ubuntu11.10下载地址 http://www.ubuntu.com/download/ubuntu/download&lt;/p&gt;

&lt;p&gt;前面的是公网普通源，后面是教育网更新源（上海交大、北理、兰大）适合在校大学生使用。&lt;/p&gt;

&lt;p&gt;1、首先备份Ubuntu 11.10源列表&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（备份下当前的源列表，有备无患嘛）
2、修改更新源&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo gedit /etc/apt/sources.list
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（打开Ubuntu 11.10源列表文件）
3、将下面的代码粘贴进去（“#”开头的那一行为注释，可以直接复制进文件中）&lt;/p&gt;

&lt;p&gt;4、通知ubuntu启用新的更新源&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get update
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#台湾源&lt;/span&gt;

deb http://tw.archive.ubuntu.com/ubuntu/ oneiric main universe restricted multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu/ oneiric main universe restricted multiverse
deb http://tw.archive.ubuntu.com/ubuntu/ oneiric-security universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ oneiric-security universe main multiverse restricted
deb http://tw.archive.ubuntu.com/ubuntu/ oneiric-updates universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ oneiric-updates universe main multiverse restricted

&lt;span class=&quot;c&quot;&gt;#网易 Ubuntu 11.10 源（速度很快）&lt;/span&gt;
deb http://mirrors.163.com/ubuntu/ oneiric main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ oneiric main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ oneiric-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ oneiric-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ oneiric-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ oneiric-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ oneiric-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ oneiric-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ oneiric-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ oneiric-updates universe main multiverse restricted

&lt;span class=&quot;c&quot;&gt;#骨头源，骨头源是bones7456架设的一个Ubuntu源 ，提供ubuntu,deepin&lt;/span&gt;
deb http://ubuntu.srt.cn/ubuntu/ oneiric main universe restricted multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ oneiric main universe restricted multiverse
deb http://ubuntu.srt.cn/ubuntu/ oneiric-security universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ oneiric-security universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ oneiric-updates universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ oneiric-proposed universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ oneiric-proposed universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ oneiric-backports universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ oneiric-backports universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ oneiric-updates universe main multiverse restricted

&lt;span class=&quot;c&quot;&gt;#mirror.lupaworld.com的源，速度很快&lt;/span&gt;

deb http://mirror.lupaworld.com/ubuntu/archive/ oneiric main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ oneiric-security main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ oneiric-updates main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ oneiric-backports main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/ubuntu-cn/ oneiric main restricted universe multiverse

&lt;span class=&quot;c&quot;&gt;#这里你也可以直接使用更快速的ubuntu.cn99.com的源（推荐）:&lt;/span&gt;

deb http://ubuntu.cn99.com/ubuntu/ oneiric main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ oneiric-updates main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ oneiric-security main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ oneiric-backports main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu-cn/ oneiric main restricted universe multiverse



//教育网源
如果大家是在校大学生，可以使用校园网/教育网，就是用教育网的资源吧，中科大，兰大、厦门大学都有很多资源，尤其是支持ipv6的，那更新速度就按兆算了。
中科大：http://mirrors.ustc.edu.cn/
厦门大学：http://mirrors.xmu.edu.cn/howto/
大家可以自己根据自己的版本设置一下，不一定局限于ubuntu 11.10，下面列出一些校内更新源。


&amp;lt;blockquote&amp;gt;#电子科技大学
deb http://ubuntu.uestc.edu.cn/ubuntu/ oneiric main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ oneiric-backports main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ oneiric-proposed main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ oneiric-security main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ oneiric-updates main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ oneiric main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ oneiric-backports main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ oneiric-proposed main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ oneiric-security main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ oneiric-updates main restricted universe multiverse

&lt;span class=&quot;c&quot;&gt;#中国科技大学&lt;/span&gt;
deb http://debian.ustc.edu.cn/ubuntu/ oneiric main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ oneiric-backports restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ oneiric-proposed main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ oneiric-security main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ oneiric-updates main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ oneiric main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ oneiric-backports main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ oneiric-proposed main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ oneiric-security main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ oneiric-updates main restricted universe multiverse

&lt;span class=&quot;c&quot;&gt;#北京理工大学&lt;/span&gt;
deb http://mirror.bjtu.edu.cn/ubuntu/ oneiric main multiverse restricted universe
deb http://mirror.bjtu.edu.cn/ubuntu/ oneiric-backports main multiverse restricted universe
deb http://mirror.bjtu.edu.cn/ubuntu/ oneiric-proposed main multiverse restricted universe
deb http://mirror.bjtu.edu.cn/ubuntu/ oneiric-security main multiverse restricted universe
deb http://mirror.bjtu.edu.cn/ubuntu/ oneiric-updates main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ oneiric main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ oneiric-backports main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ oneiric-proposed main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ oneiric-security main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ oneiric-updates main multiverse restricted universe

&lt;span class=&quot;c&quot;&gt;#兰州大学&lt;/span&gt;
deb ftp://mirror.lzu.edu.cn/ubuntu/ oneiric main multiverse restricted universe
deb ftp://mirror.lzu.edu.cn/ubuntu/ oneiric-backports main multiverse restricted universe
deb ftp://mirror.lzu.edu.cn/ubuntu/ oneiric-proposed main multiverse restricted universe
deb ftp://mirror.lzu.edu.cn/ubuntu/ oneiric-security main multiverse restricted universe
deb ftp://mirror.lzu.edu.cn/ubuntu/ oneiric-updates main multiverse restricted universe
deb ftp://mirror.lzu.edu.cn/ubuntu-cn/ oneiric main multiverse restricted universe

&lt;span class=&quot;c&quot;&gt;#上海交通大学&lt;/span&gt;
deb http://ftp.sjtu.edu.cn/ubuntu/ oneiric main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ oneiric-backports main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ oneiric-proposed main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ oneiric-security main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ oneiric-updates main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu-cn/ oneiric main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ oneiric main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ oneiric-backports main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ oneiric-proposed main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ oneiric-security main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ oneiric-updates main multiverse restricted universe
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>Linux</tag>  <tag>Ubuntu</tag> 
                 <tag>服务器</tag> 
                <pubTime>2011-10-19T08:48:12+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/baidu-platform-owners-invitation.html</loc>
        <lastmod>2011-10-08T20:55:54+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>终于拿到百度站长平台邀请码了——附申请攻略</title>
                <content>
&lt;p&gt;百度很久前就知道百度站长平台，那时候百度一直都不收录我的站点，所以看了网上的办法发邮件去申请，但是那时候石沉大海，后来过了一段时间，经过SEO后百度终于收录了我的站，那天突发奇想有跑去站长平台，发了邮件，今晚突然就收到回音了··好开心~~~~&lt;/p&gt;

&lt;p&gt;接下来会继续介绍百度站长平台，先庆祝一下&lt;del&gt;YY一下先·&lt;/del&gt;~~&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/10/baidu_zz.jpg&quot;&gt;&lt;img src=&quot;/images/2011/10/baidu_zz-560x492.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;我的申请邮件如下，希望对大家有帮助：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/10/baidu_email.jpg&quot;&gt;&lt;img src=&quot;/images/2011/10/baidu_email.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>SEO</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2011-10-08T20:55:54+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/remote-ftp-mirror-backup.html</loc>
        <lastmod>2011-10-03T20:09:55+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用wget和cron job进行远程ftp镜像备份</title>
                <content>
&lt;p&gt;一直想知道怎么对自己的站做好同步备份，一开始想用Cpanel的，但是看了很多教程，觉得很麻烦，然后今天看到wget，GNU wget是linux下的非交互式网络文件下载工具。平时使用的时候都只是简单的用来 wget -c 下载一些文件，今天才发现可以用它来直接对整个ftp站点做镜像。方法如下：&lt;/p&gt;

&lt;p&gt;直接使用命令&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wget &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; ~/mirror.log &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-nH&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; ~/mirror/ ftp://username:password@IPAddress/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-o&lt;/code&gt; 便是输出的log文件名&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-m&lt;/code&gt; 表示对ftp做镜像&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-nH&lt;/code&gt; 表示不生成远程主机的目录&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-b&lt;/code&gt; 程序将在后台执行&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-P&lt;/code&gt; 后面输入镜像存放的位置&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;一般做镜像还需使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crontab&lt;/code&gt;来自动完成镜像的同步。&lt;/p&gt;

&lt;p&gt;只需修改crontab文件即可，文件加入以下语句：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;0 0 0 &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; 0 wget &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; ~/mirror.log &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-nH&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; ~/mirror/ ftp://username:password@IPAddress/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;表示在每个星期天来完成镜像的同步工作。 前面一串数字的意义为：（直接写*表任意匹配）&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;     &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;  &lt;span class=&quot;nb&quot;&gt;command &lt;/span&gt;to be executed
-    -     -    -     -
|     |     |     |     |
|     |     |     |     +----- day of week &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;0 - 6&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Sunday&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
|     |     |     +------- month &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1 - 12&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
|     |     +--------- day of month &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1 - 31&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
|     +----------- hour &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;0 - 23&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
+------------- min &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;0 - 59
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-L&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-np&lt;/code&gt; 选项可以保证只对当前目录下做镜像）&lt;/p&gt;
</content>
                 <tag>Linux</tag> 
                 <tag>服务器</tag> 
                <pubTime>2011-10-03T20:09:55+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/appstore-error-1004-error-solution.html</loc>
        <lastmod>2011-10-01T21:04:54+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>终极解决AppStore error 1004错误</title>
                <content>
&lt;p&gt;最近在弄iPad2，一开始好好的AppSrore居然出现Error 1004，请稍后再试&lt;/p&gt;

&lt;p&gt;网上找了一下帖子很多了，不赘述。就说解决方案。。。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;改时间？ no！老是提前改时间，多麻烦！！！&lt;/li&gt;
  &lt;li&gt;重置设备？no！ 越狱的reset设备=白苹果&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;正解是&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;设置&lt;/code&gt;——&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;safari&lt;/code&gt;——&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;清除历史记录&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;清除cookie&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;清除缓存&lt;/code&gt;！！！！&lt;/p&gt;

&lt;p&gt;搞定！&lt;/p&gt;

&lt;p&gt;方法来自 apple网站的外国人的讨论。。。。。看来以后遇到疑难杂症，还得看英文网页！！！！&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Re: Error 1004 iOS 4.3.3 downloading App Store
Sep 23, 2011 7:54 PM (in response to droopy2009)

This actually has a very ** fix (easier than reseting all settings), that has worked all the times I have seen it. ** goto Settings &amp;gt; Safari &amp;gt; Then reset the cookies, Reset the Cache, and Reset the History. Now turn the iPad off and then on again. It should work fine now.

David
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>iOS</tag> 
                 <tag>电脑技巧</tag> 
                <pubTime>2011-10-01T21:04:54+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/php-installation-zendoptimizer.html</loc>
        <lastmod>2011-09-26T22:52:11+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PHP安装ZendOptimizer</title>
                <content>
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Zend Optimizer&lt;/code&gt;(以下简称&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ZO&lt;/code&gt;)用优化代码的方法来提高PHP应用程序的执行速度。实现的原理是对那些在被最终执行之前由运行编译器(Run-Time Compiler)产生的代码进行优化。&lt;/p&gt;

&lt;p&gt;优化能提高你的盈利能力&lt;/p&gt;

&lt;p&gt;一般情况下，执行使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ZO&lt;/code&gt;的PHP程序比不使用的要快40%到100%。这意味着网站的访问者可以更快的浏览网页，从而完成更多的事务，创造更好的客户满意度。更快的反应同时也意味着可以节省硬件投资，并增强网站所提供的服务。所以，使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ZO&lt;/code&gt;，就等于提高了电子商务的盈利能力。&lt;/p&gt;

&lt;p&gt;ZO能给PHP用户带来很多益处，特别是那些运营网站的人。快速运行PHP程序可以显著降低服务器的CPU负载，并可以减少一半的反应时间，也就是从访问者点击链接到服务器开始读取页面之间的时间。&lt;/p&gt;

&lt;p&gt;系统需求&lt;/p&gt;

&lt;p&gt;当前版本的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ZO&lt;/code&gt;(Beta 4)只能运行在PHP下。&lt;/p&gt;

&lt;p&gt;对操作系统的要求如下：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;基于glibc2.1的x86 Linux系统（Red Hat 6.1, Mandrake 7.0, Slackware 7.0及SuSE 6.1）&lt;/li&gt;
  &lt;li&gt;基于glibc2的x86 Linux系统（Red Hat 5.2, SuSE 6.1）&lt;/li&gt;
  &lt;li&gt;基于libc5的x86 Linux系统（Slackware 4.0, Debian 1.3.1r8）&lt;/li&gt;
  &lt;li&gt;Sparc Solaris 2.6, 7和8&lt;/li&gt;
  &lt;li&gt;FreeBSD 3.4和4.0&lt;/li&gt;
  &lt;li&gt;Windows NT 4.0（不包括其它版本的Windows）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;对PHP的要求如下：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;同时支持CGI方式和Apache模块方式&lt;/li&gt;
  &lt;li&gt;在Windows下，PHP必须：1)是从http://www.php.net上下载的现成的WIN32执行版本；2)自己编译时带”Release_Ts”(Release Thread Safe)选项的。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;安装过程&lt;/p&gt;

&lt;p&gt;UNIX&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;编译PHP，不要加调试选项-否则ZO不会工作：在配置是加上–disable-debug选项&lt;/li&gt;
  &lt;li&gt;复制ZendOptimizer.so文件到你的机器，通常放在：/usr/local/Zend/lib下&lt;/li&gt;
  &lt;li&gt;在php.ini文件中加入如下两行，不要包含任何空格：
 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zend_optimizer.optimization_level=7&lt;/code&gt;
 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zend_extension=&quot;/usr/local/Zend/lib/ZendOptimizer.so&quot;&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;重新启动Apache服务器&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;WINDOWS&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;从http://www.php.net下载WINDOWS版的PHP 4.0.0，这个版本不包含调试特性。&lt;/li&gt;
  &lt;li&gt;复制ZendOptimizer.dll文件到你的机器，通常放在：C:\Program Files\Zend\lib下&lt;/li&gt;
  &lt;li&gt;在php.ini文件中加入如下两行，不要包含任何空格：
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zend_optimizer.optimization_level=7&lt;/code&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zend_extension_ts=&quot;C:\Program Files\Zend\lib\ZendOptimizer.dll&quot;
&lt;/code&gt;4. 如果需要的话，重新启动WEB服务器&lt;/li&gt;
&lt;/ol&gt;
</content>
                 <tag>PHP</tag> 
                 <tag>服务器</tag> 
                <pubTime>2011-09-26T22:52:11+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/dating-service-discuz-x2-utf8.html</loc>
        <lastmod>2011-08-23T21:47:09+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>交友中心4.0.4 for discuz! X2【UTF8】</title>
                <content>
&lt;p&gt;之前看到Discuz!X的交友中心都是GBK的，因为我的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Discuz&lt;/code&gt;是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UTF-8&lt;/code&gt;的，所以没办法只有自己转，现在分享一下。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/08/jiaoyou.jpg&quot;&gt;&lt;img src=&quot;/images/2011/08/jiaoyou.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://dl.dbank.com/c03ue5w61j&quot;&gt;&lt;img src=&quot;/wp-includes/images/dbank.jpg&quot; alt=&quot;【UTF8】交友中心4.0.4 for discuzX.rar (115.86K)&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                
                 <tag>康盛</tag> 
                <pubTime>2011-08-23T21:47:09+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/xampp-xp-start-apache.html</loc>
        <lastmod>2011-07-25T10:04:54+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>完美解决XP下xampp等的Apache无法启动的问题</title>
                <content>
&lt;p&gt;最近在几台机上面使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xampp&lt;/code&gt;还有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;APMser&lt;/code&gt;等的PHP服务器，但是都遇到无法启动或者启动后自动关闭的问题，研究了很久，发现好像无论是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Apache&lt;/code&gt;还是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Nginx&lt;/code&gt;存在问题，那么就可以断定问题是出在电脑本身，可能是IP协议之类，在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Apache&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;log&lt;/code&gt;下的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;error.log&lt;/code&gt;看到：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Sun Jul 24 14:00:04 2011] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;notice] Digest: generating secret &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;digest authentication ...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Sun Jul 24 14:00:04 2011] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;notice] Digest: &lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Sun Jul 24 14:00:05 2011] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;notice] Apache/2.2.14 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Win32&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; resuming normal operations
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Sun Jul 24 14:00:05 2011] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;notice] Server built: Nov 11 2009 14:29:03
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Sun Jul 24 14:00:05 2011] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;notice] Parent: Created child process 2184
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Sun Jul 24 14:00:07 2011] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;notice] Digest: generating secret &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;digest authentication ...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Sun Jul 24 14:00:07 2011] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;notice] Digest: &lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Sun Jul 24 14:00:08 2011] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;notice] Child 2184: Child process is running
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Sun Jul 24 14:00:08 2011] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;crit] &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;OS 10022&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;提供了一个无效的参数。  : Child 2184: setup_inherited_listeners&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;, WSASocket failed to open the inherited socket.
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Sun Jul 24 14:00:08 2011] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;crit] Parent: child process exited with status 3 &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; Aborting.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;研究后发现是TCI/IP协议的问题，解决问题方法如下：&lt;/p&gt;

&lt;p&gt;解决办法:
1.&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;网上邻居&lt;/code&gt;-&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;本地连接&lt;/code&gt;-&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;属性&lt;/code&gt;-&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;internet协议(TCP/IP)&lt;/code&gt;-&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;属性&lt;/code&gt;-&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;高级&lt;/code&gt;-&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wins标签&lt;/code&gt;-&amp;gt;去掉启用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LMhosts查询&lt;/code&gt;前的勾.&lt;/p&gt;

&lt;p&gt;我就是用这个方法解决的，如果还是不行，就往下继续尝试吧&lt;/p&gt;

&lt;p&gt;2.&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;控制面版&lt;/code&gt;-&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;windows防火墙&lt;/code&gt;-&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;高级标签&lt;/code&gt;-&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;本地连接设置&lt;/code&gt;-&amp;gt;服务的标签里勾选&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;安全Web服务器(HTTPS)&lt;/code&gt;即可.&lt;/p&gt;

&lt;p&gt;(这上下两项完成后仍然有问题，选中：启用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCP/IP&lt;/code&gt; 上的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NetBOIS&lt;/code&gt;.)&lt;/p&gt;

&lt;p&gt;3.在运行里输入：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;netsh winsock reset&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;有人提到是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;winsock&lt;/code&gt;的问题，尝试修复&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;winsock&lt;/code&gt;，只要直接在运行里输入：&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;netsh winsock reset&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;连提示重启都不用，就OK啦···&lt;/p&gt;
</content>
                 <tag>Apache</tag>  <tag>解决问题</tag> 
                 <tag>服务器</tag> 
                <pubTime>2011-07-25T10:04:54+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/multi-segment-network-connect.html</loc>
        <lastmod>2011-07-24T11:54:30+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>电脑多网卡连接同一网段问题探究</title>
                <content>
&lt;p&gt;刚刚在用笔记本电脑无线上网，突然想起刚刚在路由器上还有一根网线剩下，而且就在我身边，我就想，如果把笔记本电脑同时通过有线和无线连接到同一个路由器会发生什么事呢。&lt;/p&gt;

&lt;p&gt;马上动手，连接上有线网络。咦没什么变化？？&lt;/p&gt;

&lt;p&gt;看了一下网络连接，然后&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ipconfig /all&lt;/code&gt;看了一下。&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;无线局域网适配器&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;无线网络连接:&lt;/span&gt;

   &lt;span class=&quot;err&quot;&gt;连接特定的&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;DNS&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;后缀&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;gateway.2wire.net&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;描述.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Intel(R)&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;PRO/无线&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;3945ABG&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;网络连接&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;物理地址.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;00-1F-3C-72-28-96&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;DHCP&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;已启用&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;是&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;自动配置已启用.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;是&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;IPv4&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;地址&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;192.168.0.72(首选)&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;子网掩码&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;255.255.255.0&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;获得租约的时间&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;2011年7月24日&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;10:36:38&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;租约过期的时间&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;2011年7月25日&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;11:30:05&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;默认网关.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;192.168.0.1&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;DHCP&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;服务器&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;192.168.0.1&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;DNS&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;服务器&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;192.168.0.1&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;TCPIP&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;上的&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;NetBIOS&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;已启用&lt;/span&gt;

&lt;span class=&quot;err&quot;&gt;以太网适配器&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;本地连接:&lt;/span&gt;

   &lt;span class=&quot;err&quot;&gt;连接特定的&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;DNS&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;后缀&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;gateway.2wire.net&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;描述.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Marvell&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Yukon&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;88E8039&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;PCI-E&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Fast&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Ethernet&lt;/span&gt;
 &lt;span class=&quot;err&quot;&gt;Controller&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;物理地址.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;00-1D-72-5F-7C-B3&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;DHCP&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;已启用&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;是&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;自动配置已启用.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;是&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;IPv4&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;地址&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;192.168.0.80(首选)&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;子网掩码&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;255.255.255.0&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;获得租约的时间&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;2011年7月24日&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;11:36:38&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;租约过期的时间&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;2011年7月25日&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;11:36:38&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;默认网关.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;192.168.0.1&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;DHCP&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;服务器&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;192.168.0.1&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;DNS&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;服务器&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;192.168.0.1&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;TCPIP&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;上的&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;NetBIOS&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;已启用&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;可以看到有线和无线网卡都在路由上获取到有效IP地址，那么电脑怎么判断走哪条线路呢？？我马上想到路由表，Route Print一下看看：&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;===========================================================================&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;接口列表&lt;/span&gt;
 &lt;span class=&quot;err&quot;&gt;12...00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;1f&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;3c&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;72&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;28&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;96&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;......Intel(R)&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;PRO/无线&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;3945ABG&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;网络连接&lt;/span&gt;
 &lt;span class=&quot;err&quot;&gt;11...00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;1d&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;72&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;5f&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;7c&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;b3&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;......Marvell&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Yukon&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;88E8039&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;PCI-E&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Fast&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Ethernet&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Controll&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;er&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;1...........................Software&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Loopback&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Interface&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;1&lt;/span&gt;
 &lt;span class=&quot;err&quot;&gt;14...00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;e0&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Microsoft&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;ISATAP&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Adapter&lt;/span&gt;
 &lt;span class=&quot;err&quot;&gt;13...00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;e0&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Teredo&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Tunneling&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;Pseudo-Interface&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;==========================================================================&lt;/span&gt;

&lt;span class=&quot;err&quot;&gt;IPv4&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;路由表&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;===========================================================================&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;活动路由:&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;网络目标&lt;/span&gt;        &lt;span class=&quot;err&quot;&gt;网络掩码&lt;/span&gt;          &lt;span class=&quot;err&quot;&gt;网关&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;接口&lt;/span&gt;   &lt;span class=&quot;err&quot;&gt;跃点数&lt;/span&gt;
          &lt;span class=&quot;err&quot;&gt;0.0.0.0&lt;/span&gt;          &lt;span class=&quot;err&quot;&gt;0.0.0.0&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;192.168.0.1&lt;/span&gt;     &lt;span class=&quot;err&quot;&gt;192.168.0.72&lt;/span&gt;     &lt;span class=&quot;err&quot;&gt;25&lt;/span&gt;
          &lt;span class=&quot;err&quot;&gt;0.0.0.0&lt;/span&gt;          &lt;span class=&quot;err&quot;&gt;0.0.0.0&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;192.168.0.1&lt;/span&gt;     &lt;span class=&quot;err&quot;&gt;192.168.0.80&lt;/span&gt;     &lt;span class=&quot;err&quot;&gt;20&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;127.0.0.0&lt;/span&gt;        &lt;span class=&quot;err&quot;&gt;255.0.0.0&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;         &lt;span class=&quot;err&quot;&gt;127.0.0.1&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;306&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;127.0.0.1&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;255.255.255.255&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;         &lt;span class=&quot;err&quot;&gt;127.0.0.1&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;306&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;127.255.255.255&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;255.255.255.255&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;         &lt;span class=&quot;err&quot;&gt;127.0.0.1&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;306&lt;/span&gt;
      &lt;span class=&quot;err&quot;&gt;192.168.0.0&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;255.255.255.0&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;192.168.0.72&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;281&lt;/span&gt;
      &lt;span class=&quot;err&quot;&gt;192.168.0.0&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;255.255.255.0&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;192.168.0.80&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;276&lt;/span&gt;
     &lt;span class=&quot;err&quot;&gt;192.168.0.72&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;255.255.255.255&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;192.168.0.72&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;281&lt;/span&gt;
     &lt;span class=&quot;err&quot;&gt;192.168.0.80&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;255.255.255.255&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;192.168.0.80&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;276&lt;/span&gt;
    &lt;span class=&quot;err&quot;&gt;192.168.0.255&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;255.255.255.255&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;192.168.0.72&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;281&lt;/span&gt;
    &lt;span class=&quot;err&quot;&gt;192.168.0.255&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;255.255.255.255&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;192.168.0.80&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;276&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;224.0.0.0&lt;/span&gt;        &lt;span class=&quot;err&quot;&gt;240.0.0.0&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;         &lt;span class=&quot;err&quot;&gt;127.0.0.1&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;306&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;224.0.0.0&lt;/span&gt;        &lt;span class=&quot;err&quot;&gt;240.0.0.0&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;192.168.0.80&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;276&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;224.0.0.0&lt;/span&gt;        &lt;span class=&quot;err&quot;&gt;240.0.0.0&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;192.168.0.72&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;281&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;255.255.255.255&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;255.255.255.255&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;         &lt;span class=&quot;err&quot;&gt;127.0.0.1&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;306&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;255.255.255.255&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;255.255.255.255&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;192.168.0.80&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;276&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;255.255.255.255&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;255.255.255.255&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;192.168.0.72&lt;/span&gt;    &lt;span class=&quot;py&quot;&gt;281&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;==========================================================================&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;永久路由:&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;无&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;IPv6&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;路由表&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;===========================================================================&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;活动路由:&lt;/span&gt;
 &lt;span class=&quot;err&quot;&gt;如果跃点数网络目标&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;网关&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;1&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;306&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;::1/128&lt;/span&gt;                  &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;1&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;306&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;ff00::/8&lt;/span&gt;                 &lt;span class=&quot;err&quot;&gt;在链路上&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;===========================================================================&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;永久路由:&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;无&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;可以看到默认路由有两条，分别对应两个网卡，但是有线连接的跳跃点是20，无线连接的是25，所以在默认情况上是走有线连接，如果有线连接中就走无线，两条连接构成冗余。&lt;/p&gt;

&lt;p&gt;好了，实验到此结束！！！！&lt;/p&gt;
</content>
                 <tag>服务器</tag> 
                 <tag>网络工程</tag> 
                <pubTime>2011-07-24T11:54:30+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/jquery-horizontal-vertical-center.html</loc>
        <lastmod>2011-07-23T21:13:59+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>使用jQuery创建水平和垂直居中的网站</title>
                <content>
&lt;p&gt;最近在做一个红酒相关的网站，因为对设计要求比较高，所以做了一个图片感比较强的网站，但是发现在大分辨率，特别是4:3的时候很奇怪，所以想让网页水平垂直都居中，就是让一个div实现水平和垂直居中，虽然好几种方式实现，但是今天介绍时我最喜欢的方法，通过css和jQuery实现。&lt;/p&gt;

&lt;h3 id=&quot;1通过css实现水平居中&quot;&gt;1、通过css实现水平居中：&lt;/h3&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;.className&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;auto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;200px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;200px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;2通过css实现水平居中和垂直居中&quot;&gt;2、通过css实现水平居中和垂直居中&lt;/h3&gt;

&lt;p&gt;通过css创建一个水平居中和垂直居中的div是一件比较麻烦的事情，您必须事先知道另外一个div的尺寸：&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;.className&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;300px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;200px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;absolute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;50%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;50%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;-100px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;-150px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3通过jquery实现&quot;&gt;3、通过jQuery实现&lt;/h3&gt;

&lt;p&gt;水平居中和垂直居中前面已经提到过了，css的方法只适用于有固定尺寸的div，所以到jQuery发挥作用了：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
	&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.className&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;css&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
		&lt;span class=&quot;na&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;absolute&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;na&quot;&gt;left&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;width&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.className&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;outerWidth&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;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;na&quot;&gt;top&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;height&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.className&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;outerHeight&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;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;c1&quot;&gt;//初始化函数&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
                 <tag>jQuery</tag>  <tag>解决问题</tag> 
                 <tag>HTML</tag> 
                <pubTime>2011-07-23T21:13:59+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/mysql-foreign-key-summary.html</loc>
        <lastmod>2011-07-21T23:14:47+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>MySQL外键使用总结</title>
                <content>
&lt;p&gt;最近有开始做一个实验室管理系统，因为分了几个表进行存储·所以要维护表间的关联··研究了一下MySQL的外键。&lt;/p&gt;

&lt;p&gt;（1）只有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;InnoDB&lt;/code&gt;类型的表才可以使用外键，mysql默认是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MyISAM&lt;/code&gt;，这种类型不支持外键约束&lt;/p&gt;

&lt;p&gt;（2）外键的好处：可以使得两张表关联，保证数据的一致性和实现一些级联操作；&lt;/p&gt;

&lt;p&gt;（3）外键的作用：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;保持数据一致性，完整性，主要目的是控制存储在外键表中的数据。 使两张表形成关联，外键只能引用外表中的列的值！
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（4）建立外键的前提：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;两个表必须是InnoDB表类型。&lt;/li&gt;
  &lt;li&gt;使用在外键关系的域必须为索引型(Index)。&lt;/li&gt;
  &lt;li&gt;使用在外键关系的域必须与数据类型相似&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;（5）创建的步骤&lt;/p&gt;

&lt;p&gt;指定主键关键字： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;foreign key&lt;/code&gt;(列名)&lt;/p&gt;

&lt;p&gt;引用外键关键字： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;references&lt;/code&gt; &lt;外键表名&gt;(外键列名)&lt;/外键表名&gt;&lt;/p&gt;

&lt;p&gt;（6）事件触发限制:&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;on delete&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;on update&lt;/code&gt; , 可设参数&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cascade&lt;/code&gt;(跟随外键改动), &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;restrict&lt;/code&gt;(限制外表中的外键改动),&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set Null&lt;/code&gt;(设空值）,&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set Default&lt;/code&gt;（设默认值）,[默认]&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;no action&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;（7）举例&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;outTable&lt;/code&gt;表 主键 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;id&lt;/code&gt; 类型 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;创建含有外键的表：&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;create&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;table&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;temp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;foreign&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;references&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;outTable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;delete&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;cascade&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;update&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;cascade&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;说明：把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;id&lt;/code&gt;列 设为外键 参照外表&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;outTable&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;id&lt;/code&gt;列 当外键的值删除 本表中对应的列筛除 当外键的值改变 本表中对应的列值改变。&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;create&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;table&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;temp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;foreign&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;references&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;outTable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;delete&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;cascade&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;update&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;cascade&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;缺点：在对MySQL做优化的时候类似查询缓存，索引缓存之类的优化对InnoDB类型的表是不起作用的，还有在数据库整体架构中用得同步复制也是对InnoDB类型的表不生效的，像数据库中核心的表类似商品表请大家尽量不要是使用外键，如果同步肯定要同步商品库的，加上了外键也就没法通不了，优化也对它没作用，岂不得不偿失，做外键的目的在于保证数据完整性，请大家通过程序来实现这个目的而不是外键，切记！&lt;/p&gt;

&lt;p&gt;来自：http://qubaoquan.blog.51cto.com/1246748/292861&lt;/p&gt;
</content>
                 <tag>MySQL</tag> 
                 <tag>PHP</tag> 
                <pubTime>2011-07-21T23:14:47+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/mysql-last-record-id.html</loc>
        <lastmod>2011-07-15T19:48:47+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Mysql插入记录后返回该记录ID</title>
                <content>
&lt;p&gt;最近和Sobin在做一个精品课程的项目，因为用到一个固定的id作为表间关联，所以在前一个表插入数据后要把插入数据生成的自增&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;id&lt;/code&gt;传递给下一个表。研究了一番决定使用Mysql提供了一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LAST_INSERT_ID()&lt;/code&gt;的函数。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LAST_INSERT_ID()&lt;/code&gt; (with no argument) returns the first automatically generated value that was set for an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AUTO_INCREMENT&lt;/code&gt; column by the most recently executed &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;INSERT&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UPDATE&lt;/code&gt; statement to affect such a column. For example, after inserting a row that generates an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AUTO_INCREMENT&lt;/code&gt; value, you can get the value like this:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;LAST_INSERT_ID&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;195&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;简单说来，就是这个函数将返回插入的那条记录在表中自增的那个字段的值，一般我们都给那个自增字段命名为ID。这样就可以返回刚插入的记录的ID值了。&lt;/p&gt;

&lt;p&gt;一个简单的例子：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;INSERT INTO `testtable` (`clou1`,`clou2`) VALUES ('testvalue','test')&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;mysql_query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;SELECT LAST_INSERT_ID()&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mysql_query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$rows&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mysql_fetch_row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$rows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这个函数是基于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;connection&lt;/code&gt;的，也就是不会被其他客户端的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;connection&lt;/code&gt;影响到，所以结果是准确的。如果使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;select max(id) from table&lt;/code&gt;,在高密度的插入请求下，是有可能出问题的，返回错误值&lt;/p&gt;
</content>
                 <tag>MySQL</tag> 
                 <tag>PHP</tag> 
                <pubTime>2011-07-15T19:48:47+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/wordpress-page-replace-categories.html</loc>
        <lastmod>2011-07-11T10:45:27+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress 页面导航更换为分类目录导航</title>
                <content>
&lt;p&gt;可能由于使用习惯的不同，国外网页设计者设计的WordPress博客主题的顶部导航是WordPress博客的页面，而国人开发的WordPress博客主题的顶部导航则是WordPress博客的分类目录，国人的使用习惯偏向后者。&lt;/p&gt;

&lt;p&gt;那么，使用以页面为导航的国外主题就要通过替换相关代码变更为以分类目录作为导航目录。&lt;/p&gt;

&lt;p&gt;相关代码：&lt;/p&gt;

&lt;p&gt;页面列表代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; 
&lt;span class=&quot;nf&quot;&gt;wp_list_pages&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'depth=1&amp;amp;sort_column=menu_order&amp;amp;title_li='&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;分类目录代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;wp_list_categories&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'depth=1&amp;amp;title_li=0&amp;amp;orderby=id&amp;amp;show_count=0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;操作步骤：&lt;/p&gt;

&lt;p&gt;登陆博客后台，点击左侧外观选项卡中的“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;编辑&lt;/code&gt;”功能，在右侧的文件中点击“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;header.php&lt;/code&gt;”（主题顶部，WordPress主题文件相关说明），找到页面列表代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; 
&lt;span class=&quot;nf&quot;&gt;wp_list_pages&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'depth=1&amp;amp;sort_column=menu_order&amp;amp;title_li='&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;用分类目录代码&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;wp_list_categories&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'depth=1&amp;amp;title_li=0&amp;amp;orderby=id&amp;amp;show_count=0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;替换掉页面列表代码，然后点击“更新文件”按钮，完成！
提醒：有些页面列表或分类目录代码不相同，如有的主题的分类目录代表是&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; 
&lt;span class=&quot;nf&quot;&gt;wp_list_categories&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'orderby=id&amp;amp;hide_empty=0&amp;amp;title_li='&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这种情况下，可以把找到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp_list_pages&lt;/code&gt;且更换为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp_list_categories&lt;/code&gt;即可。&lt;/p&gt;
</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2011-07-11T10:45:27+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/iis-flv-rmvb-streaming-solution.html</loc>
        <lastmod>2011-07-03T11:55:47+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>设置IIS解决无法播放FLV、RMVB等流媒体文件</title>
                <content>
&lt;p&gt;最近在做学校思想道德与法律基础的网站，http://210.38.160.82/sxfl/，在本地的时候，首页的FLV视频是可以读取和播放的，但是上传到服务器之后就没有反应了···&lt;/p&gt;

&lt;p&gt;原来这是由于flv是Flash媒体播放器支持的视频格式，但部分服务器需要进行MIME 类型映射设置，才能支持.flv视频格式。否则，本地能够正常播放的.flv文件，一传到服务器上就无法显示。而WIN2003加强了IIS6的MIME验证，一切未注册扩展文件格式统统显示404错误。&lt;/p&gt;

&lt;p&gt;MIME 类型映射设置的具体步骤是：
“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;开始&lt;/code&gt;” &amp;gt; “&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;控制面板&lt;/code&gt;” &amp;gt; “&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;管理工具&lt;/code&gt;” &amp;gt;“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Internet 信息服务（IIS管理器）&lt;/code&gt;”，找到您的网站，右击 &amp;gt; “&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;属性&lt;/code&gt;” &amp;gt; “&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HTTP头&lt;/code&gt;” &amp;gt; “&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MIME类型&lt;/code&gt;” &amp;gt; “新建”，在“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;扩展名&lt;/code&gt;”框内输入“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.flv&lt;/code&gt;”，“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MIME类型&lt;/code&gt;”框中输入“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flv-application/octet-stream&lt;/code&gt;”，然后确定即可。&lt;/p&gt;

&lt;p&gt;“MIME类型”只是一个描述，并一定要输入“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flv-application/octet-stream&lt;/code&gt;”&lt;/p&gt;

&lt;p&gt;RMVB等流媒体也是同个道理····&lt;/p&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>服务器</tag> 
                <pubTime>2011-07-03T11:55:47+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/forgotten-password-windows7-solution.html</loc>
        <lastmod>2011-06-25T21:59:57+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>忘记Windows7密码最新解决方法(Windows7密码破解)</title>
                <content>
&lt;p&gt;由于无法使用管理员帐号进入Windows7，辅助工具比较大，已经回不到xp时代的pe一键删除密码了，不过用Windows7的system账户运行cmd命令可以强制修改账户密码!就拿xp+Windows7为例(没有安装双系统也可以进入pe)。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;第一步&lt;/strong&gt;：由于cmd在系统目录，文件更改首先要获得文件所有权。&lt;/p&gt;

&lt;p&gt;打开“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:/windows/system32&lt;/code&gt;”(假设Windows7安装在C盘。)，右击“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;arrator.ex&lt;/code&gt;e”选择“权限”——高级——所有者，将当前xp下管理员帐号设置为所有者(如果没有当前帐号在列表，则单击“其他账户”，手动输入当前账户名)。单击“确定”返回权限设置窗口，点击“添加”，将当前管理员帐户添加到列表，并将账户对该文件读取权限设置为“完全控制”。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;第二步&lt;/strong&gt;：操作同上。&lt;/p&gt;

&lt;p&gt;设置当前账户对“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cmd.exe&lt;/code&gt;”权限为完全控制，然后将 “&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;narrator.exe&lt;/code&gt;”重命名为“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;narrator1.exe&lt;/code&gt;”，“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cmd.exe&lt;/code&gt;”重命名为“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;narrator.exe&lt;/code&gt;”。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;第三步&lt;/strong&gt;：(如果是以administrator账户登录的就不用这一步了)重启登录 Windows7。&lt;/p&gt;

&lt;p&gt;Windows7登录界面单击右下角的“轻松访问”按钮，在打开的窗口勾选“启动讲述人”，此时启动的就是cmd窗口了(是以system身份开启的，自然有管理员权限啦～)，在cmd输入下面的命令开启administrator账户，重启即可使用administrator了。&lt;/p&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>电脑技巧</tag> 
                <pubTime>2011-06-25T21:59:57+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/right-click-geoglobe.html</loc>
        <lastmod>2011-06-21T08:30:48+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>天地图GeoGlobe创建右击事件</title>
                <content>
&lt;p&gt;之前已经介绍了&lt;a href=&quot;/geoglobe-add-click-event&quot;&gt;《天地图GeoGlobe添加单击事件》&lt;/a&gt;和&lt;a href=&quot;/rewrite-double-clicke-geoglobe.html&quot;&gt;《天地图GeoGlobe重写双击事件》&lt;/a&gt;，单身你安装上述方法去定义右击事件的话，你就会一直看到浏览器弹出的右键菜单。研究了天地图官方的地图，发现它代码的实现是使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jquery&lt;/code&gt;的。所以按图索骥，依样画葫芦的写了个右击事件的教程，希望对你有帮助。&lt;/p&gt;

&lt;p&gt;原理还是比较简单，利用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jquery&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jquery.contextmenu&lt;/code&gt;创建地图右击事件菜单。&lt;/p&gt;

&lt;p&gt;代码如下：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.w3.org/1999/xhtml&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Content-Type&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/html; charset=utf-8&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;script  &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;jquery-1.4.4.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;jquery.contextmenu.r2.packed.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/lib/GeoSurfJSAPI.js&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/2d_samples/sampleCfg.js&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;onload=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;initialize()&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;frist_map&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width: 640px; height: 480px ; marging:0 auto;z-index:100;position: absolute; display: block;&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;hr&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;&amp;lt;!--右键菜单的源--&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;contextMenu&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;myMenu2&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;z-index:1000; position: absolute;&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;item_1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;选项一&lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;item_2&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;选项二&lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;item_3&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;选项三&lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;item_4&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;选项四&lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;initialize&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PortalMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;frist_map&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	     &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;loadLayerGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;imageGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	     &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setCenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LonLat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;116.12371&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;24.33058&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;14&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;c1&quot;&gt;//所有html元素id为demo2的绑定此右键菜单&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#frist_map&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;contextMenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;myMenu2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;c1&quot;&gt;//菜单样式&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;menuStyle&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;na&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;2px solid #000&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;//菜单项样式&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;itemStyle&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;na&quot;&gt;fontFamily&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;verdana&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;backgroundColor&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;green&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;white&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;1px&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;

      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;//菜单项鼠标放在上面样式&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;itemHoverStyle&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;na&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;backgroundColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;red&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;//事件&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;bindings&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;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;item_1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;t&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;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Trigger was &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Action was item_1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;item_2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;t&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;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Trigger was &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Action was item_2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;item_3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;t&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;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Trigger was &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Action was item_3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;item_4&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;t&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;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Trigger was &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Action was item_4&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;查看此示例的实际效果：&lt;a href=&quot;http://demo.yourtion.com/GeoGlobe/rightClick.php&quot;&gt;点击这里看Demo&lt;/a&gt;&lt;/p&gt;

</content>
                 <tag>GeoGlobe</tag>  <tag>天地图</tag> 
                 <tag>天地图二次开发</tag> 
                <pubTime>2011-06-21T08:30:48+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/slackware-install-ldap.html</loc>
        <lastmod>2011-06-17T23:39:57+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Slackware安装LDAP</title>
                <content>
&lt;p&gt;LDAP是一种轻权的目录访问协议，由于它在读的方式上经过精心的优化，所以读的效率很高，相反对于频繁写入数据的要求是不适合的。基于LDAP的这种特性，近年来在Internet领域的应用不断加强。目前，有关LDAP的软件很多，其中最受欢迎也是最为大家所熟知的LDAP软件是基于开放源码的OpenLdap。&lt;/p&gt;

&lt;p&gt;一、LDAP的安装：&lt;/p&gt;

&lt;p&gt;下载openldap-stable-20100719.tgz （http://www.openldap.org）
openldap安装&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;#tar -zxvf openldap-stable-20100719.tgz
#cd openldap-2.4.23
#./configure –prefix=/home/local/ldap
#make depend
#make
#make test 
#make install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;ldap数据库的建立&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;#cd /home/local/ldap/etc/openldap
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;修改slapd.conf文件如下：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;suffix “o=hitek,c=cn”
rootdn “cn=root,o=hitek,c=cn”
#cd /home/local/ldap/var/openldap-ldbm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;建立一个hitek.ldif文件，文件内容如下&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dn: o=hitek,c=cn
objectclass:top
objectclass:organization
o: hitek
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;#cd /home/local/ldap/sbin
#./slapadd –f /home/local/ldap/openldap/slapd.conf –l /home/local/ldap/var/openldap-ldbm/hitek.ldif
#cd /home/local/ldap/libexec
#./slapd
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;到此为止LDAP安装过程完成。&lt;/p&gt;
</content>
                 <tag>Linux</tag> 
                 <tag>服务器</tag> 
                <pubTime>2011-06-17T23:39:57+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/rewrite-double-clicke-geoglobe.html</loc>
        <lastmod>2011-06-02T12:51:56+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>天地图GeoGlobe重写双击事件</title>
                <content>
&lt;p&gt;之前已经介绍了&lt;a href=&quot;/geoglobe-add-click-event.html&quot;&gt;《天地图GeoGlobe添加单击事件》&lt;/a&gt;，但是如果你依样画葫芦想定义双击事件，你就会发现并不可行，双击后依然还是放大地图，感谢“oОО砯崖Оo”的研究，重写双击事件得到解决。拿出了分享一下。&lt;/p&gt;

&lt;p&gt;要定义双击事件就要重新定义地图导航控件，然后重新定义控件的双击方法。具体实现方法也比较麻烦，但是代码还是很简洁，很多东西在API文档没有，所以要自己理解咯···&lt;/p&gt;

&lt;p&gt;代码如下：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.w3.org/1999/xhtml&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Content-Type&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/html; charset=utf-8&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/lib/GeoSurfJSAPI.js&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/2d_samples/sampleCfg.js&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onload&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;myNavigation&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Control&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Navigation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//重新定义地图导航控件&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;myNavigation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;defaultDblClick&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;evt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//重新定义控件的双击方法&lt;/span&gt;
                &lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;evt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;xy&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;c1&quot;&gt;//在构造地图对象的时候，单独指定加载的控件&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PortalMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;frist_map&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,{&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;controls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;myNavigation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Control&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PanZoom&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;p&quot;&gt;});&lt;/span&gt;

        &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;loadLayerGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;vectorGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;chinaBounds&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Bounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;73.30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;135.65&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;52.32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;zoomToExtent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;chinaBounds&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;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;frist_map&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width: 640px; height: 480px ; marging:0 auto&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;查看此示例的实际效果：&lt;a href=&quot;http://demo.yourtion.com/GeoGlobe/DblClick.php&quot;&gt;点击这里看Demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;但是重定义之后其他的鼠标事件也要重构·这些之后再讲··大家多多支持··&lt;/p&gt;
</content>
                 <tag>GeoGlobe</tag>  <tag>天地图</tag> 
                 <tag>天地图二次开发</tag> 
                <pubTime>2011-06-02T12:51:56+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/mysql-database-recovery.html</loc>
        <lastmod>2011-06-01T08:01:02+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>系统崩溃后MySQL数据库恢复手记</title>
                <content>
&lt;p&gt;创E的服务器在前段时间因为硬件问题彻底崩溃了，得到网络中心的支持将服务器迁移到学校刚刚搭建起来的虚拟化平台上，系统和asp+access数据库的网站因为保存在非系统盘所以在第一时间恢复，但是因为MySQL数据库是安装在系统里面，所以数据就一直没有空去弄它。&lt;/p&gt;

&lt;p&gt;今天花了一天时间，重装了N次MySQL Server终于成功将数据库恢复，但是权限问题尚未解决。先记下数据库恢复过程，权限问题稍候再说。&lt;/p&gt;

&lt;p&gt;一开始的做法是在原有系统中将原先保存&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Data&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ibdata1&lt;/code&gt;覆盖到新装的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MySQL Data&lt;/code&gt;目录里面，但是文件虽然变大，但是数据库并没有回来。参考了文章很多资料后，发现&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ibdata1&lt;/code&gt;只是保存了数据库中是数据，但是数据库的表结构是保存在另外的地方。&lt;/p&gt;

&lt;p&gt;重新接上原来的硬盘，在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\data&lt;/code&gt;里面终于找到了原来的数据库结构和表结构文件，还是使用覆盖数据库文件的方式，先停用MySQL，再覆盖，但是之后就再也启动不了MySQL服务了。&lt;/p&gt;

&lt;p&gt;然后尝试重装的时候将数据库的保存目录指定到拷贝出来的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Date&lt;/code&gt;目录，安装后提示原来有数据文件，但是安装最后的配置就在一直没有成功，换了几次MySQL的版本也不行。&lt;/p&gt;

&lt;p&gt;最后采取安装后选择性覆盖，将后期自己建立的表文件和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ibdata1&lt;/code&gt;覆盖后启动成功，终于将数据库文件恢复，但是权限部分没有了。只能自己重建。比较麻烦···&lt;/p&gt;

&lt;p&gt;最后介绍一下MySQL的备份与恢复&lt;/p&gt;

&lt;p&gt;MySql的备份可用命令&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mysqldump&lt;/code&gt; ，使用方法很简单，&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysqldump &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 用户名 &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;密码&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt; 主机名 数据库名 &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;路径/备份名.bak；
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;同时也可以是用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mysqldump&lt;/code&gt;到处数据结构(&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tablename.sql&lt;/code&gt;)和数据(&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tablename.txt&lt;/code&gt;)&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysqldump &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 用户名 &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;密码&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt; 主机名 数据库名 tablename1 tablename2 &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; back.sql
或
mysqldump &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 用户名 &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;密码&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt; 主机名 数据库名 &lt;span class=&quot;nt&quot;&gt;--tab&lt;/span&gt; 路径 &lt;span class=&quot;nt&quot;&gt;--opt&lt;/span&gt; 数据库名.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;例如：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysqldump &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; pivot &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; pivot news &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; c:&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;ews.sql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;那么还原可以mysql命令：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysql &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 用户名 &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;密码&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt; 主机名 &lt;span class=&quot;nt&quot;&gt;--one-database&lt;/span&gt; 还原数据库名 &amp;lt; 路径/备份名.bak,--one-database是指定要恢复的数据库.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;例如：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysql &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; pivot &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; pivot news &amp;lt; c:&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;ews.sql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;(括号表示密码不先输入，在连接时在Enter password;若密码为空可缺省&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-p&lt;/code&gt;参数)&lt;/p&gt;
</content>
                 <tag>MySQL</tag> 
                 <tag>服务器</tag> 
                <pubTime>2011-06-01T08:01:02+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/geoglobe-add-click-event.html</loc>
        <lastmod>2011-05-26T09:45:26+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>天地图GeoGlobe添加单击事件</title>
                <content>
&lt;p&gt;之前写了不少关于天地图的教程，现在天地图的发展还在初步，需要大家多多的努力和支持，感谢“oОО砯崖Оo”开的QQ群：127651254。有兴趣的朋友可以加进来一起讨论天地图开发。&lt;/p&gt;

&lt;p&gt;今天我们讲一下添加单击事件的代码，通过单击事件可以触发你想要做的发生的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;function&lt;/code&gt;。这个代码比较简单，通过添加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;events.register&lt;/code&gt;。然后加入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;function&lt;/code&gt;就OK。&lt;/p&gt;

&lt;p&gt;代码如下：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE html &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.w3.org/1999/xhtml&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;content-type&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/html; charset=utf-8&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/lib/GeoSurfJSAPI.js&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/2d_samples/sampleCfg.js&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onload&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
	     &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PortalMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;frist_map&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	     &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;loadLayerGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;imageGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	     &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setCenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LonLat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;116.12371&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;24.33058&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
		 &lt;span class=&quot;c1&quot;&gt;//触发鼠标单击事件&lt;/span&gt;
  	     &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;events&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;register&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
			&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
				&lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;你干嘛点我？？&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//事件动作Functin内容&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;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;align=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;center&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;frist_map&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width: 640px; height: 480px ; marging:0 auto&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;您查看此示例的实际效果：&lt;a href=&quot;http://demo.yourtion.com/GeoGlobe/click.php&quot;&gt;点击这里看Demo&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>GeoGlobe</tag>  <tag>天地图</tag> 
                 <tag>天地图二次开发</tag> 
                <pubTime>2011-05-26T09:45:26+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/geoglobe-vector-graphics-switch-control.html</loc>
        <lastmod>2011-05-25T09:27:28+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>天地图GeoGlobe矢量绘图-图层开关控件</title>
                <content>
&lt;p&gt;之前介绍了&lt;a href=&quot;/geoglobe-latitude-longitude-scale.html&quot;&gt;《天地图GeoGlobe添加经纬度-比例尺》&lt;/a&gt;，现在继续介绍空间的功能，这次添加矢量绘图空间和图层开关。对地图的应该还是不错的，看看接下来能不能在此基础上做空间分析。&lt;/p&gt;

&lt;p&gt;跟上一次一样，还是很简单的。通过实例化GeoSurf.Control.LayerSwitcher，然加图层开关。然后添加矢量图层，然后在VLayer图层创建编辑工具栏EditingToolbar就可以了···&lt;/p&gt;

&lt;p&gt;代码如下：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.w3.org/1999/xhtml&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;content-type&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/html; charset=utf-8&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/lib/GeoSurfJSAPI.js&quot;&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/2d_samples/sampleCfg.js&quot;&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onload&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
	     &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PortalMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;frist_map&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	     &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;loadLayerGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;imageGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	     &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setCenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LonLat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;116.12371&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;24.33058&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 

		 &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;VLayer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Vector&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;VLayer&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//实例化一个Vector矢量图层VLayer&lt;/span&gt;
         &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addLayers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;VLayer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//在地图上添加VLayer&lt;/span&gt;
		 &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;EditingToolbar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Control&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;EditingToolbar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;VLayer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//在VLayer图层创建编辑工具栏EditingToolbar&lt;/span&gt;
         &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addControl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;EditingToolbar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

		 &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;LayerSwitcher&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Control&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LayerSwitcher&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//实例化图层开关控件LayerSwitcher&lt;/span&gt;
         &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addControl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LayerSwitcher&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;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;frist_map&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width: 640px; height: 480px ; marging:0 auto&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/05/tc.jpg&quot;&gt;&lt;img src=&quot;/images/2011/05/tc.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;查看此示例的实际效果：&lt;a href=&quot;http://demo.yourtion.com/GeoGlobe/control_2.php&quot;&gt;点击这里看Demo&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>GeoGlobe</tag>  <tag>天地图</tag> 
                 <tag>天地图二次开发</tag> 
                <pubTime>2011-05-25T09:27:28+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/geoglobe-add-thumbnail-map.html</loc>
        <lastmod>2011-05-24T15:28:25+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>天地图GeoGlobe添加缩略地图</title>
                <content>
&lt;p&gt;之前在技术群里就聊起怎么创建地图缩略图，感谢群主“oОО砯崖Оo”分享代码，现在我稍微修改注释然后和大家分享一下，事实上有一些函数我也不太明白，今天有博友问起&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GeoSurf.PortalMap&lt;/code&gt;的问题，希望这个实例对你有帮助。&lt;/p&gt;

&lt;p&gt;事实上天地图的开发文档说得不清不楚，只是说了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GeoSurf.Control.OverviewMap&lt;/code&gt;，但是如果单纯初始化是不能显示出缩略图的，要自己用WMS初始化地图，最近再研究有没有简单的方法。&lt;/p&gt;

&lt;p&gt;代码如下：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.w3.org/1999/xhtml&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Content-Type&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/html; charset=utf-8&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;天地图GeoGlobe添加缩略地图DEMO&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/lib/GeoSurfJSAPI.js&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/2d_samples/sampleCfg.js&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onload&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ol_wms&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;WMS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//创建一个WFS图层&lt;/span&gt;
                    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;OpenLayers WMS&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//WMS服务类型&lt;/span&gt;
                    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;http://vmap0.tiles.osgeo.org/wms/vmap0&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//WMS服务地址&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;layers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;basic&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//设置为基础层&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
				&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;oLayer1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;GlobeTile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;aaaa&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;http://tile0.tianditu.com/services/A0512_EMap&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,{&lt;/span&gt;
					&lt;span class=&quot;na&quot;&gt;isBaseLayer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
					&lt;span class=&quot;na&quot;&gt;topLevel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&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;na&quot;&gt;bottomLevel&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;p&quot;&gt;,&lt;/span&gt;
					&lt;span class=&quot;na&quot;&gt;maxExtent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Bounds&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;mi&quot;&gt;180&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;mi&quot;&gt;90&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;180&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;90&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;oLayer2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;GlobeTile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;bbbb&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;http://tile0.tianditu.com/services/AB0512_Anno&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,{&lt;/span&gt;					
					&lt;span class=&quot;na&quot;&gt;topLevel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&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;na&quot;&gt;bottomLevel&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;p&quot;&gt;,&lt;/span&gt;
					&lt;span class=&quot;na&quot;&gt;maxExtent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Bounds&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;mi&quot;&gt;180&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;mi&quot;&gt;90&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;180&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;90&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;myOverVies&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Control&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;OverviewMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;layers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;oLayer1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;oLayer2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]});&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//定义地图鸟瞰控件&lt;/span&gt;

			&lt;span class=&quot;c1&quot;&gt;//在构造地图对象的时候，单独指定加载的控件&lt;/span&gt;
            &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PortalMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;frist_map&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,{&lt;/span&gt;
                &lt;span class=&quot;na&quot;&gt;controls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;myOverVies&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Control&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PanZoom&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;p&quot;&gt;});&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;//加载地图&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;loadLayerGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;imageGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
		    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;jyuBounds&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Bounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;116.11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;24.33&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;116.12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;24.32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
		    &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;zoomToExtent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;jyuBounds&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;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;frist_map&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width: 640px; height: 480px ; marging:0 auto&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/05/GeoGlobeOverView.jpg&quot;&gt;&lt;img src=&quot;/images/2011/05/GeoGlobeOverView.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;您查看此示例的实际效果：&lt;a href=&quot;http://demo.yourtion.com/GeoGlobe/overView.php&quot;&gt;点击这里看Demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;其中很多东西都是在天地图的API参考中找不到的。大家可能要去研究它本身的JS文件。对这方面感兴趣的可以加&lt;strong&gt;QQ群：127651254&lt;/strong&gt;。一起研究&lt;/p&gt;

</content>
                 <tag>GeoGlobe</tag>  <tag>天地图</tag> 
                 <tag>天地图二次开发</tag> 
                <pubTime>2011-05-24T15:28:25+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/geoglobe-latitude-longitude-scale.html</loc>
        <lastmod>2011-05-21T16:57:37+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>天地图GeoGlobe添加经纬度-比例尺</title>
                <content>
&lt;p&gt;之前已经介绍了&lt;a href=&quot;/geoglobe-add-popup-box.html&quot;&gt;《天地图GeoGlobe添加Popup弹出框》&lt;/a&gt;和&lt;a href=&quot;/geoglobe-map-marker.html&quot;&gt;《天地图GeoGlobe创建地图标记Marker》&lt;/a&gt;，现在介绍一下在矢量地图上加上当前鼠标经纬度和当前地图比例尺的控件。&lt;/p&gt;

&lt;p&gt;通过实例化&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Control&lt;/code&gt;下的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MousePosition()&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Scale&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ScaleLine&lt;/code&gt;，然后添加到地图或者DIV中实现。&lt;/p&gt;

&lt;p&gt;代码如下：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.w3.org/1999/xhtml&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;content-type&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/html; charset=utf-8&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/lib/GeoSurfJSAPI.js&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/2d_samples/sampleCfg.js&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
	   &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;initialize&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PortalMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;frist_map&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	     &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;loadLayerGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;vectorGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	     &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setCenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LonLat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;116.12371&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;24.33058&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;c1&quot;&gt;//Control&lt;/span&gt;
	    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mousePositionCtrl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Control&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;MousePosition&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//初始化鼠标定位的控件&lt;/span&gt;
		&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addControl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mousePositionCtrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Scale&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Control&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Scale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;sc&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//在id为sc的DIV上显示一个小的比例尺指示器&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addControl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Scale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ScaleLine&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Control&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ScaleLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//显示小的线指示器用来表示当前地图的比例尺&lt;/span&gt;
         &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addControl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ScaleLine&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;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;onload=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;initialize()&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;align=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;center&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;frist_map&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width: 640px; height: 480px ; marging:0 auto&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;sc&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/05/GeoGlobe_Control.jpg&quot;&gt;&lt;img src=&quot;/images/2011/05/GeoGlobe_Control.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;您查看此示例的实际效果：&lt;a href=&quot;http://demo.yourtion.com/GeoGlobe/control_1.php&quot;&gt;点击这里看Demo&lt;/a&gt;&lt;/p&gt;

</content>
                 <tag>GeoGlobe</tag>  <tag>天地图</tag> 
                 <tag>天地图二次开发</tag> 
                <pubTime>2011-05-21T16:57:37+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/php-start-end-week-per-year.html</loc>
        <lastmod>2011-05-20T08:55:19+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>用PHP获取一年中每星期的开始结束日期</title>
                <content>
&lt;p&gt;最近项目中需要做个提交周报的功能，需要知道指定周数的开始日期和结束日期，以便处理其他业务。以下是一段通过PHP来获取一年中的每星期的开始日期和结束日期的代码，与大家分享。&lt;/p&gt;

&lt;p&gt;以下是一段通过PHP来获取一年中的每星期的开始日期和结束日期的代码。&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;get_week&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$year&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;nv&quot;&gt;$year_start&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$year&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-01-01&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$year_end&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$year&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-12-31&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$startday&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;strtotime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$year_start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;intval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'N'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$startday&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;s1&quot;&gt;'1'&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;nv&quot;&gt;$startday&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;strtotime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;nextmonday&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;strtotime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$year_start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//获取年第一周的日期&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$year_mondy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Y-m-d&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$startday&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//获取年第一周的日期&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$endday&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;strtotime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$year_end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;intval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'W'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$endday&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;s1&quot;&gt;'7'&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;nv&quot;&gt;$endday&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;strtotime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;lastsunday&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;strtotime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$year_end&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;nv&quot;&gt;$num&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;intval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'W'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$endday&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&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;nv&quot;&gt;$i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$num&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$i&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;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&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;nv&quot;&gt;$start_date&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Y-m-d&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;strtotime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$year_mondy&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$j&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; week &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$end_day&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Y-m-d&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;strtotime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$start_date&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; +6 day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$week_array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&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;k&quot;&gt;array&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$start_date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$end_day&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$week_array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;函数get_week()通过传入参数$year年份，获取当年第一天和最后一天所在的周数，计算第一周的日期，通过循环获取每一周的第一天和最后一天的日期。最后返回是一个数组。
想得到指定周数的开始日期和结束日期，比如2011年第18周的开始日期和结束日期，代码如下：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$weeks&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_week&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2011&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'第18周开始日期：'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$weeks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&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;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'第18周结束日期：'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$weeks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最后输出结果：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;第18周开始日期：2011.05.02&lt;/li&gt;
  &lt;li&gt;第18周结束日期：2011.05.08&lt;/li&gt;
&lt;/ol&gt;
</content>
                
                 <tag>PHP</tag> 
                <pubTime>2011-05-20T08:55:19+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/chrome-plugin-development-html.html</loc>
        <lastmod>2011-05-17T10:16:33+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>用HTML开发Chrome插件入门</title>
                <content>
&lt;p&gt;最近女朋友也用上Chrome了，想到给我们的情侣微博也来个Chrome插件，这次初步的插件开发，发现过程还是比较简单，有HTML和Javascript基础的朋友，都能开发出属于自己的Chrome插件。&lt;/p&gt;

&lt;h3 id=&quot;插件开发流程&quot;&gt;插件开发流程&lt;/h3&gt;

&lt;p&gt;1.开发语言和软件&lt;/p&gt;

&lt;p&gt;开发语言就是HTML和Javascript，开发软件选择一款自己熟悉的纯文本编辑器就可以了，例如系统自带的记事本，或者支持语法高亮的Notpad++。&lt;/p&gt;

&lt;p&gt;2.设计插件&lt;/p&gt;

&lt;p&gt;一个完整的插件是由4个部分组成，分别是manifest.json、.js文件、图标和HTML文件，设计插件就是设计这4类文件。manifest.json的作用是定义插件的属性，例如名称、版本、类型等;HTML文件具体实现插件的功能;.js文件是一个跟浏览器互动的脚本。&lt;/p&gt;

&lt;p&gt;3.载入插件&lt;/p&gt;

&lt;p&gt;设计好上面几个文件后，就可以将插件载入浏览器中试用一下。首先将它们整理到同一个文件夹中，然后在Chrome的工具栏中选择“扩展程序”，进入扩展管理页，在右侧选择“开发人员模式”，再点击“载入正在开发的扩展程序”按钮，定位到这个文件夹，将整个文件夹载入Chrome中。&lt;/p&gt;

&lt;p&gt;4.发布插件&lt;/p&gt;

&lt;p&gt;插件试用没有问题后，不妨将它发布出去让更多人使用。首先将插件所在的文件夹压缩成一个ZIP文件(别顺手压缩成了RAR文件)。然后再到扩展管理页，点击右下角的“获得更多扩展程序”链接，进入Chrome官方插件下载页面，在这个网页的左下角，你能看到“发布扩展程序”的链接，点击链接，上传ZIP压缩文件、添加插件的使用说明和截图，就可以发布插件了。&lt;/p&gt;

&lt;h3 id=&quot;组成结构&quot;&gt;组成结构&lt;/h3&gt;

&lt;p&gt;Chrome插件最基本的三个文件为：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;icon.png: 用于在插件工具栏上显示图标，文件名可以自定义，19*19；&lt;/li&gt;
  &lt;li&gt;manifest.json: 控制整个插件行为的配置文件，该文件需要保存成UTF-8格式；&lt;/li&gt;
  &lt;li&gt;popup.html: 点击插件图标后弹出的窗口，是插件的主界面，文件名可以自定义。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;如果希望插件结构更完善，还可以包含如下文件/目录：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;imgs目录：存放插件中使用的图片；&lt;/li&gt;
  &lt;li&gt;css目录：存放CSS文件；&lt;/li&gt;
  &lt;li&gt;js目录：存放JS文件；&lt;/li&gt;
  &lt;li&gt;background.html: 插件的后台程序，其不会因为popup.html窗口消失而停止运行。&lt;/li&gt;
  &lt;li&gt;icon_128.png: 在插件描述中作为插件的Logo，128*128。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;manifest.json&lt;/code&gt; 为整个插件的主控文件，基本功能描述如下：&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;GroovyQ Ask Question&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;//名称&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0.1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;//版本号&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;提交Groovy/Grails问题！&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;//描述信息，会显示在插件属性里&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;browser_action&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;default_icon&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;groovyq.jpg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;//指定插件图标的路径&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;popup&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;popup.html&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;指定&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;popup.html&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;文件的路径&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;

    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;permissions&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;http://www.groovyq.net/&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;//此权限支持向xxxx发送&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;Ajax&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;请求&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;popup.html&lt;/code&gt;为整个插件的界面，框架如下：&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Content-Type&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/html; charset=UTF-8&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;link&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rel=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;stylesheet&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;main.css&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;&amp;lt;!-- 注意js代码的路径，下面访问的是与popup.html同级目录的groovyq.js --&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;./groovyq.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;......&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
   ......
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;关于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Background.html&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;popup.html&lt;/code&gt;中定义的JavaScript变量会在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;popup.html&lt;/code&gt;页面关闭时被释放，如何保存全局变量呢？这时可以使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;background.html&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;background.html&lt;/code&gt;页面中定义的javascript变量会在Chrome浏览器生命期中一直存在，因此把全局变量放在这里是最合适的了。&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;//Background.html中定义变量&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;global_url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;global_type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//在popup.html中读取上述变量或赋值&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;backpg&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;chrome&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;extension&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getBackgroundPage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;backpg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;global_url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;http://www.groovyq.net&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;backpg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;global_type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;blog&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;对于数据保存，还可以使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HTML5&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localStorage&lt;/code&gt;：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;//保存&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;localStorage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;nx&quot;&gt;golbal_url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;localStorage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&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;nx&quot;&gt;global_type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//取值&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;global_url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;localStorage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;global_type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;localStorage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;插件调试发布&quot;&gt;插件调试/发布&lt;/h3&gt;

&lt;p&gt;插件开发中，可以使用任何浏览器打开popup.html进行调试。但若是用到一些Chrome的特性，就需要在Chrome上进行调试。&lt;/p&gt;

&lt;p&gt;安装插件：Chrome中，单击工具栏的扳手按钮，选择&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;工具&lt;/code&gt; -》&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;扩展程序&lt;/code&gt;，在出现的页面中单击：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;开发人员模式&lt;/code&gt; -》&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;载入正在开发的扩展程序&lt;/code&gt;，选择插件的根目录，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;确定&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;在扩展程序列表中会出现插件的相关信息，而在Chrome的工具栏中也能看到插件图标，单击图标，弹出的就是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;popup.html&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;如果修改插件程序，只需单击插件描述信息下方的“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;重新载入&lt;/code&gt;”，修改就会生效。你还可以在此对插件执行停用/卸载等操作。&lt;/p&gt;

&lt;p&gt;插件开发结束后，可以打包插件分发给更多人享用你的插件。可以选择“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;打包扩展程序&lt;/code&gt;”，填入插件根目录以及私有密钥，之后在https://chrome.google.com/extensions 发布你的程序即可。&lt;/p&gt;
</content>
                 <tag>HTML</tag> 
                 <tag>HTML</tag> 
                <pubTime>2011-05-17T10:16:33+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/wordpress-colorful-tag-cloud.html</loc>
        <lastmod>2011-04-28T14:13:34+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress3.1实现五彩标签云</title>
                <content>
&lt;p&gt;标签云（&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Tag Cloud&lt;/code&gt;）是自WordPress 2.3+ 以来的内置功能，一般直接调用函数 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp_tag_cloud&lt;/code&gt; 或者在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Widgets&lt;/code&gt; 里开启即可，但是默认的全部是一个颜色，只是大小不一样，很是不顺眼，虽然可以用插件实现各种效果，但是就觉得爽，所以我在Wordpress3.1下自己动手，参考之前的一下文章，自制五彩标签云。&lt;/p&gt;

&lt;p&gt;后台编辑主题的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;functions.php&lt;/code&gt;, 插入以下代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;colorCloud&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$text&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;nv&quot;&gt;$text&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;preg_replace_callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'|&amp;lt;a (.+?)&amp;gt;|i'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'colorCloudCallback'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
	&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$text&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;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;colorCloudCallback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$matches&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;nv&quot;&gt;$text&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$matches&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;nv&quot;&gt;$color&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;dechex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;rand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;mi&quot;&gt;16777215&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt; 
	&lt;span class=&quot;nv&quot;&gt;$pattern&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/style=(\'|\&quot;)(.*)(\'|\&quot;)/i'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
	&lt;span class=&quot;nv&quot;&gt;$text&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;preg_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pattern&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;style=&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color:#&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$color&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;;$2;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
	&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;a &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$text&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;gt;&quot;&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;nf&quot;&gt;add_filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'wp_tag_cloud'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'colorCloud'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;可以看到，颜色是随机的，可以自行修改 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$color = dechex(rand(0,16777215))&lt;/code&gt;;  这行来修改范围，这样就很炫耀哈哈。&lt;/p&gt;

&lt;p&gt;然后在侧边栏 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sidebar.php&lt;/code&gt; 里调用如下代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wp_tag_cloud&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'smallest=9&amp;amp;largest=25&amp;amp;number=60'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;即可，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;9&lt;/code&gt; 是最小的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tag&lt;/code&gt; 的字体大小（用的最少的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tag&lt;/code&gt;），&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;25&lt;/code&gt;是最大的（用的最多的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tag&lt;/code&gt;），&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;60&lt;/code&gt; 是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tag&lt;/code&gt; 的数目，可以自行修改。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/04/tag.jpg&quot;&gt;&lt;img src=&quot;/images/2011/04/tag.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2011-04-28T14:13:34+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/android-sdk-off-line-installation.html</loc>
        <lastmod>2011-04-25T08:46:41+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Android SDK离线安装方法详解(加速安装)更新中</title>
                <content>
&lt;p&gt;AndroidSDK在国内下载一直很慢··有时候通宵都下不了一点点，最后只有选择离线安装，现在发出离线安装地址和方法，希望对大家有帮助！&lt;/p&gt;

&lt;h3 id=&quot;离线安装包下载地址httpdlvmallcomc0m7f1w8rq&quot;&gt;离线安装包下载地址：&lt;a href=&quot;http://dl.vmall.com/c0m7f1w8rq&quot;&gt;http://dl.vmall.com/c0m7f1w8rq&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;一，首先下载SDK的安装包，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;android-sdk_r10-windows.zip&lt;/code&gt;（安装工具）解压到目录，如我的目录&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D:\programs\android-sdk-windows&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;下载地址：http://dl.google.com/android/android-sdk_r10-windows.zip（目前最新版）&lt;/p&gt;

&lt;p&gt;二，然后新建以下 几个文件夹&lt;/p&gt;

&lt;p&gt;包括&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;platforms&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docs&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;samples&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;usb_driver&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;market_licensing&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;三，删除&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tools&lt;/code&gt;全部内容&lt;/p&gt;

&lt;p&gt;这一步是可选的，因为tools内容可能已经过时，也可能仍然可用。&lt;/p&gt;

&lt;p&gt;四，解压文档到指定目录&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;android&lt;/code&gt;开头的文件解压到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;platforms&lt;/code&gt;目录下&lt;/li&gt;
  &lt;li&gt;把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;goole_apis&lt;/code&gt;开头的文件解压到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;add-ons&lt;/code&gt;目录下&lt;/li&gt;
  &lt;li&gt;把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;market_licensing-r01.zip&lt;/code&gt;解压到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;market_licensing&lt;/code&gt;目录下&lt;/li&gt;
  &lt;li&gt;把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tools_r07-windows.zip&lt;/code&gt;解压到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tools&lt;/code&gt;目录下（前面清空了该文件夹）&lt;/li&gt;
  &lt;li&gt;把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docs-2.2_r01-linux.zip&lt;/code&gt;解压到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docs&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;samples-2.2_r01-linux.zip&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;samples-2.1_r01-linux.zip&lt;/code&gt;解压到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;samples&lt;/code&gt;目录下&lt;/li&gt;
  &lt;li&gt;把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;usb_driver_r03-windows.zip&lt;/code&gt;解压到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;usb_driver&lt;/code&gt;目录下。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;基本上安装工作就完成了。&lt;/p&gt;

&lt;p&gt;再打开SDK &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Setup.ext&lt;/code&gt;发现，它会找到我们已经安装的内容。&lt;/p&gt;

&lt;p&gt;不过，可以也会有内容要更新或者安装，因为你看到该文章时，有可能已经有了更新的内容。&lt;/p&gt;

&lt;p&gt;然后，将你的安装目录&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/tools&lt;/code&gt;加到系统环境变量，把安装目录加到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Android_Home&lt;/code&gt;。就完成了整个安装。&lt;/p&gt;

&lt;p&gt;五、配置SDK环境变量&lt;/p&gt;

&lt;p&gt;以我安装的路径为例（&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D:\programs\android-sdk-windows&lt;/code&gt;）。&lt;/p&gt;

&lt;p&gt;在设置系统环境变量的地方新建ANDROID_HOME（右键点击我的电脑–&amp;gt;属性–&amp;gt;高级–&amp;gt;环境变量–&amp;gt;系统变量–&amp;gt;新建，注意是“系统变量”而不是“Administrator的用户变量”）&lt;/p&gt;

&lt;p&gt;1）&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ANDROID_HOME=D:\programs\android-sdk-windows&lt;/code&gt;（android sdk所在目录）；&lt;/p&gt;

&lt;p&gt;2）在 path 中加入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;%ANDROID_HOME%\tools&lt;/code&gt;，注意不要改变其他文件路径，只需在分号后面加入。&lt;/p&gt;

&lt;h3 id=&quot;附sdk原始下载地点&quot;&gt;附：SDK原始下载地点&lt;/h3&gt;

&lt;p&gt;打开下载工具（迅雷，电驴等等），下载以下内容。谷歌api的安装包&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;文件&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;下载地址&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Tools, revision 10&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/tools_r10-windows.zip&quot;&gt;http://dl-ssl.google.com/android/repository/tools_r10-windows.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Platform-tools, revision 3&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/platform-tools_r03-windows.zip&quot;&gt;http://dl-ssl.google.com/android/repository/platform-tools_r03-windows.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Docs for Android API 11, revision 1&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/docs-3.0_r01-linux.zip&quot;&gt;http://dl-ssl.google.com/android/repository/docs-3.0_r01-linux.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Platform 3.0, revision 1&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/android-3.0_r01-linux.zip&quot;&gt;http://dl-ssl.google.com/android/repository/android-3.0_r01-linux.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Platform 2.3.3._r1 Revision 1&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/android-2.3.3_r01-linux.zip&quot;&gt;http://dl-ssl.google.com/android/repository/android-2.3.3_r01-linux.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Platform 2.3.1_r2 Revision 2 (Obsolete)&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/android-2.3.1_r02-linux.zip&quot;&gt;http://dl-ssl.google.com/android/repository/android-2.3.1_r02-linux.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Platform 2.2_r1 Revision 2&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/android-2.2_r02-windows.zip&quot;&gt;http://dl-ssl.google.com/android/repository/android-2.2_r02-windows.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Platform 2.1_r2 Revision 2&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/android-2.1_r02-windows.zip&quot;&gt;http://dl-ssl.google.com/android/repository/android-2.1_r02-windows.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Platform 1.6_r2 Revision 3&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/android-1.6_r03-windows.zip&quot;&gt;http://dl-ssl.google.com/android/repository/android-1.6_r03-windows.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Platform 1.5_r3 Revision 4&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/android-1.5_r04-windows.zip&quot;&gt;http://dl-ssl.google.com/android/repository/android-1.5_r04-windows.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Samples for Android API 11, revision 1&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/samples-3.0_r01-linux.zip&quot;&gt;http://dl-ssl.google.com/android/repository/samples-3.0_r01-linux.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Samples for Android API 10, revision 1&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/samples-2.3.3_r01-linux.zip&quot;&gt;http://dl-ssl.google.com/android/repository/samples-2.3.3_r01-linux.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Samples for Android API 9, revision 1&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/samples-2.3_r01-linux.zip&quot;&gt;http://dl-ssl.google.com/android/repository/samples-2.3_r01-linux.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Samples for Android API 8, revision 1&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/samples-2.2_r01-linux.zip&quot;&gt;http://dl-ssl.google.com/android/repository/samples-2.2_r01-linux.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android SDK Samples for Android API 7, revision 1&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/samples-2.1_r01-linux.zip&quot;&gt;http://dl-ssl.google.com/android/repository/samples-2.1_r01-linux.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android + Google APIs, API 11, revision 1&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/google_apis-11_r01.zip&quot;&gt;http://dl-ssl.google.com/android/repository/google_apis-11_r01.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android + Google APIs, API 10, revision 1&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/google_apis-10_r01.zip&quot;&gt;http://dl-ssl.google.com/android/repository/google_apis-10_r01.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android + Google APIs, API 9, revision 2&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/google_apis-9_r02.zip&quot;&gt;http://dl-ssl.google.com/android/repository/google_apis-9_r02.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android + Google APIs, API 8, revision 2&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/google_apis-8_r02.zip&quot;&gt;http://dl-ssl.google.com/android/repository/google_apis-8_r02.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android + Google APIs, API 7, revision 1&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/google_apis-7_r01.zip&quot;&gt;http://dl-ssl.google.com/android/repository/google_apis-7_r01.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android + Google APIs, API 4, revision 2&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/google_apis-4_r02.zip&quot;&gt;http://dl-ssl.google.com/android/repository/google_apis-4_r02.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Android + Google APIs, API 3, revision 3&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;http://dl-ssl.google.com/android/repository/google_apis-3-r03.zip&quot;&gt;http://dl-ssl.google.com/android/repository/google_apis-3-r03.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Google USB Driver package, revision 4&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;a href=&quot;https://dl-ssl.google.com/android/repository/usb_driver_r04-windows.zip&quot;&gt;https://dl-ssl.google.com/android/repository/usb_driver_r04-windows.zip&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;strong&gt;Dbank下载地址：&lt;a href=&quot;http://dl.vmall.com/c0m7f1w8rq&quot;&gt;http://dl.vmall.com/c0m7f1w8rq&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;如果是Linux平台的朋友，请把windows统一改为linux即可，mac平台的朋友改为macosx即可。&lt;/p&gt;

&lt;p&gt;需要说明的是，文档和样例都是同样的地址&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docs-2.2_r01-linux.zip&lt;/code&gt;,&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;samples-2.2_r01-linux.zip&lt;/code&gt;,&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;samples-2.1_r01-linux.zip&lt;/code&gt;。&lt;/p&gt;
</content>
                 <tag>Android</tag>  <tag>SDK</tag> 
                 <tag>Android</tag> 
                <pubTime>2011-04-25T08:46:41+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/routing-table-vpn-analysis.html</loc>
        <lastmod>2011-04-24T08:57:51+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>添加路由表加速VPN和恢复内网连接原理浅析</title>
                <content>
&lt;p&gt;前面介绍了&lt;a href=&quot;/routing-table-speed-up-vpn.html&quot;&gt;《用路由表让VPN内网访问正常、省流量、加速VPN》&lt;/a&gt;，但是我自己是在局域网，所以顺便研究一下PPTP接入VPN和Windows路由表结合加速的原理，加深对二层隧道协议的认识。&lt;/p&gt;

&lt;p&gt;首先我们先看一下连接VPN前后访问facebook的tracert结果：&lt;/p&gt;

&lt;p&gt;未连接VPN前：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Tracing route to facebook.com &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;159.106.121.75]
over a maximum of 30 hops:
  1    &amp;lt;1 ms    &amp;lt;1 ms    &amp;lt;1 ms  192.168.200.1 
  2     2 ms     1 ms     1 ms  210.38.163.142 
  3     7 ms    10 ms     9 ms  210.38.163.174 
  4    20 ms    13 ms    27 ms  221.5.72.137 
  5    11 ms    11 ms    10 ms  120.80.189.9 
  6    17 ms    18 ms    17 ms  120.80.4.125 
  7     &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;     Request timed out.
  8     &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;     Request timed out.
  9     &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;     Request timed out.
 10     &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;     Request timed out.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;连接VPN后：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Tracing route to facebook.com &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;69.63.181.12]
over a maximum of 30 hops:
  1   262 ms   268 ms   268 ms  172.16.1.1 
  2   262 ms   256 ms   255 ms  74.117.56.129 
  3   252 ms     &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;     65.19.176.69 
  4   293 ms   286 ms   290 ms  72.52.92.122 
  5   278 ms   277 ms   273 ms  206.223.143.161 
  6   277 ms   282 ms     &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;     204.15.21.162 
  7     &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;      283 ms  204.15.21.171 
  8   272 ms   278 ms   279 ms  74.119.79.243 
  9   278 ms   274 ms   278 ms  69.63.181.12 
Trace complete.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;可以看到连接VPN后第一跳就发生了变化，由原来的192.168.200.1变成172.16.1.1。后来的就不言而喻了。&lt;/p&gt;

&lt;p&gt;再看一下路由表：&lt;/p&gt;

&lt;p&gt;连接VPN前：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Destination  Netmask    Gateway        Interface        Metric
0.0.0.0      0.0.0.0    192.168.200.1  192.168.203.64	20
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;默认路由是192.168.200.1&lt;/p&gt;

&lt;p&gt;连接VPN后：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Destination   Netmask  Gateway     Interface   Metric
0.0.0.0       0.0.0.0  172.16.1.3  172.16.1.3	  1
0.0.0.0       0.0.0.0  192.168.200.1  192.168.203.64     21
192.168.0.0   255.255.0.0 192.168.200.1  192.168.203.64  5
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;默认路由有了两条，但是172.16.1.3的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Metric&lt;/code&gt;比192.168.200.1的小，根据路由选择的原理，除非172.16.1.3失效，否则默认出口都为172.16.1.3。&lt;/p&gt;

&lt;p&gt;但是细心的人会发现，我们添加用于加速和内网的路由的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Metric&lt;/code&gt;是5，比起默认路由的要小，为什么连接内网会选择后面的路由呢。&lt;/p&gt;

&lt;p&gt;这样又要从路由选择讲起。路由表中明细的路由（静态路由）时，就会先找明细路由，在明细中找不到路由时，就走默认的。&lt;/p&gt;

&lt;p&gt;地址掩码越小、精度越高，就匹配哪个！！！&lt;/p&gt;

&lt;p&gt;比如同样的目标地址，192.168.1.0/25就比192.168.1.0/24优先！！！&lt;/p&gt;

&lt;p&gt;我们添加的路由精度较默认路由高，所以就走我们添加的路由。&lt;/p&gt;

&lt;p&gt;这就是我个人的见解，有什么错误的还请高手指正&lt;/p&gt;
</content>
                 <tag>VPN</tag> 
                 <tag>杂杂的</tag> 
                <pubTime>2011-04-24T08:57:51+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/routing-table-speed-up-vpn.html</loc>
        <lastmod>2011-04-23T13:59:54+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>用路由表让VPN内网访问正常、省流量、加速VPN</title>
                <content>
&lt;p&gt;由于连接上VPN后，默认所有流量都会走VPN线路，导致了内网访问不正常，而且如果你的VPN是限制流量的话，流量很快会被用完，所以为了访问国内网络速度不变，可以使用设置路由表的方法解决，但是为了使用VPN加密及匿名的话，就没有必要设置路由表了。&lt;/p&gt;

&lt;p&gt;其中Google项目在这里http://code.google.com/p/chnroutes，有兴趣的可以研究下，包括各个平台的设置方法。&lt;/p&gt;

&lt;p&gt;VPN的话推荐这个：&lt;a href=&quot;http://vcup.in/erb&quot;&gt;http://vcup.in/erb&lt;/a&gt; 或者&lt;a href=&quot;http://goo.gl/ysLiI&quot;&gt;http://goo.gl/ysLiI&lt;/a&gt; 。没有速度限制，很快··以后会详细介绍&lt;/p&gt;

&lt;p&gt;以下在Windows平台下添加路由表的批处理文件。&lt;a href=&quot;http://dl.dbank.com/c002b08rmf&quot;&gt;脚本文件下载&lt;/a&gt;—脚本提取生成日期2011-2-13&lt;/p&gt;

&lt;p&gt;使用方法介绍：&lt;/p&gt;

&lt;p&gt;其中包括2个文件，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vpnadd.bat&lt;/code&gt;文件是添加路由表文件，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vpndel.bat&lt;/code&gt;文件是删除路由表文件，脚本提取生成来自http://ftp.apnic.net/apnic/dbase/data/country-ipv4.lst，但是最后四个网段是用来登录MSN的（注意：win7及vista需要管理员权限执行批处理文件），以下分两种情况设置：&lt;/p&gt;

&lt;p&gt;1：当使用路由上网（非拨号，指设置网关来上网的）&lt;/p&gt;

&lt;p&gt;修改&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vpnadd.bat&lt;/code&gt;的“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set gw=192.168.1.1&lt;/code&gt;”，将192.168.1.1替换成你的网关，然后执行一次就OK了。&lt;/p&gt;

&lt;p&gt;由于添加的路由信息使用的是“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;route add&lt;/code&gt;”命令，所以重新开机后添加的路由表会消失，可以把“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;route add&lt;/code&gt;”修改为“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;route -p add&lt;/code&gt;”，这样就可以不用每次开机都执行批处理文件了，当然是可以使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vpndel.bat&lt;/code&gt;删除以上添加的路由表的，但是理论上不删也是不影响到什么。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://dl.dbank.com/c0etfq7mg0&quot;&gt;永久路由批处理&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2：当使用的是拨号上网，会有点麻烦。&lt;/p&gt;

&lt;p&gt;修改&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vpnadd.bat&lt;/code&gt;的“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set gw=192.168.1.1&lt;/code&gt;”，将192.168.1.1替换成你的IP地址。&lt;/p&gt;

&lt;p&gt;而且当你的上网IP变了之后.需要更新路由表。也就是需要删除原来的路由表。&lt;/p&gt;

&lt;p&gt;可以手工操作，方法是进入运行下面的命令&lt;/p&gt;

&lt;p&gt;“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;route del 之前上网的IP&lt;/code&gt;”&lt;/p&gt;

&lt;p&gt;并更改批处理文件后，重新执行一次…&lt;/p&gt;
</content>
                 <tag>VPN</tag> 
                 <tag>网络工程</tag> 
                <pubTime>2011-04-23T13:59:54+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/google-analytics-for-android.html</loc>
        <lastmod>2011-04-21T19:52:43+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>站长的福音Google Analytics for Android</title>
                <content>
&lt;p&gt;作为站长肯定想时刻了解自己网站的各方面的情况，看到很多IPhone、iPad用户有好多相应的应用，用Android的我感到心理不平衡，找了一下，发现谷歌分析Google Analytics原来有人开发了Android客户端，马上来与大家分享，希望对各个站长有帮助，这个软件就是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GAnalyticz&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;GAnalyticz是一个简单而快速的谷歌分析Android的移动设备客户端。获得在预定义或自定义日期范围的不同的配置文件的报告。您还可以定义的尺寸/指标，以显示该报告，并添加多个帐户。
该报告显示在选定的配置文件和日期范围的统计信息。Internet请求是通过SSL安全连接。您的帐户凭据存储在数据库中在您的密码将加密的。&lt;/p&gt;

&lt;p&gt;好了，上图说话：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/04/GAnalyticz-0.jpg&quot;&gt;&lt;img src=&quot;/images/2011/04/GAnalyticz-0.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/04/GAnalyticz-1.jpg&quot;&gt;&lt;img src=&quot;/images/2011/04/GAnalyticz-1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/04/GAnalyticz-2.jpg&quot;&gt;&lt;img src=&quot;/images/2011/04/GAnalyticz-2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/04/GAnalyticz-3.jpg&quot;&gt;&lt;img src=&quot;/images/2011/04/GAnalyticz-3.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/04/GAnalyticz-4.jpg&quot;&gt;&lt;img src=&quot;/images/2011/04/GAnalyticz-4.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/04/GAnalyticz-5.jpg&quot;&gt;&lt;img src=&quot;/images/2011/04/GAnalyticz-5.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;下载地址：&lt;a href=&quot;http://android.aquasonic.ch/ganalyticz&quot;&gt;http://android.aquasonic.ch/ganalyticz&lt;/a&gt;&lt;/p&gt;

</content>
                 <tag>Android</tag> 
                 <tag>Android</tag> 
                <pubTime>2011-04-21T19:52:43+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/linux-drcom-802-1x-solution.html</loc>
        <lastmod>2011-04-16T23:16:53+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Linux下Dr.com(802.1x)拨号上网完美解决(Ubantu)</title>
                <content>
&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;802.1x&lt;/code&gt;下的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Dr.com&lt;/code&gt;在Linux拨号一直是大家头痛并难以解决的问题，以前在Ubantu下研究安装Dr.com的客户端但是都因为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;802.1x&lt;/code&gt;的端口认证问题而失败告终，现在终于搞定了完美解决的方法。现在与大家分享，一起交流。&lt;/p&gt;

&lt;p&gt;这次使用的是第三方开发的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MentoHUST&lt;/code&gt;，因为官方的锐捷Linux版久无更新，使用官方程序很多同学无法通过认证，有些能通过但容易掉线。虽然网上第三方Linux版锐捷客户端不少，但都大同小异，不能通过锐捷的客户端校验。而MentoHUST提供一个Linux下与锐捷兼容性很好的认证客户端，方便使用Linux和锐捷的同学使用校园网。&lt;/p&gt;

&lt;p&gt;使用方法很简单，因为我的实验环境所&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ubantu&lt;/code&gt;物理机，所以只要安装deb包，然后做一下配置，最后运行即可。&lt;/p&gt;

&lt;p&gt;安装deb包成功后在终端中输入：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; 
&lt;span class=&quot;c&quot;&gt;#取得root权限&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$sudo&lt;/span&gt; mentuhust 
&lt;span class=&quot;c&quot;&gt;#运行软件，初次安装后需要初始设置，帐号密码同XP，网卡选择“1”，剩余两项填“0”。&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;#修改设置可以运行：&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$sudo&lt;/span&gt; gedit /etc/mentohust.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;开始登陆&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/04/1.png&quot;&gt;&lt;img src=&quot;/images/2011/04/1.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;让人烦恼的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;802.1x&lt;/code&gt;认证就这样搞定了`````&lt;/p&gt;

&lt;p&gt;开始上网冲浪吧&lt;/p&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MentoHUST&lt;/code&gt;的下载和其他Linux版本的编译请看&lt;a href=&quot;http://code.google.com/p/mentohust/&quot;&gt;http://code.google.com/p/mentohust/&lt;/a&gt;&lt;/p&gt;

</content>
                 <tag>Linux</tag> 
                 <tag>VPS</tag> 
                <pubTime>2011-04-16T23:16:53+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/geoglobe-add-popup-box.html</loc>
        <lastmod>2011-04-11T19:49:41+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>天地图GeoGlobe添加Popup弹出框</title>
                <content>
&lt;p&gt;前面我们已经介绍了如何在天地图中添加地图标记Marker，详见&lt;a href=&quot;/geoglobe-map-marker.html&quot;&gt;《天地图GeoGlobe创建地图标记Marker》&lt;/a&gt;，现在我们在地图标记的基础上添加Popup弹出框，弹出地图标记的相应信息。这次还是以刚落成的“活活艺术教育中心”为例，弹出“活活艺术教育中心”落成剪彩的现场图片。&lt;/p&gt;

&lt;p&gt;实现过程是先通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;marker.events.register&lt;/code&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Marker&lt;/code&gt;上创建一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mousedown&lt;/code&gt;事件，然后实例化&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GeoSurf.Popup&lt;/code&gt;，最后在图层上&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;addPopup&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;源代码如下：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Content-Type&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/html; charset=utf-8&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;天地图GeoGlobe添加Popup弹出框 DEMO&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;language=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;javascript&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/lib/GeoSurfJSAPI.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;language=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;javascript&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/2d_samples/sampleCfg.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;language=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onload&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PortalMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mark_map&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;loadLayerGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;imageGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setCenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LonLat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;116.12294&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;24.33260&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 

	&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Layer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Markers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;MarkerLayer&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//创建基础层&lt;/span&gt;
	&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addLayer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//增加图层，用地图的实例化对象来实现&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Icon&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Icon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;http://demo.yourtion.com/GeoGlobe/marker_huohuo.png&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;34&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Pixel&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;mi&quot;&gt;10&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;mi&quot;&gt;34&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//图标&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;lonlat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LonLat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;116.12236&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;24.33489&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//经纬度&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Marker_HuoHuo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;lonlat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Icon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//构造Marker&lt;/span&gt;
	&lt;span class=&quot;nx&quot;&gt;Layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addMarker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Marker_HuoHuo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//增加标签&lt;/span&gt;

	&lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;events&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;register&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mousedown&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Marker_HuoHuo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//在Marker上添加mousedown事件&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;contentHTML&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;lt;img src=&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;popup_HuoHuo.jpg&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//popup显示的内容&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Popup_HuoHuo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Popup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;HuoHuo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;lonlat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;330&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;220&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;contentHTML&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//实例化Popup&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addPopup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Popup_HuoHuo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//添加Popup弹出&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;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;h1&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;marging:0 auto&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;天地图GeoGlobe添加Popup弹出框 DEMO---Yourtion.com&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;mark_map&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width: 640px; height: 480px ; marging:0 auto&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;您查看此示例的实际效果：&lt;a href=&quot;http://demo.yourtion.com/GeoGlobe/popup.php&quot;&gt;点击这里看Demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;其中。&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GeoSurf.Size(330,220)&lt;/code&gt;就是弹出框的大小，&lt;/p&gt;

&lt;p&gt;关于Popup的详细功能和设置将会在后面的文章陆续介绍····&lt;/p&gt;

</content>
                 <tag>GeoGlobe</tag>  <tag>天地图</tag> 
                 <tag>天地图二次开发</tag> 
                <pubTime>2011-04-11T19:49:41+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/geoglobe-map-marker.html</loc>
        <lastmod>2011-04-03T12:46:53+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>天地图GeoGlobe创建地图标记Marker</title>
                <content>
&lt;p&gt;上一次我们已经在&lt;a href=&quot;/geoglobe-development-entry.html&quot;&gt;《天地图GeoGlobe开发入门》&lt;/a&gt;中利用GeoGlobe二维地图API创建了一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;map&lt;/code&gt;对象，在div中显示出以嘉应学院为中心点的640*480像素大小的卫星地图，现在我们要在地图上添加地图标记，也就是Marker，用来标记出我们刚落成的“活活艺术教育中心”的位置所在。&lt;/p&gt;

&lt;p&gt;实现也是比较简单的，我们通过实例化&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GeoSurf.LonLat&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GeoSurf.Icon&lt;/code&gt;两个类，再在地图上创建一个特殊的层叫做&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GeoSurf.Layer&lt;/code&gt;最后实例化&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GeoSurf.Marker&lt;/code&gt;，最终创建一个地图标记&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Marker&lt;/code&gt;（GeoGlobe地标）。&lt;/p&gt;

&lt;p&gt;源代码如下：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Content-Type&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/html; charset=utf-8&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;天地图GeoGlobe创建地图标记Marker DEMO&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;language=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;javascript&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/lib/GeoSurfJSAPI.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;language=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;javascript&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/2d_samples/sampleCfg.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;language=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onload&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PortalMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mark_map&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;loadLayerGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;imageGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setCenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LonLat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;116.12294&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;24.33260&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 

	&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Layer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Markers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;MarkerLayer&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//创建基础层&lt;/span&gt;
	&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addLayer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//增加图层，用地图的实例化对象来实现&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Icon&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Icon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;http://demo.yourtion.com/GeoGlobe/marker_huohuo.png&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;34&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Pixel&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;mi&quot;&gt;10&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;mi&quot;&gt;34&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//图标&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;lonlat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LonLat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;116.12236&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;24.33489&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//经纬度&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Marker_HuoHuo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;lonlat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Icon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//构造Marker&lt;/span&gt;
	&lt;span class=&quot;nx&quot;&gt;Layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addMarker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Marker_HuoHuo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//增加标签&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;mark_map&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width: 640px; height: 480px ; marging:0 auto&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;您查看此示例的实际效果：&lt;a href=&quot;http://demo.yourtion.com/GeoGlobe/marker.php&quot;&gt;点击这里看Demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;其中我使用的Marker图标是PS过的，加上了文字，你可以使用没有PS的Marker：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://demo.yourtion.com/GeoGlobe/marker.png&quot;&gt;&lt;img src=&quot;http://demo.yourtion.com/GeoGlobe/marker.png&quot; alt=&quot;地图Marker&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;基本来说，上面的代码注释已经比较清楚，我也就不细讲，应该可以看懂得啦~&lt;/p&gt;
</content>
                 <tag>GeoGlobe</tag>  <tag>天地图</tag> 
                 <tag>天地图二次开发</tag> 
                <pubTime>2011-04-03T12:46:53+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/geoglobe-development-entry.html</loc>
        <lastmod>2011-04-02T10:38:03+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>天地图GeoGlobe开发入门</title>
                <content>
&lt;p&gt;现在我们以一个最简单的示例来帮助您快速对GeoGlobe二维地图API开发有一个全面的了解，并且有一个直观感性的认识。&lt;/p&gt;

&lt;p&gt;下面的代码是在一个普通的HTML页面里加入一个以嘉应学院为中心点的640*480像素大小的卫星地图。&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE html &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
 &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.w3.org/1999/xhtml&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;content-type&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/html; charset=utf-8&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;天地图GeoGlobe开发入门DEMO&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/lib/GeoSurfJSAPI.js&quot;&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/2d_samples/sampleCfg.js&quot;&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
	   &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;initialize&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PortalMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;frist_map&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	     &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;loadLayerGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;imageGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	     &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setCenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LonLat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;116.12371&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;24.33058&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;14&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;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;onload=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;initialize()&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;align=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;center&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;h1&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;marging:0 auto&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;天地图GeoGlobe开发入门DEMO---Yourtion.com&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;frist_map&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width: 640px; height: 480px ; marging:0 auto&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;您查看此示例的实际效果：&lt;a href=&quot;http://demo.yourtion.com/GeoGlobe/&quot;&gt;点击这里看Demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;接下来我们分析一下上面的代码，通过几个方面实现地图的调用：
下面来介绍此示例中需要注意的地方：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;script&lt;/code&gt; 标签包含 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GeoGlobe&lt;/code&gt;二维地图API。&lt;/li&gt;
  &lt;li&gt;创建名为“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;frist_map&lt;/code&gt;”的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;div&lt;/code&gt; 元素来包含地图。&lt;/li&gt;
  &lt;li&gt;编写 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JavaScript&lt;/code&gt; 函数创建“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;map&lt;/code&gt;”对象。&lt;/li&gt;
  &lt;li&gt;将地图的中心设置为指定的地理点。&lt;/li&gt;
  &lt;li&gt;从 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;body&lt;/code&gt; 标签的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;onLoad&lt;/code&gt; 事件初始化地图对象。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;加载 GeoGlobe二维地图API&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.tianditu.com/guide/lib/GeoSurfJSAPI.js&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;http://www.tianditu.com/guide/lib/GeoSurfJSAPI.js 网址指向包含使用 GeoSurf 地图 API 所需定义的 JavaScript 文件的位置。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;创建地图容器&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;frist_map&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width: 640px; height: 480px&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;要让地图在网页上显示，必须为其指定一个位置。通常，我们通过创建名为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;div&lt;/code&gt; 的元素并在浏览器的文档对象模型 (DOM) 中获取此元素的引用执行此操作。&lt;/p&gt;

&lt;p&gt;在上述示例中，我们定义名为“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;frist_map&lt;/code&gt;”的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;div&lt;/code&gt;，并使用CSS样式属性设置其尺寸。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;创建地图对象&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PortalMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;frist_map&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GeoSurf.map&lt;/code&gt; 类是表示地图的 JavaScript 类。此类的对象在页面上定义单个地图。（可以创建此类的多个实例，每个对象将在页面上定义一个不同的地图。）我们使用 JavaScript &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;new&lt;/code&gt; 操作符创建此类的一个新实例。&lt;/p&gt;

&lt;p&gt;当创建新的地图实例时，在页面中指定一个 DOM 节点（通常是 div 元素）作为地图的容器。HTML 节点是 JavaScript &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;document&lt;/code&gt; 对象的子对象，而且我们通过传入该子对象的id值来获得该元素的引用。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;设置地图中心点和缩放级别&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setCenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GeoSurf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LonLat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;116.12371&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;24.33058&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;默认情况下，地图中心点为经纬度地理坐标（0，0）。现在我们需要调用地图对象的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setCenter&lt;/code&gt;方法定位到北京的地理位置和相应缩放级别，以便得到一个恰当的显示效果。&lt;/p&gt;

&lt;p&gt;经过以上步骤，您就可以得到一个具备基本功能的电子地图了。在这个地图中，您可以对地图进行放大、缩小、平移等常见操作，点击这里可以体验实际效果。&lt;/p&gt;
</content>
                 <tag>GeoGlobe</tag>  <tag>天地图</tag> 
                 <tag>天地图二次开发</tag> 
                <pubTime>2011-04-02T10:38:03+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/php-output-escaping-javascript.html</loc>
        <lastmod>2011-04-01T22:56:53+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>用PHP输出转义JavaScript代码</title>
                <content>
&lt;p&gt;最近在做天地图是GIS集成··要输出HTML到JavaScript里面··涉及到代码转义什么的比较麻烦··所以写个PHP的function&lt;/p&gt;

&lt;p&gt;分享一下：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;jsformat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$str&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;nv&quot;&gt;$str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;trim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\\s\\s'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'\\s'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;chr&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;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;chr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'	'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\\'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'\\\\'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&quot;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'\\&quot;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\\\''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'\\\\\''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;'&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;\'&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;使用就不用说了··就是直接调用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jsformat($str)&lt;/code&gt;&lt;/p&gt;
</content>
                 <tag>JavaScript</tag>  <tag>PHP</tag> 
                 <tag>PHP</tag> 
                <pubTime>2011-04-01T22:56:53+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/catchable-fatal-error-solution.html</loc>
        <lastmod>2011-03-24T08:04:02+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Catchable fatal error:Object of class * could not be converted to string解决方法</title>
                <content>
&lt;p&gt;最近在弄Wordpress的sina登陆··但是在登陆之后老是会出现：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Catchable fatal error:Object of class WP_Error could not be converted to string in formatting.php on line 2818&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;研究了很久终于找到解决方法。&lt;/p&gt;

&lt;p&gt;这是由于 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;object&lt;/code&gt;转换成 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;string&lt;/code&gt; 時才会发生这个严重错误(fatal error)。&lt;/p&gt;

&lt;p&gt;若要解决这个问题，只要你將原本类定义的地方加上 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;__toString()&lt;/code&gt; 方法即可。例如，我发生错误的是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WP_Error&lt;/code&gt;的类位于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/wp-includes/class-wp-error.php&lt;/code&gt;。便在类定义一开始加入：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__toString&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;问题解决···大家遇到相应问题可以举一反三···共同进步哦···&lt;/p&gt;
</content>
                 <tag>WordPress</tag>  <tag>解决问题</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2011-03-24T08:04:02+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/sina-api-oauth-released-microblog.html</loc>
        <lastmod>2011-03-23T07:50:26+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>新浪微博API使用OAuth认证发布微博实例</title>
                <content>
&lt;p&gt;继续前面的文章&lt;a href=&quot;/sina-oauth-verification-storage.html&quot;&gt;《新浪微博OAuth认证详解及验证数据储存》&lt;/a&gt;，现在我们就使用它来发布微博。&lt;/p&gt;

&lt;p&gt;我们已经将用户新浪微博的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oauth_token&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oauth_secret&lt;/code&gt;保存到&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token'&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;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_secret'&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;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_secret'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;里面，现在要做的就很简单了··就是调用sinaOauth的类进行发布。。&lt;/p&gt;

&lt;p&gt;代码如下：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;//Statuses/update&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;WeiboClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;WB_AKEY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
                      &lt;span class=&quot;no&quot;&gt;WB_SKEY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
                      &lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'last_key'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token'&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;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'last_key'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token_secret'&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;nv&quot;&gt;$msg&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;测试发表微博&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$msg&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$msg&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Error occured&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&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;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'error_code'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'error'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])){&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Error_code: '&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'error_code'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;';  Error: '&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'error'&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&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;k&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'id'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot; : &quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;iconv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'UTF-8'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'GB2312'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'text'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot; - &quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;created_at&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样最简单的就OK了····&lt;/p&gt;
</content>
                 <tag>PHP</tag> 
                 <tag>PHP</tag> 
                <pubTime>2011-03-23T07:50:26+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/delphi-call-cmd-output.html</loc>
        <lastmod>2011-03-20T09:56:52+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Delphi调用Cmd并取得输出字符</title>
                <content>
&lt;p&gt;最近想做个调用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CMD&lt;/code&gt;命令并取得结果的程序··找了一下··共享代码&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;procedure CheckResult(b: Boolean);
begin
  if not b then
    raise Exception.Create(SysErrorMessage(GetLastError));
end;

function RunDOS(const CommandLine: string): string;
var
  HRead, HWrite: THandle;
  StartInfo: TStartupInfo;
  ProceInfo: TProcessInformation;
  b: Boolean;
  sa: TSecurityAttributes;
  inS: THandleStream;
  sRet: TStrings;
begin
  Result := '';
  FillChar(sa, sizeof(sa), 0);
//设置允许继承，否则在NT和2000下无法取得输出结果
  sa.nLength := sizeof(sa);
  sa.bInheritHandle := True;
  sa.lpSecurityDescriptor := nil;
  b := CreatePipe(HRead, HWrite, @sa, 0);
  CheckResult(b);

  FillChar(StartInfo, SizeOf(StartInfo), 0);
  StartInfo.cb := SizeOf(StartInfo);
  StartInfo.wShowWindow := SW_HIDE;
//使用指定的句柄作为标准输入输出的文件句柄,使用指定的显示方式
  StartInfo.dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW;
  StartInfo.hStdError := HWrite;
  StartInfo.hStdInput := GetStdHandle(STD_INPUT_HANDLE); //HRead;
  StartInfo.hStdOutput := HWrite;

  b := CreateProcess(nil, //lpApplicationName: PChar
    PChar(CommandLine), //lpCommandLine: PChar
    nil, //lpProcessAttributes: PSecurityAttributes
    nil, //lpThreadAttributes: PSecurityAttributes
    True, //bInheritHandles: BOOL
    CREATE_NEW_CONSOLE,
    nil,
    nil,
    StartInfo,
    ProceInfo);

  CheckResult(b);
  WaitForSingleObject(ProceInfo.hProcess, INFINITE);

  inS := THandleStream.Create(HRead);
  if inS.Size &amp;gt; 0 then
  begin
    sRet := TStringList.Create;
    sRet.LoadFromStream(inS);
    Result := sRet.Text;
    sRet.Free;
  end;
  inS.Free;

  CloseHandle(HRead);
  CloseHandle(HWrite);
end;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;使用方法也很简单···就是调用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Function&lt;/code&gt;；&lt;/p&gt;
</content>
                 <tag>Delphi</tag> 
                 <tag>Delphi</tag> 
                <pubTime>2011-03-20T09:56:52+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/delphi-invalue-fix.html</loc>
        <lastmod>2011-03-15T16:49:02+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Delphi格式'%s'无效或不匹配解决方法</title>
                <content>
&lt;p&gt;Delphi7在打开 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Project&lt;/code&gt;-&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;options&lt;/code&gt; (工程-选项) 时弹出”格式’%s’ 无效或不匹配”。研究了很久，终于知道是怎么回事，解决方法共享一下，事实上很简单~~&lt;/p&gt;

&lt;p&gt;在“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;我的电脑&lt;/code&gt;”-&amp;gt;右键“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;属性&lt;/code&gt;”-&amp;gt;“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;高级&lt;/code&gt;”-&amp;gt;“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;性能&lt;/code&gt;”-&amp;gt;“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;设置&lt;/code&gt;”-&amp;gt;“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;数据执行保护&lt;/code&gt;”&lt;/p&gt;

&lt;p&gt;选择“只为关键Windows程序和服务启动数据执行保护”，然后重启电脑就OK了&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/03/1.jpg&quot;&gt;&lt;img src=&quot;/images/2011/03/1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>Delphi</tag> 
                 <tag>Delphi</tag> 
                <pubTime>2011-03-15T16:49:02+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/shlcms-automatically-add-thumbnails.html</loc>
        <lastmod>2011-03-13T06:17:15+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>SHLCMS添加文章自动增加缩略图到Flash</title>
                <content>
&lt;p&gt;SHLCMS的Flash展示很不错，但是不能自动将新闻或者想要的栏目里的文章自动展示，研究了一番，参考Sobin之前做的东西，利用正则表达式实现发布自动添加Flash展示，修改文章自动修改，删除文章自动删除。&lt;/p&gt;

&lt;p&gt;修改&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SHLCMS&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\admini\controllers\list.php&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;function create()&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;redirect_to($request['p'],'index');&lt;/code&gt;之前加入以下代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cm&quot;&gt;/* 新增图片 - Yourtion - http://blog.Yourtion.com */&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$title&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'title'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'p'&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;mi&quot;&gt;40&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;insert_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/zzrs/?p=40&amp;amp;a=view&amp;amp;r=&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$pattern&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/&amp;lt;img.*?src=[&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;\'| &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;](.*?(?:[\.gif|\.jpg]))[&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;\'|&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;].*?[\/]?&amp;gt;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   	&lt;span class=&quot;nv&quot;&gt;$match_times&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;preg_match_all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pattern&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
   	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$match_times&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&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;nv&quot;&gt;$pic&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$pic&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;nv&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;INSERT &quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;TB_PREFIX&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;flash (id,title,summary,picpath,group_id,url) VALUES ('&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$r&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;','&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$title&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;','&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$title&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;','&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pic&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;',1,'&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$n&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;')&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sql&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;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;function edit()&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;redirect_to($request['p'],'index');&lt;/code&gt;之前加入以下代码：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/* 修改文章图片- Yourtion - http://blog.Yourtion.com */
$title=$request['title'];
$content=$request['content'];
if($request['p']==40){
	$n = &quot;/zzrs/?p=40&amp;amp;a=view&amp;amp;r=&quot;.$r;
	$pattern=&quot;/&amp;lt;img.*?src=[\\\'| \\\&quot;](.*?(?:[\.gif|\.jpg]))[\\\'|\\\&quot;].*?[\/]?&amp;gt;/&quot;;
   $match_times=preg_match_all($pattern,$content,$match);
   if($match_times&amp;gt;0){
      	$pic = $match[1][0];
		$pic = '/'.substr($pic,2);
		$sql='update '.TB_PREFIX.'flash set picpath=&quot;'.$pic.'&quot;,title=&quot;'.$title.'&quot;,summary=&quot;'.$title.'&quot; where id='.$request['n'];
		$db-&amp;gt;query($sql);
	}
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;function destroy()&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;redirect_to($request['p'],'index');&lt;/code&gt;之前加入以下代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cm&quot;&gt;/*删除文章图片- Yourtion - http://blog.yourtion.com */&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'delete from '&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;TB_PREFIX&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'flash where id='&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'n'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;redirect_to&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'p'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'index'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;什么的代码中有一些硬编码，在使用的时候改成你自己的。有空重新改一下，见谅··&lt;/p&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$request['p']==40&lt;/code&gt;是你要自动添加图片的频道ID；&lt;/p&gt;

&lt;p&gt;而&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$n = &quot;/zzrs/?p=40&amp;amp;a=view&amp;amp;r=&quot;.$r;&lt;/code&gt;是你发布新闻后文章内容相对根目录的地址。&lt;/p&gt;

&lt;p&gt;这样对&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;list.php&lt;/code&gt;的更改就完成了，还有就是改一下调用代码的部分，&lt;/p&gt;

&lt;p&gt;在SHLCMS的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\xml&lt;/code&gt;下的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dt_flash.php&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;将&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$flashs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_results&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;select * from &quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;TB_PREFIX&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;flash where group_id=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$group_id&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; order by ordering&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;改为&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$flashs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_results&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;select * from &quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;TB_PREFIX&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;flash where group_id=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$group_id&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; order by id DESC limit 5&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样就大功告成了····&lt;/p&gt;

&lt;p&gt;希望大家多提意见建议，一同进步·······&lt;/p&gt;
</content>
                 <tag>SHLCMS</tag> 
                 <tag>PHP</tag> 
                <pubTime>2011-03-13T06:17:15+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/shlcms-direct-download.html</loc>
        <lastmod>2011-03-12T14:39:23+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>SHLCMS下载频道直接下载文件</title>
                <content>
&lt;p&gt;最近在做组织部人事处的文章，在文章首页的下载栏目想点击链接直接下线文件，不用进入详细内容页面再点下载。&lt;/p&gt;

&lt;p&gt;实现方法很简单，在Skins里你的模版文件夹下面的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index&lt;/code&gt;下新建一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;download_0.php&lt;/code&gt;的文件&lt;/p&gt;

&lt;p&gt;内容如下：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;URLREWRITE&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;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_root_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;·&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;softwareName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_root_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;softwareName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后在你的主页模版用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;?php echo dt_download(38,5,25,0,0,true) ?&amp;gt;&lt;/code&gt;直接调用即可。&lt;/p&gt;
</content>
                 <tag>SHLCMS</tag> 
                 <tag>PHP</tag> 
                <pubTime>2011-03-12T14:39:23+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/java-access-denied-socketpermission-solution.html</loc>
        <lastmod>2011-03-08T09:44:48+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Java出现access denied java.net.SocketPermission解决方法</title>
                <content>
&lt;h3 id=&quot;1执行java-perfecttime出现异常&quot;&gt;1.执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;java PerfectTime&lt;/code&gt;出现异常　&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:2005 connect,resolve)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;无法解析和连接到127.0.0.1的2005端口上，原因是在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PerfectTime&lt;/code&gt;中设置了安全管理器&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;＜System.setSecurityManager(new RMISecurityManager());＞&lt;/code&gt;，可是又没有设置访问的策略，解决办法有四(解决这种异常的办法同样适用于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DisplayPerfectTime&lt;/code&gt;)：&lt;/p&gt;

&lt;p&gt;(1) 可以把代码&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;System.setSecurityManager(new RMISecurityManager());&lt;/code&gt;去掉，不设置安全管理器&lt;/p&gt;

&lt;p&gt;(2) 修改JRE的安全策略文件，这就要求你能确定执行时是用的哪个JRE，比如在Eclipse中用JDK是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c:\Java\jdk1.5.0_06&lt;/code&gt;,相应的安全策略文件就是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c:\java\jdk1.5.0_06\jre\lib\security\java.policy&lt;/code&gt;,如果是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Applet&lt;/code&gt;中的java程序就应该是在 jre 目录中,如文件&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Java\jre1.5.0_06\lib\security\java.policy&lt;/code&gt;。修改安全策略文件，在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grant {}&lt;/code&gt;，大括号中加上&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;permission java.net.SocketPermission &quot;localhost:2005&quot;,&quot;connect,resolve&quot;&lt;/code&gt;;&lt;/p&gt;

&lt;p&gt;(3) 建立自己的策略文件，如&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c:\MyPolicy.policy&lt;/code&gt; ,内容为：&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;grant&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;permission&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;java&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;net&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;SocketPermission&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;localhost:2005&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;connect,resolve&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PerfectTime&lt;/code&gt;时用命令&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;java -Djava.security.policy=c:\MyPolicy.policy PerfectTime&lt;/code&gt; 　指定了安全策略文件&lt;/p&gt;

&lt;p&gt;(4) 把 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;System.setSecurityManager (new RMISecurityManager())&lt;/code&gt;改为匿名类实现，覆盖两个方法&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setSecurityManager&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;RMISecurityManager&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;checkConnect&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;checkConnect&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Object&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;当然最简单的解决方法莫过于第一种。&lt;/p&gt;

&lt;h3 id=&quot;2同样是执行-perfecttime-出现的异常&quot;&gt;2.同样是执行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PerfectTime&lt;/code&gt; 出现的异常&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:&lt;/p&gt;

  &lt;p&gt;java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:&lt;/p&gt;

  &lt;p&gt;java.lang.ClassNotFoundException: PerfectTime_Stub&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;很多人对这个问题有些莫名其妙，因为明明看到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PerfectTime_Stub&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PerfectTime&lt;/code&gt; 这两个类是在同一个目录中，并且&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;classpath&lt;/code&gt; 也有设置当前目录，按理既然能加载 PerfectTime 类执行，就能加载到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PerfectTime_Stub&lt;/code&gt;吧，为什么还提示&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ClassNotFound&lt;/code&gt;呢？&lt;/p&gt;

&lt;p&gt;其实类 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PerfectTime_Stub&lt;/code&gt;并非由&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PerfectTime&lt;/code&gt;执行行直接加载，而是PerfectTime在向RMI注册时，要求&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rmiregistry&lt;/code&gt;去加载 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PerfectTime_Stub&lt;/code&gt;类的，理解了这一层次上的意义就会知道其实 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PerfectTime_Stub&lt;/code&gt;是为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rmiregistry&lt;/code&gt;所用的。所以解决办法是：&lt;/p&gt;

&lt;p&gt;(1) 在执行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rmiregistry&lt;/code&gt; 之前，设置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;classpath&lt;/code&gt;让能查找到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PerfectTime_Stub&lt;/code&gt;类，如在同一Dos窗口中，假设 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PerfectTime_Stub&lt;/code&gt;类是在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;E:\workspace\TestRMI\bin&lt;/code&gt;目录中，执行过程那就是&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;C:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ocuments and Settings&lt;span class=&quot;se&quot;&gt;\u&lt;/span&gt;nmi&amp;gt;set &lt;span class=&quot;nv&quot;&gt;classpath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;%classpath%&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;E:&lt;span class=&quot;se&quot;&gt;\w&lt;/span&gt;orkspace&lt;span class=&quot;se&quot;&gt;\T&lt;/span&gt;estRMI&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;in

&lt;/span&gt;C:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ocuments and Settings&lt;span class=&quot;se&quot;&gt;\u&lt;/span&gt;nmi&amp;gt;rmiregistry 2005
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;(2) 或者在命令行中先进入到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PerfectTime_Stub&lt;/code&gt;类所在的目录，然后再执行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rmiregistry&lt;/code&gt; (这种方法实质是与上面一样的，只是恰当的应用的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;classpath&lt;/code&gt;中的当前目录 “.” )，执行过程如下&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;C:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ocuments and Settings&lt;span class=&quot;se&quot;&gt;\u&lt;/span&gt;nmi&amp;gt;e:

E:&lt;span class=&quot;se&quot;&gt;\&amp;gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;E:&lt;span class=&quot;se&quot;&gt;\w&lt;/span&gt;orkspace&lt;span class=&quot;se&quot;&gt;\T&lt;/span&gt;estRMI&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;in

&lt;/span&gt;E:&lt;span class=&quot;se&quot;&gt;\w&lt;/span&gt;orkspace&lt;span class=&quot;se&quot;&gt;\T&lt;/span&gt;estRMI&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;rmiregistry 2005
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;参看：rmiregistry was finding the stubs in its CLASSPATH&lt;/p&gt;

&lt;h3 id=&quot;3-执行客户端程序-displayperfecttime-出现异常&quot;&gt;3. 执行客户端程序 DisplayPerfectTime 出现异常　&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;java.security.AccessControlException: access denied&lt;/p&gt;

  &lt;p&gt;(java.net.SocketPermission 127.0.0.1:1276 connect,resolve)，&lt;/p&gt;

  &lt;p&gt;同时在服务器端也产生异常　&lt;/p&gt;

  &lt;p&gt;Exception in thread “RMI TCP Connection(6)-127.0.0.1”&lt;/p&gt;

  &lt;p&gt;java.security.AccessControlException: access denied&lt;/p&gt;

  &lt;p&gt;(java.net.SocketPermission 127.0.0.1:1296 accept,resolve)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;直接能想到的解决办法是把127.0.0.1:1276，127.0.0.1:1276的解析连接权限也加上，方法可取第 1 种异常所列的方法，但这个端口是随机的。&lt;/p&gt;

&lt;p&gt;在此解析一下这些端口的用途，2005是直接指定的供客户端查找注册的服务对象引用的端口，这是固定的，而上面产生的在客户端和服务器上的1276和1296的端口，是随机的，是在方法调用时真正的客户端与提供服务的服务器（而非注册服务器）之间的数据通信的端口。&lt;/p&gt;

&lt;p&gt;为了满足上面的端口应用，可以在安全策略文件中只加上　&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;permission java.net.SocketPermission &quot;localhost:*&quot;,&quot;accept,connect,resolve&quot;&lt;/code&gt;;　允许在所有端口上的接受，连接，解析。&lt;/p&gt;

&lt;p&gt;再如果要访问的IP很多，又要写成　&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;permission java.net.SocketPermission &quot;*:*&quot;,&quot;accept,connect,resolve&quot;;&lt;/code&gt;　方便。&lt;/p&gt;

&lt;h3 id=&quot;4执行客户端程序-displayperfecttime出现异常&quot;&gt;4.执行客户端程序 DisplayPerfectTime出现异常&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;java.rmi.UnmarshalException: Error unmarshaling return header;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;nested exception is:  java.io.EOFException，&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;这种异常应该比较少见，出现情况是 客户端有权限访问服务提供端的某个端口，而服务提供端却无权限在某个端口上或给那个客户端提供服务造成的，解决办法把客户端和服务器的安全策略文件都改为能访问任何端口就行。&lt;/p&gt;

&lt;p&gt;总结：上面1、3、4三种情况都是因为权限不足所造成的，如果安全控制的粒度不要求太细的化，在服务器端和客户端可以不用设置定全管理器，或者策略文件中设置为能接受、连接、解析任何IP及端口：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;permission java.net.SocketPermission &quot;*:*&quot;,&quot;accept,connect,resolve&quot;&lt;/code&gt;;　或者用1(4)的方法忽略所有IP及端口的检测。&lt;/p&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>j2me</tag> 
                <pubTime>2011-03-08T09:44:48+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/xampp-apache-unable-access-solutions.html</loc>
        <lastmod>2011-02-28T09:42:41+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>xampp Apache启动后localhost IP均无法访问站点解决方法</title>
                <content>
&lt;p&gt;刚刚把启动了50多天的服务器重启了一下，结果发现xampp上的Apache显示Running但是网站均无法访问，端口监听也显示正常，研究了很久，发现error.log上面显示：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;[error] (OS 10038)在一个非套接字上尝试了一个操作。  : winnt_accept: getsockname error on listening socket, is IPv6 available?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;研究了很久，找到解决的方法，分享一下：&lt;/p&gt;

&lt;p&gt;解决办法一：&lt;/p&gt;

&lt;p&gt;可能是安装了某些程序修改了Winsock，使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;netsh winsock reset&lt;/code&gt;命令修复Winsock重启计算机即可!&lt;/p&gt;

&lt;p&gt;解决办法二：&lt;/p&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;httpd.conf&lt;/code&gt;文件中添加 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Win32DisableAcceptEx&lt;/code&gt; 标记，如下：&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;If&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Module&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;mpm_winnt.c\&amp;gt;&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;ThreadsPerChild&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;1000&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;MaxRequestsPerChild&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;10000&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;Win32DisableAcceptEx&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;解决办法三：&lt;/p&gt;

&lt;p&gt;1、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;网上邻居&lt;/code&gt;-;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;本地连接&lt;/code&gt;-;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;属性&lt;/code&gt;-;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;internet协议(TCP/IP)&lt;/code&gt;-;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;属性&lt;/code&gt;-;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;高级&lt;/code&gt;-;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wins标签&lt;/code&gt;-;去掉启用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LMhosts&lt;/code&gt;查询前的勾.&lt;/p&gt;

&lt;p&gt;2、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;控制面版&lt;/code&gt;-;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;windows防火墙&lt;/code&gt;-;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;高级标签&lt;/code&gt;-;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;本地连接设置&lt;/code&gt;-;服务的标签里勾选&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;安全Web服务器(HTTPS)&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;3、然后重启&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Apache&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;然后就OK了&lt;/p&gt;
</content>
                 <tag>Apache</tag>  <tag>解决问题</tag> 
                 <tag>服务器</tag> 
                <pubTime>2011-02-28T09:42:41+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/php-asp-net-webservice-2.html</loc>
        <lastmod>2011-02-23T16:58:34+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PHP调用ASP.NET的WebService</title>
                <content>
&lt;p&gt;创建一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C#&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;web service&lt;/code&gt;，这个就不多说了，我用vs2008的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wizard&lt;/code&gt;创建了一个最简单的，让它运行在：http://localhost/webservice1/service1.asmx&lt;/p&gt;

&lt;p&gt;其中有个web method像这样的：&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WebMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;HelloWorld&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Hello World&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;ok，一切就绪。在某php文件中如下写法：
php5本身就支持SOAP调用Web Service:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//get localization strings from C# webservice&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;SoapClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'http://localhost/webservice1/Localization.asmx?wsdl'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Call web service method from C# WebService:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetLocalizationResource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;if&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;nb&quot;&gt;is_soap_fault&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$result&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;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;return:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;GetLocalizationResourceResult&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;k&quot;&gt;else&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;soap call fault&quot;&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;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样就OK了，会继续介绍SOAP&lt;/p&gt;
</content>
                 <tag>PHP</tag> 
                 <tag>PHP</tag> 
                <pubTime>2011-02-23T16:58:34+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/asp-net-can-not-load-oci-dll.html</loc>
        <lastmod>2011-02-22T21:42:03+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>ASP.net无法加载oci.dll解决新法</title>
                <content>
&lt;p&gt;看老师们在一台新虚拟机上迁移一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ASP.net&lt;/code&gt;与&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ORACLE&lt;/code&gt;的程序，一直出现&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oci.dll&lt;/code&gt;无法加载的问题，用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;regsvr32&lt;/code&gt;注册，提示：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;oci.dll was loaded,but the DLLRegisterServer entry point was not found.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;研究了很久，什么目录权限啊，注册表啊，都没有见效。&lt;/p&gt;

&lt;p&gt;最终无奈之下把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oraclient8.dll&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;orasql9.dll&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oci.dll&lt;/code&gt;拷贝到System32解决问题。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\MTxOCI]

&quot;OracleXaLib&quot;=&quot;oraclient8.dll&quot;
&quot;OracleSqlLib&quot;=&quot;orasql8.dll&quot;
&quot;OracleOciLib&quot;=&quot;oci.dll&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>电脑技巧</tag> 
                <pubTime>2011-02-22T21:42:03+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/mtk-android-flash-video.html</loc>
        <lastmod>2011-02-14T13:35:56+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>让MTK平台Android支持Flash-在线视频播放(全屏、流畅)</title>
                <content>
&lt;p&gt;前段时间入手了A1-必火版，MTK6516解决方案，Android 2.2，速度不错，但是一直装不上FlashPlayer，播放不了在线视频，很不爽，研究后发现了一个解决方法，可以全屏播放，WiFi接入，特别流畅！！&lt;/p&gt;

&lt;p&gt;SkyFire浏览器，集成flash播放，让要CPU支持的flash插件见鬼去吧。&lt;/p&gt;

&lt;p&gt;Skyfire浏览器主打的是“PC级的网络浏览器”，强调的是在手机上实现PC机上浏览器的真实效果，并且支持大多数的网页内嵌内容，Skyfire支持多种网页规格和插件，如Flash 10、Silverlight 2、Ajax和Javascript等等，使得连网上的串流影片都可以顺利播放，突破了旧式手提版浏览器的不足，也实现了手提装置上可以透过浏览器显示完整的网页画面这个梦想。另一方面，Skyfire 比之前的改进还有其操作界面和运作效能等等：新版本的启动速度和电力消耗都有改善，加强实用性。而新增的搜寻功能则让用户更快速地链接到想去的网站。而在缩放和导航方面也更为顺畅，用户也无需先放大页面就可以点击连结。&lt;/p&gt;

&lt;p&gt;看图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/02/SkyFire.jpg&quot;&gt;&lt;img src=&quot;/images/2011/02/SkyFire.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/02/SkyFire1.png&quot;&gt;&lt;img src=&quot;/images/2011/02/SkyFire1.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;/images/2011/02/SkyFire2.jpg&quot;&gt;&lt;img src=&quot;/images/2011/02/SkyFire2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;版本说明：2.3.3适用于1.x版本的rom，3.0版适用于2.x的rom。&lt;/p&gt;

&lt;p&gt;下载地址：&lt;a href=&quot;http://dl.dbank.com/c08rf3j7g8&quot;&gt;SkyFire浏览器&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://www.skyfire.com/images/stories/android_qrcode.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;http://www.skyfire.com/product/android&lt;/p&gt;
</content>
                 <tag>Android</tag>  <tag>MTK</tag> 
                 <tag>Android</tag> 
                <pubTime>2011-02-14T13:35:56+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/about-mtk-6516-cpu.html</loc>
        <lastmod>2011-02-09T17:30:40+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>关于MTK 6516 CPU ARM926EJ 208M的问题</title>
                <content>
&lt;p&gt;最近也进了不山寨的MTK智能手机Android 2.2系统，看到大家对于MTK 6516的CPU是108M不是商家说的416M甚至800M提出质疑，作为一个消费者，也为商家们正名一下，顺便普及一下MTK的知识吧。&lt;/p&gt;

&lt;p&gt;问题一：为什么会CPU一栏显示arm926ej-s&lt;/p&gt;

&lt;p&gt;答：最近大家好像都很纠结于那个安卓测CPU….虽然觉得其实这个问题很白痴，CPU 280别说跑安卓2.2…能不能跑1.6都是个问题，比较深奥的术语就不多说了，尽量简明，第一，大家用安卓的那个软件,是基于C语言编写，实际来说跟大家平时测试电脑CPU的软件算法大同小异，第一步通过语言测试CPU的系统框架（也就是大家看到的arm926ej-s，其实这个框架很多大厂都有用的，例如安凯 三星 高通的部分CPU都是基于这个设计的） 第二步，根据上面框架收窄范围，在本身数据库寻找这个CPU的资料，没有，就直接显示框架….于是大家就看到了那个arm926ej-s了。&lt;/p&gt;

&lt;p&gt;问题二：为什么CPU只显示208M频率&lt;/p&gt;

&lt;p&gt;答：MTK6516芯片是由ARM 9 416MHz 和ARM 7 280两个芯片组成，说双核的话，那酷睿这些真正双核绝对泪目….MTK靠什么起家，就是因为高度的集成降低了手机的制作生产成本，MTK6516不是CPU，是芯片组，打个比方来说是一个除了没机箱的主机，ARM7 280是整个主板的控制芯片顺带负责硬解RMVB等一些功能，真正系统运算是ARM 9 416那个，显示是因为MTK6516的启动顺序问题，那个软件检测到ARM7就停止了，以为那个就是实际运作CPU，因为目前很少这种手机封装的。&lt;/p&gt;

&lt;p&gt;问题三：MTK6516的实际极限是多少？&lt;/p&gt;

&lt;p&gt;答：按照arm926ej-s的设计，当然MTK6516有很多公版和非公版，这只能是一个概念，原来跟同学聊过，当初设计的时候，MTK 6516应该是可以上到615水平，但是造成的就是良品率问题，所以就锁了，而且这个锁是硬锁，想超就省省了，没戏，至于大家也不要太纠结于那个软件的测试或者安卓的CPU对比了，人家的测试软件都是基于有名气的大厂CPU做过相对优化的，MTK是什么？山寨吗…而且这MTK6516的确还算给力的，起码比较稳定，是不？要性能，这芯片就算了。&lt;/p&gt;

&lt;p&gt;对于某人的质疑回复&lt;/p&gt;

&lt;p&gt;没办法，随便写的，的确是416左右把，手误了，因为我不干这行很多年了，不过现在还有个同学在上海的MTK分部当工程师，他是负责MTK6516的非公版设计，我还是比较相信他说的话，闲聊时候了解了下而已。也早就不是当年这么热衷这手机了，什么手机在我手上也就是打电话和发短信，要么就是上上UC或者看下PDF，其实只想说一个道理，有必要这么计较这CPU信息吗？如果真的是208，能拉得动2.2？而且哥们，6516也算老芯片了，但比较特殊的，你要真用电脑那个来看，我还真没想法了。何况，我又不是在这写论文，的确，那软件平时不可能误测modem,问题是MT6516的启动机制，ARM7 280（实际平时也是260）不单是MODEM，MTK还集成了整个MTK6516的BOIS，所以我前面才说了为什么会这样，当然，你说那个208是ARM 9的也可以，因为MTK6516是基于arm926ej-s设计的，arm926ej-s&lt;/p&gt;

&lt;p&gt;框架包括手机 主板 CPU 都可以的，就像DDR测试的时候的双倍数据速率原理一样，显示工作频率是208,实际416，但再说下去，估计也就真的是懂行才懂了，你觉得有这必要吗？其实就好像当年ATOM一样，刚出时候也因为比较新，本来频率实际是1.4G 确显示700M，问题是人家是intel出的东西，CPU-Z会马上修正，你觉得这测试软件会因为MTK去修改数据库？&lt;/p&gt;

&lt;p&gt;来自：http://bbs.shanzhaiji.cn/viewthread.php?tid=212359&lt;/p&gt;
</content>
                 <tag>MTK</tag> 
                 <tag>Android</tag> 
                <pubTime>2011-02-09T17:30:40+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/about-vps.html</loc>
        <lastmod>2011-02-06T17:19:42+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>VPS详解</title>
                <content>
&lt;p&gt;最近在学习Linux，遇到了一些问题，也解决了一些问题，我研究一下Linux的虚拟主机，下面给大家介绍一下虚拟专用服务器技术，希望大家看完本文，能了解到虚拟专用服务器技术。&lt;/p&gt;

&lt;p&gt;VPS（Virtual Private Server 虚拟专用服务器）技术，将一部服务器分割成多个虚拟专享服务器的优质服务。 每个VPS都可分配独立公网IP地址、独立操作系统、独立超大空间、独立内存、独立CPU资源、独立执行程序和独立系统配置等。 用户除了可以分配多个虚拟主机及无限企业邮箱外，更具有独立服务器功能，可自行安装程序，单独重启服务器。 高端虚拟主机用户的最佳选择。您不再受其他用户程序对您造成的影响, 得到的是更加公平的资源分配，远远低于虚拟主机的故障率.
VPS主机技术优势?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1、唯一同时支持Linux和Windows的VPS产品&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;VPS是唯一一款同时支持Linux和Windows平台的VPS(虚拟专用服务器)产品。VPS采用虚拟操作系统技术，使得每一台物理服务器在硬件支持的情况下可以安装50~200个VPS来为客户提供服务。是最佳的商用虚拟化服务器产品。Virtuozzo管理工具对Windows和Linux是通用的，使得对同时管理两种操作系统的工作更加简便易行。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2、两个隔离：实现了服务器零宕机，确保每个VPS主机独占资源&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;为什么用户往往会钟情于独立主机服务呢？最重要的原因之一就是对服务器有完全的控制权并且不受外界其他因素的干扰。而VPS主机则具有同样的功能！VPS实现了两个隔离，软件和硬件的隔离以及客户和客户的隔离&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3、 软件和硬件的隔离&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;VPS主机采用操作系统虚拟化技术实现了软件和硬件的隔离，因而改变了黑客程序经常利用的攻击入口，从而增强了服务器的安全性，这同时意味着VPS主机可以被快速而容易地从一台服务器迁移至另一台。事实上VPS主机甚至比独立的服务器都要更加安全可靠。由于基于操作系统虚拟化技术，VPS主机完全与底层硬件隔离，通过操作系统模版轻松实现VPS主机的开通，可以通过拖拽方式瞬间实现VPS主机的服务器迁移，从而真正实现服务器维护和更新时零宕机。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4、客户之间的隔离&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;每一个VPS主机拥有独立的服务器的资源（包括驱动器、CPU、内存、硬盘和网络I/O），由于采用动态的分区隔离，VPS主机实现不同客户之间的隔离。客户之间的隔离确保每个VPS主机都能独占自己的服务器资源，而且针对单个用户的DDos攻击不会影响同一物理服务器的其他用户，将DDos的攻击危害降至最少，从而提高了服务器的安全性。而且如果其中一个VPS主机宕机，其它的VPS主机不会受到影响，仍旧可以正常运行。&lt;/p&gt;

&lt;h3 id=&quot;虚拟主机-vs-vps主机&quot;&gt;虚拟主机 VS VPS主机&lt;/h3&gt;

&lt;p&gt;虚拟主机的缺陷在于所有使用者同时共享服务器上的全部资源，当其中的一个使用者过度使用资源，负荷过重时即容易造成服务器发生问题，也因此造成危及其它使用者的情况。VPS主机（Virtual Private Server 虚拟独享主机）乃是以世界知名公司VMWARE公司的虚拟化软件将服务器上的资源做高度技术含量的独立划分，使划分的每一个独立领域有独自的 Root/Administrator管理权限，独自的操作系统OS与IP地址，就像是完全独立主机一般，拥有完全的控制权。并且所有的使用者因各自独立与使用监视，所以不会产生相互影响的现象。&lt;/p&gt;

&lt;p&gt;来自：http://os.51cto.com/art/200912/166091.htm&lt;/p&gt;

&lt;p&gt;VPS是利用VPS（Virtual Private Server）技术，将一部服务器分割成多个虚拟专享服务器的优质服务。每个VPS都可分配独立公网IP地址、独立操作系统Windows/Linux、独立超大空间、独立内存、独立CPU资源、独立执行程序和独立系统配置等。用户除了可以分配多个虚拟主机及无限企业邮箱外，更具有独立服务器功能，可自行安装程序，单独重启服务器，总而言之，VPS是一项具备高弹性、高质量及低成本效益的服务器解决方案。&lt;/p&gt;

&lt;p&gt;通过我的介绍你应该对VPS有所了解，虚拟主机和VPS主机孰好孰坏，说你不清楚，还是看你的选择。&lt;/p&gt;
</content>
                 <tag>VPS</tag> 
                 <tag>VPS</tag> 
                <pubTime>2011-02-06T17:19:42+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/debian-deploy-nginx-php.html</loc>
        <lastmod>2011-02-05T22:15:21+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Debian下部署Nginx+PHP</title>
                <content>
&lt;p&gt;前面已经介绍过Debian下的Nginx配置，继续参考http://67054.blog.51cto.com/57054/128471配置PHP环境，但是针对其中出现的问题，进行更正修改。&lt;/p&gt;

&lt;p&gt;1、首先修改nginx的配置文件&lt;/p&gt;

&lt;p&gt;vim /etc/nginx/conf/nginx.conf&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#user  nobody;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;worker_processes&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;worker_rlimit_nofile&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;51200&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;                           //需要在shell下执行ulimit  -SHn  512 00
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;events&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;epoll&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;worker_connections&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;51200&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;err&quot;&gt;http&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;err&quot;&gt;include&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;mime.types&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;	&lt;span class=&quot;err&quot;&gt;default_type&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;application/octet-stream&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;
	&lt;span class=&quot;err&quot;&gt;server_names_hash_bucket_size&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;128&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;	&lt;span class=&quot;err&quot;&gt;client_header_buffer_size&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;32k&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;	&lt;span class=&quot;err&quot;&gt;large_client_header_buffers&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;32k&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;	&lt;span class=&quot;err&quot;&gt;log_format&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;access&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;'$remote_addr&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$remote_user&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;[$time_local]&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;$request&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'&lt;/span&gt;
	&lt;span class=&quot;err&quot;&gt;'&quot;$status&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$body_bytes_sent&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;$http_referer&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'&lt;/span&gt;
	&lt;span class=&quot;err&quot;&gt;'&quot;$http_user_agent&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;$http_x_forwarded_for&quot;'&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;	&lt;span class=&quot;err&quot;&gt;access_log&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;logs/access.log&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;access&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;	&lt;span class=&quot;err&quot;&gt;sendfile&lt;/span&gt;        &lt;span class=&quot;err&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;	&lt;span class=&quot;err&quot;&gt;tcp_nopush&lt;/span&gt;     &lt;span class=&quot;err&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;	&lt;span class=&quot;c&quot;&gt;#keepalive_timeout  0;
&lt;/span&gt;	&lt;span class=&quot;err&quot;&gt;keepalive_timeout&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;
	&lt;span class=&quot;err&quot;&gt;tcp_nodelay&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;	&lt;span class=&quot;c&quot;&gt;#gzip  on;
&lt;/span&gt;	&lt;span class=&quot;err&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;err&quot;&gt;listen&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;		&lt;span class=&quot;err&quot;&gt;server_name&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;localhost&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;		&lt;span class=&quot;c&quot;&gt;#charset koi8-r;
&lt;/span&gt;		&lt;span class=&quot;c&quot;&gt;#access_log  logs/host.access.log  main;
&lt;/span&gt;		&lt;span class=&quot;err&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;err&quot;&gt;root&lt;/span&gt;   &lt;span class=&quot;err&quot;&gt;/home/web&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;		&lt;span class=&quot;err&quot;&gt;index&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;index.php&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;index.html&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;index.htm&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;		&lt;span class=&quot;err&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;(-f&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$request_filename/index.html){&lt;/span&gt;
			&lt;span class=&quot;err&quot;&gt;rewrite&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;(.*)&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$1/index.html&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;		&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;err&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;(-f&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$request_filename/index.php){&lt;/span&gt;
			&lt;span class=&quot;err&quot;&gt;rewrite&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;(.*)&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$1/index.php&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;		&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;err&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;(-f&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$request_filename){&lt;/span&gt;
			&lt;span class=&quot;err&quot;&gt;rewrite&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;(.*)&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;/index.php&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;		&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;err&quot;&gt;error_page&lt;/span&gt;   &lt;span class=&quot;err&quot;&gt;500&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;502&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;503&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;504&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;/50x.html&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;	
	&lt;span class=&quot;py&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/50x.html {&lt;/span&gt;
		&lt;span class=&quot;err&quot;&gt;root&lt;/span&gt;   &lt;span class=&quot;err&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;	&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;
	
	&lt;span class=&quot;err&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\.php$&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;err&quot;&gt;root&lt;/span&gt;           &lt;span class=&quot;err&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;		&lt;span class=&quot;err&quot;&gt;fastcgi_pass&lt;/span&gt;   &lt;span class=&quot;err&quot;&gt;127.0.0.1:9000&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;		&lt;span class=&quot;err&quot;&gt;fastcgi_index&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;		&lt;span class=&quot;err&quot;&gt;fastcgi_param&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;SCRIPT_FILENAME&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;/home/web$fastcgi_script_name&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;    //home/web 为php网站的目录
&lt;/span&gt;		&lt;span class=&quot;err&quot;&gt;include&lt;/span&gt;        &lt;span class=&quot;err&quot;&gt;fastcgi_params&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;	&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;以上是我的nginx.conf文件内容&lt;/p&gt;

&lt;p&gt;2、安装php5-cgi模块&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;php5-cgi php5-gd php5-curl
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;修改&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/php5/cgi/php.ini&lt;/code&gt;文件，里面有一项&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cgi.fix_pathinfo&lt;/code&gt;数据为1，默认为0 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cgi.fix_pathinfo=1&lt;/code&gt;; 这样&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php5-cgi&lt;/code&gt;方能正常使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SCRIPT_FILENAME&lt;/code&gt;这个变量。&lt;/p&gt;

&lt;p&gt;这里还要装一个php加速的软件&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ZendOptimizer&lt;/code&gt;，在输入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php.ini&lt;/code&gt;位置的时候输入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/php5/cgi/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;3、安装&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;spawn-fcgi spawn-fcgi&lt;/code&gt;是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lighttpd&lt;/code&gt;的一个用来控制&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php-cgi&lt;/code&gt;的工具
如果系统没有安装&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GCC&lt;/code&gt;编译环境，刚需要在安装&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lighttpd&lt;/code&gt;之前要安装&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;build-essential&lt;/code&gt;工具包，执行以下&lt;/p&gt;

&lt;p&gt;命令&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;aptitude &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;build-essential  libpcre3-dev
wget http://www.lighttpd.net/download/spawn-fcgi-1.6.3.tar.gz
&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-zxf&lt;/span&gt; spawn-fcgi-1.6.3.tar.gz
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;spawn-fcgi-1.6.3
./configure &lt;span class=&quot;nt&quot;&gt;--bindir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/bin &lt;span class=&quot;nt&quot;&gt;--libdir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/lib &lt;span class=&quot;nt&quot;&gt;--prefix&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/etc
make&amp;amp;&amp;amp;make &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样cgi控制器就安装完成了。&lt;/p&gt;

&lt;p&gt;4、启动cgi&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;spawn-fcgi &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; 127.0.0.1 &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 9000 &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; 5 &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; www &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; www &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; /usr/bin/php5-cgi
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;注意:ip,端口与nginx服务器中的fastcgi-pass要对应. -C表示打开几个cgi进程
启动nginx ，在启动之前先测试下配置文件是否正确&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nginx &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; /etc/nginx/conf/nginx.conf
2009/02/03 15:27:12 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;info] 21782#0: the configuration file /etc/nginx/conf/nginx.conf syntax is ok
2009/02/03 15:27:12 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;info] 21782#0: the configuration file /etc/nginx/conf/nginx.conf was tested successfully
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;出现以上信息说明配置文件准确。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/etc/init.d/nginx start
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;好了，如果没有出错信息，则说明配置成功了，现在写个phpinfo测试下吧&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /home/web
vim index.php
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;输入&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;phpinfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;保存。测试是否出现phpinfo&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl http://127.0.0.1/index.php
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;或者用其它机器访问本&lt;/p&gt;

&lt;p&gt;完成!&lt;/p&gt;
</content>
                 <tag>Debian</tag>  <tag>Nginx</tag>  <tag>PHP</tag> 
                 <tag>VPS</tag> 
                <pubTime>2011-02-05T22:15:21+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/nginx-debian.html</loc>
        <lastmod>2011-02-03T21:42:05+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Debian下快速部署Nginx</title>
                <content>
&lt;p&gt;之前介绍了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LNMP&lt;/code&gt;的一键安装，但是因为VPS的内存太小，在256M下面同时运行Nginx和Mysql会爆内存，所以决定分开两部服务器。一部做前端，一部做数据库。&lt;/p&gt;

&lt;p&gt;参考了：http://67054.blog.51cto.com/57054/128245 ，之后成功在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Debian&lt;/code&gt;下面部署&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Nginx&lt;/code&gt;。分享一下：&lt;/p&gt;

&lt;p&gt;首先不需要太多包，只需要 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pcre&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssl&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zlib&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;aptitude &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;现在，我们可以下载源代码了。如下&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt;  /home
wget  http://sysoev.ru/nginx/nginx-0.7.30.tar.gz
&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-zxvf&lt;/span&gt; nginx-0.7.30.tar.gz
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;nginx-0.7.30
./configure &lt;span class=&quot;nt&quot;&gt;--sbin-path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/local/sbin &lt;span class=&quot;nt&quot;&gt;--with-http_ssl_module&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;--with-http_stub_status_module&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最后会显示&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5 library is not used
+ sha1 library is not used
+ using system zlib library
nginx path prefix: &lt;span class=&quot;s2&quot;&gt;&quot;/usr/local/nginx&quot;&lt;/span&gt;
nginx binary file: &lt;span class=&quot;s2&quot;&gt;&quot;/usr/local/sbin&quot;&lt;/span&gt;
nginx configuration prefix: &lt;span class=&quot;s2&quot;&gt;&quot;/usr/local/nginx/conf&quot;&lt;/span&gt;
nginx configuration file: &lt;span class=&quot;s2&quot;&gt;&quot;/usr/local/nginx/conf/nginx.conf&quot;&lt;/span&gt;
nginx pid file: &lt;span class=&quot;s2&quot;&gt;&quot;/usr/local/nginx/logs/nginx.pid&quot;&lt;/span&gt;
nginx error log file: &lt;span class=&quot;s2&quot;&gt;&quot;/usr/local/nginx/logs/error.log&quot;&lt;/span&gt;
nginx http access log file: &lt;span class=&quot;s2&quot;&gt;&quot;/usr/local/nginx/logs/access.log&quot;&lt;/span&gt;
nginx http client request body temporary files: &lt;span class=&quot;s2&quot;&gt;&quot;/usr/local/nginx/client_body_temp&quot;&lt;/span&gt;
nginx http proxy temporary files: &lt;span class=&quot;s2&quot;&gt;&quot;/usr/local/nginx/proxy_temp&quot;&lt;/span&gt;
nginx http fastcgi temporary files: &lt;span class=&quot;s2&quot;&gt;&quot;/usr/local/nginx/fastcgi_temp&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;继续&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;make&amp;amp;&amp;amp;make &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;现在来创建一个启动脚本&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nano /etc/init.d/nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后插入以下脚本&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#! /bin/sh&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;### BEGIN INIT INFO&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Provides:          nginx&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Required-Start:    $all&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Required-Stop:     $all&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Default-Start:     2 3 4 5&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Default-Stop:      0 1 6&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Short-De.ion: starts the nginx web server&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# De.ion:       starts nginx using start-stop-daemon&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;### END INIT INFO&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
&lt;span class=&quot;nv&quot;&gt;DAEMON&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/local/sbin/nginx
&lt;span class=&quot;nv&quot;&gt;NAME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;nginx
&lt;span class=&quot;nv&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;nginx
&lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$DAEMON&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;exit &lt;/span&gt;0
&lt;span class=&quot;c&quot;&gt;# Include nginx defaults if available&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; /etc/default/nginx &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; /etc/default/nginx
&lt;span class=&quot;k&quot;&gt;fi
&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in
&lt;/span&gt;start&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Starting &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$DESC&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;: &quot;&lt;/span&gt;
	start-stop-daemon &lt;span class=&quot;nt&quot;&gt;--start&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--quiet&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--pidfile&lt;/span&gt; /usr/local/nginx/logs/nginx.pid &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;--exec&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$DAEMON&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$DAEMON_OPTS&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$NAME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.&quot;&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
stop&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Stopping &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$DESC&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;: &quot;&lt;/span&gt;
	start-stop-daemon &lt;span class=&quot;nt&quot;&gt;--stop&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--quiet&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--pidfile&lt;/span&gt; /usr/local/nginx/logs/nginx.pid &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;--exec&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$DAEMON&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$NAME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.&quot;&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
restart|force-reload&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Restarting &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$DESC&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;: &quot;&lt;/span&gt;
	start-stop-daemon &lt;span class=&quot;nt&quot;&gt;--stop&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--quiet&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--pidfile&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
	/usr/local/nginx/logs/nginx.pid &lt;span class=&quot;nt&quot;&gt;--exec&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$DAEMON&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;sleep &lt;/span&gt;1
	start-stop-daemon &lt;span class=&quot;nt&quot;&gt;--start&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--quiet&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--pidfile&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
	/usr/local/nginx/logs/nginx.pid &lt;span class=&quot;nt&quot;&gt;--exec&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$DAEMON&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$DAEMON_OPTS&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$NAME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.&quot;&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
reload&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Reloading &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$DESC&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; configuration: &quot;&lt;/span&gt;
	start-stop-daemon &lt;span class=&quot;nt&quot;&gt;--stop&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--signal&lt;/span&gt; HUP &lt;span class=&quot;nt&quot;&gt;--quiet&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--pidfile&lt;/span&gt; /usr/local/nginx/logs/nginx.pid &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;--exec&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$DAEMON&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$NAME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.&quot;&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/etc/init.d/&lt;span class=&quot;nv&quot;&gt;$NAME&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Usage: &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$N&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; {start|stop|restart|force-reload}&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&amp;amp;2
&lt;span class=&quot;nb&quot;&gt;exit &lt;/span&gt;1
&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;esac&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;exit &lt;/span&gt;0
&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/etc/init.d/&lt;span class=&quot;nv&quot;&gt;$NAME&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Usage: &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$N&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; {start|stop|restart|force-reload}&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&amp;amp;2
&lt;span class=&quot;nb&quot;&gt;exit &lt;/span&gt;1
&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;esac
&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;exit &lt;/span&gt;0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;继续&lt;/p&gt;

&lt;p&gt;添加脚本到系统默认运行级别&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/usr/sbin/update-rc.d &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; nginx defaults
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;由于nginx是安装在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/&lt;/code&gt;，可以链接到我们常用的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/&lt;/code&gt;下&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /usr/local/nginx  /etc/nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;现在可以运行nginx了&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/etc/init.d/nginx start
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;继续&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl http://localhost
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;或者用局域网其它机器访问本机,如果出现&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Welcome to nginx!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;说明nginx安装成功了。&lt;/p&gt;
</content>
                 <tag>Debian</tag>  <tag>Nginx</tag> 
                 <tag>VPS</tag> 
                <pubTime>2011-02-03T21:42:05+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ubuntu-system-garbage-removal.html</loc>
        <lastmod>2011-02-02T20:22:27+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>ubuntu系统垃圾清除</title>
                <content>
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get autoclean清理旧版本的软件缓存
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get clean清理所有软件缓存
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get autoremove删除系统不再使用的孤立软件
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;dpkg &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; |grep ^rc|awk &lt;span class=&quot;s1&quot;&gt;'{print $2}'&lt;/span&gt; |sudo xargs dpkg &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; 清除已删除包的残馀配置文件
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>Ubuntu</tag> 
                 <tag>VPS</tag> 
                <pubTime>2011-02-02T20:22:27+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/vps-mysql-php-phpmyadmin.html</loc>
        <lastmod>2011-02-01T11:09:50+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>VPS LNMP(Nginx、MySQL、PHP、phpMyAdmin)一键安装配置</title>
                <content>
&lt;p&gt;最近申请了免费的VPS主机在练手，所以想在上面安装一个LAMP环境，但是鉴于内存只有256，相当有限，而且CPU配置比较低，只能投靠Nginx的怀抱。&lt;/p&gt;

&lt;p&gt;在网上找到一个LNMP的集成环境安装包，很不错，和大家分享一下。http://lnmp.org&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LNMP&lt;/code&gt;一键安装包是一个用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Linux Shell&lt;/code&gt;编写的可以为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CentOS/RadHat&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Debian/Ubuntu VPS(VDS)&lt;/code&gt;或独立主机安装&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LNMP&lt;/code&gt;(&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Nginx&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MySQL&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PHP&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;phpMyAdmin&lt;/code&gt;)生产环境的Shell程序。&lt;/p&gt;

&lt;h3 id=&quot;我们为什么需要它&quot;&gt;我们为什么需要它?&lt;/h3&gt;

&lt;p&gt;编译安装需要输入大量的命令，如果是配置生产环境需要耗费大量的时间。
不会Linux的站长或Linux新手想使用Linux作为生产环境……&lt;/p&gt;

&lt;h3 id=&quot;它有什么优势&quot;&gt;它有什么优势?&lt;/h3&gt;

&lt;p&gt;无需一个一个的输入命令，无需值守，编译安装优化编译参数，提高性能，解决不必要的软件间依赖，特别针对VPS用户进行了优化。&lt;/p&gt;

&lt;h3 id=&quot;安装哪些软件&quot;&gt;安装哪些软件&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Nginx&lt;/li&gt;
  &lt;li&gt;MySQL&lt;/li&gt;
  &lt;li&gt;PHP&lt;/li&gt;
  &lt;li&gt;PHPMyAdmin&lt;/li&gt;
  &lt;li&gt;Zend Optimizer&lt;/li&gt;
  &lt;li&gt;eAccelerator&lt;/li&gt;
  &lt;li&gt;Nginx-RRD&lt;/li&gt;
  &lt;li&gt;vsFTPd/PureFtpd&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;安装步骤&quot;&gt;安装步骤:&lt;/h3&gt;

&lt;p&gt;1、下载LNMP一键安装包：&lt;/p&gt;

&lt;p&gt;可以选择使用下载版(推荐国外或者美国VPS使用)或者完整版(推荐国内VPS使用)，如果使用下载版执行命令 wget -c http://soft.vpser.net/lnmp/lnmp0.5.tar.gz，如果使用完整版，执行命令 wget -c http://soft.vpser.net/lnmp/lnmp0.5-full.tar.gz，执行上述命令后LNMP一键安装包就会被下载到VPS上。&lt;/p&gt;

&lt;p&gt;2、解压LNMP一键安装包：&lt;/p&gt;

&lt;p&gt;执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tar zxvf lnmp0.5.tar.gz&lt;/code&gt;或者&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tar zxvf lnmp0.5-full.tar.gz&lt;/code&gt; 就会将LNMP一键安装包解压缩。&lt;/p&gt;

&lt;p&gt;3、CentOS下安装步骤&lt;/p&gt;

&lt;p&gt;下载版执行命令 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cd lnmp0.5/&lt;/code&gt; ，完整版执行命令：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cd lnmp0.5-full/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;然后再执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./centos.sh&lt;/code&gt; 也可以执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./centos.sh | tee lnmp.log&lt;/code&gt; (推荐这种方式,出错时可以到论坛上传&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lnmp.log&lt;/code&gt;日志)，输入要绑定的域名，回车，再输入要设置的MySQL root的密码，再次回车确认。程序会自动安装编译Nginx、PHP、MySQL、phpMyAdmin、Zend这几个软件。&lt;/p&gt;

&lt;p&gt;4、Debian/Ubuntu下安装步骤&lt;/p&gt;

&lt;p&gt;下载版执行命令 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cd lnmp0.5/&lt;/code&gt; ，完整版执行命令：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cd lnmp0.5-full/&lt;/code&gt;
然后执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./debian.sh&lt;/code&gt; 也可以执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./debian.sh | tee lnmp.log&lt;/code&gt;(推荐这种方式,出错时可以到论坛上传lnmp.log日志)，输入要绑定的域名，回车，&lt;/p&gt;

&lt;p&gt;再次输入VPS/服务器所在位置：asia、america、europe、oceania或africa，回车，再输入要设置的MySQL root的密码，回车后，再次回车确认。&lt;/p&gt;

&lt;p&gt;程序会自动安装编译Nginx、PHP、MySQL、phpMyAdmin、Zend这几个软件。安装大约10分钟左右需要设置MySQL root用户的密码。&lt;/p&gt;

&lt;h3 id=&quot;安装其他组件&quot;&gt;安装其他组件&lt;/h3&gt;

&lt;p&gt;1、安装eAccelerator，执行如下命令：./eaccelerator.sh 就会自动安装并重启web服务。&lt;/p&gt;

&lt;p&gt;2、安装ionCube，执行如下命令：./ionCube.sh 就会自动安装并重启web服务。&lt;/p&gt;

&lt;p&gt;3、安装PureFTPd和管理面板，执行如下命令：./pureftpd.sh 就会自动安装PureFTPd，安装完PureFTPd，需要在浏览器执行http://你的域名或IP/ftp/install.php 安装PureFTPd用户管理。详细教程参考：http://www.vpser.net/manage/lnmp-pureftpd-cp.html&lt;/p&gt;

&lt;p&gt;4、安装VsFTPD，执行如下命令：./vsftpd.sh 就会自动安装上vsftpd，只需要执行命令：useradd -d /home/wwwroot -s /sbin/nologin adminftp 添加上帐号指定好ftp帐号的根目录，再执行：passwd adminftp 设置上密码，登录就可以了。&lt;/p&gt;

&lt;h3 id=&quot;虚拟主机管理&quot;&gt;虚拟主机管理&lt;/h3&gt;

&lt;p&gt;1、添加虚拟主机&lt;/p&gt;

&lt;p&gt;执行如下命令：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/root/vhost.sh&lt;/code&gt; 根据提示输入要绑定的域名，回车，如果需要添加更多的域名，输入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;y&lt;/code&gt;，再输入要另外绑定的域名，多个域名可以用空格隔开。&lt;/p&gt;

&lt;p&gt;再输入域名绑定的目录(绝对目录，如&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/home/wwwroot/lnmp&lt;/code&gt;，如果不填默认是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/home/wwwroot/绑定的域名&lt;/code&gt;)，再选择是否添加伪静态规则，默认已经有了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Discuz&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Wordpress&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sablog&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;emlog&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dabr&lt;/code&gt;，可直接输入以上名称即可，如果需要添加自定义伪静态规则，直接输入一个想要的名字，程序会自动创建伪静态文件，直接在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/nginx/conf/你自定义的伪静态名字.conf&lt;/code&gt; 里面添加伪静态规则就行。接下来会提示是否需要启用日志功能，一般情况下不需要启动，直接输入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt;就行，如需启动，输入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;y&lt;/code&gt;，再输入要定义的日志文件名字，回车就会自动添加虚拟主机。&lt;/p&gt;

&lt;p&gt;2、删除虚拟主机，ssh执行：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rm /usr/local/nginx/conf/vhost/域名.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;3、状态管理及相关管理页面&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td&gt;LNMP状态管理： /root/lnmp {start&lt;/td&gt;
          &lt;td&gt;stop&lt;/td&gt;
          &lt;td&gt;reload&lt;/td&gt;
          &lt;td&gt;restart&lt;/td&gt;
          &lt;td&gt;kill&lt;/td&gt;
          &lt;td&gt;status}&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td&gt;PureFTPd状态管理 /root/pureftpd {start&lt;/td&gt;
          &lt;td&gt;stop&lt;/td&gt;
          &lt;td&gt;restart&lt;/td&gt;
          &lt;td&gt;kill&lt;/td&gt;
          &lt;td&gt;status}&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/li&gt;
  &lt;li&gt;phpinfo : http://前面输入的域名或IP/phpinfo.php&lt;/li&gt;
  &lt;li&gt;phpMyAdmin : http://前面输入的域名或IP/phpmyadmin/&lt;/li&gt;
  &lt;li&gt;探针 : http://前面输入的域名或IP/p.php&lt;/li&gt;
  &lt;li&gt;MySQL root密码：如果不输入直接回车为root，否则为你输入的密码。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;lnmp相关目录&quot;&gt;LNMP相关目录：&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;mysql : /usr/local/mysql&lt;/li&gt;
  &lt;li&gt;php : /usr/local/php&lt;/li&gt;
  &lt;li&gt;nginx : /usr/local/nginx&lt;/li&gt;
  &lt;li&gt;网站目录: /home/wwwroot&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;注：已经在DiaHosting、PhotonVPS（感谢提供测试VPS）、RasHost、VPSYOU、BurstNet、Linode、VPS.net、Rapidxen 及几位lnmp网友提供的VPS上的CentOS 32/64bit、Debian 4/5 32/64bit上测试成功。同时感谢提供测试VPS的商家及网友。&lt;/p&gt;
</content>
                 <tag>Debian</tag>  <tag>MySQL</tag>  <tag>Nginx</tag>  <tag>PHP</tag> 
                 <tag>VPS</tag> 
                <pubTime>2011-02-01T11:09:50+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/discuzx-error-406-not-acceptable-solution.html</loc>
        <lastmod>2011-01-31T10:55:44+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Discuz X保存时406 Not Acceptable错误解决方法</title>
                <content>
&lt;p&gt;之前一直正常的DiscuzX1突然出问题，在DIY后保存或者在后台改变设置保存时会出现，&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;406 Not Acceptable&lt;/p&gt;

  &lt;p&gt;An appropriate representation of the requested resource / could not be found on this server.&lt;/p&gt;

  &lt;p&gt;Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;升级成X1.5依旧这样，我就怀疑是服务器的问题。&lt;/p&gt;

&lt;p&gt;研究了之后才发现，原来是服务器为了您的网站安全，在所有的共享服务器上安装有Apache的一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MOD&lt;/code&gt;叫作&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Mod security&lt;/code&gt;，就是因为这个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MOD&lt;/code&gt;，当网址中包含有“%”号等其它敏感字符的时候，就会被&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Mod security&lt;/code&gt; 阻挡，导致 406 Not Acceptable 错误。&lt;/p&gt;

&lt;p&gt;如果是旧版本的Apache就可以通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt;控制 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Mod security&lt;/code&gt; 的一些选项，新版中没办法使用.htaccess控制了，只能联系他们的技术支持将你的网址加入白名单内。一般出现这样的情况都是国外的空间，下面为英文不好的童鞋提供一个发邮件或者Ticket的模版。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Hello, I am sorry to bother you! I hope you can help me disable the Mod security for this domain: **???.com**, my cpanel account name is **???**. 
Because my URL must contain the characters &quot;%&quot;, but the Mod security led to the error, thanks very much!
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;把里面的域名和账户名提换成你的就OK了。&lt;/p&gt;
</content>
                
                 <tag>康盛</tag> 
                <pubTime>2011-01-31T10:55:44+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/j2me-environment-build-download.html</loc>
        <lastmod>2011-01-28T16:15:10+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>j2me环境搭建及软件下载</title>
                <content>
&lt;p&gt;最近突发奇想想做PageCookery的手机java端，之前看过一点j2me，现在很久没弄，都给生疏了，连环境怎么搭都忘了，花了很久去Sun那里下载东西，贴出来大家共享一下，加快下载速度嘛。&lt;/p&gt;

&lt;p&gt;本文环境主要需要（会提供Dbank高速下载）&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;jdk1.6 下载地址：http://java.sun.com/javase/downloads/index.jsp&lt;/li&gt;
  &lt;li&gt;Eclipse3.6.1 下载地址：http://www.eclipse.org/downloads/&lt;/li&gt;
  &lt;li&gt;WTK是2.5.2版本的 下载地址：http://java.sun.com/javame/downloads/index.jsp&lt;/li&gt;
  &lt;li&gt;eclipseme 1.79版本 下载地址：http://sourceforge.net/project/showfiles.php?group_id=86829&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Dbank高速下载：&lt;a href=&quot;http://dl.dbank.com/c0qbt3fn78&quot;&gt;j2me环境搭建软件&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;安装配置&lt;/p&gt;

&lt;p&gt;1、安装jdk，一路next&lt;/p&gt;

&lt;p&gt;2、Eclipse安装，解压到指定目录即可&lt;/p&gt;

&lt;p&gt;3、安装wtk，一路next,注意路径选择（一会要用）&lt;/p&gt;

&lt;p&gt;4、Eclipse me插件安装. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;help&lt;/code&gt;–&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;software updates&lt;/code&gt;–&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;available Software(面板)&lt;/code&gt;，–&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Add Site&lt;/code&gt; –&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Archive&lt;/code&gt;(选择eclipseme插件文件)确定之后你会在发现一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;E:\tool\java\eclipseme.feature_1.7.9_site.zip&lt;/code&gt;!(file:后面的根据你的路径会不一样)，然后选中这个，再点击右边菜单install，安装过后eclipse会提示是否重启eclipse,选重启这个时候已经安装完啦&lt;/p&gt;

&lt;p&gt;5、重启后配置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;window&lt;/code&gt;–&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Preferences&lt;/code&gt;找到J2ME下的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Device Managerment&lt;/code&gt; ,右边菜单Import，选择刚才&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wtk&lt;/code&gt;的安装路径，选择&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DefaultColorPhone&lt;/code&gt;，OK！&lt;/p&gt;

&lt;p&gt;6、Eclipse汉化，&lt;/p&gt;

&lt;p&gt;可以使用最简单，直接拷贝法：将对应目录下的文件拷贝到和Eclipse对应目录下即可。（将解压后的语言包下的features和plugins目录下的所有文件和jar包分别拷贝到Eclipse的features和plugins目录下）这样就汉化成功了，不过这种方法日后不好管理；&lt;/p&gt;

&lt;p&gt;或者使用link安装，在eclipse -&amp;gt;Help -&amp;gt;software updates -&amp;gt; Find and Install -&amp;gt;Search for new features to install -&amp;gt;NEXT-&amp;gt;选择New Remote Site 升级地址填写为&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;http://download.eclipse.org/technology/babel/update-site/R0.8.0/helios&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;然后出列表后选择一下简体中文就可以了！&lt;/p&gt;

&lt;p&gt;现在整个开发环境已经配置好啦&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helloworld程序编程&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1、建立工程：文件–&amp;gt;新项目–&amp;gt;选择J2ME下的J2ME Midlet Suite，工程建立完毕&lt;/p&gt;

&lt;p&gt;2、Helloworld类，在src上右键“新建其他”，在面板上选j2me下的J2ME Midlet，这个类自动继承了MIDlet类，类名为HelloWorld，内容如下：&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;javax.microedition.lcdui.Display&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;javax.microedition.lcdui.TextBox&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;javax.microedition.midlet.MIDlet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;javax.microedition.midlet.MIDletStateChangeException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;  

&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HelloWorld&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MIDlet&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TextBox&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;textbox&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;HelloWorld&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;textbox&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TextBox&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Hello World!&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;destroyApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MIDletStateChangeException&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nc&quot;&gt;Display&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getDisplay&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCurrent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;textbox&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;pauseApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// TODO Auto-generated method stub&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;startApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MIDletStateChangeException&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// TODO Auto-generated method stub&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;四、运行程序&lt;/p&gt;

&lt;p&gt;点击&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Run&lt;/code&gt;，耐心等下你会看到一个非常漂亮的手机，虽然只是个图案。&lt;/p&gt;

&lt;p&gt;这样就大功告成了！&lt;/p&gt;
</content>
                 <tag>j2me</tag>  <tag>Java</tag>  <tag>移动开发</tag> 
                 <tag>j2me</tag> 
                <pubTime>2011-01-28T16:15:10+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/sina-oauth-verification-storage.html</loc>
        <lastmod>2011-01-27T09:22:28+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>新浪微博OAuth认证详解及验证数据储存</title>
                <content>
&lt;p&gt;网上很多关于OAuth的文章，但是包括sina本身都都没有详细的的介绍，包括验证过程和验证后数据的储存，所以参考了Twitter的认证过程写下一些详细的注释代码。&lt;/p&gt;

&lt;p&gt;在我们开始前，我们先建立一张数据库来保存用户信息，下面是一个基本的 Mysql 的例子：&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TABLE&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`oauth_users`&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;`id`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;INT&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;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;UNSIGNED&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;`oauth_provider`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;VARCHAR&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;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;`oauth_uid`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;`oauth_token`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;`oauth_secret`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;`username`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;PRIMARY&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;KEY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`id`&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;ENGINE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MyISAM&lt;/span&gt;  &lt;span class=&quot;k&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CHARSET&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;注意 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oauth_token&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oauth_secret&lt;/code&gt; 这两个字段。sina的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OAuth&lt;/code&gt; 认证需要 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;token&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;token_secret&lt;/code&gt; 两个参数来完成认证，所以我们需要预留两个字段来记录他们。&lt;/p&gt;

&lt;p&gt;然后我们需要依次完成以下工作：&lt;/p&gt;

&lt;p&gt;向 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SinaAPI&lt;/code&gt;发起认证申请
注册/或者登录，如果用户已经有帐号的情况下
将相关数据保存在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Session&lt;/code&gt; 中&lt;/p&gt;

&lt;p&gt;基于 OAuth 的认证流程从生成一个网址开始。用户被重定向到该网址要求认证，认证通过后，会重定向到我们的应用服务器，并会将两个认证后的参数通过 URL 方式传回。&lt;/p&gt;

&lt;p&gt;建立index.php&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;session_start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//if( isset($_SESSION['last_key']) )&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Location: weibolist.php&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;include_once&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'config.php'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;include_once&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'weibooauth.php'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 创建 sinaOAuth 对象实例&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$sinaOAuth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;WeiboOAuth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;WB_AKEY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;WB_SKEY&lt;/span&gt;  &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$keys&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$sinaOAuth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getRequestToken&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Requesting authentication tokens, the parameter is the URL we will be redirected to&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$aurl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$sinaOAuth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getAuthorizeURL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token'&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;kc&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'http://t.yourtion.com/sina/callback.php'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 保存到 session 中&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'keys'&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;nv&quot;&gt;$keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$aurl&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Use Oauth to login&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;接下来，我们还需要在这个文件中完成以下三件事：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;验证 URL 中的数据&lt;/li&gt;
  &lt;li&gt;验证 Session 中的 token 数据&lt;/li&gt;
  &lt;li&gt;验证 Session 中的 secret 数据&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;如果所有数据库都是合法的，我们需要创建一个新的 SinaOAuth 对象实例，跟之前不同的是，我们要把获取到的 token 数据做为参数传入对象。之后，我们应该可以获取到一个 access token，这个获取到的数据应该是一个数组，这个 access token 是我们唯一需要保存起来的数据。&lt;/p&gt;

&lt;p&gt;建立callback.php&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;session_start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;include_once&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'config.php'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;include_once&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'weibooauth.php'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&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;nb&quot;&gt;empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_GET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_verifier'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'keys'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'keys'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token'&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;c1&quot;&gt;// SinaOAuth 对象实例，注意新加入的两个参数&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$sinaOAuth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;WeiboOAuth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;WB_AKEY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;WB_SKEY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'keys'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'keys'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token_secret'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 获取 access token&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$access_token&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$sinaOAuth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getAccessToken&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_REQUEST&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_verifier'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 将获取到的 access token 保存到 Session 中&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'access_token'&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;nv&quot;&gt;$access_token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 获取用户信息&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$user_info&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$sinaOAuth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'account/verify_credentials'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 打印用户信息&lt;/span&gt;
  	&lt;span class=&quot;nb&quot;&gt;mysql_connect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DATABASE_HOST&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;DATABASE_USER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;DATABASE_PSSWORD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;mysql_select_db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DATABASE_DB_NAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;c1&quot;&gt;//更换成你的数据库连接，在config.php中&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$user_info&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&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;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$user_info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'id'&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;c1&quot;&gt;// Something's wrong, go back to square 1&lt;/span&gt;
        &lt;span class=&quot;nb&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Location: index.php'&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;k&quot;&gt;else&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// Let's find the user by its ID&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;SELECT * FROM oauth_users WHERE oauth_provider='sina' AND oauth_uid=&quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$user_info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'id'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;mysql_query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;mysql_fetch_array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// If not, let's add it to the database&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$result&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;nv&quot;&gt;$sql&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;INSERT INTO oauth_users (oauth_provider, oauth_uid, username, oauth_token, oauth_secret) VALUES ('sina', '&quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;
                &lt;span class=&quot;nv&quot;&gt;$user_info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'id'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;', '&quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$user_info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'screen_name'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;', '&quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$access_token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;
                &lt;span class=&quot;s2&quot;&gt;&quot;', '&quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$access_token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token_secret'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;')&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;mysql_query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;mysql_query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;SELECT * FROM oauth_users WHERE id = &quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mysql_insert_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;mysql_fetch_array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$query&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;k&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;// Update the tokens&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;mysql_query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;UPDATE oauth_users SET oauth_token = '&quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$access_token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;
                &lt;span class=&quot;s2&quot;&gt;&quot;', oauth_secret = '&quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$access_token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token_secret'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;
                &lt;span class=&quot;s2&quot;&gt;&quot;' WHERE oauth_provider = 'sina' AND oauth_uid = &quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$user_info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'id'&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;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'id'&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;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'id'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'username'&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;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'username'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_uid'&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;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_uid'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_provider'&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;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_provider'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token'&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;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_token'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_secret'&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;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'oauth_secret'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
		&lt;span class=&quot;nb&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Location: update.php'&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;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 数据不完整，转到上一步&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Location: index.php'&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;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;你可以通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$user_info-&amp;gt;id&lt;/code&gt; 来获得用户的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ID&lt;/code&gt;，通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$user_info-&amp;gt;screen_name&lt;/code&gt; 来获取用户名，等等，其它的信息也可以通过同样的方式获取。&lt;/p&gt;

&lt;p&gt;需要重点指出的是，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oauth_verifier&lt;/code&gt; 这个传回来的参数不能被重用，如果上面的代码已经正确输出了用户信息，你可以试着重新刷新页面，应该会看到页面会抛出一个错误信息，因为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oauth_verifier&lt;/code&gt; 已经被我们用过一次了。要再次使用，需要到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.php&lt;/code&gt; 页面重新发起一个认证请求。&lt;/p&gt;

&lt;p&gt;用户注册&lt;/p&gt;

&lt;p&gt;获得了用户信息后，现在我们要开始把用户信息注册到我们自己的数据库中，当然前提是用户没有在本地数据库注册过。&lt;/p&gt;

&lt;p&gt;上面代码中的数据库链接信息要改成你自己的。如果用户已经存在于我们的数据库中，我们需要更新用户的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tokens&lt;/code&gt; 字段，因为这说明 Twitter 生成了新的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tokens&lt;/code&gt;，数据库中的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tokens&lt;/code&gt; 已经过期了。如果用户不存在，我们需要新加一条记录，并将相关的数据保存在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Session&lt;/code&gt;中，最后重定向回 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;update.php&lt;/code&gt; 页面。&lt;/p&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;update.php&lt;/code&gt;代码如下：&lt;/p&gt;

&lt;p&gt;需要注意的是，上面代码中的 SQL 没有经过验证，你在实际使用的时候可能要经过修改。连接数据库前，我们需要先验证一下用户是否已经登录。有了用户名，我们就可以展示一条个性的欢迎信息了：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php
include_once ('config.php');
include_once ('weibooauth.php');
session_start();
if(!empty($_SESSION['username'])){
    // User is logged in, redirect
    header('index.php');
}
?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.w3.org/1999/xhtml&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;dir=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ltr&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;lang=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;zh-CN&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;head&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;profile=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://gmpg.org/xfn/11&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;通过 OAuth 进行身份验证--Yourtion&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;content-type&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/html; charset=UTF-8&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Hello &lt;span class=&quot;cp&quot;&gt;&amp;lt;?=$_SESSION['username'] ?&amp;gt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这就是OAuth认证和储存的主要过程，希望对你有帮助。
代码下载：&lt;a href=&quot;http://dl.dbank.com/c08tfjks09&quot;&gt;SinaOauth&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>PHP</tag> 
                 <tag>PHP</tag> 
                <pubTime>2011-01-27T09:22:28+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/curl-json-headers-already-sent-solution.html</loc>
        <lastmod>2011-01-26T08:50:43+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>关于curl json返回值导致headers already sent的新解决</title>
                <content>
&lt;p&gt;今天心血来潮研究新浪跟微博通的API发布，用的是Curl+json数据。但是数据虽然可以正常地到达微博通还有新浪，但是发布页面会出现：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Warning: Cannot modify header information - headers already sent by (output started at /home/jcom/public_html/yourtion/t/index.php:418&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;研究了很久，很多人说只要把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl_setopt($ch,CURLOPT_HEADER,false)&lt;/code&gt;就行了。&lt;/p&gt;

&lt;p&gt;但是改了之后一样会出现headers already sent的问题。&lt;/p&gt;

&lt;p&gt;所以应该是curl后返回值输出引起的，仔细研读&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;phpmanual&lt;/code&gt;之后，发现curl有一个变量是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CURLOPT_RETURNTRANSFER&lt;/code&gt;，作用是将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl_exec()&lt;/code&gt;获取的信息以文件流的形式返回，而不是直接输出。&lt;/p&gt;

&lt;p&gt;灵机一动想到江curl输出储存到变量然后不输出就不会引起headers already sent。&lt;/p&gt;

&lt;p&gt;问题最终解决。顺便分享一下”Cannot modify header information”的解决方法：&lt;/p&gt;

&lt;p&gt;1.Blank lines (空白行):检查有&amp;lt;?php … ?&amp;gt; 后面没有空白行，特别是include或者require的文件。不少问题是这些空白行导致的。&lt;/p&gt;

&lt;p&gt;2.Use exit statement (用exit来解决):Use exit after header statement seems to help some people在header后加上exit();&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;header&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Location: xxx&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;3.PHP has this annoying problem, if your HTML goes before any PHP code or any header modification before redirecting to certain page, it’ll said “Warning: Cannot modify header information - headers already sent by ….” Basically anytime you output to browser, the header is set and cannot be modified.  So two ways to get around the problem:
3a. Use Javascript (用Javascript来解决):&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;script&amp;gt; self.location(&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;file.php&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;);&amp;lt;/script&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Since it’s a script, it won’t modify the header until execution of Javascript.可以用Javascript来代替header。&lt;/p&gt;

&lt;p&gt;但是上面的这段代码我没有执行成功… 另外需要注意，采用这种方法需要浏览器支持Javascript.&lt;/p&gt;

&lt;p&gt;3b. Use output buffering (用输出缓存来解决):&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;ob_start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
... HTML codes ...
&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;mf&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;PHP&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;codes&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;header&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Location: ....&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;ob_end_flush&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This will save the output buffer on server and not output to browser yet, which means you can modify the header all you want until the ob_end_flush() statement.  This method is cleaner than the Javascript since Javascript method assumes the browser has Javascript turn on.  However, there are overhead to store output buffer on server before output, but with modern hardware I would imagine it won’t be that big of deal.  Javascript solution would be better if you know for sure your user has Javascript turn on on their browser.&lt;/p&gt;

&lt;p&gt;就像上面的代码那样，这种方法在生成页面的时候缓存，这样就允许在输出head之后再输出header了。&lt;/p&gt;

&lt;p&gt;4.set output_buffering = On in php.ini (开启php.ini中的output_buffering )set output_buffering = On will enable output buffering for all files. But this method may slow down your php output. The performance of this method depends on which Web server you’re working with, and what kind of scripts you’re using.&lt;/p&gt;

&lt;p&gt;这种方法和3b的方法理论上是一样的。但是这种方法开启了所有php程序的输出缓存，这样做可能影响php执行效率，这取决于服务器的性能和代码的复杂度。&lt;/p&gt;
</content>
                 <tag>PHP</tag>  <tag>解决问题</tag> 
                 <tag>PHP</tag> 
                <pubTime>2011-01-26T08:50:43+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/pagecookery-mobile-quickly-blogging.html</loc>
        <lastmod>2011-01-25T08:14:39+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PageCookery的手机快速微博功能--概念内测版</title>
                <content>
&lt;p&gt;最近用PageCookery架了一个情侣微博http://love.yourtion.com。是一个双栏情侣微博。随时随地的手机微博功能自然少不了！&lt;/p&gt;

&lt;p&gt;PageCookery的手机发布功能比较方便，但是部分是手机将居然连Cookie都不支持，这样就没办法办法成功登陆，更不用说微博，我女朋友的手机就是一个典型。&lt;/p&gt;

&lt;p&gt;为此，我在PageCookery手机网页端的基础上，改写了一个快速验证的微博发布回复系统，解决女朋友手机没办法发微博的问题，一开始是在原来微博系统的基础上增加一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;case&lt;/code&gt;，绕过原来的用户验证机制，用另外一个明码密码进行验证用户，最终发布微博。&lt;/p&gt;

&lt;p&gt;但是后来发现我在电脑可以正常发布微博到了手机就不行，研究了很久发现可能是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POST&lt;/code&gt;的时候用的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Form&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;enctype&lt;/code&gt;类型问题，把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;multipart/form-data&lt;/code&gt;改成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;application/x-www-form-urlencoded&lt;/code&gt;之后我地方手机是正常了，但是女朋友的还是不行，最终导致我重新写了发布的代码，但是问题依旧。&lt;/p&gt;

&lt;p&gt;在我研究了三天这个东西，即将抓狂的时候，决定把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POST&lt;/code&gt;改成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GET&lt;/code&gt;，然后，居然奇迹般的正常了，神马山寨机啊，居然连&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POST&lt;/code&gt;数据都会···我就开始佩服那些163啊新浪啊，他们的微博居然在我女朋友那边神马手机也能正常，算了，差距····&lt;/p&gt;

&lt;p&gt;因为是自己做来自己用，还是很粗糙的代码，安全性也一般，还有一些是硬编码，也就不放源码了，基本实现思路也说了，有兴趣的可以一起研究下，或者有空了重新写一下那些代码再发布。最后看图说话，快速发布微博的几个页面·····&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/01/love1.jpg&quot;&gt;&lt;img src=&quot;/images/2011/01/love1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/01/love2.jpg&quot;&gt;&lt;img src=&quot;/images/2011/01/love2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/01/love3.jpg&quot;&gt;&lt;img src=&quot;/images/2011/01/love3.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>Delphi</tag>  <tag>PageCookery</tag> 
                 <tag>PageCookery</tag> 
                <pubTime>2011-01-25T08:14:39+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/successful-applicants-sina-sae.html</loc>
        <lastmod>2011-01-24T07:40:51+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PageCookery与新浪微博、微博通同步更新</title>
                <content>
&lt;p&gt;因为讨厌了嘀咕同步到新浪微博的时候加的是嘀咕的链接，加上最近刚好想研究一下新浪API，借此机会研究开始研究curl和json的使用。&lt;/p&gt;

&lt;p&gt;看了很多文章还有研究一些插件后，决定采用Base认证进行链接，因为比较简单可行，怎么说也是个初学者嘛！&lt;/p&gt;

&lt;p&gt;在PageCookery的index.php里面找到case ‘save’:，在里面找到：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$entryid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$SQL&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Insert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'entry'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'prefix'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'time'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'from'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'userid'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;intval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'prefix'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]),&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Format&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Safe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'message'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]),&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;TIMENOW&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$User&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'id'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后在下面插入以下代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$status&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'message'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot; http://t.yourtion.com/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$sinapasswd&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;USERNAME:PASSWORD&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$sina&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;curl_init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;http://api.t.sina.com.cn/statuses/update.json&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;curl_setopt_array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sina&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;CURLOPT_HEADER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;CURLOPT_RETURNTRANSFER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;CURLOPT_POST&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&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;no&quot;&gt;CURLOPT_POSTFIELDS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;source=APPKEY&amp;amp;
status=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$status&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;CURLOPT_HTTPAUTH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;CURLAUTH_BASIC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;CURLOPT_USERPWD&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sinapasswd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$sian1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;curl_exec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sina&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;注意将其中的USERNAME、PASSWORD、APPKEY替换成你的信息，如果你没有新浪开放平台的APPKEY的话，那就建议你转用微博通http://weiboto.com/。去上面注册个账户就能同步各种SNS，还包括Twitter。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/01/weiboto.jpg&quot;&gt;&lt;img src=&quot;/images/2011/01/weiboto.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/01/weiboto1.jpg&quot;&gt;&lt;img src=&quot;/images/2011/01/weiboto1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;绑定你想要同步的SNS，然后使用以下代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$status&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'message'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$wbtpasswd&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;USERNAME:PASSWORD&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$wbt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;curl_init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;http://api.weiboto.com/statuses/update.json&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;curl_setopt_array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$wbt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;CURLOPT_HEADER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;CURLOPT_RETURNTRANSFER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;CURLOPT_POST&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&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;no&quot;&gt;CURLOPT_POSTFIELDS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;status=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$status&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;CURLOPT_HTTPAUTH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;CURLAUTH_BASIC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;CURLOPT_USERPWD&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$wbtpasswd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$wbt1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;curl_exec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$wbt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;还是记得替换你的USERNAME和PASSWORD。然后你发布的消息就同步了。&lt;/p&gt;

&lt;p&gt;测试的时候发了很多测试微博在新浪，嗮一下-&lt;a href=&quot;http://t.sina.com.cn/yourtion&quot;&gt;http://t.sina.com.cn/yourtion&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/01/sina2.jpg&quot;&gt;&lt;img src=&quot;/images/2011/01/sina2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/01/sina1.jpg&quot;&gt;&lt;img src=&quot;/images/2011/01/sina1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/01/xianguo.jpg&quot;&gt;&lt;img src=&quot;/images/2011/01/xianguo.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;希望大家测试成功，有什么问题欢迎提出，共同研究共同成长！&lt;/p&gt;
</content>
                 <tag>PageCookery</tag>  <tag>PHP</tag> 
                 <tag>PageCookery</tag> 
                <pubTime>2011-01-24T07:40:51+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/pagecookery-generate-sitemap.html</loc>
        <lastmod>2011-01-23T12:51:43+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PageCookery自动生成Sitemap</title>
                <content>
&lt;p&gt;之前写过&lt;a href=&quot;/pagecookery-create-sitemap.html&quot;&gt;《PageCookery生成SiteMap》&lt;/a&gt;的文章，介绍了怎么样利用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rss&lt;/code&gt;生成类改造成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sitemap&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;但是每次生成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SiteMap&lt;/code&gt;都要手动运行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sitemap.php&lt;/code&gt;才会生成，最近在研究快速发布微博的功能，刚好在编辑&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;httprequest.php&lt;/code&gt;这个文件，看到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rss&lt;/code&gt;生成的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cron&lt;/code&gt;。灵机一动，利用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;corn&lt;/code&gt;进行知道生成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sitemap&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;很简单，在httprequest.php里面找到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;case 'cron':&lt;/code&gt;，在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$_config['rss_import'] = array&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;(上面插入以下代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$_config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'sitemap'&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;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
		&lt;span class=&quot;s1&quot;&gt;'cache_root'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;basename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'PHP_SELF'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]),&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;__FILE__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'cache/'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;s1&quot;&gt;'distance'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;900&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;s1&quot;&gt;'script_location'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;basename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'PHP_SELF'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]),&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;__FILE__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'sitemap.php'&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;大功告成！以后Sitemap就是自动生成的了！&lt;/p&gt;
</content>
                 <tag>PageCookery</tag>  <tag>PHP</tag> 
                 <tag>PageCookery</tag> 
                <pubTime>2011-01-23T12:51:43+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/calendar-two-dimensional-array-php.html</loc>
        <lastmod>2011-01-21T20:36:44+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PHP历遍二维数组</title>
                <content>
&lt;p&gt;最近在研究PageCookery的快速发布，解决手机没有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cookies&lt;/code&gt;的问题。在谓语调用部分要历遍数据库读取的二维数组。&lt;/p&gt;

&lt;p&gt;一开始打算用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;foreach&lt;/code&gt;来历遍，但是发现没有成功，oo不过关，没办法oo写······&lt;/p&gt;

&lt;p&gt;研究后决定用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;for&lt;/code&gt;循环，演示代码如下：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;  
  &lt;span class=&quot;nv&quot;&gt;$blog&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;  
    &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;  
     &lt;span class=&quot;s2&quot;&gt;&quot;titledata&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;titleMM&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  
     &lt;span class=&quot;s2&quot;&gt;&quot;bodydata&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;bodyMM&quot;&lt;/span&gt;  
       &lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;  
    &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;  
     &lt;span class=&quot;s2&quot;&gt;&quot;titledata&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;titleGG&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  
     &lt;span class=&quot;s2&quot;&gt;&quot;bodydata&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;bodyGG&quot;&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;c1&quot;&gt;//出错  &lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$blog&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$b&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;nv&quot;&gt;$b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'titledata'&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;s2&quot;&gt;&quot;BB&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  
    &lt;span class=&quot;nv&quot;&gt;$b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'bodydata'&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;s2&quot;&gt;&quot;CC&quot;&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;print_r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$blog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  
   &lt;span class=&quot;c1&quot;&gt;//正确  &lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&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;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$blog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&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;p&quot;&gt;{&lt;/span&gt;  
       &lt;span class=&quot;nv&quot;&gt;$blog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'titledata'&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;s2&quot;&gt;&quot;title&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  
       &lt;span class=&quot;nv&quot;&gt;$blog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'bodydata'&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;s2&quot;&gt;&quot;body&quot;&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;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
                 <tag>PHP</tag> 
                 <tag>PageCookery</tag> 
                <pubTime>2011-01-21T20:36:44+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/microblogging-data-recovery.html</loc>
        <lastmod>2011-01-20T17:50:14+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>微博数据恢复记</title>
                <content>
&lt;p&gt;前段时间因为误操作，导致整个服务器上的数据全部丢失，博客因为数据库定时备份，所以恢复起来有些问题，但是还是有数据可以恢复的。&lt;/p&gt;

&lt;p&gt;最大的问题是微博的所有数据库都没备份，巧妇难为无米之炊啊！！！所以一直没有动。那天灵机一动想起我的PageCookery是自动同步到嘀咕的，遂决定从嘀咕入手，恢复数据。&lt;/p&gt;

&lt;p&gt;首先去opencolud把我所有的嘀咕导出成文章发到博客大巴，然后进行第二步：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/01/1.jpg&quot;&gt;&lt;img src=&quot;/images/2011/01/1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/01/2.jpg&quot;&gt;&lt;img src=&quot;/images/2011/01/2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/01/3.jpg&quot;&gt;&lt;img src=&quot;/images/2011/01/3.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;然后把导出来的数据黏贴到记事本进行初步的整理，再导入到Excel中进行SQL的批量生成，然后发现有时区问题造成的时间差，又研究了好一些SQL的解决方案，最后写出了SQL。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/01/4.jpg&quot;&gt;&lt;img src=&quot;/images/2011/01/4.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;然后进入数据库导入数据。因为嘀咕的数据只有微博内容没有回复什么的，最后也就只能新建个谓语叫“之前说”，至此，微博内容数据恢复完成，YourtionSay回来了。&lt;/p&gt;

&lt;p&gt;欢迎继续支持http://t.yourtion.com&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2011/01/6.jpg&quot;&gt;&lt;img src=&quot;/images/2011/01/6.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>MySQL</tag>  <tag>PageCookery</tag> 
                 <tag>PageCookery</tag> 
                <pubTime>2011-01-20T17:50:14+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/php-mysql-calculate-time-difference.html</loc>
        <lastmod>2011-01-19T11:45:49+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>在php和MySql中计算时间差</title>
                <content>
&lt;p&gt;在php中计算时间差有时候是件麻烦的事!不过只要你掌握了日期时间函数的用法那这些也就变的简单了。&lt;/p&gt;

&lt;p&gt;最近在研究自己爱围脖的时候就要计算到恋爱天数,这需要php根据每天的日期进行计算,下面就来谈谈实现这种日期计算的几种方法:&lt;/p&gt;

&lt;p&gt;(1) 如果有数据库就很容易了!若是MSSQL可以使用触发器!用专门计算日期差的函数&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;datediff()&lt;/code&gt;便可!若是MYSQL那就用两个日期字段的差值计算的计算结果保存在另一个数值型字段中!用时调用便可!&lt;/p&gt;

&lt;p&gt;(2)如果没有数据库,那就得完全用php的时间日期函数!&lt;/p&gt;

&lt;p&gt;下面主要说明之:&lt;/p&gt;

&lt;p&gt;例:计算1998年5月3日到1999-6-5的天数:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$startdate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mktime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;5&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;3&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1998&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$enddate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mktime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;6&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;5&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1999&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//所得到的值为从1970-1-1到参数时间的总秒数结果是整数.那么下面的代码就好编多了&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$days&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;round&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$enddate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$startdate&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;mi&quot;&gt;3600&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;24&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;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$days&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$days&lt;/code&gt;为得到的天数;&lt;/p&gt;

&lt;p&gt;若&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mktime()&lt;/code&gt;中的参数缺省,那表示使用当前日期,这样便可计算从借书日期至今的天数。&lt;/p&gt;

&lt;p&gt;最后说一下SQL的计算方法：&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DateDiff 函数&lt;/strong&gt;
描述:返回两个日期之间的时间间隔。
语法:&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;DateDiff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;interval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;date1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;date2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;firstdayofweek&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;firstweekofyear&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;interval&lt;/code&gt;: 必选。字符串表达式，表示用于计算 date1 和 date2 之间的时间间隔。有关数值，请参阅“设置”部分。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date1&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date2&lt;/code&gt;: 必选。日期表达式。用于计算的两个日期。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;firstdayofweek&lt;/code&gt;: 可选。指定星期中第一天的常数。如果没有指定，则默认为星期日。有关数值，请参阅“设置”部分。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;firstweekofyear&lt;/code&gt;: 可选。指定一年中第一周的常数。如果没有指定，则默认为 1 月 1 日所在的星期。有关数值，请参阅“设置”部分。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;interval&lt;/code&gt; 参数可以有以下值：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yyyy&lt;/code&gt; (年)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;q&lt;/code&gt; (季度)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;m&lt;/code&gt; (月)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;y&lt;/code&gt; (一年的日数)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d&lt;/code&gt; (日)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;w&lt;/code&gt; (一周的日数)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ww&lt;/code&gt; (周)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h&lt;/code&gt; (小时)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt; (分钟)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s&lt;/code&gt; (秒)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;firstdayofweek 参数可以有以下值：&lt;/p&gt;

&lt;p&gt;(以下分别为：常数 值 描述)&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbUseSystem&lt;/code&gt; 0 使用区域语言支持 (NLS) API 设置。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbSunday&lt;/code&gt; 1 星期日（默认）&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbMonday&lt;/code&gt; 2 星期一&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbTuesday&lt;/code&gt; 3 星期二&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbWednesday&lt;/code&gt; 4 星期三&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbThursday&lt;/code&gt; 5 星期四&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbFriday&lt;/code&gt; 6 星期五&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbSaturday&lt;/code&gt; 7 星期六&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;firstweekofyear 参数可以有以下值：&lt;/p&gt;

&lt;p&gt;(以下分别为：常数 值 描述)&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbUseSystem&lt;/code&gt; 0 使用区域语言支持 (NLS) API 设置。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbFirstJan1&lt;/code&gt; 1 由 1 月 1 日所在的星期开始（默认）。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbFirstFourDays&lt;/code&gt; 2 由在新年中至少有四天的第一周开始。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbFirstFullWeek&lt;/code&gt; 3 由在新的一年中第一个完整的周开始。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;说明:&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DateDiff&lt;/code&gt; 函数用于判断在两个日期之间存在的指定时间间隔的数目。&lt;/p&gt;

&lt;p&gt;例如可以使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DateDiff&lt;/code&gt; 计算两个日期相差的天数，或者当天到当年最后一天之间的星期数。&lt;/p&gt;

&lt;p&gt;要计算 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date1&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date2&lt;/code&gt; 相差的天数，可以使用“一年的日数”（“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;y&lt;/code&gt;”）或“日”（“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d&lt;/code&gt;”）。当 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;interval&lt;/code&gt; 为“一周的日数”（“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;w&lt;/code&gt;”）时，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DateDiff&lt;/code&gt; 返回两个日期之间的星期数。&lt;/p&gt;

&lt;p&gt;如果 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date1&lt;/code&gt; 是星期一，则 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DateDiff&lt;/code&gt; 计算到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date2&lt;/code&gt; 之前星期一的数目。此结果包含 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date2&lt;/code&gt; 而不包含 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date1&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;如果 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;interval&lt;/code&gt; 是“周”（“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ww&lt;/code&gt;”），则 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DateDiff&lt;/code&gt; 函数返回日历表中两个日期之间的星期数。函数计算 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date1&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date2&lt;/code&gt; 之间星期日的数目。&lt;/p&gt;

&lt;p&gt;如果 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date2&lt;/code&gt; 是星期日，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DateDiff&lt;/code&gt; 将计算 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date2&lt;/code&gt;，但即使 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date1&lt;/code&gt; 是星期日，也不会计算 date1。&lt;/p&gt;

&lt;p&gt;如果 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date1&lt;/code&gt; 晚于 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date2&lt;/code&gt;，则 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DateDiff&lt;/code&gt; 函数返回负数。
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;firstdayofweek&lt;/code&gt; 参数会对使用“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;w&lt;/code&gt;”和“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ww&lt;/code&gt;”间隔符号的计算产生影响。&lt;/p&gt;

&lt;p&gt;如果 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date1&lt;/code&gt; 或 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date2&lt;/code&gt; 是日期文字，则指定的年度会成为日期的固定部分。但是如果 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date1&lt;/code&gt; 或 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date2&lt;/code&gt; 被包括在引号 (“ “) 中并且省略年份，则在代码中每次计算 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date1&lt;/code&gt; 或 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date2&lt;/code&gt; 表达式时，将插入当前年份。这样就可以编写适用于不同年份的程序代码。&lt;/p&gt;

&lt;p&gt;在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;interval&lt;/code&gt; 为“年”（“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yyyy&lt;/code&gt;”）时，比较 12 月 31 日和来年的 1 月 1 日，虽然实际上只相差一天，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DateDiff&lt;/code&gt; 返回 1 表示相差一个年份。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DatePart 函数&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;描述:返回给定日期的指定部分。
语法:&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;DatePart&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;interval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;firstdayofweek&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;firstweekofyear&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DatePart&lt;/code&gt;: 函数的语法有以下参数：&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;interval&lt;/code&gt;: 必选。字符串表达式，表示要返回的时间间隔。有关数值，请参阅“设置”部分。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date&lt;/code&gt;: 必选。要计算的日期表达式。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;firstdayofweek&lt;/code&gt;: 可选。指定星期中的第一天的常数。如果没有指定，则默认为星期日。有关数值，请参阅“设置”部分。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;firstweekofyear&lt;/code&gt;: 可选。指定一年中第一周的常数。如果没有指定，则默认为 1 月 1 日所在的星期。有关数值，请参阅“设置”部分。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;interval&lt;/code&gt; 参数可以有以下值：
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yyyy&lt;/code&gt; (年) 、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;q&lt;/code&gt; (季度) 、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;m&lt;/code&gt; (月) 、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;y&lt;/code&gt; (一年的日数) 、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d&lt;/code&gt; (日) 、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;w&lt;/code&gt; (一周的日数) 、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ww&lt;/code&gt; (周) 、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h&lt;/code&gt; (小时) 、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt; (分钟) 、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s&lt;/code&gt; (秒)&lt;/p&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;firstdayofweek&lt;/code&gt; 参数可以有以下值：&lt;/p&gt;

&lt;p&gt;(以下分别为：常数 值 描述)&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbUseSystem&lt;/code&gt; 0 使用区域语言支持 (NLS) API 设置。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbSunday&lt;/code&gt; 1 星期日（默认）&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbMonday&lt;/code&gt; 2 星期一&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbTuesday&lt;/code&gt; 3 星期二&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbWednesday&lt;/code&gt; 4 星期三&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbThursday&lt;/code&gt; 5 星期四&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbFriday&lt;/code&gt; 6 星期五&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbSaturday&lt;/code&gt; 7 星期六&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;firstweekofyear 参数可以有以下值：&lt;/p&gt;

&lt;p&gt;(以下分别为：常数 值 描述)&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbUseSystem&lt;/code&gt; 0 使用区域语言支持 (NLS) API 设置。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbFirstJan1&lt;/code&gt; 1 由 1 月 1 日所在的星期开始（默认）。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbFirstFourDays&lt;/code&gt; 2 由在新年中至少有四天的第一周开始。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vbFirstFullWeek&lt;/code&gt; 3 由在新的一年中第一个完整的周（不跨年度）开始。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;说明:&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DatePart&lt;/code&gt; 函数用于计算日期并返回指定的时间间隔。例如使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DatePart&lt;/code&gt; 计算某一天是星期几或当前的时间。&lt;/p&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;firstdayofweek&lt;/code&gt; 参数会影响使用“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;w&lt;/code&gt;”和“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ww&lt;/code&gt;”间隔符号的计算。&lt;/p&gt;

&lt;p&gt;如果 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date&lt;/code&gt; 是日期文字，则指定的年度会成为日期的固定部分。但是如果 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date&lt;/code&gt; 被包含在引号 (“ “) 中，并且省略年份，则在代码中每次计算 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date&lt;/code&gt; 表达式时，将插入当前年份。这样就可以编写适用于不同年份的程序代码！&lt;/p&gt;
</content>
                 <tag>MySQL</tag>  <tag>PHP</tag> 
                 <tag>PHP</tag> 
                <pubTime>2011-01-19T11:45:49+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/wordpress-perfect-code-highlighting.html</loc>
        <lastmod>2011-01-10T09:35:05+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress完美代码语法高亮插件</title>
                <content>
&lt;p&gt;来自：http://blog.nxun.com/archives/8&lt;/p&gt;

&lt;p&gt;目前我正在使用的代码高亮插件：Syntax Highlighter Optimized，很不错~&lt;/p&gt;

&lt;p&gt;主要特性：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;采用最新版 SyntaxHighlighter 3.0.83 作为核心代码&lt;/li&gt;
  &lt;li&gt;语法js文件动态加载，只加载页面中需要的&lt;/li&gt;
  &lt;li&gt;选择代码段时不会选中行号&lt;/li&gt;
  &lt;li&gt;自动换行，行号自动对齐&lt;/li&gt;
  &lt;li&gt;日志编辑器中增加插入代码的按钮&lt;/li&gt;
  &lt;li&gt;内置8种风格css&lt;/li&gt;
  &lt;li&gt;本插件支持几乎所有主流的程序语言。&lt;/li&gt;
  &lt;li&gt;本插件在IE[6-8]、FireFox3、Chrome5下测试通过。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;显示效果：&lt;/p&gt;

&lt;p&gt;[默认风格]
&lt;a href=&quot;/images/2011/01/sh.png&quot;&gt;&lt;img src=&quot;/images/2011/01/sh.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[另一种深色调风格]
&lt;a href=&quot;/images/2011/01/sh2.png&quot;&gt;&lt;img src=&quot;/images/2011/01/sh2.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;使用方法：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;在 可视化编辑 中点击按钮插入代码。&lt;/li&gt;
  &lt;li&gt;在 HTML编辑 中使用以下格式插入代码。&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;pre&amp;gt;&lt;/span&gt; // brush: + language
function foo()
{
alert(&quot;Hello World!&quot;);
return;
}
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/pre&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;版本改动：&lt;/p&gt;

&lt;p&gt;v1.1b
修正了 IE8 下复制代码不换行的问题。&lt;/p&gt;

&lt;p&gt;v1.1
修正了一些 IE6 下的显示问题。&lt;/p&gt;

&lt;p&gt;v1.0
初始版本。&lt;/p&gt;

&lt;p&gt;常见问题：&lt;/p&gt;

&lt;p&gt;1.启用插件后代码无变化
请检查当前主题的footer.php中是否有wp_footer()这个函数的调用。&lt;/p&gt;

&lt;p&gt;下载：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://dl.dbank.com/c0yymo0j25&quot;&gt;syntax-highlighter-optimized &lt;/a&gt; – v1.1b&lt;/p&gt;

</content>
                 <tag>WordPress</tag>  <tag>插件</tag> 
                 <tag>WordPress插件</tag> 
                <pubTime>2011-01-10T09:35:05+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/shlcms-generation-sitemap.html</loc>
        <lastmod>2011-01-09T14:01:18+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>SHLCMS实现sitemap.xml生成</title>
                <content>
&lt;p&gt;来自：http://www.shenhoulong.net/viewthread.php?tid=7980&amp;amp;highlight=sitemap&lt;/p&gt;

&lt;p&gt;在admini文件中找到login.php文件，找到if($_GET[‘act’]==’logout’)这个函数
替换为以下代码，这个是修改过的了，上次帖子中有错误，使用的请修改成以下最新代码。&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_GET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'act'&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;s1&quot;&gt;'logout'&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;k&quot;&gt;global&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sitemap_list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$siteMenu&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$siteClass&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;select * from `&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;TB_PREFIX&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;menu` where deep='0' and isHidden='0'&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$sitemap_list&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_results&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&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;nb&quot;&gt;empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sitemap_list&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;k&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sitemap_list&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isExternalLinks&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&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;nv&quot;&gt;$loc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'http://'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'HTTP_HOST'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;redirectUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
			&lt;span class=&quot;nv&quot;&gt;$loc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'http://'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'HTTP_HOST'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/?p='&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

		&lt;span class=&quot;nv&quot;&gt;$siteMenu&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loc&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Y-m-d&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;monthly&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
		1.0&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n\r\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

		&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;select * from `&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;TB_PREFIX&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;menu` where deep='1' and isHidden='0' and parentId=&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$MapChildren&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_results&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;if&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;nb&quot;&gt;empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$MapChildren&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;k&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$MapChildren&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$subMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
				&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;redirectUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&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;nv&quot;&gt;$subMap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
				&lt;span class=&quot;nv&quot;&gt;$siteClass&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;http://&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'HTTP_HOST'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/?p='&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$subMap-&amp;gt;id&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Y-m-d&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;weekly&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
				0.8&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n\r\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&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;p&quot;&gt;}&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;nv&quot;&gt;$sitemapheader&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;lt;!--?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?--&amp;gt;
'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;string2file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sitemapheader&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$siteMenu&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$siteClass&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ABSPATH&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/sitemap.xml'&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;nb&quot;&gt;session_start&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;nb&quot;&gt;session_destroy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;setcookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'username'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;setcookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'pwd'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;setcookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;session_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;time&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;mi&quot;&gt;3600&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;原理很简单就是改动了后台注销登陆响应函数每次后台退出时调用代码生成新的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sitemap.xml&lt;/code&gt;。复制修改代码后在网站根目录下手动建立一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sitemap.xml&lt;/code&gt;，用记事本另存为UTF-8编码。登陆后台、退出后台、检查&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sitemap.xml&lt;/code&gt;是否更新。到google站长管理中提交自己站的sitemap.xml吧。&lt;/p&gt;

&lt;p&gt;注意：其中修改时间采用退出时间，优先级&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;priority&lt;/code&gt;、更新频率&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;changefreq&lt;/code&gt;，用户自身需要调整。高级用户可以改动数据库&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shl_menu&lt;/code&gt;表，修改栏目保存时写进时间，后台退出时读时间到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sitemap.xml&lt;/code&gt;中。&lt;/p&gt;

&lt;p&gt;此功能支持深喉咙3.8中文版，生成动态的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sitemap.xml&lt;/code&gt;（也就是生成的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sitemap&lt;/code&gt;中的链接没有采用静态化，而且该&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sitemap&lt;/code&gt;每次在你退出后台时都自动更新），需要中英或者是静态化的sitemap自行修改（原理类似）。&lt;/p&gt;
</content>
                 <tag>SHLCMS</tag> 
                 <tag>PHP</tag> 
                <pubTime>2011-01-09T14:01:18+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/fix-error-allowed-memory-size.html</loc>
        <lastmod>2011-01-08T22:59:07+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>修复Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate xxx bytes)</title>
                <content>
&lt;p&gt;昨天服务器问题，重新安装了WP，结果在后台插件页面一进去就显示：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate xxx bytes)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;研究一番发现，解决方法共享一下：&lt;/p&gt;

&lt;p&gt;它是说，你正在进行的操作需要这么多的内存，但你现在服务器分配的内存不足。
正常情况下，服务器的内存当然是够的，只是你的配置文件需要修改。
解决这个问题，我们一般有两种方式：&lt;/p&gt;

&lt;p&gt;1、修改WP配置文件。
这是最简单的方式，编辑wp-config.php这个文件，给他加上一句：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;‘&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;WP_MEMORY_LIMIT&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;’&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;’&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;M&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;’&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其中64M可以写得更大，比如96M。&lt;/p&gt;

&lt;p&gt;2、修改php.ini
到你的网站根目录下，建立一个php.ini文件，写入下面这句：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;memory_limit&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;MB&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后再到网站根目录下修改.htaccess这个文件，写入下面这句：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;SetEnv PHPRC /home/host1/public_html/usr1/
(unix path to the directory where php.ini is)
(keep the slashes)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;一般情况下，使用第一种方法即可。&lt;/p&gt;
</content>
                 <tag>WordPress</tag>  <tag>解决问题</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2011-01-08T22:59:07+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/wordpress-image-border.html</loc>
        <lastmod>2011-01-02T11:27:38+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>用CSS给wordpress图片添加立体边框</title>
                <content>
&lt;p&gt;看到我博客的童鞋会发现我博客的图片会有一个阴影边框~这不是在上传前添加的效果，而是css实现的。&lt;/p&gt;

&lt;p&gt;怎么做？看下去就知道了~~~~&lt;/p&gt;

&lt;p&gt;先在你博客主题的CSS中找到img和a img的样式，没有就自己建立，然后使用一下代码：&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;img&lt;/span&gt; 
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;10px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;solid&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;-moz-box-shadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;-webkit-box-shadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;box-shadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;progid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DXImageTransform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Shadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Strength&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Direction&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;135&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Color&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;'#000000'&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;nt&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;img&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;10px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;solid&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;-moz-box-shadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;-webkit-box-shadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;box-shadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;progid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DXImageTransform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Shadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Strength&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Direction&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;135&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Color&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;'#000000'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;这样就可以了，最后在你觉得没有必要边距那么大的地方应用以下样式，如：&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;.attachment-post-thumbnail&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&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;nc&quot;&gt;.avatar&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;大功告成~~~&lt;/p&gt;
</content>
                 <tag>CSS</tag>  <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2011-01-02T11:27:38+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/domain-registration-expiration-time.html</loc>
        <lastmod>2010-12-27T23:21:59+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>域名到期注册时间</title>
                <content>
&lt;p&gt;最近手上有个com域名到期了，但是注册不了~研究一下~~~&lt;/p&gt;

&lt;p&gt;com国际域名从到期到掉下来时间为:30+30+5=65天&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;域名到期后13天内仍可以正常解析和管理，并可以在线续费，续费价格与注册域名价格相同；&lt;/li&gt;
  &lt;li&gt;过期14天－40天期间域名解析会暂停，这期间仍然可以在线续费，续费价格与注册域名价格相同；&lt;/li&gt;
  &lt;li&gt;过期41天－70天内域名仍不能访问和管理，可以手工续费，但是续费价格比较高，大约价格为1000元/年；&lt;/li&gt;
  &lt;li&gt;过期75天后会被彻底删除。&lt;/li&gt;
  &lt;li&gt;75天后就可以重新注册了。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;但是据了解，多家注册商已有相关计划。不过，他们此次调整的仅为删除期，高价赎回期仍为15天。域名注册商易名中国在接受采访时表示，他们缩短删除期，主要是受近期域名管理政策以及价格因素的影响。&lt;/p&gt;

&lt;p&gt;所谓删除期，是指域名到期之后，原注册者仍享有优先续费的期限，而赎回期是指原注册者可高价赎回域名的期限。目前，ICANN对通用顶级域名实行30天删除期加30天赎回期的政策。2007年，CNNIC曾出台政策，将CN域名初始的15天删除期，改成了45天的自动续费期及15天的高价赎回期。&lt;/p&gt;

&lt;p&gt;国际域名过期65–75天后ICANN会删除，删除之后可以立即注册。&lt;/p&gt;

&lt;p&gt;国际域名COM NET ORG大约域名从到期到删除时间为:30+30+5=65天，精确删除时间网上也是众说不一，有时是75天，带有很大随机性，但也有一些普遍规律。国际域名删除时间，集中在北京时间早上2 点至 4点，如果你要抢注域名一定要在半夜不睡觉等待抢注。&lt;/p&gt;

&lt;p&gt;通常情况下，英文国际域名分为四种状态：活动期、注册商保留期、赎回期以及删除期。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Active：国际域名在活动状态，最少注册时长不少于1年，最多注册时长不超过10年。&lt;/li&gt;
  &lt;li&gt;On Hold：注册商保留期，一般为1-45天(国内所注册顶级域名保留期大约为30天)，此期间虽然域名过期了，但用户仍然可以对域名进行续费。&lt;/li&gt;
  &lt;li&gt;RGP：赎回期，为30天，此期间用户必须付出高昂费用才能重新获该域名拥有权。&lt;/li&gt;
  &lt;li&gt;Soon To Expire：删除期，为5天，此期间域名无法注册和赎回。&lt;/li&gt;
  &lt;li&gt;四种状态过后，域名管理机构释放域名给公众注册。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;二、国内域名过期15天后CNNIC会删除，删除之后可以立即注册。而.cn域名是过期15天后，在第16天凌晨4:30分准时删除，所以你一般要在4点20分左右做好抢注准备。&lt;/p&gt;

&lt;p&gt;通常情况下，国内域名分为两种状态&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Active：国内域名在活动状态，最少注册时长不少于1年，最多注册时长不超过5年。&lt;/li&gt;
  &lt;li&gt;PendingDelete：等待删除状态。表明域名欠费，已经停止解析。此状态从过期当天开始，注册局会对域名进行保留15天，在保留期内域名可以进行续费以获继续保留域名拥有权。当超过15天后域名没有进行续费，将被注册局删除并重新释放到互联网开放给公众注册。&lt;/li&gt;
  &lt;li&gt;两种状态过后，域名管理机构释放域名给公众注册。&lt;/li&gt;
&lt;/ol&gt;
</content>
                 <tag>域名</tag> 
                 <tag>电脑技巧</tag> 
                <pubTime>2010-12-27T23:21:59+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/pagecookery-create-sitemap.html</loc>
        <lastmod>2010-12-16T07:24:15+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PageCookery生成SiteMap</title>
                <content>
&lt;p&gt;无聊之下想到为PageCookery创建一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SiteMap&lt;/code&gt;模块，让它生成网站的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SiteMap&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;一开始打算用php直接读取数据库，但是发现这样很麻烦，然后突然想起&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RSS&lt;/code&gt;也是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;XML&lt;/code&gt;的，所以最后决定用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RSS&lt;/code&gt;进行更改，生成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SiteMap&lt;/code&gt;如下：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/12/sitemap.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;发出来大家共享一下~举一反三。&lt;/p&gt;

&lt;p&gt;我的微博的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SiteMap&lt;/code&gt;：http://t.yourtion.com/sitemap.xml&lt;/p&gt;

&lt;p&gt;下载地址：&lt;a href=&quot;http://dl.dbank.com/c0osuoqdte&quot;&gt;PageCookery生成SiteMap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;下载后放在PageCooker的根目录下，运行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SiteMap.php&lt;/code&gt;就会在微博根目录生成一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SiteMap.xml&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;还没有实现实时生成，慢慢改进咯。&lt;/p&gt;
</content>
                 <tag>PageCookery</tag>  <tag>PHP</tag> 
                 <tag>PageCookery</tag> 
                <pubTime>2010-12-16T07:24:15+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/shlcms-administrator-logs-module.html</loc>
        <lastmod>2010-12-15T17:21:02+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>为shl（深喉咙）CMS创建管理员日志模块</title>
                <content>
&lt;p&gt;因为最近在使用深喉咙开发，但是一个要求比较高的网站，要做管理员日志，所以只有自己开发日志模块。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/12/weblog.jpg&quot;&gt;&lt;img src=&quot;/images/2010/12/weblog-300x111.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;创建数据表：&lt;/p&gt;

&lt;p&gt;– 表的结构 ‘web_log’&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/12/weblogdb.jpg&quot;&gt;&lt;img src=&quot;/images/2010/12/weblogdb-300x89.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;DROP&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TABLE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;EXISTS&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;web_log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TABLE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;EXISTS&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;web_log&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'name'&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;CHARACTER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;128&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;CHARACTER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;datetime&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;events&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;128&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;CHARACTER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ip&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;CHARACTER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;PRIMARY&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;KEY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&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;ENGINE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MyISAM&lt;/span&gt;  &lt;span class=&quot;k&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CHARSET&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&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;o&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;blockquote&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;注意引号换为半角
注意把web_log中的web_前缀改为你的数据表前缀。然后执行&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://你的CMS目录/inc/models/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;生成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;log&lt;/code&gt;数据表的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;models&lt;/code&gt;类。&lt;/p&gt;

&lt;p&gt;下载：weblog模块替换到深喉咙安装目录：&lt;a href=&quot;http://dl.dbank.com/c08i39tb4a&quot;&gt;weblog模块&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;这样安装就基本完成了。&lt;/p&gt;

&lt;p&gt;我已经在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;login&lt;/code&gt;里面添加了日志选项，接下来我会写在其他地方添加日志的教程，敬请期待~~~~~~&lt;/p&gt;
</content>
                 <tag>SHLCMS</tag> 
                 <tag>PHP</tag> 
                <pubTime>2010-12-15T17:21:02+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/php-import-excel-to-mysql.html</loc>
        <lastmod>2010-12-14T16:08:03+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PHP导入Excel到MySQL</title>
                <content>
&lt;p&gt;最近在做一个系统的重构~之前它导入用户名和密码都是要手工黏贴到数据库的~所以想直接用Excel导入，方便用户操作。&lt;/p&gt;

&lt;p&gt;研究了一下~方法不少~最后决定用Excel导入~在网上搜了很多这方面的资料，发现都是将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;excel&lt;/code&gt;文件另存为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;csv&lt;/code&gt;文件，然后从&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;csv&lt;/code&gt;文件导入。这里介绍一个直接将excel文件导入mysql的例子。我花了一晚上的时间测试，无论导入简繁体都不会出现乱码，非常好用。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PHP-ExcelReader&lt;/code&gt;,下载地址: http://sourceforge.net/projects/phpexcelreader&lt;/p&gt;

&lt;p&gt;说明：&lt;/p&gt;

&lt;p&gt;PHP将EXCEL导入MYSQL的测试环境：MYSQL数据库采用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;utf8&lt;/code&gt;编码.导入EXCEL文档是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xls&lt;/code&gt;格式,经过测试，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xlsx&lt;/code&gt; 格式[excel 2007]也OK.&lt;/p&gt;

&lt;p&gt;请替换成你配置好的数据，如数据库配置等。运行http://localost/test.php实现导入。&lt;/p&gt;

&lt;p&gt;以下是我贴出的详细代码，其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test.php&lt;/code&gt;为我写的测试文件，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reader.php&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oleread.inc&lt;/code&gt;文件是从上面提供的网址中下载的。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;PHP将EXCEL导入MYSQL的代码示例&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test.php&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;php&lt;/span&gt; 
&lt;span class=&quot;na&quot;&gt;require_once&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;reader.php&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;';&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;//&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;ExcelFile&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;($&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;data = &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Spreadsheet_Excel_Reader&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;//&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Set&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;output&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Encoding.&lt;/span&gt; 
&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;data-&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;setOutputEncoding('gbk');
//”data.xls”是指要导入到mysql中的excel文件
$data-&amp;gt;read('data.xls');
@$db = mysql_connect('localhost', 'root', '123456') or
die(&quot;Could not connect to database.&quot;);//连接数据库
mysql_query(&quot;set names 'gbk'&quot;);//输出中文
mysql_select_db('mydb'); //选择数据库
error_reporting(E_ALL ^ E_NOTICE);
for ($i = 1; $i &lt;span class=&quot;nt&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;data-&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;sheets[0]['numRows']; $i++) {
	//以下注释的for循环打印excel表数据
	/*
	for ($j = 1; $j &lt;span class=&quot;nt&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;data-&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;sheets[0]['numCols']; $j++) {
		echo &quot;\&quot;&quot;.$data-&amp;gt;sheets[0]['cells'][$i][$j].&quot;\&quot;,&quot;;
	}
	echo &quot;\n&quot;;
*/
//以下代码是将excel表数据【3个字段】插入到mysql中，根据你的excel表字段的多少，改写以下代码吧！
$sql = &quot;INSERT INTO test VALUES('&quot;.
$data-&amp;gt;sheets[0]['cells'][$i][1].&quot;','&quot;.
$data-&amp;gt;sheets[0]['cells'][$i][2].&quot;','&quot;.
$data-&amp;gt;sheets[0]['cells'][$i][3].&quot;')&quot;;
echo $sql.'&lt;span class=&quot;nt&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;br&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;';
$res = mysql_query($sql);
}
?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;以上就是PHP将EXCEL导入MYSQL的相关方法介绍，希望多又需要的朋友有所帮助。&lt;/p&gt;

&lt;p&gt;但是发现他class里面的文件有点问题，修改了之后就正常了~可以到&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://dl.dbank.com/c03m2yw4md&quot;&gt;这里下载phpexcelreader&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>MySQL</tag>  <tag>PHP</tag> 
                 <tag>PHP</tag> 
                <pubTime>2010-12-14T16:08:03+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/wordpress-automatically-cut-off.html</loc>
        <lastmod>2010-12-11T10:00:56+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress自动截断--可按字符截断</title>
                <content>
&lt;p&gt;有访客说介绍一个字符截断的插件，找了一下~发现很多插件都是调用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;?php the_excerpt(); ?&amp;gt;&lt;/code&gt;输出~要专门跑去改模版，太麻烦了&lt;/p&gt;

&lt;p&gt;找到一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WP Limit Posts Automatically&lt;/code&gt;，它可以支持按单词（英文，如sofish只认为是一个单词）输入、按字数（中文用户或许应该选择这个，方便控制）、只输出第一段，相当强大。但是没有更新了。有兴趣可以试试。&lt;/p&gt;

&lt;p&gt;官方链接：&lt;a href=&quot;http://www.jenst.se/2007/12/03/wp-limit-posts-automatically&quot;&gt;http://www.jenst.se/2007/12/03/wp-limit-posts-automatically&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;最后还是看中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WP Kit CN，3.0&lt;/code&gt;可以使用。
这款插件的目标就是：让不懂PHP，不懂HTML的您，可以使用几乎全部的功能！&lt;/p&gt;

&lt;p&gt;功能描述：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;最新评论输出&lt;/li&gt;
  &lt;li&gt;最新文章输出&lt;/li&gt;
  &lt;li&gt;N天内留言最多用户输出&lt;/li&gt;
  &lt;li&gt;本周或本月内留言最多用户输出&lt;/li&gt;
  &lt;li&gt;随机文章输出&lt;/li&gt;
  &lt;li&gt;评论最多的文章输出&lt;/li&gt;
  &lt;li&gt;最近回响输出&lt;/li&gt;
  &lt;li&gt;自动摘要算法，更加适合中文使用&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;特性描述：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;丰富的Widget支持，几乎每个功能，都有对应的边栏Widget，轻松调用&lt;/li&gt;
  &lt;li&gt;标准模板标签，为主题作者准备，标准的WordPress模板标签调用方式&lt;/li&gt;
  &lt;li&gt;后台管理面板，支持参数设定&lt;/li&gt;
  &lt;li&gt;WP Kit CN插件官方主页&amp;amp;下载：&lt;a href=&quot;http://wordpress.org/extend/plugins/wp-kit-cn/&quot;&gt;http://wordpress.org/extend/plugins/wp-kit-cn/&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</content>
                 <tag>WordPress</tag>  <tag>插件</tag> 
                 <tag>WordPress插件</tag> 
                <pubTime>2010-12-11T10:00:56+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/delphi-background-music.html</loc>
        <lastmod>2010-12-04T09:53:41+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Delphi实现背景音乐播放</title>
                <content>
&lt;p&gt;最近在做个抽奖程序，想加入抽奖声音，本来打算使用了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TMediaPlayer&lt;/code&gt;控件来播放音乐。&lt;/p&gt;

&lt;p&gt;最后发现可以直接使用WINDOWS为我们提供的API函数来播放音乐，方法如下：首先需要在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;uses&lt;/code&gt;部分加入mmsystem，接着写入下列语句，其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;e:\1.mid&lt;/code&gt;为播放的文件，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NN&lt;/code&gt;为自定义名称标志。&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;procedure TForm1.Button1Click(Sender: TObject);
begin
//播放音乐
  MCISendString(OPEN e: \1.MID type SEQUENCER ALIAS NN, , 0, 0);
  MCISendString(PLAY NN FROM 0, , 0, 0);
  MCISendString(CLOSE ANIMATION, , 0, 0);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
//停止播放
  MCISendString(OPEN e: \1.MID type SEQUENCER ALIAS NN, , 0, 0);
  MCISendString(STOP NN, , 0, 0);
  MCISendString(CLOSE ANIMATION, , 0, 0);
end;
&lt;/code&gt;&lt;/pre&gt;

</content>
                 <tag>Delphi</tag> 
                 <tag>Delphi</tag> 
                <pubTime>2010-12-04T09:53:41+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/joomla-template-parsing.html</loc>
        <lastmod>2010-11-22T09:40:46+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Joomla模板解析</title>
                <content>
&lt;p&gt;所有前台的模板，你可以在joomla所在路径&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/templates/&lt;/code&gt;里找到,所有后台模板可以在joomla所在路径&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/administrator/templates/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;通常模板会包含下面的文件：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.php&lt;/code&gt; 控制模块及组件的所在位置&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;component.php&lt;/code&gt; 控制打印或发送好友页面&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;template.css&lt;/code&gt; 模板CSS文件&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;templateDetails.xml&lt;/code&gt; 模板信息，用于模板安装及管理&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;template_thumbnail.(jpg,.png, gif)&lt;/code&gt; 200x150的模板缩微图，当鼠标放到模板名称上时会显示。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;通常joomla1.5中还会含有下面的文件夹&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;css&lt;/code&gt; 包含所有的css文件&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;html&lt;/code&gt; 包含所有覆盖核心及模块的输出文件&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;images&lt;/code&gt; 模板所用到的图片&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;打开rhuk_milkyway（自带模板）里的templateDetails.xml可以看到&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;install&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;version=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;1.5&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;template&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;name&amp;gt;&lt;/span&gt;rhuk_milkyway&lt;span class=&quot;nt&quot;&gt;&amp;lt;/name&amp;gt;&lt;/span&gt;（模板名称）
&lt;span class=&quot;nt&quot;&gt;&amp;lt;creationDate&amp;gt;&lt;/span&gt;11/20/06&lt;span class=&quot;nt&quot;&gt;&amp;lt;/creationDate&amp;gt;&lt;/span&gt;（创建时间）
&lt;span class=&quot;nt&quot;&gt;&amp;lt;author&amp;gt;&lt;/span&gt;Andy Miller&lt;span class=&quot;nt&quot;&gt;&amp;lt;/author&amp;gt;&lt;/span&gt;（作者）
&lt;span class=&quot;nt&quot;&gt;&amp;lt;authorEmail&amp;gt;&lt;/span&gt;rhuk@rockettheme.com.com&lt;span class=&quot;nt&quot;&gt;&amp;lt;/authorEmail&amp;gt;&lt;/span&gt;（作者邮箱）
&lt;span class=&quot;nt&quot;&gt;&amp;lt;authorUrl&amp;gt;&lt;/span&gt;http://www.rockettheme.com&lt;span class=&quot;nt&quot;&gt;&amp;lt;/authorUrl&amp;gt;&lt;/span&gt;（作者网站）
&lt;span class=&quot;nt&quot;&gt;&amp;lt;copyright&amp;gt;&amp;lt;/copyright&amp;gt;&lt;/span&gt;（版权）
&lt;span class=&quot;nt&quot;&gt;&amp;lt;license&amp;gt;&lt;/span&gt;GNU/GPL&lt;span class=&quot;nt&quot;&gt;&amp;lt;/license&amp;gt;&lt;/span&gt;（许可）
&lt;span class=&quot;nt&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;1.0.2&lt;span class=&quot;nt&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;（版本）
&lt;span class=&quot;nt&quot;&gt;&amp;lt;description&amp;gt;&lt;/span&gt;TPL_RHUK_MILKYWAY&lt;span class=&quot;nt&quot;&gt;&amp;lt;/description&amp;gt;&lt;/span&gt;（描述）
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;上面的信息会在模板管理里面显示。&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;files&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;filename&amp;gt;&lt;/span&gt;index.php&lt;span class=&quot;nt&quot;&gt;&amp;lt;/filename&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;filename&amp;gt;&lt;/span&gt;templateDetails.xml&lt;span class=&quot;nt&quot;&gt;&amp;lt;/filename&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;filename&amp;gt;&lt;/span&gt;template_thumbnail.png&lt;span class=&quot;nt&quot;&gt;&amp;lt;/filename&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;filename&amp;gt;&lt;/span&gt;params.ini&lt;span class=&quot;nt&quot;&gt;&amp;lt;/filename&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;filename&amp;gt;&lt;/span&gt;images/arrow.png&lt;span class=&quot;nt&quot;&gt;&amp;lt;/filename&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;filename&amp;gt;&lt;/span&gt;images/indent1.png&lt;span class=&quot;nt&quot;&gt;&amp;lt;/filename&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/files&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这里是所有和模板相关文件的文件名及路径（以模板路径为根目录）
更好的写法，（推荐的写法）&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;files&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;filename&amp;gt;&lt;/span&gt;index.php&lt;span class=&quot;nt&quot;&gt;&amp;lt;/filename&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;filename&amp;gt;&lt;/span&gt;component.php&lt;span class=&quot;nt&quot;&gt;&amp;lt;/filename&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;filename&amp;gt;&lt;/span&gt;templateDetails.xml&lt;span class=&quot;nt&quot;&gt;&amp;lt;/filename&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;filename&amp;gt;&lt;/span&gt;template_thumbnail.png&lt;span class=&quot;nt&quot;&gt;&amp;lt;/filename&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;filename&amp;gt;&lt;/span&gt;params.ini&lt;span class=&quot;nt&quot;&gt;&amp;lt;/filename&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;folder&amp;gt;&lt;/span&gt;images/&lt;span class=&quot;nt&quot;&gt;&amp;lt;/folder&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;folder&amp;gt;&lt;/span&gt;css/&lt;span class=&quot;nt&quot;&gt;&amp;lt;/folder&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/files&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;有的模析包含了语言文件。在templateDetails.xml里会有如下信息&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;languages&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;language&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;tag=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;en-GB&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;en-GB.tpl_beez.ini&lt;span class=&quot;nt&quot;&gt;&amp;lt;/language&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/languages&amp;gt;&lt;/span&gt;（前台语言文件）
&lt;span class=&quot;nt&quot;&gt;&amp;lt;administration&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;languages&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;folder=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;admin&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;language&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;tag=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;en-GB&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;en-GB.tpl_beez.ini&lt;span class=&quot;nt&quot;&gt;&amp;lt;/language&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/languages&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/administration&amp;gt;&lt;/span&gt;（后台语言文件）
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;模块位置信息&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;positions&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;position&amp;gt;&lt;/span&gt;breadcrumb&lt;span class=&quot;nt&quot;&gt;&amp;lt;/position&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;position&amp;gt;&lt;/span&gt;left&lt;span class=&quot;nt&quot;&gt;&amp;lt;/position&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;position&amp;gt;&lt;/span&gt;right&lt;span class=&quot;nt&quot;&gt;&amp;lt;/position&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;position&amp;gt;&lt;/span&gt;top&lt;span class=&quot;nt&quot;&gt;&amp;lt;/position&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;position&amp;gt;&lt;/span&gt;user1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/position&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;position&amp;gt;&lt;/span&gt;user2&lt;span class=&quot;nt&quot;&gt;&amp;lt;/position&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;position&amp;gt;&lt;/span&gt;user3&lt;span class=&quot;nt&quot;&gt;&amp;lt;/position&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;position&amp;gt;&lt;/span&gt;user4&lt;span class=&quot;nt&quot;&gt;&amp;lt;/position&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;position&amp;gt;&lt;/span&gt;footer&lt;span class=&quot;nt&quot;&gt;&amp;lt;/position&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;position&amp;gt;&lt;/span&gt;debug&lt;span class=&quot;nt&quot;&gt;&amp;lt;/position&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;position&amp;gt;&lt;/span&gt;syndicate&lt;span class=&quot;nt&quot;&gt;&amp;lt;/position&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/positions&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;如果要添加新的模块位置，不仅要写入index.php也要在这里加入参数&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;params&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;param&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;colorVariation&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;list&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;default=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;white&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;label=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Color Variation&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;description=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Color variation to use&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;option&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;blue&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Blue&lt;span class=&quot;nt&quot;&gt;&amp;lt;/option&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;option&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;red&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Red&lt;span class=&quot;nt&quot;&gt;&amp;lt;/option&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;option&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;green&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Green&lt;span class=&quot;nt&quot;&gt;&amp;lt;/option&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;option&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;orange&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Orange&lt;span class=&quot;nt&quot;&gt;&amp;lt;/option&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;option&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;black&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Black&lt;span class=&quot;nt&quot;&gt;&amp;lt;/option&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;option&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;white&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;White&lt;span class=&quot;nt&quot;&gt;&amp;lt;/option&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/params&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这可以给模板设置里增加一些参数选项。&lt;/p&gt;
</content>
                 <tag>Joomla</tag> 
                 <tag>PHP</tag> 
                <pubTime>2010-11-22T09:40:46+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/joomla-common-functions-resolve.html</loc>
        <lastmod>2010-11-16T09:05:28+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Joomla常用功能解析</title>
                <content>
&lt;p&gt;获得表单提交数据：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;JRequest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getCmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'task'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;JRequest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getInt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'limit'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;nc&quot;&gt;JRequest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getVar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'message'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;绑定模板数据：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;view.html.php: $this-&amp;gt;assignRef('lists', 'value');&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;网站名： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$mainframe-&amp;gt;getCfg('sitename');&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;获得管理员名称与邮箱:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$mainframe&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getCfg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'mailfrom'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$mainframe&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getCfg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'fromname'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;配置文件设置方法:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Get the path of the configuration file $fname = JPATH_CONFIGURATION.DS.'configuration.php';  // clear cache $cache = JFactory::getCache(); $cache-&amp;gt;clean();&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Update the credentials with the new settings $config =&amp;amp; JFactory::getConfig(); $config-&amp;gt;setValue('config.form_email', 'xxx');&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Get the config registry in PHP class format and write it to configuation.php jimport('[Joomla](http://joomla.kuaizhanbao.com/).filesystem.file'); if (!JFile::write($fname, $config-&amp;gt;toString('PHP', 'config', array('class' =&amp;gt; 'JConfig')))) { $msg = JText::_('ERRORCONFIGFILE'); }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;路 由地址为HTML全地址: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JRoute::_( 'index.php?option=com_ccNewsletter' );&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;绝对地址： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JPATH_COMPONENT&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;组件地址，前台、后台 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JPATH_ADMINISTRATOR&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;组件路径后台 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JPATH_COMPONENT_SITE&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;组件路径前台 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JPATH_ROOT&lt;/code&gt; 根目录&lt;/p&gt;

&lt;p&gt;日历：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; 
&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;JHTML&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'calendar'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
	&lt;span class=&quot;s1&quot;&gt;'1980-1-1'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
	&lt;span class=&quot;s1&quot;&gt;'ielts_score_date'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
	&lt;span class=&quot;s1&quot;&gt;'ielts_score_date'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
	&lt;span class=&quot;s1&quot;&gt;'%Y-%m-%d'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
	&lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'class'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'short'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
			&lt;span class=&quot;s1&quot;&gt;'size'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'25'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;err&quot;&gt; &lt;/span&gt;
			&lt;span class=&quot;s1&quot;&gt;'maxlength'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'19'&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;cp&quot;&gt;?&amp;gt;&lt;/span&gt;

JHTML::_('date',  $this-&amp;gt;list-&amp;gt;modified, JText::_('DATE_FORMAT_LC2') )
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;载入脚本：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JHTML::script('upload.js', 'components/com_smipa/js/', false); JHTML::_('behavior.mootools');&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;获得全局对象：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;JFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getUser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; 
&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;JFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getDBO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; 
&lt;span class=&quot;nv&quot;&gt;$document&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;JFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getDocument&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; 
&lt;span class=&quot;nv&quot;&gt;$lang&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;JFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getLanguage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;数据库对象操作：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;JFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getDBO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;loadObjectList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;对象列表&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;loadObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;一行对象&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;loadResult&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;单个结果&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Quote&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;过滤敏感字Document对象操作：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$document&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addStyleSheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$document&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addScript&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;语言对象操作：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$lang&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_lang&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'en-GB'&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$lang&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_lang&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'zh-TW'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;用户对象操作:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'guest'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//是否登录,登录了返回false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;获得组件的Menuid：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$menu&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;JSite&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getMenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; 
&lt;span class=&quot;nv&quot;&gt;$Items&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$menu&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getItems&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'link'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
			&lt;span class=&quot;s1&quot;&gt;'index.phpoption=com_idoblog&amp;amp;view=idoblog'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;nv&quot;&gt;$Itemid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$Items&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;获得当前Menuid:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$menus&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;JSite&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getMenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; 
&lt;span class=&quot;nv&quot;&gt;$menu&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$menus&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getActive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;发送Email:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$sent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;JUtility&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sendMail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$contactname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$adminmail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&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;nv&quot;&gt;$sent&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;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Send email failed.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;修改默 认提示信息：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;libraries\Joomla\document\html\renderer\message.php&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Javascript弹 出小窗口：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/xx&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rel=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{handler: 'iframe', size: {x: 570, y: 350}}&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;xx&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>Joomla</tag> 
                 <tag>PHP</tag> 
                <pubTime>2010-11-16T09:05:28+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/css-div-float-height-auto-increase.html</loc>
        <lastmod>2010-11-09T07:59:04+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>css div设置float后高度不自动增加解决</title>
                <content>
&lt;p&gt;在用css重构嘉应学院主页的时候，发现最大的那个标签高度不会随着内部标签增加而变高，导致我的背景色不会覆盖，研究了一下，原来跟&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;float&lt;/code&gt;有关，解决方法，主要是一下四种：&lt;/p&gt;

&lt;h3 id=&quot;1额外标签法&quot;&gt;1.额外标签法&lt;/h3&gt;

&lt;p&gt;这种方法就是向父容器的末尾再插入一个额外的标签，并令其清除浮动（clear）以撑大父容器。这种方法浏览器兼容性好，没有什么问题，缺点就是需要额外的（而且通常是无语义的）标签。
我个人不喜欢这种方法，但是它确实是W3C推荐的方法&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;div style=&quot;clear:both;&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;或者使用&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;br style=&quot;clear:both;&quot; /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;2使用after伪类&quot;&gt;2.使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;after&lt;/code&gt;伪类&lt;/h3&gt;

&lt;p&gt;这种方法就是对父容器使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;after&lt;/code&gt;伪类和内容声明在指定的现在内容末尾添加新的内容。经常的做法就是添加一个“点”，因为它比较小不太引人注意。然后我们再利用它来清除浮动（闭合浮动元素），并隐藏这个内容。&lt;/p&gt;

&lt;p&gt;这种方法兼容性一般，但经过各种 hack 也可以应付不同浏览器了，同时又可以保证html 比较干净，所以用得还是比较多的。
以下为引用的内容：&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;#outer&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;:after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;hidden&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;block&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;clear&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;both&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3设置overflow为hidden或者auto&quot;&gt;3.设置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;overflow&lt;/code&gt;为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hidden&lt;/code&gt;或者&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;auto&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;这种做法就是将父容器的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;overflow&lt;/code&gt;设为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hidden&lt;/code&gt;或&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;auot&lt;/code&gt;就可以在标准兼容浏览器中闭合浮动元素.&lt;/p&gt;

&lt;p&gt;不过使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;overflow&lt;/code&gt;的时候，可能会对页面表现带来影响，而且这种影响是不确定的，你最好是能在多个浏览器上测试你的页面&lt;/p&gt;

&lt;h3 id=&quot;4浮动外部元素float-in-float&quot;&gt;4.浮动外部元素，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;float-in-float&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;这种做法就是让父容器也浮动，这利用到了浮动元素的一个特性——浮动元素会闭合浮动元素。这种方式在 IE/Win 和标准兼容浏览器中都有较好的效果，但缺点也很明显——父容器未必想浮动就浮动的了，毕竟浮动是一种比较特殊的行为，有时布局不允许其浮动也很正常。&lt;/p&gt;
</content>
                 <tag>CSS</tag>  <tag>解决问题</tag> 
                 <tag>HTML</tag> 
                <pubTime>2010-11-09T07:59:04+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/detailed-structure-joomla-mvc.html</loc>
        <lastmod>2010-11-06T08:13:11+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>JoomlaMVC结构详解</title>
                <content>
&lt;p&gt;Joomla&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.php?option=组件名&amp;amp;view=视图名&amp;amp;controller=控制器名&amp;amp;layout=视图分页名&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Joomla&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.php?option=com_test模板和组件com_test的展示 index2.php?option=com_test&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;仅组件&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;com_test&lt;/code&gt;的展示&lt;/p&gt;

&lt;p&gt;组件开发需要在数据库 添加记录，并以&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;com_&lt;/code&gt;开头，组件分前台与后台,后台组件放在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;administrator/components&lt;/code&gt;下，前台组件放在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;components&lt;/code&gt; 下。&lt;/p&gt;

&lt;p&gt;Task是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Controller&lt;/code&gt;下的分支，没有Task时用默用处理。&lt;/p&gt;

&lt;p&gt;建立了View可以用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.php?option=com_test&amp;amp;view=?&lt;/code&gt; 来显示，不需要写&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Controller&lt;/code&gt;，但必需有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Controller&lt;/code&gt;存在&lt;/p&gt;

&lt;h3 id=&quot;命名规则&quot;&gt;命名规则：&lt;/h3&gt;

&lt;p&gt;Controller 类名：控制器名&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Controller&lt;/code&gt;, 控制器名随时，但会影响&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;View&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Model&lt;/code&gt;的命名 文件名 随时，由主文件调用&lt;/p&gt;

&lt;p&gt;View 类名：控制器名&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;View&lt;/code&gt;视图名 放在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;views&lt;/code&gt;目录下，以视图名作为目录名，主文件为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;view.html.php&lt;/code&gt;，模板页在tmpl下&lt;/p&gt;

&lt;p&gt;Model 类名：控制器名&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Model&lt;/code&gt;视图名 放在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;models&lt;/code&gt;目录下，以视图名为文件名&lt;/p&gt;

&lt;p&gt;Model: 继承&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JModel&lt;/code&gt;，所有以&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;get&lt;/code&gt;开头的成员函数都作用参数。&lt;/p&gt;

&lt;p&gt;比如getXXX(), 从View中可以用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$this-&amp;gt;get('xxx')&lt;/code&gt;获取返回值 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Controller&lt;/code&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JController&lt;/code&gt;成员名对应task名。&lt;/p&gt;
</content>
                 <tag>Joomla</tag> 
                 <tag>PHP</tag> 
                <pubTime>2010-11-06T08:13:11+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/sina-sae-connection-mysql.html</loc>
        <lastmod>2010-11-03T10:22:49+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>新浪SAE中MySQL的连接</title>
                <content>
&lt;p&gt;在用新浪SAE做一个Jquery的微博，但是MySQL的连接一直有问题。&lt;/p&gt;

&lt;p&gt;因为没有用新浪SAE提供的基于mysql模块的SaeMysql类，只是用MySQL的connect&lt;/p&gt;

&lt;p&gt;新浪那边提供的MySQL连接信息：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;Host&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'HTTP_MYSQLPORT'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sae&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sina&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cn&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;Port&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'HTTP_MYSQLPORT'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;如果直接用&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mysql_connect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'HTTP_MYS
QLPORT'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sae&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sina&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DB_USER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DB_PASSWORD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;会提示：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;SAE_Warning&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;mysql_connect&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;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connect&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;nc&quot;&gt;Unknown&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MySQL&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;host&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'3308mysqlsaesinacomcn'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&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;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;php&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;研究了很久，得出连接字符串应该这么写&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;define('DB_HOST',$_SERVER['HTTP_MYSQL
PORT'].'.mysql.sae.sina.com.cn:'.$_SERVER['HTTP_MYSQLPORT']);

$query=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样就可以成功连接和使用MySQL了·······&lt;/p&gt;

&lt;p&gt;希望对你有帮助哦····&lt;/p&gt;
</content>
                 <tag>MySQL</tag>  <tag>新浪SAE</tag> 
                 <tag>云服务</tag> 
                <pubTime>2010-11-03T10:22:49+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/successful-applicants-sina-sae.html</loc>
        <lastmod>2010-11-02T09:43:45+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>成功申请新浪SAE</title>
                <content>
&lt;p&gt;最近在研究新浪微博API，同时申请了新浪SAE，使用了一下~感觉还不错~&lt;/p&gt;

&lt;p&gt;地址：&lt;a href=&quot;http://sae.sina.com.cn/&quot;&gt;http://sae.sina.com.cn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;什么是新浪SAE？SAE=Sina App Engine&lt;/p&gt;

&lt;p&gt;Sina App Engine，名称咋这么熟悉呢？对啦，估计你是 Google App Engine 看多了，新浪的这个新服务跟 GAE 取名相似，其实服务也差不多，GAE 是一个分布式的 Python 和 Java 开发和运行平台，而 SAE 主要支持 PHP 和 MySQL ，目前的 Alpha 版本采用的是经过修改的PHP5.3(这里有修改列表)，和支持主从分离的MySQL 5.0，Memcached 和 Cron服务。鉴于新浪的实力，毫无疑问 SAE 会成为下一个高质量的 PHP+MySQL 空间。:-)&lt;/p&gt;

&lt;p&gt;Sina SAE 提供一整套的 PHP+MySQL 开发，托管和运行平台，提供 SDK 和开发文档，它支持创建多个应用，采用 .sinaapp.com 的二级域名。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;比起传统的虚拟机主机托管，SAE有什么优势&lt;/strong&gt;？&lt;/p&gt;

&lt;p&gt;Sina App Engine是新浪云计算服务的核心组成部分，和传统的虚拟主机托管有着理念上的本质不同。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;传统服务托管面向的是硬件软件设备，使用者得到的也是设备的使用权；而SAE面向的服务，使用者得到的是服务的使用权。&lt;/li&gt;
  &lt;li&gt;传统服务托管不面向开发者，开发者无法在其上享受到开发的乐趣；而SAE的一个重要用户就是web developer，开发者可以在其上通过在线调试、日志分析、协作共享等功能进行web开发。&lt;/li&gt;
  &lt;li&gt;传统服务托管不提供分布式系统解决方案；而SAE提供的完整的分布式web服务的解决方案，其中不仅仅包括分布式数据库、分布式文件系统，更包括分布式定时器系统、网页抓取服务、图像处理服务等。&lt;/li&gt;
  &lt;li&gt;传统服务托管不解决域名问题，用户往往烦恼于域名申请；而SAE的用户将自动得到在sinaapp下的二级域名，同时SAE还支持域名cname。&lt;/li&gt;
  &lt;li&gt;传统服务托管无法保证SLA（Service Level Agreement），硬件故障的成本基本由使用者承担；而SAE保证用户的SLA，用户的web服务自动享有高冗余的前端服务器、享有自动负载均衡系统、服务自动扩展、服务自动收缩等功能。&lt;/li&gt;
  &lt;li&gt;传统的服务托管采用预付费的方式，费用固定且和实际使用情况无直接关系；而SAE采用预充值方式，“所付即所用，所付仅所用”，web服务的一切损耗均提供报表查询和账单汇总，让用户一目了然。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;鉴于新浪的实力，毫无疑问 SAE 会成为下一个高质量的 PHP+MySQL 空间。:-)&lt;/p&gt;
</content>
                 <tag>新浪SAE</tag> 
                 <tag>云服务</tag> 
                <pubTime>2010-11-02T09:43:45+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/wp-t-wap-ucweb-no-permission-solution.html</loc>
        <lastmod>2010-10-25T18:30:01+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WP-T-WAP在UCWEB没有添加日志的权限解决办法</title>
                <content>
&lt;p&gt;WP-T-WAP插件确实不错，不过前几天用UC浏览器发表文章发现提示“您没有添加日志的权限。返回首页。”&lt;/p&gt;

&lt;p&gt;而登陆提示”ERROR: WordPress requires Cookies but your browser does not support them or they are blocked.”&lt;/p&gt;

&lt;p&gt;而以前用的好好的，现在却这样。So，应该不是插件的原因，第二个提示的意思应该是浏览器不支持cookies，我想起来前几天把UC浏览器设置中高级设置里WAP压缩中转关掉了。。。&lt;/p&gt;

&lt;p&gt;于是去打开中转，再进入wap页，成功解决！&lt;/p&gt;
</content>
                 <tag>WordPress</tag>  <tag>解决问题</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-10-25T18:30:01+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/windows2003-users-import-export.html</loc>
        <lastmod>2010-10-18T13:52:55+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Windows2003用户导入导出（非AD用户）</title>
                <content>
&lt;p&gt;因为网络中心有一台服务器要腾出来用，所以要把服务器里面的网站迁移到另外一台服务器上~但是服务器用户的导出问题一直比较麻烦~&lt;/p&gt;

&lt;p&gt;于是到网上找了下，有两个小工具&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;addusers.exe&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;copypwd.exe&lt;/code&gt;，使用方法如下：&lt;/p&gt;

&lt;p&gt;A, 备份账号&lt;/p&gt;

&lt;p&gt;命令：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c:\addusers.exe /d:u Account.bak&lt;/code&gt; //名字不能改，必须是Account.bak;&lt;/p&gt;

&lt;p&gt;B, 备份账号密码：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;copypwd.exe&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;命令：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c:\copypwd.exe dump &amp;gt; copypwd.txt&lt;/code&gt; //同样，名字不能改，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;copypwd.exe&lt;/code&gt;只认&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;copypwd.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;注意：要删除&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;account.bak&lt;/code&gt;,&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;copypwd.txt&lt;/code&gt;中与账号无关的内容&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;导入：&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;先通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;addusers&lt;/code&gt;导入账号：&lt;/p&gt;

&lt;p&gt;命令：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c:\addusers.exe /p:L /c Account.bak&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;导入密码：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c:\copypwd.exe set&lt;/code&gt; //备份的密码文文件要在同一个目录下。&lt;/p&gt;

&lt;p&gt;试了一下，比一个一个的添加方便多了，只是使用时要注意几点：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;copypwd.exe&lt;/code&gt;只能在本地会话上使用，如果用远程桌面会出现错误。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;addusers.exe&lt;/code&gt;导出的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Account.bak&lt;/code&gt;，要把里面的计算机名改掉，因为迁移之后计算机名就变了。&lt;/li&gt;
  &lt;li&gt;用户、密码导入到新服务器后，常规属性里变成了默认的“用户下次登录时需更改密码”，注意要改回来。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;总之，如果有大量用户需要导入导出的话，用这个工具要方便许多。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://dl.dbank.com/c0u649e13y&quot;&gt;addusers和copypwd下载&lt;/a&gt;&lt;/p&gt;
</content>
                
                 <tag>服务器</tag> 
                <pubTime>2010-10-18T13:52:55+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/php-mdb-connection.html</loc>
        <lastmod>2010-10-06T14:02:26+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PHP连接mdb数据库</title>
                <content>
&lt;p&gt;因为之前做的PingSwitch要做一个WEB展示的前端，因为一开始用了Delphi和access的结构，而Delphi与MySQL的连接又相对麻烦，最后只能选择用PHP+Access的组合，比较奇怪，但是也合理·····&lt;/p&gt;

&lt;p&gt;在PHP中连接access数据库的话我们必须&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ADO&lt;/code&gt;来连接，这跟ASP中连接数据库非常的类似。下边给出了一段DEMO供大家参考。&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?PHP&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;/*
创建ADO连接
*/&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$conn&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;COM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ADODB.Connection&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;die&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ADO Connection faild.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$connstr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;realpath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;DATUM/cnbt.mdb&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$conn&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$connstr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;/*
创建记录集查询
*/&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$rs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;COM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ADODB.RecordSet&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$rs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;select * from dbo_dirs&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$conn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;/*
循环读取数据
*/&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while&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;nv&quot;&gt;$rs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;eof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$rs-&amp;gt;Fields&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;[&quot;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;]-&amp;gt;Value;
	echo &quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;;
	&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$rs-&amp;gt;Movenext&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;(); //将记录集指针下移
}
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$rs-&amp;gt;close&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;();
?&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样运行就没问题了····&lt;/p&gt;
</content>
                 <tag>Access</tag>  <tag>PHP</tag> 
                 <tag>PHP</tag> 
                <pubTime>2010-10-06T14:02:26+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/delphi-operation-ini-file.html</loc>
        <lastmod>2010-10-05T18:52:41+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Delphi操作ini配置文件</title>
                <content>
&lt;p&gt;最近在做的IP设置程序~因为有些东西要保存成常量~但是又可能需要进行一些改动~所以就想到了保存到INI配置文件的办法~&lt;/p&gt;

&lt;p&gt;找了一下教程~还是继续分享~&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;一、有必要了解INI文件的结构：&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;;注释
&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;[小节名]&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;关键字=值&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;INI文件允许有多个小节，每个小节又允许有多个关键字， “=”后面是该关键字的值。&lt;/li&gt;
  &lt;li&gt;值的类型有三种：字符串、整型数值和布尔值。其中字符串存贮在INI文件中时没有引号，布尔真值用1表示，布尔假值用0表示。&lt;/li&gt;
  &lt;li&gt;注释以分号“;”开头。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;二、定义&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1、在Interface的Uses节增加IniFiles；&lt;/p&gt;

&lt;p&gt;2、在Var变量定义部分增加一行：&lt;/p&gt;

&lt;p&gt;myinifile:Tinifile;&lt;/p&gt;

&lt;p&gt;然后，就可以对变量myinifile进行创建、打开、读取、写入等操作了。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;三、打开INI文件&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;myinifile:=Tinifile.create('program.ini');
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;— 上面这一行语句将会为变量myinifile与具体的文件 program.ini建立联系，然后，就可以通过变量myinifile，来读写program.ini文件中的关键字的值了。&lt;/p&gt;

&lt;p&gt;—- 值得注意的是，如果括号中的文件名没有指明路径的话，那么这个Program.ini文件会存储在Windows目录中,把Program.ini文件存储在应用程序当前目录中的方法是：为其指定完整的路径及文件名。下面的两条语句可以完成这个功能：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Filename:=ExtractFilePath(Paramstr(0))+'program.ini';
myinifile:=Tinifile.Create(filename);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;四、读取关键字的值&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;— 针对INI文件支持的字符串、整型数值、布尔值三种数据类型，TINIfiles类提供了三种不同的对象方法来读取INI文件中关键字的值。&lt;/p&gt;

&lt;p&gt;— 假设已定义变量vs、vi、vb分别为string、 integer、boolean类型。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;vs:=myinifile.Readstring(‘小节名’,’关键字’,缺省值);&lt;/li&gt;
  &lt;li&gt;vi:=myinifile.Readinteger(‘小节名’,’关键字’,缺省值);&lt;/li&gt;
  &lt;li&gt;vb:=myinifile.Readbool(‘小节名’,’关键字’,缺省值);&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;— 其中缺省值为该INI文件不存在该关键字时返回的缺省值。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;五、写入INI文件&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;—- 同样的，TInifile类也提供了三种不同的对象方法，向INI文件写入字符串、整型数及布尔类型的关键字。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;myinifile.writestring(‘小节名’,’关键字’,变量或字符串值);&lt;/li&gt;
  &lt;li&gt;myinifile.writeinteger(‘小节名’,’关键字’,变量或整型数值);&lt;/li&gt;
  &lt;li&gt;myinifile.writebool(‘小节名’,’关键字’,变量或True或False);&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;—- 当这个INI文件不存在时，上面的语句还会自动创建该INI文件。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;六、删除关键字&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;—- 除了可用写入方法增加一个关键字，Tinifile类还提供了一个删除关键字的对象方法：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;myinifile.DeleteKey('小节名','关键字');
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;七、小节操作&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;— 增加一个小节可用写入的方法来完成，删除一个小节可用下面的对象方法：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;myinifile.EraseSection('小节名');&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;— 另外Tinifile类还提供了三种对象方法来对小节进行操作：&lt;/p&gt;

&lt;p&gt;— myinifile.readsection(‘小节名’,TStrings变量);可将指定小节中的所有关键字名读取至一个字符串列表变量中；&lt;/p&gt;

&lt;p&gt;— myinifile.readsections(TStrings变量);可将INI文件中所有小节名读取至一个字符串列表变量中去。&lt;/p&gt;

&lt;p&gt;—- myinifile.readsectionvalues(‘小节名’,TStrings变量);可将INI文件中指定小节的所有行（包括关键字、=、值）读取至一个字符串列表变量中去。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;八、释放&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;在适当的位置用下面的语句释放myinifile：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;myinifile.distory;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;九、一个实例&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;—- 下面用一个简单的例子(如图)，演示了建立、读取、存贮INI文件的方法。myini.ini文件中包含有“程序参数”小节，和用户名称（字符串）、是否 正式用户（布尔值）和已运行时间（整型值）三个关键字。程序在窗体建立读取这些数据，并在窗体释放时写myini.ini文件&lt;/p&gt;

&lt;p&gt;— 附源程序清单&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
inifiles, //配置操作文件
StdCtrls, ExtCtrls;
type
	TForm1 = class(TForm)
	Edit1: TEdit;
	CheckBox1: TCheckBox;
	Edit2: TEdit;
	Label1: TLabel;
	Label2: TLabel;
	Timer1: TTimer;
	Label3: TLabel;
	procedure FormCreate(Sender: TObject);
	procedure FormDestroy(Sender: TObject);
	procedure Timer1Timer(Sender: TObject);
	private
	{ Private declarations }
	public
	{ Public declarations }
end;
var
	Form1: TForm1;
	implementation
var
	myinifile:TInifile;
	{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var
filename:string;
begin
	filename:=ExtractFilePath(paramstr(0))+'myini.ini';
	myinifile:=TInifile.Create(filename);
	edit1.Text:= myinifile.readstring('程序参数','用户名称','缺省的用户名称');
	edit2.text:= inttostr(myinifile.readinteger('程序参数','已运行时间',0));
	checkbox1.Checked:= myinifile.readbool('程序参数','是否正式用户',False);
	end;
	procedure TForm1.FormDestroy(Sender: TObject);
		begin
			myinifile.writestring('程序参数','用户名称',edit1.Text);
			myinifile.writeinteger('程序参数','已运行时间',strtoint(edit2.text));
			myinifile.writebool('程序参数','是否正式用户',checkbox1.Checked);
			myinifile.Destroy;
		end;
		procedure TForm1.Timer1Timer(Sender: TObject);
	begin
		edit2.Text:=inttostr(strtoint(edit2.text)+1);
	end;
end.
&lt;/code&gt;&lt;/pre&gt;

</content>
                 <tag>Delphi</tag> 
                 <tag>Delphi</tag> 
                <pubTime>2010-10-05T18:52:41+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/delphi-get-access-table-name.html</loc>
        <lastmod>2010-10-03T13:21:50+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Delphi获取Access中的表名</title>
                <content>
&lt;p&gt;因为开始做IP设置程序~把每一栋楼划分为一个表~也就在一开始的时候要历遍数据库中的所有表来获得下拉菜单的选项，找了一些资料，结果如下：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;//声明变量：
lString,lTableName:TStrings;
//-----------获取表名信息-------------
lString:=TStringList.Create;
lTableName:=TStringList.Create;
DM_Conn.con_Access.GetTableNames(lString,True);
for i:=0 to lString.Count-1 do
	begin
	if (lString.Strings[i]&amp;lt;&amp;gt;'MSysACEs')
	and (lString.Strings[i]&amp;lt;&amp;gt;'MSysObjects')
	and (lString.Strings[i]&amp;lt;&amp;gt;'MSysQueries')
	and (lString.Strings[i]&amp;lt;&amp;gt;'MSysRelationships') then
	lTableName.Add(lString.Strings[i]);
	end;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;我最终使用的代码如下：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;procedure TForm1.FormCreate(Sender: TObject);
var
//声明变量：
lString:TStrings;
i:Integer;
Begin
	//-----------获取表名信息-------------
	lString:=TStringList.Create;
	form1.ADOConnection1.GetTableNames(lString,True);
	for i:=0 to lString.Count-1 do
		begin
		if (lString.Strings[i]&amp;lt;&amp;gt;'MSysACEs')
		and (lString.Strings[i]&amp;lt;&amp;gt;'MSysObjects')
		and (lString.Strings[i]&amp;lt;&amp;gt;'MSysQueries')
		and (lString.Strings[i]&amp;lt;&amp;gt;'MSysRelationships') then
		form1.combobox1.Items.Add(lString.Strings[i]);
		End;
	button2.Enabled:=false;
end;

procedure TForm1.FormCreate(Sender: TObject);
var//声明变量：
lString:TStrings;
i:Integer;
	Begin //-----------获取表名信息-------------
		lString:=TStringList.Create;
		form1.ADOConnection1.GetTableNames(lString,True);
		for i:=0 to lString.Count-1 do
	begin
		if (lString.Strings[i]&amp;lt;&amp;gt;'MSysACEs')and 
		(lString.Strings[i]&amp;lt;&amp;gt;'MSysObjects')and 
		(lString.Strings[i]&amp;lt;&amp;gt;'MSysQueries')and 
		(lString.Strings[i]&amp;lt;&amp;gt;'MSysRelationships') 
		then
		form1.combobox1.Items.Add(lString.Strings[i]);
	End;
	button2.Enabled:=false;
end;
&lt;/code&gt;&lt;/pre&gt;

</content>
                 <tag>Access</tag>  <tag>Delphi</tag> 
                 <tag>Delphi</tag> 
                <pubTime>2010-10-03T13:21:50+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/delphi-not-called-coinitialize-solution.html</loc>
        <lastmod>2010-09-28T09:22:08+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Delphi“尚未调用CoInitialize”解决方法</title>
                <content>
&lt;p&gt;之前写过&lt;a href=&quot;/delphi-thread-create-suspend-activation-termination.html&quot;&gt;《Delphi线程简单创建、挂起、激活与终止》&lt;/a&gt;，但是在运行的时候会出现没有调用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CoInitialize&lt;/code&gt;的错误~查找了一下~随便分享解决方法~&lt;/p&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CoInitialize(LPVOID)&lt;/code&gt;，它将以特定参数调用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CoInitializeEx&lt;/code&gt;，为当前单元初始化COM库，并标记协同模式为单线程模式。参数必须为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NULL&lt;/code&gt;。这是关于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OLE&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;COM&lt;/code&gt;的问题。&lt;/p&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CoInitializeEx(LPVOID)&lt;/code&gt;，新版本，可以用参数指定协同模式，如多线程模式，但注意单元的协同模式是不能改的，如果在已经初始化为多线程的单元里初始化&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OLE&lt;/code&gt;将失败并返回&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RPC_E_CHANGED_MODE&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;每个线程只要调用一次初始化就够了，同一线程中的后续调用也将通过，但会返回S_FALSE。后面解除初始化调用要与本调用一一对应，返回&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;S_FALSE&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CoInitialize&lt;/code&gt;调用也计算在内。应用程序的第一个线程将调用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CoInitializeEx&lt;/code&gt;(&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;COINIT_APARTMENTTHREADED&lt;/code&gt;或0)，必须是最后一个解除初始化的。如果不按上面的顺序进行初始化/解除函数调用，在该单线程单元(&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;STA&lt;/code&gt;)里后续的初始化调用将失败，应用程序将无法工作。由于无法控制本地服务器的载入/御载顺序，在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DLLMain&lt;/code&gt;里调用初始化/解除函数是不安全的。&lt;/p&gt;

&lt;p&gt;例：&lt;/p&gt;

&lt;p&gt;1）在DLL中使用ADO数据库组件时，调用程序调用该DLL时会出现”尚未调用CoInitialize”错误，解决的办法是在程序初始化时调用CoInitialize（nil）方法。&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;initialization
CoInitialize(nil);

{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
finalization
CoUninitialize;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;2） 把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebBrowser&lt;/code&gt;封装到Dll里面调用的时候总是说“尚未调用 CoInitialize。”，”CoInitialize has not been called”或“尚未调用 CoInitialize。”的解决方法。&lt;/p&gt;

&lt;p&gt;用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TWebBrowser&lt;/code&gt;显示HTML文档时或者把WebBrowser封装到Dll里面调用的时候总是说“尚未调用 CoInitialize。”，解决方法：
在“开始 -&amp;gt; 运行”中输入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;regsvr32 shdocvw.dll&lt;/code&gt;
然后在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;uses&lt;/code&gt;中加入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ActiveX&lt;/code&gt;，老版本的加入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OLE2&lt;/code&gt;；&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;uses
ActiveX, // 确认加入这个单元
// 老版本的Delphi用 OLE2 代替
Windows;

initialization
CoInitialize(nil); // 手动调用 CoInitialize()

finalization
CoUnInitialize; // 释放内存

end.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Delphi中 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CoInitialize&lt;/code&gt;和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OleInitialize&lt;/code&gt;有什么区别&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CoInitialize&lt;/code&gt;————- COM对象&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OleInitialize&lt;/code&gt; ———– OLE对象&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;COM&lt;/code&gt;库：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CoInitialize&lt;/code&gt;{Ex}、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CoUnitialize&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OLE&lt;/code&gt;系统：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OleInitialize&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OleUnitialize&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;COM&lt;/code&gt;对象和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OLE&lt;/code&gt;对象有什么不同呢?是不是COM是OLE的子集?&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OLE&lt;/code&gt;是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;COM&lt;/code&gt;的前身，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MS&lt;/code&gt;现在已经全部转道&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;COM&lt;/code&gt;上了，应该现在不发展&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OLE&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;如果是使用多线程的话那就在&lt;/p&gt;

&lt;p&gt;那么&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Execute&lt;/code&gt;事件的开头加上&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CoInitialize（nil）&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;结尾加上&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CoUninitialize()&lt;/code&gt;&lt;/p&gt;
</content>
                 <tag>Delphi</tag>  <tag>解决问题</tag> 
                 <tag>Delphi</tag> 
                <pubTime>2010-09-28T09:22:08+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/delphi-access-violations-problem-solving.html</loc>
        <lastmod>2010-09-27T08:59:31+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Delphi Access Violations 问题的解决思路</title>
                <content>
&lt;p&gt;Windows用户可能经常会看到类似于错误提示：“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Error：Accessviolationataddress836556F8.Readofaddress836556F8&lt;/code&gt;”。作为一个Delphi程序开发者，遇到这种错误的机会比其他用户更多(^_^)。&lt;/p&gt;

&lt;p&gt;究竟什么是“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AccessViolation&lt;/code&gt;”？如何在设计期避免它的出现？&lt;/p&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AccessViolation&lt;/code&gt;（非法访问），&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GeneralProtectionFault&lt;/code&gt;（一般保护性错误）或者&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;InvalidPageFault&lt;/code&gt;（无效页面错误），虽然说法不一样，但本质上总是由同一种错误引起的。&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AccessViolation&lt;/code&gt;常常在计算机用户运行的程序试图存取未被指定使用的存储区时遇到。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Accessviolationataddress&lt;十六进制值&gt;&lt;/十六进制值&gt;&lt;/li&gt;
  &lt;li&gt;inmodule&lt;应用程序名&gt;&lt;/应用程序名&gt;&lt;/li&gt;
  &lt;li&gt;Readofaddress&lt;十六进制值&gt;&lt;/十六进制值&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;一旦Windows要在它被分配的存储区之外写数据信息，它就会覆盖其他程序甚至操作系统的命令或数据。一旦发生了这种情况，操作系统将会瘫痪或者以某种形式关闭，你必须重新启动计算机。&lt;/p&gt;

&lt;p&gt;例如，在WindowsNT/2000下一个程序遇到这种错误时，Dr.Watson出现并且停止了该程序，捕获了一些快速的细节状态，再把它们用文本形式记录下来。&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AccessViolation&lt;/code&gt;是某些最令人气恼的Windows程序遇到的错误之一。本文的目的就是让你找到Delphi中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AccessViolation&lt;/code&gt;的解决之道。首先声明一点，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AccessViolation&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MicrosoftAccess&lt;/code&gt;没有任何关系。&lt;/p&gt;

&lt;p&gt;用Delphi开发程序时，我们可以把遇到的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AccessViolation&lt;/code&gt;分成两大类：运行期和设计期。&lt;/p&gt;

&lt;p&gt;一、设计期的AccessViolation&lt;/p&gt;

&lt;p&gt;1.硬件原因&lt;/p&gt;

&lt;p&gt;在启动或关闭DelphiIDE以及编译一个Delphi工程时容易出现设计期的AccessViolation。在你的计算机运行中出现AccessViolation信息可能由各种各样的原因引起，包括系统BIOS、操作系统或者是硬件驱动线，有些声卡、显卡、网卡实际上也会导致这种错误。为什么这么说？计算机里的每一块卡都有它的设备驱动程序。对于不同的制造商、不同版本的Windows或者不同版本的Delphi都可能会遇到不同的问题。如下的几个步骤可能有助于你解决遇到的这些问题：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;按照必要的步骤来证实你安装的驱动程序之间没有冲突。&lt;/li&gt;
  &lt;li&gt;有时降低显示分辨率可能会使某些古怪的显卡驱动程序稳定一些。&lt;/li&gt;
  &lt;li&gt;如果使用双处理器的主板，则保证对每个处理器的修改步骤一样。&lt;/li&gt;
  &lt;li&gt;对于计算机上的所有硬件注意使用最新的驱动程序。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;2.软件原因&lt;/p&gt;

&lt;p&gt;尽管Intel的计算机中Windows是最流行的操作系统，由于Windows系统天生的脆弱性和BUG，应用程序的误操作可能导致操作系统的迅速瘫痪（有时操作系统本身也会莫名其妙的瘫痪）。选择一个更稳定的程序开发环境是解决之道，如下几个步骤可以帮助你防止某些AccessViolation的发生：&lt;/p&gt;

&lt;p&gt;（1）尽管Windows9X相当流行，WindowsNT/2000还是从多方面被证实是一个稳定得多的环境，几乎对于所有的Windows代码平台而言都是这样。&lt;/p&gt;

&lt;p&gt;（2）确保对于WindowsNT/2000已经安装了最新的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;servicepack&lt;/code&gt;。每次安装完新版的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;servicepack&lt;/code&gt;，你会发现机器变得稳定了。&lt;/p&gt;

&lt;p&gt;（3）为你使用的各种版本的Delphi装上当前的更新或补丁（&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BDE&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ADO&lt;/code&gt;……），这是提前预防错误的好办法。尽量使用最新的Delphi补丁——&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AccessViolation&lt;/code&gt;错误数量尤其是设计期的错误数会大大减少。&lt;/p&gt;

&lt;p&gt;（4）如果你在IDE中经常随机遇到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AccessViolation&lt;/code&gt;错误，很有可能是你安装了一个不好的控件、包或者一个向导，它不是你使用的版本的Delphi所编写或编译的。试着一个一个卸载定制的控件（或者包）直到问题被解决，然后联系控件厂商关注这个问题的结果。&lt;/p&gt;

&lt;p&gt;（5）检查一下计算机里是否有没用的东西和程序冲突。奇怪的软件程序和测试版的产品常常会导致AccessViolation错误。&lt;/p&gt;

&lt;p&gt;（6）如果系统设置有错误，那么&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AccessViolation&lt;/code&gt;错误可能也会经常出现。如果你不停地遇到一个错误提示信息一样的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AccessViolation&lt;/code&gt;，记录下这些细节，然后通知可能导致这个错误的软件制造厂商。&lt;/p&gt;

&lt;p&gt;这些就是我对设计期&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AccessViolation&lt;/code&gt;错误的全部建议。&lt;/p&gt;

&lt;p&gt;二、运行期的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AccessViolation&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Delphi常见的运行期&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AccessViolation&lt;/code&gt;错误有哪些？如何防止？&lt;/p&gt;

&lt;p&gt;任何软件开发都会遇到这样的情况：你写好程序并测试，然后到处发送，结果用户告诉你它失败了。&lt;/p&gt;

&lt;p&gt;你可能考虑用编译指令{$D}编译你的程序——Delphi可以建立一个有助于定位AccessViolation错误的源代码的镜像文件。&lt;/p&gt;

&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;工程选项对话框（Project&lt;/td&gt;
      &lt;td&gt;Options&lt;/td&gt;
      &lt;td&gt;Linker&amp;amp;Compiler）让你指定你所需要的一切。对于单元文件，debug信息和单元的对象代码一起记录在unit文件里了。&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;编译使用这个单元的程序时，debug信息会增加单元文件的大小而且会增加额外的内存开销，但是它不会影响最终可执行文件的大小和运行速度。&lt;/p&gt;

&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;包含debug信息和镜像文件（Project&lt;/td&gt;
      &lt;td&gt;Options&lt;/td&gt;
      &lt;td&gt;Linker）选项的产品只有在{$D+}编译指令下才会完成行信息。&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Accessviolation&lt;/code&gt;通常只在程序的某一个方面表现出来。当问题第一次出现时，考虑一下用户进行了什么操作是很重要的，然后从这里寻找突破口。从用户的角度来看，你的程序中止了他们的工作，由他们来告诉你出现的问题似乎让你延期解决这个问题了。然而，与用户交流是你发现问题和改善程序的惟一有效方法。&lt;/p&gt;

&lt;p&gt;现在你将可以知道在只给你冲突地址的情况下，如何轻松发现准确路径、源代码文件、发生&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Accessviolation&lt;/code&gt;错误的行：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;“Search-Find Error…”。&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;当一个运行期Access violation出现时，你的用户得到的错误信息类似于如下情况：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Access violation at address &lt;十六进制值&gt;&lt;/十六进制值&gt;&lt;/li&gt;
  &lt;li&gt;in module &lt;应用程序名&gt;&lt;/应用程序名&gt;&lt;/li&gt;
  &lt;li&gt;Read of address &lt;十六进制值&gt;&lt;/十六进制值&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;如果你的程序在Delphi IDE里包含debug信息编译，你可以定位到导致这个错误源代码这一行。&lt;/p&gt;

&lt;p&gt;在Delphi程序中，一个最普遍导致Access Violation错误的原因是使用了一个没有被创建的对象。如果第二个地址&lt;十六进制值&gt;是FFFFFFF或0000000，十有八九就是你访问了一个没有被建立的对象。例如，你调用了一个表单的事件，但这个表单不是自动创建的，也没有代码实例化。&lt;/十六进制值&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;procedure TfrMain.OnCreate(Sender: TObject);
var BadForm: TBadForm;
begin
	//这里将会产生Access violation
	BadForm.Refresh;
end;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;假设BadForm在工程选项“Available Forms”窗口列表里——这个窗口是需要手工创建和释放的。在上面的代码里调用BadForm窗口的Refresh方法就会导致Access violation。&lt;/p&gt;

&lt;p&gt;如果你在Debugger选项窗口使“Stop on Delphi Exceptions”生效，那么就会弹出下面的信息：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The message states that the EAccessViolation has occurred. The EAccessViolation is the exception class for invalid memory access errors.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;这是你在设计程序时将会看到的信息，下一个信息框将会出现，然后程序失败了：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Access violation at address 0043F193
in module 'Project1.exe'
Read of address 000000.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;第一个十六进制数0043F193是发生Access violation的编译代码（Project1.exe）的运行期错误的地址。在IDE里选择菜单项“Search&lt;/td&gt;
      &lt;td&gt;Find Error…”，在对话框里输入错误发生的地址（0043F193）后点击“OK”按钮。Delphi将会重新编译你的工程文件，然后显示发生运行期错误的那一行代码，这里就是BadForm.Refresh这一行了。&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;下面列出了Delphi环境下导致Access violation错误的大部分常见原因。这个列表不是也不可能覆盖所有可能出现的Access violation的情况。请在论坛上发送你的Access violation信息，大家可以试着一起解决这个问题——真正的实际事例一般情况下比列出来的错误隐晦得多。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;调用一个不存在的对象&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;如上所述，大部分Access violation的合理原因是使用了没有被创建或者已经被释放的对象。为了防止这种类型的Access violation的发生，请确保你访问的任何对象都首先被创建了。例如，当一个Table定位在一个没有被创建的data module（从auto-crete窗口里移走了）里，你可能在窗体的OnCreate事件里打开这个表。&lt;/p&gt;

&lt;p&gt;在下面的代码里，在调用一个已经被删除了的对象（b:TBitmap）事件后，一个Access violation出现了：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;var b:TBitmap;
begin
	b:=TBitmap.Create;
	try
		//对b对象进行一些操作
	finally
		b.free;
	end;
	...
	//由于b已经被释放，一个Access violation错误将会出现
	b.Canvas.TextOut(0,0,'这是一个 Access Violation');
end;
&lt;/code&gt;&lt;/pre&gt;

&lt;ol&gt;
  &lt;li&gt;不存在的API参数&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;如果你试图给Win API函数传递一个不存在的参数将会出现一个Access violation错误。解决此类Access violation错误的最好方法是查阅Win API帮助，看看这个API函数调用的参数信息以及参数类型。例如，总是保证不给一个缓冲参数传递一个无效指针。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;让Delphi释放&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;当一个对象拥有另一个对象时，让它给你做删除工作。因为默认情况下，所有的窗体（自动创建的）都属于Application对象。当一个应用程序结束时，它释放了Application对象，也就释放了所有窗体。例如，如果你在程序开始时自动创建了两个窗体（Form1/Unit1和Form2/Unit2），下面的代码就会导致Access violation错误的出现：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;unit Unit1;
...
uses unit2;
...
procedure TForm1.Call_Form2
begin
Form2.ShowModal;
Form2.Free;
//Access violation错误将会出现
Form2.ShowModal;
end;
&lt;/code&gt;&lt;/pre&gt;

&lt;ol&gt;
  &lt;li&gt;杀死异常&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;永远不要破坏临时异常对象（E），处理一个异常会自动释放异常对象。如果你自己手动释放了异常对象，程序会试图再次释放它，那么就会出现Access violation错误：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;Zero:=0;
try
	dummy:= 10 / Zero;
except
	on E: EZeroDivide do
		MessageDlg('不能用0做除数!',mtError, [mbOK], 0);
	E.free. //Access violation错误将会出现
end;
&lt;/code&gt;&lt;/pre&gt;

&lt;ol&gt;
  &lt;li&gt;检索一个空字符串&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;一个空字符串是没有任何数据的。就是说，检索一个空字符串相当于访问一个不存在的对象，这将导致Access violation错误：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;var s: string;
begin
	s:='';
	s[1]:='a';
	//Access violation错误将会出现
end;
&lt;/code&gt;&lt;/pre&gt;

&lt;ol&gt;
  &lt;li&gt;直接引用指针&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;你必须间接引用指针，否则你会改变指针地址并可能会破坏其他存储单元 ：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;procedure TForm1.Button1Click(Sender: TObject);
var
p1 : pointer;
p2 : pointer;
begin
	GetMem(p1, 128);
	GetMem(p2, 128);
	//下一行导致Access violation错误
	Move(p1, p2, 128);
	//下一行方法正确
	Move(p1^, p2^, 128);
	FreeMem(p1, 128);
	FreeMem(p2, 128);
end;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;这些就是我对运行期Access Violation错误的全部建议，我希望你们也能对你们程序出现的Access Violation错误提出一些看法。&lt;/p&gt;
</content>
                 <tag>Access</tag>  <tag>Delphi</tag> 
                 <tag>Delphi</tag> 
                <pubTime>2010-09-27T08:59:31+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/delphi-adoquery-in-an-array.html</loc>
        <lastmod>2010-09-26T16:01:44+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Delphi利用ADOQuery将SQL查询结果存放到数组</title>
                <content>
&lt;p&gt;最近在用Delphi做交换机存活测试软件~因为要将Access数据库中的IP地址表等导入数组~研究了一下~大家分享一下~~&lt;/p&gt;

&lt;p&gt;比如 select B from A ，把查询的字段B放到一个数组中（假设是字符型的）：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;procedure TForm1.Button1Click(Sender: TObject);
var
	A: Array of String;//定义动态数组
	Index: Integer;//定义数组下标变量
	begin ADOQuery.SQL.Clear;
		ADOQuery.SQL.Add('Select B from A');
		ADOQuery.Open;
		Setlength(A,ADOQuery.RecordCount); //设置数组宽度
		Index := 0;//初始化下标
		ADOQuery.First;
		While Not ADOQuery.Eof Do //数据集循环
			begin
				A[Index] := ADOQuery.FieldByName('B').asString;//数据添加到数组中 Inc(Index);
				ADOQuery.Next;
			end;
	end;
&lt;/code&gt;&lt;/pre&gt;

</content>
                 <tag>Access</tag>  <tag>Delphi</tag> 
                 <tag>Delphi</tag> 
                <pubTime>2010-09-26T16:01:44+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/delphi-thread-create-suspend-activation-termination.html</loc>
        <lastmod>2010-09-21T11:36:55+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Delphi线程简单创建、挂起、激活与终止</title>
                <content>
&lt;p&gt;因为在做PingSwitch项目时发现在Ping交换机做循环的时候界面会死掉~老师说那要使用线程来做就不会~&lt;/p&gt;

&lt;p&gt;因为不用涉及线程间的数据同步~所以就最简单实用的就足够了·····找了好多教程，都是很复杂的···看到个简单的，大家分享一下。&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
	TForm1 = class(TForm)
	Button1: TButton;
	Button2: TButton;
	Button3: TButton;
	Button4: TButton;
	procedure Button1Click(Sender: TObject);
	procedure Button2Click(Sender: TObject);
	procedure Button3Click(Sender: TObject);
	procedure Button4Click(Sender: TObject);
	private
	{ Private declarations }
	public
	{ Public declarations }
	hThread:Thandle;//定义一个句柄
	ThreadID:DWord;
end;

var
Form1: TForm1;

implementation

{$R *.dfm}
function MyThreadFunc(P:pointer):Longint;stdcall;
	var
	i:longint;
	DC:HDC;
	S:string;
	begin
		DC:=GetDC(Form1.Handle);
		for i:=0 to 500000 do begin
		S:=Inttostr(i);
		Textout(DC,10,10,Pchar(S),length(S));
	end;
	ReleaseDC(Form1.Handle,DC);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
	//创建线程，同时线程函数被调用
	hthread:=CreateThread(nil,0,@MyThreadfunc,nil,0,ThreadID);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
	SuspendThread(hThread); //挂起线程
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
	ResumeThread(hThread); // 激活线程
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
	TerminateThread(hThread,0); //　终止线程
end;

end.
&lt;/code&gt;&lt;/pre&gt;
</content>
                 <tag>Delphi</tag> 
                 <tag>Delphi</tag> 
                <pubTime>2010-09-21T11:36:55+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/delphi-accuracy-delay-analysis.html</loc>
        <lastmod>2010-09-19T09:50:47+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Delphi的三种延时及其精度分析</title>
                <content>
&lt;p&gt;因为PingSwitch项目要不间断Ping交换机所以Ping的速度和评论不能太大，所以要进行延时操作，一般用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sleep&lt;/code&gt;，但是好奇就找了一下资料：&lt;/p&gt;

&lt;p&gt;在Delphi中，通常可以用以下三种方法来实现程序的延时，即&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TTtimer&lt;/code&gt;控件，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sleep&lt;/code&gt;函数，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GetTickCount&lt;/code&gt;函数。但是其精度是各不相同的。
一、三种方法的简单介绍&lt;/p&gt;

&lt;p&gt;1）&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TTtimer&lt;/code&gt;控件&lt;/p&gt;

&lt;p&gt;TTtimer控件的实质是调用Windows API定时函数&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SetTimer&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;KillTimer&lt;/code&gt;来实现的，并简化了对&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WM_TIMER&lt;/code&gt; 消息的处理过程。通过设置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OnTimer&lt;/code&gt;事件和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Interval&lt;/code&gt;属性，我们可以很方便的产生一些简单的定时事件。&lt;/p&gt;

&lt;p&gt;2）&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sleep&lt;/code&gt;函数&lt;/p&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sleep&lt;/code&gt;函数用来使程序的执行延时给定的时间值。&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sleep&lt;/code&gt;的调用形式为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sleep(milliseconds)&lt;/code&gt;，暂停当前的进程&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;milliseconds&lt;/code&gt;毫秒。&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sleep&lt;/code&gt;的实现方法其实也是调用Windows API的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sleep&lt;/code&gt;函数。例如：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;sleep(1000); //延迟1000毫秒
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;而&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sleep&lt;/code&gt;会引起程序停滞，如果你延迟的时间较长的话，你的程序将不能够响应延时期间的发生的其他消息，所以程序看起来好像暂时死机。&lt;/p&gt;

&lt;p&gt;3）&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GetTickCount&lt;/code&gt;函数&lt;/p&gt;

&lt;p&gt;在主程序中延时，为了达到延时和响应消息这两个目的，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GetTickCount()&lt;/code&gt;构成的循环就是一种广为流传的方法。例如：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;procedure Delay(MSecs: Longint);
//延时函数，MSecs单位为毫秒(千分之1秒)
var
FirstTickCount, Now: Longint;
begin
	FirstTickCount := GetTickCount();
	repeat
	Application.ProcessMessages;
	Now := GetTickCount();
	until (Now - FirstTickCount &amp;gt;= MSecs) or (Now &amp;lt; FirstTickCount);
end;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;二、高精度的微妙级性能计数器（high-resolution performance counter）介绍&lt;/p&gt;

&lt;p&gt;为了比较以上方法的精度，首先需要找到一个参考的定时器。在这里，我提供了两个参考的定时器。一是用单片机每隔1.024ms产生一个实时中断RTI，作为计数器；二是选用了一个高精度的微妙级性能计数器&lt;/p&gt;

&lt;p&gt;（参见：http://msdn.microsoft.com/msdnmag/issues/04/03/HighResolutionTimer/default.aspx ，或者 http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=200249
）&lt;/p&gt;

&lt;p&gt;1）计数器的Delphi源代码&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;{
	A high-precision counter/timer. Retrieves time differences
	downto microsec.
	Quick Reference:
	THPCounter inherits from TComponent.

	Key-Methods:
	Start: Starts the counter. Place this call just before the
	code you want to measure.

	Read: Reads the counter as a string. Place this call just
	after the code you want to measure.

	ReadInt: Reads the counter as an Int64. Place this call just
	after the code you want to measure.
}
unit HPCounter;

interface

uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls;

type
TInt64 = TLargeInteger;
THPCounter = class(TComponent)
private
Frequency: TLargeInteger;
lpPerformanceCount1: TLargeInteger;
lpPerformanceCount2: TLargeInteger;
fAbout: string;
procedure SetAbout(Value: string);
{ Private declarations }
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Start;
function Read: string;
function ReadInt: TLargeInteger;
{ Private declarations }
published
property About: string read fAbout write SetAbout;
{ Published declarations }
end;

procedure Register;

implementation

procedure Register;
begin
	RegisterComponents('MAs Prod.', [THPCounter]);
end;

constructor THPCounter.Create(AOwner: TComponent);
begin
	inherited Create(AOwner);
	fAbout:= 'Version 1.1, 2000® Mats Asplund, EMail: masprod@telia.com, Site: http://go.to/masdp';
end;

destructor THPCounter.Destroy;
begin
	inherited Destroy;
end;

function THPCounter.Read: string;
begin
	QueryPerformanceCounter(TInt64((@lpPerformanceCount2)^));
	QueryPerformanceFrequency(TInt64((@Frequency)^));
	Result:=IntToStr(Round(1000000 * (lpPerformanceCount2 -
	lpPerformanceCount1) / Frequency));
end;

function THPCounter.ReadInt: TLargeInteger;
begin
	QueryPerformanceCounter(TInt64((@lpPerformanceCount2)^));
	QueryPerformanceFrequency(TInt64((@Frequency)^));
	Result:=Round(1000000 * (lpPerformanceCount2 -
	lpPerformanceCount1) / Frequency);
end;

procedure THPCounter.SetAbout(Value: string);
begin
	Exit;
end;

procedure THPCounter.Start;
begin
	QueryPerformanceCounter(TInt64((@lpPerformanceCount1)^));
end;

end.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;2）使用方法：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
HPCounter, StdCtrls;

type
	TForm1 = class(TForm)
	Button1: TButton;
	Edit1: TEdit;
	Label1: TLabel;
	Label2: TLabel;
	procedure Button1Click(Sender: TObject);
	private
	{ Private declarations }
	public
	{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
	Edit1.Text:= '';
	Application.ProcessMessages;
	with THPCounter.Create(Self) do
	begin
		Start;
		// Place code to measure here
		Sleep(1000);
		// Place code to measure here
		Edit1.Text:=Read;
		Free;
	end;
end;

end.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;二、三种方法的精度比较&lt;/p&gt;

&lt;p&gt;为了比较，采用以上3种方法，分别设置延时时间为1ms、2ms、5ms、10ms、20ms、50ms、100ms、200ms、500ms、1000ms，循环次数为5次，得到实际的延时时间。&lt;/p&gt;

&lt;p&gt;1）TTtimer控件&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;实际延时时间（ms）
1ms： 8.012 21.551 6.875 21.647 9.809
2ms： 9.957 20.675 14.671 11.903 20.551
5ms： 9.952 20.605 9.924 20.705 12.682
10ms：14.852 9.96 21.547 9.82 20.634
20ms：27.512 34.291 26.427 31.244 30.398
50ms：61.196 61.307 64.027 62.048 63.059
100ms：102.495 108.408 112.318 110.322 102.531
200ms：193.955 202.135 207.016 205.082 202.194
500ms：496.659 500.534 503.398 495.551 500.394
1000ms：999.699 1003.576 993.698 1004.443 995.625
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;2）Sleep函数&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1ms： 1.895 1.895 1.896 1.897 1.898
2ms： 2.868 2.874 2.852 2.872 2.869
5ms： 5.8 5.797 5.79 5.79 5.791
10ms：10.675 10.683 10.611 10.669 10.67
20ms：20.404 20.434 20.447 20.477 20.368
50ms：50.67 50.691 50.69 50.682 50.671
100ms：100.515 100.469 100.484 100.481 100.484
200ms：200.101 200.126 199.892 200.066 200.108
500ms：499.961 499.961 499.958 499.961 499.96
1000ms：1000.034 1000.04 1000.03 1000.018 1000.029
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;3）GetTickCount函数&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1ms： 15.54 15.596 15.527 15.566 15.838
2ms： 15.561 15.563 15.603 15.477 15.571
5ms： 15.519 15.549 15.569 15.666 15.394
10ms：15.558 15.561 15.522 15.568 15.518
20ms：31.186 31.137 31.17 31.17 31.19
50ms：62.445 62.4 63.893 60.88 62.404
100ms：109.276 109.298 109.273 109.28 109.28
200ms：203.027 203.084 203.021 203.027 203.046
500ms：499.959 499.961 499.963 499.967 499.965
1000ms：1000.023 1000.022 1000.026 1000.029 1000.021
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;可见，相对而言，Sleep的精度最高，尤其是在10ms以内的延时，只有sleep函数才能够做到。TTimer控件的定时精度最差，而且稳定性不好，波动很大。GetTickCount函数所能实现的最短延时为15ms左右，稳定性相对TTimer要好一些。&lt;/p&gt;
</content>
                 <tag>Delphi</tag> 
                 <tag>Delphi</tag> 
                <pubTime>2010-09-19T09:50:47+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/delphi-simplest-ping.html</loc>
        <lastmod>2010-09-18T14:37:48+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>关于Delphi实现最简单Ping</title>
                <content>
&lt;h3 id=&quot;函数&quot;&gt;函数&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;procedure pinghost(ip:string;var info:string);
ip:目标ＩＰ地址；
info:ping了以后产生的信息(1)或(2)；
(1)成功信息
ip 发送测试的字符数　返回时间
(2)出错信息
Can not find host!
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&quot;使用方法&quot;&gt;使用方法：&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;uses ping;

procedure TForm1.Button1Click(Sender: TObject);
var
str:string;
ping:Tping;
begin
ping:=Tping.create ;//一定要初试化哦
ping.pinghost('127.0.0.1',str);
memo1.Lines.Add(str);
ping.destroy ;
end;
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;以下保存为pingpas&quot;&gt;以下保存为[ping.pas]&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;unit ping;

interface

uses

Windows, SysUtils, Classes,  Controls, Winsock,
StdCtrls;

type
	PIPOptionInformation = ^TIPOptionInformation;
	TIPOptionInformation = packed record
	TTL: Byte;
	TOS: Byte;
	Flags: Byte;
	OptionsSize: Byte;
	OptionsData: PChar;
end;

PIcmpEchoReply = ^TIcmpEchoReply;
TIcmpEchoReply = packed record
Address: DWORD;
Status: DWORD;
RTT: DWORD;
DataSize: Word;
Reserved: Word;
Data: Pointer;
Options: TIPOptionInformation;
end;

TIcmpCreateFile = function: THandle; stdcall;
TIcmpCloseHandle = function(IcmpHandle: THandle): Boolean; stdcall;
TIcmpSendEcho = function(
	IcmpHandle:THandle;
	DestinationAddress: DWORD;
	RequestData: Pointer;
	RequestSize: Word;
	RequestOptions: PIPOptionInformation;
	ReplyBuffer: Pointer;
	ReplySize: DWord;
	Timeout: DWord
): DWord; stdcall;

Tping =class(Tobject)

private
{ Private declarations }
hICMP: THANDLE;
IcmpCreateFile : TIcmpCreateFile;
IcmpCloseHandle: TIcmpCloseHandle;
IcmpSendEcho: TIcmpSendEcho;
public
procedure   pinghost(ip:string;var info:string);
constructor create;
destructor destroy;override;
{ Public declarations }
end;

var
hICMPdll: HMODULE;

implementation

constructor Tping.create;
begin
	inherited create;
		hICMPdll := LoadLibrary('icmp.dll');
		@ICMPCreateFile := GetProcAddress(hICMPdll, 'IcmpCreateFile');
		@IcmpCloseHandle := GetProcAddress(hICMPdll,'IcmpCloseHandle');
		@IcmpSendEcho := GetProcAddress(hICMPdll, 'IcmpSendEcho');
		hICMP := IcmpCreateFile;
	end;

	destructor Tping.destroy;
	begin
		FreeLibrary(hIcmpDll);
		inherited destroy;
	end;

	procedure Tping.pinghost(ip:string;var info:string);
	var
	// IP Options for packet to send
	IPOpt:TIPOptionInformation;
	FIPAddress:DWORD;
	pReqData,pRevData:PChar;
	// ICMP Echo reply buffer
	pIPE:PIcmpEchoReply;
	FSize: DWORD;
	MyString:string;
	FTimeOut:DWORD;
	BufferSize:DWORD;
	begin

		if ip &amp;lt;&amp;gt; '' then
		begin
			FIPAddress := inet_addr(PChar(ip));
			FSize := 40;
			BufferSize := SizeOf(TICMPEchoReply) + FSize;
			GetMem(pRevData,FSize);
			GetMem(pIPE,BufferSize);
			FillChar(pIPE^, SizeOf(pIPE^), 0);
			pIPE^.Data := pRevData;
			MyString := 'Test Net - Sos Admin';
			pReqData := PChar(MyString);
			FillChar(IPOpt, Sizeof(IPOpt), 0);
			IPOpt.TTL := 64;
			FTimeOut := 4000;
			
			try
				IcmpSendEcho(hICMP, FIPAddress, pReqData, Length(MyString),@IPOpt, pIPE, BufferSize, FTimeOut);
				if pReqData^ = pIPE^.Options.OptionsData^ then
				info:=ip+ '　' + IntToStr(pIPE^.DataSize) + '　　　' +IntToStr(pIPE^.RTT);
			except
				info:='Can not find host!';
				FreeMem(pRevData);
				FreeMem(pIPE);
				Exit;
			end;

			FreeMem(pRevData);
			FreeMem(pIPE);
		end;

	end;

end.
&lt;/code&gt;&lt;/pre&gt;
</content>
                 <tag>Delphi</tag> 
                 <tag>Delphi</tag> 
                <pubTime>2010-09-18T14:37:48+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/cmsware-error-code-2-solution.html</loc>
        <lastmod>2010-09-17T16:41:19+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>CMSWare Error code: 2 问题解决方法</title>
                <content>
&lt;p&gt;今天下午学校主页突然模版不正常了~显示图片出错~然后提示：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;[CMS] Template Running Error, click here to learn more.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;但是在此之前并没有动过网站和服务器~详细出错内容如下：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[CMS] Template Running Error, click here to learn more.
Exception message: fopen(http://newsadmin.jyu.edu.cn/resource/img/h000/h04/img201008132155131.jpg) [function.fopen]: failed to open stream: operation failed
Error code: 2
-- Backtrace --
(): TemplateError.handler
/srv/httpd/htdocs/cmsware/include/functions.php5.php(1246): fopen
/srv/httpd/htdocs/cmsware/sysdata/templates_c/%%c_^@templates@jiada@index1003.htm(128): AutoMini
/srv/httpd/htdocs/cmsware/include/lib/kTemplate/kTemplate.class.php(347): include
/srv/httpd/htdocs/cmsware/include/lib/kTemplate/kTemplate.class.php(546): kTemplate._fetch
/srv/httpd/htdocs/cmsware/include/admin/publishAdmin.class.php(2183): kTemplate.fetch
/srv/httpd/htdocs/cmsware/admin/admin_task.php(250): publishAdmin.refreshIndex
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;很明显是图片打不开导致的~但是之前是完全没问题的~刚刚添加的新闻删除页没有效果~&lt;/p&gt;

&lt;p&gt;研究了很久~官方的意思是：可能原因及解决方案：你的服务器环境不能解析域名，请检查是不是服务器的dns服务解析的问题。&lt;/p&gt;

&lt;p&gt;原来是学校的一个DNS服务器突然挂了~导致解析不正常~&lt;/p&gt;

&lt;p&gt;将图片改成相对路径发布~问题解决~~&lt;/p&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>PHP</tag> 
                <pubTime>2010-09-17T16:41:19+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/boson-netsim-for-ccnp-crsky.html</loc>
        <lastmod>2010-09-07T08:57:37+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Boson NetSim for CCNP 破解</title>
                <content>
&lt;p&gt;开学这段时间开始比较忙，加上没什么心情，所以博客很久没有更新，见谅啊。&lt;/p&gt;

&lt;p&gt;前几天报名参加了11月份的网工考试，刚好今天在找Cisco的模拟，找到好东西，大家分享一下·····&lt;/p&gt;

&lt;p&gt;找了个Boson NetSim for CCNP7.05的破解，将其升级到了最新版本的7.0.12。顺便进行了下汉化，同时也汉化部分了模拟器中命令的帮助提示。&lt;/p&gt;

&lt;p&gt;如何进行破解，请跟我来：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;去Boson的官网上下载Boson NetSim for CCNP 的最新版本。&lt;/li&gt;
  &lt;li&gt;安装Boson NetSim for CCNP 并运行，选择 Use Demo Version。&lt;/li&gt;
  &lt;li&gt;选择主界面上的Tools菜单中Check for Updates。直接更新全部文件。并重启程序。&lt;/li&gt;
  &lt;li&gt;关闭程序，将我提供的3个文件覆盖到安装文件夹。&lt;/li&gt;
  &lt;li&gt;启动程序后，选择 Use Demo Version&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;现在看看是不是可以使用全部的命令了？只是主界面上显示的7.05。&lt;/p&gt;

&lt;p&gt;如果觉得英文看的不爽，可以使用我提供的汉化包，将汉化包中的文件覆盖到安装文件夹，就可以看到熟悉的中文了，这可是连命令提示都汉化了哦。：），当然如果想使用英文提示，请不要覆盖mscon43demo.dll。&lt;/p&gt;

&lt;p&gt;目前汉化还不完全，不过模拟器主界面和网络设计器的界面已全部汉化，过几天抽时间进行完整的汉化。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://dl.dbank.com/c0h176iaj6&quot;&gt;下载地址&lt;/a&gt;&lt;/p&gt;
</content>
                
                 <tag>电脑技巧</tag> 
                <pubTime>2010-09-07T08:57:37+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ecmal-add-stores-zoning-permissions.html</loc>
        <lastmod>2010-08-27T15:51:41+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Ecmal批量添加商店（包括分区和权限）</title>
                <content>
&lt;p&gt;ShowBox的商城基本进入尾声。前段时间介绍了&lt;a href=&quot;/ecmall-bulk-add-users.html&quot;&gt;《ECmall批量添加用户》&lt;/a&gt;。&lt;/p&gt;

&lt;p&gt;但是发现后台没办法批量添加商城，所以又花了一个晚上研究在SQL中添加商城，包括分区和权限。&lt;/p&gt;

&lt;p&gt;首先用这个语句在Excel的A1中调用商店名和店主名，在B1调用店主id生成加入开通商城的代码：&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;CONCATENATE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;INSERT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;INTO&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`ecm_store`&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;VALUES&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;,B1,&quot;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;', '&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;,A1,&quot;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;', '&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;,A1,&quot;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;', &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, NULL , &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, '&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;', &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, '&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;', '&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;mi&quot;&gt;00&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;', NULL , '&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;', &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, '&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1282202793&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;', '&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;', NULL , '&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;', '&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;', &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, NULL , NULL , NULL , &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;);
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;INSERT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;INTO&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`ecm_store`&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;VALUES&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'14'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'A101'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'A101'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'1'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0.00'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'1'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'1282202793'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'14'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'1'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后生成之后发现 商城分区不是在商店的表里面设置的，又研究了分区和商店的关系表。用Excel语句在B1调用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;商店id&lt;/code&gt;在C1调用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;分区id&lt;/code&gt;生产SQL语句：&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;CONCATENATE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;INSERT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;INTO&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`ecm_category_store`&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`cate_id`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`store_id`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;VALUES&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&quot;,c1,&quot;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&quot;,B1,&quot;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;INSERT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;INTO&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`ecm_category_store`&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`cate_id`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`store_id`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;VALUES&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'1'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'14'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;本来以为这样就可以，结果早上他们测试之后发现权限不对～所以又重新研究了权限那一块，得出我们用的是all权限，所以用Excel的语句在D1里面调用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;用户id&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;商店id&lt;/code&gt;（我两个是一样的）：&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;CONCATENATE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;INSERT INTO  `ecm_user_priv` (  `user_id` ,  `store_id` ,  `privs` ) VALUES ('&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;D1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;',  '&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;D1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;',  'all');&quot;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;INSERT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;INTO&lt;/span&gt;  &lt;span class=&quot;nv&quot;&gt;`ecm_user_priv`&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;  &lt;span class=&quot;nv&quot;&gt;`user_id`&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;nv&quot;&gt;`store_id`&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;nv&quot;&gt;`privs`&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;VALUES&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&quot;,14,&quot;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;s1&quot;&gt;'&quot;,14,&quot;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;s1&quot;&gt;'all'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最后就可以正常使用了··就这样添加了300多个用户···&lt;/p&gt;
</content>
                 <tag>SQL</tag> 
                 <tag>康盛</tag> 
                <pubTime>2010-08-27T15:51:41+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/jquery-co-exist-with-lightbox.html</loc>
        <lastmod>2010-08-26T13:02:51+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>jquery.min跟lightbox共存</title>
                <content>
&lt;p&gt;最近在做Showbox的站点，21showbox.com。因为首页效果之前是用ImageFlow，所以研究了很久都没办法将ImageFlow的点击效果。然后又换了另外一个放大效果，但是在页面上表现不好，最后就决定用LihghtBox效果。&lt;/p&gt;

&lt;p&gt;但是当我满心欢喜地将代码集成到页面里面的时候就发现LightBox没用了···&lt;/p&gt;

&lt;p&gt;很快我就想到是JS的兼容问题，当我去掉原来jquery.min的时候，LightBox效果就正常了。原来的代码如下：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;text/javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;jquery.min.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/script&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;language&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ready&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&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;cm&quot;&gt;/*	2nd example	*/&lt;/span&gt;
	&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#menu2 li a&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;wrapInner&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

	&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#menu2 li a&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;each&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;span&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&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;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#menu2 li a&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hover&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.out&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;	&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;animate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;45px&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// move down - hide&lt;/span&gt;
		&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.over&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;animate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;0px&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;	&lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// move down - show&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.out&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;	&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;animate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;0px&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;	&lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// move up - show&lt;/span&gt;
		&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.over&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;animate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;-45px&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// move up - hide&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;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/script&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;LightBox要加入的代码：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;js/prototype.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;js/scriptaculous.js?load=effects,builder&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;js/lightbox.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后根据jquery的多库共存机制，他的应用代码是：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;jQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;noConflict&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;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&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;c1&quot;&gt;// 使用 $ 作为 jQuery 别名的代码&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;nx&quot;&gt;jQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 其他用 $ 作为别名的库的代码&amp;lt;/blockquote&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;所以整合之后的代码就变成：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;text/javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;jquery.min.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/script&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;text/javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;js/prototype.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/script&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;text/javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;js/scriptaculous.js?load=effects,builder&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/script&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;text/javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;js/lightbox.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/script&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;language&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;jQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;noConflict&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;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ready&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&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;cm&quot;&gt;/*	2nd example	*/&lt;/span&gt;
			&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#menu2 li a&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;wrapInner&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

			&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#menu2 li a&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;each&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;span&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&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;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#menu2 li a&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hover&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.out&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;	&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;animate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;45px&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// move down - hide&lt;/span&gt;
				&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.over&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;animate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;0px&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;	&lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// move down - show&lt;/span&gt;
			&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&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;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.out&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;	&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;animate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;0px&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;	&lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// move up - show&lt;/span&gt;
				&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.over&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;animate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;-45px&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// move up - hide&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;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;jQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/script&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样主页的导航jquery和LightBox就完美地共存了··&lt;/p&gt;
</content>
                 <tag>jQuery</tag> 
                 <tag>HTML</tag> 
                <pubTime>2010-08-26T13:02:51+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/add-a-dash-way-the-article-list.html</loc>
        <lastmod>2010-08-21T17:45:31+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>文章列表添加虚线方法</title>
                <content>
&lt;p&gt;最近在为梅州刑侦的网站工作收尾，已经拖了相当久··都有些不好意思啦··  人家提了要求要在文章列表下面加虚线，也就只好研究一下··因为用CSS，之前Table的做法就不适合了···重新研究一下···  这个方法不错··希望你能举一反三··用在自己站点咯···  动易标签提供了两个参数，我们可以利用这两个参数来制作。&lt;/p&gt;

&lt;p&gt;风格样式1： 列表中奇数行的CSS效果的类名&lt;/p&gt;

&lt;p&gt;风格样式2： 列表中偶数行的CSS效果的类名&amp;lt;/blockquote&amp;gt;&lt;/p&gt;

&lt;p&gt;大家来动手做吧，先把下面ＣＳＳ放在风格最后面，然后保存，刷新风格。  以下是CSS代码：&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;.lbxx&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;.lbxx2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;border-bottom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#ccc&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;dashed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;c&quot;&gt;/* 定义虚线，可以修改 #ccc ，可以修改虚线颜色*/&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.lbxx&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;#FFFFFF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;c&quot;&gt;/*  定义列表奇数行背景颜色，白色*/&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.lbxx&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;:link&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;m&quot;&gt;#000000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;c&quot;&gt;/* 未访问的链接，黑颜色*/&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.lbxx&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;:visited&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;m&quot;&gt;#000000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;c&quot;&gt;/*已访问的链接， 黑颜色*/&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.lbxx&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;:hover&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;COLOR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#FF0000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/* 鼠标在链接上，red颜色*/&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.lbxx&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;:bb:active&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#FF0000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/*  点击激活链接，黑颜色*/&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.lbxx2&lt;/span&gt;  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;#FFFFFF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/* 定义列表偶数行背景颜色，白色*/&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.lbxx2&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;:link&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;m&quot;&gt;#000000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;c&quot;&gt;/* 未访问的链接，黑颜色*/&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.lbxx2&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;:visited&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;m&quot;&gt;#000000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;  &lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/*已访问的链接， 黑颜色*/&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.lbxx2&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;:hover&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;COLOR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#FF0000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;c&quot;&gt;/* 鼠标在链接上，red颜色*/&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;.lbxx2&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;:active&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#FF0000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;c&quot;&gt;/*  点击激活链接，黑颜色*/&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;第一行CSS是定义虚线的，“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#ccc&lt;/code&gt;” 为虚线的颜色；“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1px&lt;/code&gt;”为虚线的像素；其他上面都有注释了。  然后我们就可以在标签调用就可以了&lt;/p&gt;

&lt;p&gt;下面举个例：大家注意一下有两个CSS的样式，一个是“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lbxx&lt;/code&gt;”， 一个是“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lbxx2&lt;/code&gt;”，在下面标签调用的时候只要把两个风格样式填上去就可以了。  如：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;!--{$GetArticleList(0,0,false,0,0,11,false,false,&quot;&quot;,0,3,2,56,0,false,1,false,false,0,false,false,false,false,false,false,0,1,,lbxx,lbxx2)}--&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其他标签也是一样。  如果是编辑标签的时候也是把这两个风格填上去即可。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;风格样式1： 列表中奇数行的CSS效果的类名&lt;/p&gt;

  &lt;p&gt;风格样式2： 列表中偶数行的CSS效果的类名&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;现在大家知道怎么做了吧。分别有什么作用？你看看旁边红色字不就清楚了！&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;注意&lt;/strong&gt;：标签的显示样式不一定要是“表格式”，我用的是DIV输出既“5”&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ShowType&lt;/code&gt; —–显示方式，1为普通样式，2为表格式，3为各项独立式，4为智能多列式，5为输出DIV，6为输出RSS&lt;/p&gt;
</content>
                 <tag>CSS</tag> 
                 <tag>HTML</tag> 
                <pubTime>2010-08-21T17:45:31+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ecmall-bulk-add-users.html</loc>
        <lastmod>2010-08-20T23:54:54+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>ECmall批量添加用户</title>
                <content>
&lt;p&gt;最近在做Showbox的job，用ECmall做的商城。因为商家那边要求要批量添加店里的用户，但是后台没有这样的功能，也就只有从sql那边下手。顺便温习一下Excel和SQL。&lt;/p&gt;

&lt;p&gt;经过研究他的数据库结构，终于得到了要添加的SQL语句，结果在前台发现登录不了。才知道密码忘了用MD5去加密。&lt;/p&gt;

&lt;p&gt;最后用语句：&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;INSERT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;INTO&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;jcom_mall&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ecm_member&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;VALUES&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'yourtion'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'mail@yourtion.com'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'5fa2db591ebb44529673957ed8b738fc'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;添加好用户，然后是用Excel表格进行用户名等数据的代入和SQL语句的生成，查了不少资料和尝试多次之后得出语句:&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;CONCATENATE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;INSERT INTO jcom_mall.ecm_member VALUES (NULL , '&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;', 'mail@yourtion.com', '5fa2db591ebb44529673957ed8b738fc', '', '0', NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , '0', NULL , NULL , '0', '0', NULL , '0', NULL , '');&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其中“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A1&lt;/code&gt;”就是用户名所在列，其他用户信息忽略，等用户第一次登陆更改密码和其信息时候更改，你也可以在Excel上面写好按照”,&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A1&lt;/code&gt;,”的形式导入语句。&lt;/p&gt;

&lt;p&gt;希望你能举一反三，有空我会找一些关于SQL和Excel的资料，希望对你有帮助～&lt;/p&gt;
</content>
                 <tag>SQL</tag> 
                 <tag>康盛</tag> 
                <pubTime>2010-08-20T23:54:54+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/htaccess-rewrite-rule-instance.html</loc>
        <lastmod>2010-08-18T16:31:43+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>.htaccess的rewrite实例</title>
                <content>
&lt;p&gt;关于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt;文件相信大家都不陌生吧，不过网上关于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt;编写方法的教程很有限，也没有几个完全是博主自己写的。&lt;/p&gt;

&lt;p&gt;我在这里就搜了几个常用规则，总结一下rewrite规则的用法。当然这只是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt;功能的一小部分，但是相当实用。&lt;/p&gt;

&lt;p&gt;如果熟练掌握&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rewrite&lt;/code&gt;规则的编写，能够加强对网站URL的控制，对用户体验、SEO都十分有利。（注：所有规则来源于网络）&lt;/p&gt;

&lt;p&gt;一、防盗链功能&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;RewriteEngine&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;On&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{HTTP_REFERER}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;!^http://(.+\.)?mysite\.com/&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;[NC]&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{HTTP_REFERER}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;!^$&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteRule&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;.*\.(jpe?g|gif|bmp|png)$&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;/images/nohotlink.jpg&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;[L]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;1.打开&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Rewrite&lt;/code&gt;功能。有可能服务器设置里已经是全局下打开了，但是多写也没事。&lt;/p&gt;

&lt;p&gt;2.&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RewriteCond&lt;/code&gt;指令，定义生效条件，用于寻找匹配条件的地址。后面内容用正则表达式匹配。代表含义是发送的请求不由mysite.com而来，那就是盗链啦。末尾的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[NC]&lt;/code&gt;代表忽略大小写。&lt;/p&gt;

&lt;p&gt;3.发送请求的主机前缀不为空。&lt;/p&gt;

&lt;p&gt;4.&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RewriteRule&lt;/code&gt;指令，定义重写规则，把匹配的地址按此规则重写。本例中把这些后缀为这些图片格式的，都替换到某一个图片下。&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[L]&lt;/code&gt;表示这是最后一段规则。&lt;/p&gt;

&lt;p&gt;在此再这里总结一下几个常用参数：&lt;/p&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RewriteCond&lt;/code&gt;下：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[NC]&lt;/code&gt;  不分字母大小写&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[OR]&lt;/code&gt;  用于连接下一条规则&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RewriteRule&lt;/code&gt;下：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[R]&lt;/code&gt; 强制重定向，[R=code] code默认为302&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[F]&lt;/code&gt; 禁用URL，返回HTTP 403 错误&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[L]&lt;/code&gt; 这是最后一条规则，之后内容无用。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;还有一篇关于正则表达式的教程（很详细）：http://www.unibetter.com/deerchao/zhengzhe-biaodashi-jiaocheng-se.htm&lt;/p&gt;

&lt;p&gt;二、网址规范化&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#Options +FollowSymLinks
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;rewriteEngine&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;on&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;rewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{http_host}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;^yourdomain.com&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;[NC]&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;rewriteRule&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;^(.*)$&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;http://www.yourdomain.com/$1&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;[R=301,L]&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;/blockquote&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这个是把所有二级域名都重定向到www.yourdomain.com的例子，看起来是不是很简单？&lt;/p&gt;

&lt;p&gt;需要注意的是，这里的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Options +FollowSymLinks&lt;/code&gt;不是必须的，但在某些服务器如果不设置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FollowSymLinks&lt;/code&gt;，可能引起500错误。再来看一个好玩的重定向：&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;RewriteEngine&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;On&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteBase&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;/&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{HTTP_USER_AGENT}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;(Googlebot)&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteRule&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;^&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;http://abc.com/&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;[R=301,L]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;打开&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Rewrite&lt;/code&gt;功能。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RewriteBase&lt;/code&gt;指令，设置目录级重写的基准URL。可以理解成把该目录（这个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt;所在目录）假定为基准的URL前缀。本例中这样的写法无用。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RewriteCond&lt;/code&gt;指令。匹配所有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;USER_AGENT&lt;/code&gt;为Googlebot的发送请求。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RewriteRule&lt;/code&gt;指令。本例中把这些请求都重定向到了abc.com。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;在本例中，这个配置应该是黑客所为，把google蜘蛛指向某个网站，等于伪造PR。&lt;/p&gt;

&lt;p&gt;三、临时错误页面&lt;/p&gt;

&lt;p&gt;当你的网站在升级、修改的时候，你最好让访客转到指定的页面，而不是没做完的页面或者是错误页。这时我们做一个302转跳就OK啦。&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;RewriteEngine&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;on&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{REQUEST_URI}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;!/maintenance.html$&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{REMOTE_ADDR}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;!^123\.123\.123\.123&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteRule&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;/error.html&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;[R=302,L]&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;/blockquote&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td&gt;继续打开Rewrite功能。 – -&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/li&gt;
  &lt;li&gt;REQUEST_URI，请求的URL值。这里指所有访问 maintenance.html页面的请求。&lt;/li&gt;
  &lt;li&gt;REMOTE_ADDR，向服务器发送请求的IP地址。本例中此处应设为你自己的 IP，这样就只有你能访问。&lt;/li&gt;
  &lt;li&gt;RewriteRule指令。本例中把这些请求都重定向到了error.html 。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;在本例，我们总结几个常用的正则表达式和特殊符号。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(.*)&lt;/code&gt;用于匹配某一区域内所有内容。如 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;abc/def/ghi&lt;/code&gt; 可用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(.*)\/(.*)\/(.*)&lt;/code&gt;匹配。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;([a-zA-Z_]+)&lt;/code&gt;匹配英文单词，允许用-和_连接。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;([0-9]+)&lt;/code&gt;匹配多位数字，通常用于匹配ID。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;([0-9])&lt;/code&gt;只匹配一位的数字。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;^&lt;/code&gt;表示正则的开始&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$&lt;/code&gt; 表示正则的结束&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;四、重定向WordPress的RSS Feed链接地址到Feedburner地址&lt;/p&gt;

&lt;p&gt;除了可以更改模板里的RSS地址外，.htaccess也能实现RSS地址的更改，并更加方便。&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;RewriteEngine&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;on&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{HTTP_USER_AGENT}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;!FeedBurner&lt;/span&gt;    &lt;span class=&quot;nn&quot;&gt;[NC]&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{HTTP_USER_AGENT}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;!FeedValidator&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;[NC]&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteRule&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;^feed/?(&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;[_0-9a-z-]&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;+)?/?$&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;http://feeds2.feedburner.com/yourname&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;[R=302,NC,L]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;有了上面的总结，本例其实就很简单了吧。&lt;/p&gt;

&lt;p&gt;唯一要注意的是这样操作要确保填写正确的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HTTP_USER_AGENT&lt;/code&gt;。其实你不常换模板的话。可能还是直接改模板更省事。&lt;/p&gt;

&lt;p&gt;在最后，为懒虫们推荐几个好东东：&lt;/p&gt;

&lt;p&gt;在线&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt;生成器：htaccessEditor&lt;/p&gt;

&lt;p&gt;在线正则表达式检查器：http://www.sman.cn/Blog/attachments/month_0711/320071117123354.html&lt;/p&gt;

&lt;p&gt;关于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mod_rewrite&lt;/code&gt;模块中文参考手册：http://man.chinaunix.net/newsoft/Apache2.2_chinese_manual/mod/mod_rewrite.html&lt;/p&gt;

&lt;p&gt;其实&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rewrite&lt;/code&gt;也只是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;APACHE&lt;/code&gt;一个模块而已，做到边查边写足矣，实在不行直接去搜一个规则也未尝不可。不过其中的正则表达式还是非常实用的，值得深入学习。&lt;/p&gt;
</content>
                 <tag>.htaccess</tag> 
                 <tag>服务器</tag> 
                <pubTime>2010-08-18T16:31:43+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/magic-css3-doraemon.html</loc>
        <lastmod>2010-08-16T14:12:07+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>神奇的CSS3哆啦A梦</title>
                <content>
&lt;p&gt;今天突然想起之前提起CSS3的哆啦A梦～然后就跑去网上找了一下。&lt;/p&gt;

&lt;p&gt;纯CSS制作的哆啦A梦在不同浏览器下面的表现确实各有千秋···&lt;/p&gt;

&lt;p&gt;归根结底的说，不能说IE多垃圾，要说css的滤镜，其他浏览器怎么不支持的话，公说公有理婆说婆有理，存在即合理吧。关键是找到自己喜欢的浏览器就OK了。&lt;/p&gt;

&lt;p&gt;好在现在兄弟伙们对IE和其他浏览器的兼容习以为常了，蛋定咯···&lt;/p&gt;

&lt;p&gt;可以看演示（用自己的浏览器试试吧）：&lt;a href=&quot;http://demo.yourtion.com/doraemon_css3.htm&quot;&gt;http://demo.yourtion.com/doraemon_css3.htm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;或者下载源文件：&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=NDg2ODUwMjE=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;css3写的哆啦A梦.rar&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;按照介绍，它对webkit内核的浏览器支持最佳，比如gg浏览器，火狐浏览器，至于IE下面嘛，惨不忍睹，看图：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/08/01.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;看上面这张图，在chrome5.0和firefox3.6下很不错，有阴影有立体感，而且眼睛还能动。opera10没有了阴影，至于IE8，都成变形金刚了。  测试结果如下：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/08/Firefox-.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;效果在其次的是Firefox (3.6)，效果和Safari的一样，但眼睛不能动。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/08/Opera10.5.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;在Opera (10.53) 里，看不到渐变色。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/08/Safari.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;iPhone OS 3.1的Safari里，它的脸是方的 -_-！！！&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/08/IE9.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;在IE9测试版里，阿蒙的胳膊是方的…强劲的肌肉么？&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/08/IE8.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;在IE8里，阿蒙是…方的，很有喜感&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/08/IE7.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;在IE7里，雷死人啊，大花猫啊。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/08/IE6.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;在IE6里…小叮当害羞了╮(╯▽╰)╭。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/08/dora.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;这才是人家的真面目。&lt;/p&gt;

&lt;p&gt;来自：http://soamz.com/devsign/duolaameng-xiaodingdang-css.html&lt;/p&gt;
</content>
                 <tag>CSS</tag> 
                 <tag>HTML</tag> 
                <pubTime>2010-08-16T14:12:07+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/mourning-site-gray-method-change.html</loc>
        <lastmod>2010-08-15T11:54:16+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>悼念——网站变黑白的方法（包括Flash）</title>
                <content>
&lt;p&gt;为表达全国各族人民对甘肃舟曲特大山洪泥石流遇难同胞的深切哀悼，国务院决定，8月15日全国下半旗志哀，停止公共娱乐活动。&lt;/p&gt;

&lt;p&gt;舟曲泥石流已致1239人遇难，505人失踪。&lt;/p&gt;

&lt;p&gt;14日国务院发布公告：为表达全国各族人民对甘肃舟曲特大山洪泥石流遇难同胞的深切哀悼，国务院决定，2010年8月15日举行全国哀悼活动，全国和驻外使领馆下半旗志哀，停止公共娱乐活动。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;响应号召，我把博客跟微博还有团队博客微博都变成灰白，悼念遇难同胞。&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;方法如下：&lt;/p&gt;

&lt;p&gt;如果你的网站能够支持支持CSS，是符合W3标准的网页，那就在CSS文件的最前面加上一行代码就可以了，这段代码使用的是CSS滤镜，将网页中的色彩部分给滤掉了。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS滤镜过滤色彩代码&lt;/strong&gt;：&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;html&lt;/span&gt; 
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; 
	&lt;span class=&quot;nl&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;progid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DXImageTransform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BasicImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;grayscale&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;第二种方法:只支持IE&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*{filter:Gray;}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;上面的代码可以使除了FLASH之外的网页所有元素变灰,如果网页中含有FLASH,可以使用下面的方法使FLASH变灰:&lt;/p&gt;

&lt;p&gt;第一种方法:如果是用下面的方式调用FLASH,则在代码中加入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wmode=&quot;opaque&quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;第二种方法:如果是用下面的方式调用FLASH,则在代码中加入&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;param&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wmode&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;opaque&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>CSS</tag> 
                 <tag>HTML</tag> 
                <pubTime>2010-08-15T11:54:16+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/replacement-domain-blog-yourtion-com.html</loc>
        <lastmod>2010-08-11T10:49:17+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>博客更换二级域名blog.yourtion.com</title>
                <content>
&lt;p&gt;因为想做个主页来展示博客、微博还有相册什么的~还有就是不想主目录那么乱~所以就学King把博客转到二级域名下面~&lt;/p&gt;

&lt;p&gt;步骤如下：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;先在后台把博客的路径改为：http://blog.yourtion.com&lt;/li&gt;
  &lt;li&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cpanel&lt;/code&gt;下面建立子域，然后把博客的文件移动到子目录下面&lt;/li&gt;
  &lt;li&gt;参考&lt;a href=&quot;/wordpress-replacement-301-redirect.html&quot;&gt;《WordPress 更换域名数据库操作以及301重定向设置》&lt;/a&gt;把文章里面的图片链接什么跳转到子域&lt;/li&gt;
  &lt;li&gt;然后就是友链还有SEO这些了···&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;等待收录什么还有一段时间~过段时间再做进入页面~&lt;/p&gt;
</content>
                 <tag>域名</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2010-08-11T10:49:17+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/external-call-ecall-wordpress.html</loc>
        <lastmod>2010-08-10T11:26:00+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress外部调用–Ecall</title>
                <content>
&lt;p&gt;最近因为团队博客的最新动态要调用到主站上面，但是主站页面因为SEO等原因做成静态页面~所以就要找一个js调用的方法~没想到WordPress真的有哦~那就是ECall~~&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ecall插件介绍：&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ecall是External Call的缩写, 即外部调用。&lt;/p&gt;

&lt;p&gt;Ecall是我们WPC团队完成的第一个正式插件，也已经被wordpress官方收录。&lt;/p&gt;

&lt;p&gt;Ecall的作用简单的说就是，自动生成一段JS代码，把它放到任何网站上，即可显示出wordpress的文章列表。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ecall下载地址：&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=NDc0OTU1ODM=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;ecall.2.5.01.zip&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://wordpress.org/extend/plugins/ecall&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://wordpress.org/extend/plugins/ecall&quot;&gt;http://wordpress.org/extend/plugins/ecall&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ecall主要特点：&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;自由定制模版&lt;/li&gt;
  &lt;li&gt;缓存加速&lt;/li&gt;
  &lt;li&gt;隐藏分类&lt;/li&gt;
  &lt;li&gt;授权机制，防止恶意调用&lt;/li&gt;
  &lt;li&gt;文章的js调用方式&lt;/li&gt;
  &lt;li&gt;遵循WordPress插件开发规范&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Ecall使用说明：&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;安装并启用插件之后，你可以在后台设置里看到﻿Ecall setting的标签，进入后即可对Ecall进行配置。&lt;/p&gt;

&lt;p&gt;在配置页面你将看到类似这样的代码：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'text/javascript'&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'http://blog.j0753.com/index.php?key=9bd4cb46a739cd86fbfdf76e83a44297&amp;amp;cid=0&amp;amp;rows=6'&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;http://blog.j0753.com :代表博客域名&lt;/li&gt;
  &lt;li&gt;key: 代表插件生成的授权密钥（在插件配置页面可获得）&lt;/li&gt;
  &lt;li&gt;cid: 代表分类的id（可选，如果没有cid即代表所有的分类）&lt;/li&gt;
  &lt;li&gt;rows: 代表显示的数据条数（可选，默认10条）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;插件配置如下，很简单，只要把生成的代码拷贝到你要调用的地方就OK了~&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/08/image17.png&quot;&gt;&lt;img src=&quot;/images/2010/08/image16.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>WordPress</tag>  <tag>插件</tag> 
                 <tag>WordPress插件</tag> 
                <pubTime>2010-08-10T11:26:00+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/freakauth_light-assigning-error-solution.html</loc>
        <lastmod>2010-08-08T08:54:09+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>FreakAuth_light出现Assigning the return value of new by reference is deprecated解决方法</title>
                <content>
&lt;p&gt;最近在研究CodeIgniter。因为要登录验证，所以找到了FreakAuth_light，这是一个很不错的验证插件～可以满足你日常要求～&lt;/p&gt;

&lt;p&gt;但是按照他的要求配置玩以后却出现：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Message: Assigning the return value of new by reference is deprecated
Filename: helpers/freakauth_light_helper.php
Line Number: 32
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;还有：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Message: Cannot modify header information - headers already sent by (output started at D:\xampp\htdocs\ciyz\system\application\helpers\freakauth_light_helper.php:32)
Filename: libraries/Db_session.php
Line Number: 248
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;的错误。经过研究终于解决了问题。顺给给大家分享，&lt;/p&gt;

&lt;p&gt;解决问题很简单，将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;helpers/freakauth_light_helper.php&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;第32行的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$obj-&amp;gt;freakauth_light = &amp;amp; new MyFAL();&lt;/code&gt;改为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$obj-&amp;gt;freakauth_light =  new MyFAL();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;以后会写文章介绍一下FreakAuth_lightd的配置和使用。至于为什么出那个错误请看下文：&lt;/p&gt;

&lt;p&gt;自从php5.3，越来越多的人会遇到“Assigning the return value of new by reference is deprecated in xxxx”这样的提示，尤其是在国外产品中（例如wordpress、joolma），很多人的解决办法很简单：把php版本换回就版本就ok了。&lt;/p&gt;

&lt;p&gt;毫无疑问这是个好办法，对这种遇到问题不求甚解的态度可能会让人看到些什么。我认为要换回php的旧版本，其实是对php技术爱好者的一种羞辱（用词不当，大致是这个意思）。解决办法：php5.3开始后，废除了php中的”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;=&amp;amp;&lt;/code&gt;”符号，所以要想复制，直接用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;=&lt;/code&gt;引用即可。详细如下：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;PHP5对象复制是采用引用的方式；&lt;/li&gt;
  &lt;li&gt;如果不采用引用方式，则需要在复制对象时加关键字 clone;&lt;/li&gt;
  &lt;li&gt;如果在复制的过程中，同时要变更某些属性，则增加函数_clone();&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Message: Assigning the return value of new by reference is deprecated
Filename: helpers/freakauth_light_helper.php
Line Number: 32
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>CodeIgniter</tag>  <tag>解决问题</tag> 
                 <tag>PHP</tag> 
                <pubTime>2010-08-08T08:54:09+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/htaccess-domain-point-subdirectory.html</loc>
        <lastmod>2010-08-07T14:39:06+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>用.htaccess将主域名从网站根目录指向子目录</title>
                <content>
&lt;p&gt;想将主域名指向其中一个文件夹/目录，问我会不会弄，我随即就说通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt;重写就可以了，虽然对&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt;有一定的了解，可是真正要实现这个功能的重写，还不知道具体怎么实现，尝试了几次都出现这样或那样的问题。无奈中&lt;del&gt;只好上网寻找答案&lt;/del&gt;&lt;/p&gt;

&lt;p&gt;找这种答案还是很容易的，很快就在HostMonster的知识库里找到了，那里有一篇文章专门写如何用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt;重写将主域名指向一个子目录/文件夹。&lt;/p&gt;

&lt;p&gt;在虚拟主机中，主域名是使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;public_html&lt;/code&gt;目录/文件夹作为主域名的缺省目录，主域名网站的文件和程序都是放在public_html目录下，附加的域名(addon domains)使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;public_html&lt;/code&gt;目录/文件夹下的子目录/子文件夹。有的人可能觉得public_html目录/文件夹下的会看起来比较乱，因此想把主域名也指向其中一个子目录/文件夹。这样就需要利用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt;的重写功能。&lt;/p&gt;

&lt;p&gt;具体的写法如下：&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# .htaccess main domain to subfolder redirect
# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.
&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Do not change this line.
&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteEngine&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;on&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Change yourdomain.com to be your main domain.
&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{HTTP_HOST}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;^(www.)?yourmaindomain.com$&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Change ’subfolder’ to be the folder you will use for your main domain.
&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{REQUEST_URI}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;!^/subfolder/&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Don’t change this line.
&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{REQUEST_FILENAME}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;!-f&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{REQUEST_FILENAME}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;!-d&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Change ’subfolder’ to be the folder you will use for your main domain.
&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteRule&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;^(.*)$&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;/subfolder/$1&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Change yourdomain.com to be your main domain again.
# Change ’subfolder’ to be the folder you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{HTTP_HOST}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;^(www.)?yourmaindomain.com$&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteRule&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;^(/)?$&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;subfolder/index.php&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;[L]&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;﻿&amp;lt;/blockquote&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>.htaccess</tag>  <tag>域名</tag>  <tag>服务器</tag> 
                 <tag>服务器</tag> 
                <pubTime>2010-08-07T14:39:06+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/network-management-experience.html</loc>
        <lastmod>2010-08-03T12:54:33+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>关于网络管理的一点体会～</title>
                <content>
&lt;p&gt;这两天基本都是在网络中心的机房度过～因为最近学校进了一台认证网关～然后同时也要进行路由调整。然后就在机房打下手～&lt;/p&gt;

&lt;p&gt;先是帮他们调整设备 ，然后是帮迁移认证网关的数据库服务器～备份之前的系统，卸载原有软件，安装数据库～等待工程师迁移数据，安装。测试。调整路由。弄到晚上12点40才搞定。&lt;/p&gt;

&lt;p&gt;有点想法，记录下来。&lt;/p&gt;

&lt;p&gt;首先就是调整路由前要仔细画好原先和调整后的拓扑图，认真标出各个端口调整的IP，包括上一条下一跳的IP地址，防止路由配置错误然后走了一大条弯路～&lt;/p&gt;

&lt;p&gt;然后是服务器调整的时候要先把原数据库脱机，然后最好重启服务器，防止服务器的进程占用文件，这样也会提高数据库迁移的速度。&lt;/p&gt;

&lt;p&gt;最后是还要计划清楚或者是考虑清楚还哪些要同时调整。就像我们调整认证网关还有同时调整下行服务器的Radios，结果就是忘了，导致一直没有人上线的故障。最后就还要去调整100台交换机。&lt;/p&gt;

&lt;p&gt;小小感想。&lt;/p&gt;
</content>
                
                 <tag>网络工程</tag> 
                <pubTime>2010-08-03T12:54:33+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/digital-clock-design.html</loc>
        <lastmod>2010-08-02T12:49:00+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>数字钟的设计</title>
                <content>
&lt;p&gt;数字钟已成为人们日常生活中必不可少的必需品，广泛用于个人家庭以及车站、码头、剧场、办公室等公共场所，给人们的生活、学习、工作、娱乐带来极大的方便。由于数字集成电路技术的迅速发展及其采用了先进的石英技术，使数字钟具有走时准确、性能稳定、携带方便等优点，它还用于计时、自动报时及自动控制等各个领域。尽管目前市场上已有现成的数字钟集成电路芯片出售，价格便宜、使用也方便，但鉴于数字钟电路的基本组成包含了数字电路的主要组成部分，因此进行数字钟的设计是必要的。在这里我将已学过的比较零散的数字电路的知识有机的、系统的联系起来用于实际，来培养我的综合分析和设计电路的能力。&lt;/p&gt;

&lt;p&gt;本次设计以数字电子为主，实现对时、分、秒、星期数字显示的计时装置,周期为24小时，显示满刻度为23时59分59秒，并具有校时功能和报时功能的数字电子钟。电路主要采用中规模CMOS集成电路.本系统的设计电路由脉冲逻辑电路模块、时钟脉冲模块、电源模块、时钟译码显示电路模块、整点报时模块、校时模块、星期模块等几部分组成。&lt;/p&gt;

&lt;p&gt;采用电池作电源，采用低功耗的CMOS芯片及液晶显示器，发生器使用晶体振荡、计数振荡器CD4060及双JK触发器CD4027，将标准秒信号送入“秒计数器”；计数器采用“可予制四位二进制异步清除”计数器来实现，分别组成两个六十进制(秒、分)、一个二十四进制(时)的计数器；整电报时电路以门电路、触发器及扬声器构成，要求在离整点差5秒时，每1秒钟鸣叫一次，共响5次，前四次为低音512Hz，最后一声为高音1024Hz；星期计数器是用四个D触发器组成；校时电路是由与非门构成的双稳态触发器，用来对“星期”、“时”、“分”、“秒”显示数字进行调整的；译码显示电路选用BCD-7段锁存译码／驱动器CC4511构成，再经过六位LED七段显示器显示出来。&lt;/p&gt;

&lt;p&gt;由于本人能力有限，在设计中难免会出现错误与不足，希望各位老师能指出帮助我进&lt;/p&gt;

&lt;p&gt;多功能数字电子钟的设计&lt;/p&gt;

&lt;h3 id=&quot;一-概述&quot;&gt;一、 概述&lt;/h3&gt;

&lt;p&gt;数字钟已成为人们日常生活中必不可少的必需品，广泛用于个人家庭以及办公室等公共场所，给人们的生活、学习、工作、娱乐带来极大的方便。由于数字集成电路技术的发展和采用了先进的石英技术，使数字钟具有走时准确、性能稳定、携带方便等优点，它还用于计时、自动报时及自动控制等各个领域。尽管目前市场上已有现成的数字钟集成电路芯片出售，价格便宜、使用也方便，但鉴于数字钟电路的基本组成包含了数字电路的主要组成部分，因此进行数字钟的设计是必要的。在这里我们将已学过的比较零散的数字电路的知识有机的、系统的联系起来用于实际，来培养我们的综合分析和设计电路的能力。&lt;/p&gt;

&lt;p&gt;本次设计以数字电子为主，实现对时、分、秒、星期数字显示的计时装置,周期为24小时，显示满刻度为23时59分59秒，并具有校时功能和报时功能的数字电子钟。电路主要采用中规模CMOS集成电路.本系统的设计电路由脉冲逻辑电路模块、时钟脉冲模块、电源模块、时钟译码显示电路模块、整点报时模块、校时模块、星期模块等几部分组成。采用电池作电源，采用低功耗的CMOS芯片及液晶显示器，发生器使用晶体振荡、计数振荡器CD4060及双JK触发器CD4027，将标准秒信号送入“秒计数器”；计数器采用“可予制四位二进制异步清除”计数器来实现，分别组成两个六十进制(秒、分)、一个二十四进制(时)的计数器；整电报时电路以门电路、触发器及扬声器构成，要求在离整点差5秒时，每1秒钟鸣叫一次，共响5次，前四次为低音512Hz，最后一声为高音1024Hz；星期计数器是用四个D触发器组成；校时电路是由与非门构成的双稳态触发器，用来对“星期”、“时”、“分”、“秒”显示数字进行调整的；译码显示电路选用BCD-7段锁存译码／驱动器CC4511构成，再经过六位LED七段显示器显示出来。如图1所示多功能数字钟的组成框图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/08/image1.png&quot;&gt;&lt;img src=&quot;/images/2010/08/image1.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;图1数字钟的组成框图&lt;/p&gt;

&lt;h3 id=&quot;二-秒脉冲发生器&quot;&gt;二 、秒脉冲发生器&lt;/h3&gt;

&lt;h4 id=&quot;晶体振荡器&quot;&gt;晶体振荡器&lt;/h4&gt;

&lt;p&gt;a：晶体振器构成&lt;/p&gt;

&lt;p&gt;晶体振荡器电路给数字钟提供一个频率稳定准确的32768Ｈz的方波信号，可保证数字钟的走时准确及稳定。不管是指针式的电子钟还是数字显示的电子钟都使用了晶体振荡器电路。如图2所示晶体振荡电路框图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/08/image2.png&quot;&gt;&lt;img src=&quot;/images/2010/08/image2.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;图2晶体振荡电路框图&lt;/p&gt;

&lt;p&gt;b：晶体振荡器电路原理&lt;/p&gt;

&lt;p&gt;在电路中，非门U1与晶体、电容和电阻构成晶体振荡器电路，U2实现整形功能，将振荡器输出的近似于正弦波的波形转换为较理想的方波。输出反馈电阻R1为非门提供偏置，使电路工作于放大区域，即非门的功能近似于一个高增益的反相放大器。电容C1、C2与晶体构成一个谐振型网络，完成对振荡频率的控制功能，同时提供了一个180度相移，从而和非门构成一个正反馈网络，实现了振荡器的功能。由于晶体具有较高的频率稳定性及准确性，从而保证了输出频率的稳定和准确。晶体XTAL1的频率选为32768Hz。其中C1的值取5~20 pF，C2为30pF。C1作为校正电容可以对温度进行补偿，以提高频率准确度和稳定度。由于电路的输入阻抗极高，因此反馈电阻R1可选为10MΩ。较高的反馈电阻有利于提高振荡频率的稳定性。&lt;/p&gt;

&lt;p&gt;2.分频器电路&lt;/p&gt;

&lt;p&gt;分频器电路将32768Ｈz的高频方波信号经32768（  ）次分频后得到1Hz的方波信号供秒计数器进行计数。分频器实际上也就是计数器，为此电路输送一秒脉冲。&lt;/p&gt;

&lt;p&gt;3.秒脉冲发生器&lt;/p&gt;

&lt;p&gt;CD4060的10、11脚之间并接石英晶体和反馈电阻与其内部的反相器组成一个石英晶体振荡器。电路产生的32768Hz的信号经过内部十四级分频后由3脚（Q14其分频系数为16384）输出脉冲频率为2Hz，再通过一个二分频器分频就得到了1Hz的时钟信号，也就是1S；CD4027为双JK触发器，其内部含有两个独立的JK触发器，其中16脚6脚（2J）5脚（2K）接电源，4脚（R2）7脚（S2）接地，3脚（CP2）输入2Hz脉冲信号，分频后的1Hz脉冲由1脚（Q2）输出。
&lt;a href=&quot;/images/2010/08/image3.png&quot;&gt;&lt;img src=&quot;/images/2010/08/image_thumb3.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;三-计数器&quot;&gt;三 、计数器&lt;/h3&gt;

&lt;p&gt;有了时间标准“秒”信号后，就可以根据60秒为1分、60分为1小时、24小时为1天的计数周期，分别组成两个六十进制(秒、分)、一个二十四进制(时)的计数器。将这些计数器适当连接，就可以构成秒、分、时的计数，实现计时功能。&lt;/p&gt;

&lt;p&gt;1．74LS161构成秒、分的六十进制计数器&lt;/p&gt;

&lt;p&gt;数字钟的“秒”、“分”信号产生电路都是由六十进制计数器构成，“时”信号产生电路为二十四进制计数器。它们都可以用两个“可予制四位二进制异步清除”计数器来实现。利用74LS161芯片的预置数功能，也可以构成不同进制的计数器。因为一片74LS161内含有一个四位二进制异步清除计数器，因此需用两片74LS161就可以构成六十进制计数器了。集成电路74LS161芯片的电路其中（如图3）CP为时钟脉冲输入端，D0、D1、D2、D3为预置数输入端，  为置数控制端，  为异步复位端，二者均为低电平有效；Q0、Q1、Q2、Q3为计数器的输出端。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/08/image4.png&quot; alt=&quot;image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;图3  74LS161管脚排列图&lt;/p&gt;

&lt;p&gt;a：计数功能：
当 = =CTP=CTT=1，CP=CP↑时，实现计数功能。&lt;/p&gt;

&lt;p&gt;b：同步并行置数功能：
当 =1时，预置控制端 =0，并且 CP=CP↑时，Q3Q2Q1Q0= D3D2D1D0，实现同步预置数功能。&lt;/p&gt;

&lt;p&gt;c：保持功能：
当 = =1且CTP•CTT=0时，输出Q3Q2Q1Q0保持不变。&lt;/p&gt;

&lt;p&gt;d：异步清零功能：
当复位端 =0时，输出Q3Q2Q1Q0全为零，实现异步清零功能（又称复位功能）。&lt;/p&gt;

&lt;p&gt;秒个位计数器&lt;/p&gt;

&lt;p&gt;47LS161被接成十进制计数器，其置数输入端A、B、C、D（3脚4脚5脚6脚）接低电平，LD、EP、ET（9脚10脚7脚）接高电平，秒脉冲由CP（2脚）端输入。计数器的输出端QA、QB、QC、QD（14脚13脚12脚11脚）接译码电路CD4511的输入端D、C、B、A。当秒脉冲输入时，电路状态按二进制自然序列依次递增1，QA、QB、QC、QD输出为0000、0001、0010、0011、0100、0101、0110、0111、1000、1001，当输出为1010也就是10时，QA、QC输出都为1，经过一个与非门后一路经反相后送入或非门的一个输入端，输出送往计数器的清零端RD使秒计数器清零，另一路经反相后作为进位脉冲送入秒十位计数器的脉冲输入端。&lt;/p&gt;

&lt;p&gt;秒十位计数器&lt;/p&gt;

&lt;p&gt;在这里74LS161被接成六进制计数器，接法与秒个位计数器相同，秒个位计数器送来的进位脉冲送入秒使位计数器的脉冲输入端，使其按二进制自然序依次递增1，QA、QB、QC、QD端输出为0000、0001、0010、0011、0100、0101，当输出为0110也就是6时，QB、QC输出为1，QA、QD输出为0，QB、QC经过一个与非门后一路先送往秒十位计数器的清零端，然后取反接或非门的另一个输入端后送入秒个位计数器的清零端，将整个秒计数器清零，另一路经反相后作为进位脉冲送入分个位计数器的脉冲输入端。&lt;/p&gt;

&lt;p&gt;分计数器的连接方法与秒计数器相同，分计数器向时计数器送进位脉冲。秒、分的六十进制计数器的构成如图4所示：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/08/image5.png&quot;&gt;&lt;img src=&quot;/images/2010/08/image5.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;图4  74LS161构成秒、分的六十进制计数器框图&lt;/p&gt;

&lt;p&gt;2．74LS161构成二十四进制计数器&lt;/p&gt;

&lt;p&gt;二十四进制计数器，也是用两个74LS161集成块来实现的，方法与二十四进制计数器大同小异，但其要求个位是十进制，状态变化在0000～1001间循环，十位是二进制，状态变化在0000～0010间循环，显示为0~23时。&lt;/p&gt;

&lt;p&gt;原理：&lt;/p&gt;

&lt;p&gt;由分计数器送来的进位脉冲送入时个位计数器，电路在分进位脉冲的作用下按二进制自然序依次递增1，当计数到24，这时小时个位输出0100（也就是4），小时十位输出0010（也就是2），小时十位计数器只有QC端有输出，小时个位计数器只有QB端有输出，将QC、QB端接一个二输入与非门，与非门输出一路先送入十位计数器的清零端然后取反送入或非门的另一个输入端，输出接小时个位计数器的清零端，其每10小时清零并向小时十位计数器送进位脉冲，当十位输出为二，小时个位输出为四时，将整个电路清零，另一路取反后作为星期进位脉冲送入星期显示电路的脉冲输入端，完成24小时的显示及向星期电路送星期进位脉冲的功能。二十四进制计数器的构成如图5所示：&lt;/p&gt;

&lt;p&gt;图5  74LS161构成小时的二十四进制计数器框图&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/08/image6.png&quot;&gt;&lt;img src=&quot;/images/2010/08/image6.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;四-星期计数器&quot;&gt;四 、星期计数器&lt;/h3&gt;

&lt;p&gt;每当累计24小时，小时十位会发出一个“星期脉冲”进位信号，该信号将被送到“星期计数器”，“星期计数器” 采用8进制计时器，可实现对一周7天的累计（第七天时显示为“日”为1000），译码显示电路将计数器的输出状态送到七段显示译码器译码，通过七位LED七段显示器显示出来。
星期计数器是用四个D触发器组成，它利用了D 触发器的计数功能，来完成计数的，它的逻辑功能&lt;/p&gt;

&lt;p&gt;图如图6所示。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/08/image7.png&quot;&gt;&lt;img src=&quot;/images/2010/08/image7.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;图6  星期计数器电路图&lt;/p&gt;

&lt;p&gt;设计中将D触发器的 端和ID端相连显然，成了计数型触发器。由4个D触发器构成的四位移位寄存器，各触发器的RD端联在一起作为复位端。R和S则为触发器的异步复位和置位端，高电平触发，通常处于低电平状态。Q1~Q4为输出端，提供译码显示的。如图6 将后三个D触发器送到与非门，是为了实现星期计数，显示星期一至星期日，当计到七时也就是，Q3Q2Q1Q0=0111时，经与非门归零，此时就不显示星期七，系统继续进行计数，直到显示星期日时便停止计数，这样就完成了一次完整的计数。等待下一次的计数。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/08/image8.png&quot;&gt;&lt;img src=&quot;/images/2010/08/image8.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;五-校时电路&quot;&gt;五 、校时电路&lt;/h3&gt;

&lt;p&gt;当时钟指示不准时，就需要校准时间。校准的方法很多，常用的有“快速校时法”。由与非门构成的双稳态触发器，可以将1Hz的“计数器的进位信号”送至“计数器的CP端”。其工作过程为：当接通校时开关时，与非门输出一个低电平和一个高电平。“计数器进位信号”通过“校时CP端”送至“计数器的CP端”，使“计数器”在“秒”信号的控制下“快速”计数，当校时电路打到A时，秒计数器经过与非门，发出一个分计数脉冲，进行一次计数。当校时电路打到B的分计时器CP是，开始进行校时，以达到准确的时间。当校时电路打到C时，开始进行准确的校时，将校时开关打到D，时计数器可以接收到，由分计数发出的脉冲信号。当校时开关打到E时，星期计数器能接收到，由时计数器发出的星期脉冲信号，此时对星期进行计数。若将校时开关打到F 时，也随即进行星期的校时，从而进行一次完整的校时，以达到了校时的目的。其构成电路如下图7所示。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/08/image9.png&quot;&gt;&lt;img src=&quot;/images/2010/08/image9.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;图7 单次脉冲产生校时电路图&lt;/p&gt;

&lt;h3 id=&quot;六-报时电路&quot;&gt;六 、报时电路&lt;/h3&gt;

&lt;p&gt;数字钟整点报时是最基本的功能之一。现在设计的电路要求在离整点差6秒时，每1秒钟鸣叫一次，共响6次，前五次为低音512Hz，最后一声为高音1024Hz。当计时到59分时，与非门（59分）接通，同时校分与非门接通，经RS触发器，保持此状态，因此扬声器不发生。当计时到59分54秒时，与非门（54秒）经RS触发器使其置零，在经与门与512HZ和成，一起送到扬声器，使扬声器发声，鸣叫5声后，当计数到59分59秒时，与非门（59秒）接通，经RS触发器在经非门与1024HZ频率，一同驱动扬声器，使其达到高音，此时报时完毕。整点报时电路主要由控制门电路和音响电路两部分组成。控制门电路部分由与非门组成，分别表示“分十位”“分个位”“秒十位”和“秒个位”的状态，与计数器的四个触发器A、B、C、D相连。音响电路采用射极输出器，推动8Ω的喇叭，三极管基极串接lkΩ限流电阻，是为了防止电流过大损坏喇叭，集电极串接51Ω限流电阻，三极管选用高频小功率管即可。其构成如图8所示：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/08/image10.png&quot;&gt;&lt;img src=&quot;/images/2010/08/image10.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;图8 报时电路图&lt;/p&gt;

&lt;h3 id=&quot;七译码驱动及显示电路&quot;&gt;七、译码驱动及显示电路&lt;/h3&gt;

&lt;p&gt;电路由译码器集成电路CD4511、共阴极LED数码管组成。计数器74LS161输出的为四位二进制数，经译码电路译码输出端控制LED管显示十进制数0~9。&lt;/p&gt;

&lt;p&gt;译码显示电路选用BCD-7段锁存译码／驱动器CC4511。七段显示数码管的外部引线排列如图9所示：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/08/image11.png&quot;&gt;&lt;img src=&quot;/images/2010/08/image11.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;图9 七段显示数码管的外部引线排列图&lt;/p&gt;

&lt;p&gt;CD4511 是一个用于驱动共阴 LED 显示器的 BCD 码—七段码译码器，其引脚如图10所示：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/08/image12.png&quot;&gt;&lt;img src=&quot;/images/2010/08/image12.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;图10 CD4511引脚图&lt;/p&gt;

&lt;p&gt;其功能介绍如下：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;BI：当BI=0 时，不管其它输入端状态如何，七段数码管均处于熄灭状态，不显示数字。&lt;/li&gt;
  &lt;li&gt;LT：当BI=1，LT=0 时，不管输入 DCBA 状态如何，七段均发亮，显示“8”。它主要用来检测数码管是否损坏。&lt;/li&gt;
  &lt;li&gt;LE：使能控制端，当LE=0时，允许译码输出。&lt;/li&gt;
  &lt;li&gt;DCBA：为8421BCD码输入端。&lt;/li&gt;
  &lt;li&gt;abcdefg：为译码输出，输出为高电平。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;CD4511的EI、LI端接高电平，LE端接低电平，输入端D、C、B、A接74LS161的输出端QA、QB、QC、QD。，其输出端a~f接数码管。当数字钟的计数器在CP脉冲韵作用下，按60秒为1分、60分为1小时，‘24小时为1天的计数规律计数时，就应将其状态显示成清晰的数字符号。这就需要将计数器的状态进行译码并将其显示出来。我们选用的计数器全部是二-十进制集成片，“秒”、“分”、“时”的个位和十位的状态分别由集成片中的四个触发器的输出状态来反映的。每组(四个)．输出的计数状态都按 BCD代码以高低电平来表现。因此，需经译码电路将计数器输出的BCD代码变成能驱动七段数码显示器的工作信号。原理如图11所示：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/08/image13.png&quot;&gt;&lt;img src=&quot;/images/2010/08/image13.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;图11译码显示电路&lt;/p&gt;

&lt;p&gt;八、元件明细表&lt;/p&gt;

&lt;p&gt;序号 名称 规格 数量&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;1 译码器 CD4511 6个&lt;/li&gt;
  &lt;li&gt;2 七段显示器 BS201 7个&lt;/li&gt;
  &lt;li&gt;3 触发器 边沿D触发器 4个&lt;/li&gt;
  &lt;li&gt;4 石英晶体 32768 1个&lt;/li&gt;
  &lt;li&gt;5 集成块 74LS161 6个&lt;/li&gt;
  &lt;li&gt;6 集成块 CD4511 7个&lt;/li&gt;
  &lt;li&gt;7 电容 22PF 1个&lt;/li&gt;
  &lt;li&gt;8 可变电容 3-22PF 1个&lt;/li&gt;
  &lt;li&gt;9 触发器 RS触发器 2个&lt;/li&gt;
  &lt;li&gt;10 电阻 1KΩ 1个&lt;/li&gt;
  &lt;li&gt;11 电阻 10 KΩ 2个&lt;/li&gt;
  &lt;li&gt;12 电阻 22MΩ 1个&lt;/li&gt;
  &lt;li&gt;13 或门 74LS32 1个&lt;/li&gt;
  &lt;li&gt;14 与门 74LS08 6个&lt;/li&gt;
  &lt;li&gt;15 非门 74LS04 8个&lt;/li&gt;
  &lt;li&gt;16 与非门 74LS00 8个&lt;/li&gt;
  &lt;li&gt;17 与非门 74LS10 3个&lt;/li&gt;
  &lt;li&gt;18 与非门 74LS20 1个&lt;/li&gt;
  &lt;li&gt;19 扬声器 8W、2.5Ω 1个&lt;/li&gt;
  &lt;li&gt;20 三极管 8050 1个&lt;/li&gt;
  &lt;li&gt;21 开关 AZD1169 3个&lt;/li&gt;
&lt;/ul&gt;
</content>
                
                 <tag>杂杂的</tag> 
                <pubTime>2010-08-02T12:49:00+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/pagecookery-photo-wall-reconstruction.html</loc>
        <lastmod>2010-07-27T14:49:31+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PageCookery照片墙改造</title>
                <content>
&lt;p&gt;今天看到人家发给我的一个网站，说很好看。我发现是用ImageFlow做的效果。之前研究过一下下。遂决定将我的微博上的照片墙拿来改造。事实上ImageFlow很简单就是在它预定的DIV里面加入要调用图片的&lt;img /&gt;标记即可。&lt;/p&gt;

&lt;p&gt;效果：&lt;a href=&quot;http://t.yourtion.com/?act=photos&quot;&gt;http://t.yourtion.com/?act=photos&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;改造过程：&lt;/p&gt;

&lt;p&gt;因为PageCookery调用Flick的相册后生成的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;ul&amp;gt;&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;li&amp;gt;&lt;/code&gt;标签，所以先从标签入手，&lt;/p&gt;

&lt;p&gt;下载：&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=NDQ3NDAyNjE=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;ImageFlow_1.3.0.zip&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;把下载回来的ImageFlow解压到你的微博下面的imageflow目录。&lt;/p&gt;

&lt;p&gt;然后把template下的photos.html中的&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;main&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;padding: 0;&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;&amp;lt;!--{foreach ($recent_photos['items'] AS $photo)}--&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;background: url({$photo['media']['m']}) no-repeat center center&quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;title=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{$photo['title']}&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{$photo['link']}&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;target=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;_blank&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;{$photo['title']}&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--{/foreach}--&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;clear:left&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;替换为：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;main&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;padding: 0;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;myImageFlow&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;imageflow&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;&amp;lt;!--{foreach ($recent_photos['items'] AS $photo)}--&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;img&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{$photo['media']['m']}&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;longdesc=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{$photo['link']}&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;alt=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{$photo['title']}&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--{/foreach}--&amp;gt;&lt;/span&gt; 

&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;clear:left&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后在前面加上&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;imageflow/imageflow.packed.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最后在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;head.html&lt;/code&gt;中的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;head&amp;gt;&lt;/code&gt;中加入&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;link&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rel=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;stylesheet&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;imageflow/imageflow.packed.css&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/css&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样就大功告成了，剩下的是一些微调的工作。&lt;/p&gt;

&lt;p&gt;下面是我博客的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;head&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;photo&lt;/code&gt;还有imageflow文件的打包。希望对你有帮助，举一反三自己改造咯&lt;/p&gt;

&lt;p&gt;我博客的文件打包：&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=NDQ3NDE1NTk=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;ImageFlow.rar&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;更加详细的用法可以参看ImageFlow的官方文档：&lt;a href=&quot;http://finnrudolph.de/ImageFlow/Documentation&quot;&gt;http://finnrudolph.de/ImageFlow/Documentation&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>CSS</tag>  <tag>PHP</tag> 
                 <tag>PageCookery</tag> 
                <pubTime>2010-07-27T14:49:31+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/dbank-client-folder-virtual-hard-disk.html</loc>
        <lastmod>2010-07-22T22:24:34+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>将DBank客户端文件夹变成虚拟硬盘</title>
                <content>
&lt;p&gt;有时候跑到DBank的同步文件夹很麻烦。所以想把它虚拟磁盘。这样就方便很多。  说干就干，想到Windows下一个用来将文件夹虚拟磁盘的命令：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;subst&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;subst，DOS命令，用于路径替换 ，将路径与驱动器号关联，就是把一个目录当作一个磁盘驱动器来看，不过不能格式化。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;于是我就新建了一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dbank.bat&lt;/code&gt;文件，内容如下：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;@EchoOff
subst  z:  D:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;OC&lt;span class=&quot;se&quot;&gt;\我&lt;/span&gt;的DBank
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Z:&lt;/code&gt;可以改成你想虚拟的盘符，而“D:\DOC\我的DBank”就是你Dbank同步路径。&lt;/p&gt;

&lt;p&gt;最后把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dbank.bat&lt;/code&gt;放到启动下面，这样每次开机就会虚拟磁盘啦~&lt;/p&gt;

&lt;p&gt;就是那么简单~~~~~&lt;/p&gt;

&lt;p&gt;接下来说说Subsy的一些高级用法：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SUBST &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;drive1: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;drive2:]path] SUBST drive1: /D  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;drive1: 指定要指派路径的虚拟驱动器。&lt;/li&gt;
  &lt;li&gt;[drive2:]path  指定物理驱动器和要指派给虚拟驱动器的 路径。&lt;/li&gt;
  &lt;li&gt;/D 删除被替换的 (虚拟) 驱动器。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;不加任何参数键入 SUBST，可以显示当前虚拟驱动器的清单。&lt;/p&gt;

&lt;p&gt;Subst至少在视窗操作系统中能起到以下几个作用：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;减少未安装软驱系统安装硬件驱动程序时的等待时间；&lt;/li&gt;
  &lt;li&gt;方便用户管理常用目录。&lt;/li&gt;
  &lt;li&gt;“欺骗功能”  现在让我们来看Subst是如何来实现这一切的。  在&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Windows9x/Me中，我们只需在“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;开始&lt;/code&gt;”、“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;运行&lt;/code&gt;”的地址栏中输入“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Msconfig&lt;/code&gt;”，然后点击确定或回车即可调出“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;系统配置实用程序&lt;/code&gt;”。&lt;/p&gt;

&lt;p&gt;1.再点击&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Autoexec.bat&lt;/code&gt;，输入“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;subst a: c:\tools&lt;/code&gt;”语句，点击“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;确定&lt;/code&gt;”按钮，然后重新启动。&lt;/p&gt;

&lt;p&gt;这一步的作用是利用系统启动时自动执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Autoexec.bat&lt;/code&gt;中的命令语句的特性，将没有软驱的电脑(如网吧的工作站就通常不配软驱)虚拟出一个软驱，双击该软驱可以调出C盘的Tools目录内容，并可以在其中进行拷贝、删除等操作。而且还缩短了无软驱电脑系统在查找驱动程序时反复查找A盘的等待时间(速度慢的电脑可能要1分钟之多，多么令人烦恼的事情！)。&lt;/p&gt;

&lt;p&gt;当然在有软驱的电脑中，我们最好将命令行中的A盘符更改为E或者F直至Z等盘符，不必担心虚拟盘符是否会与光驱盘符有冲突，光驱盘符通常会自动向后延续。&lt;/p&gt;

&lt;p&gt;2.我们还可以利用这个命令来快速调用常用目录，例如我的稿件通常是放在“D:＼稿件”目录中，通过在“系统配置实用程序”中虚拟出一个G盘后，每次我就可以方便地管理稿件目录了。&lt;/p&gt;

&lt;p&gt;3.我们就以一个最典型的例子来讲解Subst的欺骗功能：Office97在安装的时候需要使用一张加密软盘。软盘多次使用就有可能损坏。&lt;/p&gt;

&lt;p&gt;我们可以将软盘的内容拷贝到硬盘上，如&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;E:\disk&lt;/code&gt;，然后在命令提示符或者开始菜单的运行中输入如下命令行：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c:\windows\command\subst a: e:\disk &lt;/code&gt;这样就可以不需要软盘安装Office了。&lt;/p&gt;

&lt;p&gt;这种方法同样比较适合于无软驱电脑用户和急需软盘而又暂时无盘的用户(但经过实验，有软驱的用户可以通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Subst&lt;/code&gt;命令虚拟的盘符来将原驱动器盘符隐藏)。&lt;/p&gt;

&lt;p&gt;注意：在Windows2000／XP中同样有这个命令，但是应当注意的是这个命令不能虚拟已经存在的驱动程序盘符。例如，如果你的电脑中安装了软驱，盘符为A，就不能用Subst虚拟A盘。&lt;/p&gt;
</content>
                
                 <tag>电脑技巧</tag> 
                <pubTime>2010-07-22T22:24:34+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/super-cool-slide-show-cu3er.html</loc>
        <lastmod>2010-07-17T15:27:51+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>一个超酷的幻灯片：CU3ER</title>
                <content>
&lt;p&gt;演示地址：&lt;a href=&quot;http://demo.yourtion.com/cu3er/&quot;&gt;http://demo.yourtion.com/cu3er/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;强大的3D展示功能确实跟以前所见的幻灯片不太一样，给人耳目一新的感觉。&lt;/p&gt;

&lt;p&gt;这是在汕头大学的网站上面看到的。觉得那么多大学网站里面，汕大的网站还是很不错的，很大气！&lt;/p&gt;

&lt;p&gt;因为从官方下载的源文件没有自动播放、幻灯图片链接等功能，所以我在这里就简单介绍一下使用方法。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CU3ER的使用十分简单，保证3分钟内你就可以学会了。&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;下载&quot;&gt;下载&lt;/h3&gt;

&lt;p&gt;到我的Dbank下载：&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=NDEyODg2ODk=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;cu3er-v0.9.2.zip&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;或者到 http://www.progressivered.com/cu3er/download/ 猛击那个红色的大按钮，下载源文件。&lt;/p&gt;

&lt;h3 id=&quot;配置&quot;&gt;配置&lt;/h3&gt;

&lt;p&gt;配置上最核心就是config.xml这个文件了，接下来介绍一下大致标签的含义：&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;cu3er&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;slides&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;slide&amp;gt;&lt;/span&gt;
			&lt;span class=&quot;nt&quot;&gt;&amp;lt;url&amp;gt;&lt;/span&gt;images/slide_1.jpg&lt;span class=&quot;nt&quot;&gt;&amp;lt;/url&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;/slide&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;slide&amp;gt;&lt;/span&gt;
			&lt;span class=&quot;nt&quot;&gt;&amp;lt;url&amp;gt;&lt;/span&gt;images/slide_2.jpg&lt;span class=&quot;nt&quot;&gt;&amp;lt;/url&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;/slide&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;slide&amp;gt;&lt;/span&gt;
			&lt;span class=&quot;nt&quot;&gt;&amp;lt;url&amp;gt;&lt;/span&gt;images/slide_3.jpg&lt;span class=&quot;nt&quot;&gt;&amp;lt;/url&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;/slide&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/slides&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/cu3er&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;很简单，每一张图片都是包含在标签之中的，你可以把图片地址修改为你要的图片。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;给幻灯片的每张图加上链接：&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;只需要在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;url&amp;gt;&amp;lt;/url&amp;gt;&lt;/code&gt;下加上&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;link&amp;gt;&amp;lt;/link&amp;gt;&lt;/code&gt;，例如&lt;link /&gt;http://yourtion.com&amp;lt;/link&amp;gt;。&lt;/p&gt;

&lt;p&gt;需要注意的是，下载下来直接改，然后直接运行demo是无效的，必须要上传到服务器或在本地的站点上运行才可以。还有，默认的打开方式是新窗口打开，可以通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;link target=”_blank&quot;&amp;gt;&lt;/code&gt;来控制打开方式。&lt;/p&gt;

&lt;p&gt;加入标题和描述：&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;description&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;link&amp;gt;&amp;lt;/link&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;heading&amp;gt;&amp;lt;/heading&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;paragraph&amp;gt;&amp;lt;/paragraph&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/description&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;说明一下，heading就是标题，paragraph就是描述。还有&lt;link /&gt;就是标题的链接了。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;修改好图片之后，就是“前进，后退“按钮了&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;这些配置全部包含在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;settings&amp;gt;&lt;/code&gt;标签以内的：&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;settings&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;prev_button&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;defaults&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;round_corners=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;5,5,5,5&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;tweenOver&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;tint=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0xFFFFFF&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;scaleX=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;1.1&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;scaleY=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;1.1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;tweenOut&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;tint=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0x000000&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/prev_button&amp;gt;&lt;/span&gt;

	&lt;span class=&quot;nt&quot;&gt;&amp;lt;prev_symbol&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;tweenOver&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;tint=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0x000000&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/prev_symbol&amp;gt;&lt;/span&gt;

	&lt;span class=&quot;nt&quot;&gt;&amp;lt;next_button&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;defaults&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;round_corners=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;5,5,5,5&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;tweenOver&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;tint=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0xFFFFFF&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;scaleX=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;1.1&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;scaleY=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;1.1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;tweenOut&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;tint=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0x000000&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/next_button&amp;gt;&lt;/span&gt;

	&lt;span class=&quot;nt&quot;&gt;&amp;lt;next_symbol&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;nt&quot;&gt;&amp;lt;tweenOver&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;tint=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0x000000&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/next_symbol&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/settings&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;prev_button&amp;gt;&lt;/code&gt;代表后退按钮， &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;prev_symbol&amp;gt;&lt;/code&gt;代表后退按钮的“箭头”。前进按钮与箭头同上。 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;tweenOver tint=&quot;0xFFFFFF&quot; scaleX=&quot;1.1&quot; scaleY=&quot;1.1&quot;/&amp;gt;&lt;/code&gt;是指当鼠标移上（&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mouseover&lt;/code&gt;）前进后退按钮时，按钮样式变大1.1倍，并变为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ffffff&lt;/code&gt;这个颜色。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;幻灯片自动播放&lt;/strong&gt;，需要在里加入以下代码：&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;auto_play&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;defaults&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;symbol=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;circular&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;time=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;tweenIn&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;x=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;500&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;y=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;50&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;35&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;35&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;tint=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0xFFFFFF&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/auto_play&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;更多的功能和详细的解析可以看官方的文档：&lt;a href=&quot;http://www.progressivered.com/cu3er/docs/&quot;&gt;http://www.progressivered.com/cu3er/docs/&lt;/a&gt;。&lt;/p&gt;
</content>
                 <tag>特效</tag>  <tag>插件</tag> 
                 <tag>HTML</tag> 
                <pubTime>2010-07-17T15:27:51+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/php-development-tool-phpdesigner.html</loc>
        <lastmod>2010-07-16T21:57:37+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>介绍个PHP开发利器-phpDesigner</title>
                <content>
&lt;p&gt;之前用过Eclipse，NetBean还有其他的很多PHP开发环境～像Eclispse和Nenbean都是需要JDK环境·运行起来感觉就挺慢，想Zend的话我又嫌它太庞大～而Notepad++我又嫌他功能不够，特别是调试的方面～今天找到了phpDesigner就符合我的胃口，不敢独享！&lt;/p&gt;

&lt;p&gt;最近又刚还在研究CI框架！发现他的注释提示功能很有用～所以CI开发也是利器啊！&lt;/p&gt;

&lt;p&gt;他占用的资源小～在我的老爷笔记本（P3-866）上面都不是很卡，加上他对类的提醒注释等等调用很快，还可以加载PHP手册查找函数等等 ···&lt;/p&gt;

&lt;p&gt;它不仅仅是适用于PHP编程，也可以用于HTML，CSS和JavaScript的开发。PHP Designer设计最主要的目的就是加快你的编程速度，让你更轻松。然而，也正是这个原因，它更倾向于初学者。&lt;/p&gt;

&lt;p&gt;也许PHP Designer最主要的优点，就在于它的智能语法标识，让你第一时间发现错误，而不是到了最后抓头摸脑。这个功能也不仅仅是应用于PHP，对于其他语言也很适用。当然，PHP Designer也附带了自己的编译器，让你可以检测脚本错误，并给出修改方案，在大部分情况下都适用。&lt;/p&gt;

&lt;p&gt;如果你正在寻找一款美观的PHP编辑器，而且必须同时支持其他多种语言的话，那么PHP Designer也许可以让你的生活变得更简单。&lt;/p&gt;

&lt;p&gt;说得再多再好也没用～还是自己下载去试试吧～&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=NDExMDM3MzM=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;phpdesigner_7_2_1_setup.rar&lt;/a&gt;&lt;/p&gt;

</content>
                 <tag>CodeIgniter</tag>  <tag>PHP</tag> 
                 <tag>PHP</tag> 
                <pubTime>2010-07-16T21:57:37+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/supesite6-login-problems-solution.html</loc>
        <lastmod>2010-07-14T13:44:55+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>解决SupeSite6管理员登陆出现安全问答的问题</title>
                <content>
&lt;p&gt;最近在做一个SuperSite和UC的站点，不知什么时候开始，登陆SupeSite要二次验证，输入安全验证答案，可是用户本身并没有设置这个问题，就是在Ucenter里面去掉问答还是会提示。在网络中翻了半天，总算找到了一个解决办法&lt;/p&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bath.login.php&lt;/code&gt;中&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SCONFIG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'noseccode'&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;nb&quot;&gt;empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SCONFIG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'ucmode'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$member&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'secques'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这个东西是不是错了呀？&lt;/p&gt;

&lt;p&gt;我的改成：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SCONFIG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'noseccode'&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;nb&quot;&gt;empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SCONFIG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'ucmode'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$member&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'secques'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;不再提示我二次提问 / 安全提问了~~~~目前就这样解决这个问题，不知道还有没有更好的方法。&lt;/p&gt;
</content>
                 <tag>解决问题</tag> 
                 <tag>康盛</tag> 
                <pubTime>2010-07-14T13:44:55+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/ubuntu-server-terminal-gui.html</loc>
        <lastmod>2010-07-13T15:22:46+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Ubuntu Server：从终端走到界面</title>
                <content>
&lt;p&gt;总觉得Ubuntu Server作的有点不尽人意,相比RHEL5,连个图形界面都没有,还是我自己装的,相当郁闷,由于终端模式下不能识别无线网络(这个可以理解,没有哪个服务器还用无线网络的),我只能插有线,下面是从终端控制台走向图形化界面的过程。&lt;/p&gt;

&lt;p&gt;1、连接网络，你一定要确保网络通畅，如果你和我一样使用Wireless，那先找根网线插上&lt;/p&gt;

&lt;p&gt;2、安装xinit:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;xinit
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;如果你此时重起，你就会大显你能够进入一个图形化界面了，只是除了鼠标指针，什么也没有&lt;/p&gt;

&lt;p&gt;3、安装环境管理器 如果你喜欢 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GNOME&lt;/code&gt;，使用&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;gdm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;KDE&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Xface&lt;/code&gt;用户分别改为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;KDM&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;XDM&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;4、安装桌面环境&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;Ubuntu-desktop
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;或者&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kubuntu-desktop&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xubuntu-desktop&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;如果你只想装界面的核心环境，或者网速比较曼的话，可以&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;gnome-core 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;或者 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kde-core&lt;/code&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xface4&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;5、如果你装的是CORE的，那么你还需要做以下的工作&lt;/p&gt;

&lt;p&gt;1、安装新立得软件包管理器&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;gsynaptic
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;2、安装无线上网模块（如果需要）&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;network-manager&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;3、安装中文支持（能够显示中文）&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;language-support-zh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;4、从新立得软件包管理器中选择中文输入法支持和中文界面支持&lt;/p&gt;

&lt;p&gt;5、使用新立得软件包管理器安装其他你想要的软件&lt;/p&gt;
</content>
                 <tag>Linux</tag> 
                 <tag>电脑技巧</tag> 
                <pubTime>2010-07-13T15:22:46+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/made-directly-to-wordpress-page-link.html</loc>
        <lastmod>2010-07-06T10:09:17+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>把WordPress页面直接做成链接</title>
                <content>
&lt;p&gt;来自：http://www.ifunkey.com/1825.html&lt;/p&gt;

&lt;p&gt;有时候我们需要在WordPress首页添加BBS，留言板，微博之类的链接，当然，这些我们可以在友链里实现，也可以在小工具中的“文本”写入HTML代码来实现，但如果想把页面的链接直接做成链接，指向BBS，留言板就需要进行下面的操作，之后我们就可以实现点击页面链接直接转向我们设定的网址，而不是站内的某个页面，很方便的说～&lt;/p&gt;

&lt;p&gt;两个方法：&lt;/p&gt;

&lt;p&gt;第一，创建一个命名为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Redirect.php&lt;/code&gt;的文件，拷贝内容如下：（如果出现错误，请把代码的标点换成英文输入法下的标点）&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;/*
Template Name: Redirect
*/&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;have_posts&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;nf&quot;&gt;the_post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
	
	&lt;span class=&quot;nv&quot;&gt;$pattern&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;preg_match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pattern&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_the_excerpt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$matches&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$matches&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;nb&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Location: '&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$matches&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&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;k&quot;&gt;else&lt;/span&gt; 
		&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Enter a URL into your page body text.'&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;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后把这个文件上传到Wordpress中所使用的主题的根目录下（比如/wp-content/themes/主题目录）。&lt;/p&gt;

&lt;p&gt;接下来，按照正常方式创建一个页面，并在创建页面底部的”页面模板”选择Redirect。在页面中，除了你的链接，其它什么内容都不要填。然后发布页面即可。&lt;/p&gt;

&lt;p&gt;第二，创建一个名为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;link_to.php&lt;/code&gt;的文件，内容如下：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php
/*
Template Name: link to
*/
?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;要跳转的地址&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;link_to.php&lt;/code&gt;上传至所用主题的目录下，比如用的是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;inove&lt;/code&gt;主题，就上传至&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/wp-content/themes/inove&lt;/code&gt;下面，&lt;/p&gt;

&lt;p&gt;然后在后台创建一个页面，页面模板选择“link_to”（上传那个文件后就可以出现“&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;link to&lt;/code&gt;”选项），&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;location=“你要跳转的地址”&lt;/code&gt;，这样，点击页面就可以跳转到你希望的网址了。&lt;/p&gt;

&lt;p&gt;而在日志标题上实现这样的效果，我们在创建一篇文章之后，添加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;!–more–&amp;gt;&lt;/code&gt;标签，紧跟其后添加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;script&amp;gt;location=“要跳转的地址”;&amp;lt;/script&amp;gt;&lt;/code&gt;这段代码即可实现点击日志标题实现跳转的效果。&lt;/p&gt;
</content>
                 <tag>WordPress</tag>  <tag>PHP</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-07-06T10:09:17+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/use-url-redirects-low-pr.html</loc>
        <lastmod>2010-07-05T11:56:36+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>运用网址重定向，减少低PR站点对自己站点的影响</title>
                <content>
&lt;p&gt;来自：http://www.ifunkey.com/1898.html&lt;/p&gt;

&lt;p&gt;我们知道谷歌有一套独有的PR系统来判定一个站点的优劣与排名（WordPress是很适合Google的程序，相对其他的程序，PR值提升的略快一点），虽然不一定准确，但经过众多SEOER的研究发现当我们发表的文章中含有一个指向低PR值网站的链接的时候，对我们自己站点的PR还是有影响的。&lt;/p&gt;

&lt;p&gt;我们可以用重定向来解决这个问题，这样可以让你文章中的外链不会影响到自己的站点在搜索引擎中的权重。&lt;/p&gt;

&lt;p&gt;首先创建一个文本文档，保存为···，当然，你可以用你喜欢的文件名来替换&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;re_link&lt;/code&gt;，在这&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;re_link.php&lt;/code&gt;中拷贝下面的内容进去&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
	&lt;span class=&quot;c1&quot;&gt;// Change to the URL you want to redirect to&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$R_URL&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_GET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'url'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$R_URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;”&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Location&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$R_URL&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;”&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;保存后上传到你的站点根目录中，这样当我们在建立一个指向比如 http://www.oxoxox.com 这个链接的时候这样写 http://www.yoursite.com/redirect_url.php?url=http://www.oxoxox.com 就万无一失了。&lt;/p&gt;

&lt;p&gt;如果打打开链接后，看到一个关于header的warning，检查两个地方来搞定这个问题：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;看看你的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;re_link.php&lt;/code&gt;文件的php起止符(也就是)前后是否有空格和空行。如果有，删除它们。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;打开主机根目录下的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php.ini&lt;/code&gt;文件，确保: “&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;output_buffering = on&lt;/code&gt;” 或者 “&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;output_buffering = n&lt;/code&gt;” n为4096或其他接近的数字。&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;发现如果后面要转向的地址也是带有?的地址，会出现错误，所以，避免该死的问号&lt;/p&gt;
</content>
                 <tag>SEO</tag>  <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-07-05T11:56:36+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/wordpress-message-board-reverse.html</loc>
        <lastmod>2010-07-04T11:04:02+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress自制留言板倒序分页问题</title>
                <content>
&lt;p&gt;之前看教程自己制作了留言板&lt;a href=&quot;/create-wordpress-gestbook-no-plugin.html&quot;&gt;《无插件创建WordPress留言板》&lt;/a&gt;~但是倒序显示的问题一直不行~今天重新研究了一回~终于解决了~还搞定了分页问题~&lt;/p&gt;

&lt;p&gt;给大家分享一下~希望对你有帮助~&lt;/p&gt;

&lt;p&gt;网上流传的方法是找到guestcomments.php里面的&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;?php foreach ($comments as $comment) : ?&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;替换成：&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;?php foreach (array_reverse($comments) as $comment) : ?&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;实现留言板留言倒序显示。&lt;/p&gt;

&lt;p&gt;但是我替换后并没有改变~研究发现那一段是针对WP2.6以前的版本~WordPress2.7开始支持的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp_list_comments&lt;/code&gt;函数，我用的是3.0啊~~晕死~&lt;/p&gt;

&lt;p&gt;从&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp_list_comments&lt;/code&gt;函数入手开始查找，于是找到模板标签&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp_list_comments()&lt;/code&gt; 里面详细讲解了这个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp_list_comments&lt;/code&gt;函数包含的各类定义:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; 
&lt;span class=&quot;nv&quot;&gt;$args&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'walker'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'max_depth'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'style'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'ul'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'callback'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'end-callback'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'type'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'all'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'page'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'per_page'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'avatar_size'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'reverse_top_level'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'reverse_children'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; 
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;发现，里面是有个参数reverse_top_level来选择是否倒序的，如果你指定了这个参数的值，那么就是你所指定的值优先。那么，我们就可以传参让它倒序了，而因为我们是自己制作的一个模版，所以，又不会影响到其他的文章页评论！&lt;/p&gt;

&lt;p&gt;所以把&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guestcomments.php&lt;/code&gt;里的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;?php wp_list_comments(); ?&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;替换成&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;wp_list_comments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'reverse_top_level=1&amp;amp;type=comment&amp;amp;callback=mytheme_comment'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;就解决了倒序问题·····然后是分页~事实上也是有函数的~&lt;/p&gt;

&lt;p&gt;只需要将原来的&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; 
	&lt;span class=&quot;nf&quot;&gt;wp_list_comments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'type=comment&amp;amp;callback=mytheme_comment'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;之后加上&amp;amp;per_page=显示数目,&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; 
	&lt;span class=&quot;nf&quot;&gt;wp_list_comments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'type=comment&amp;amp;callback=mytheme_comment&amp;amp;per_page=10'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;就可以控制页面显示评论分页数目了 。&lt;/p&gt;

&lt;p&gt;最后 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;?php wp_list_comments(); ?&amp;gt;&lt;/code&gt;就变成&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; 
	&lt;span class=&quot;nf&quot;&gt;wp_list_comments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'reverse_top_level=1&amp;amp;type=comment&amp;amp;callback=mytheme_comment&amp;amp;per_page=10'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这就是我留言板的效果了·&lt;/p&gt;
</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-07-04T11:04:02+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/puppy-small-but-lean-linux.html</loc>
        <lastmod>2010-07-02T23:37:21+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Puppy~小巧却精悍的Linux</title>
                <content>
&lt;p&gt;最近在弄一部很老的笔记本~&lt;/p&gt;

&lt;p&gt;P3-866的U~安装精简的2003还是有点卡~所以想找个简单的Linux来玩玩~结果找到Puppy Linux~还不错~推荐一下~&lt;/p&gt;

&lt;p&gt;先介绍一下Puppy Linux吧！&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;PuppyLinux是个相当小巧的Linux发行版，虽然它只有几MB的大小，但它自带了大量的描扫仪、打印机、数码相机的驱动以及音乐录制/编辑/转换软件。在今年5月发布的PuppyLinux4.00得到了大家的广泛认可后，PuppyLinux的下一个发行版:PuppyLinux4.1和我们也越来越近了，现在PuppyLinux4.1Beta已经发布了。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;PuppyLinux4.1采用Linux2.6.21.7内核，在多数的硬件上都能够很好地运行，也就保证了PuppyLinux安装在U盘上后能在各种不同的硬件上运行。当然在古董级的硬件上也能够很好的运行,如果你有一台很古董级的本本那你就试试PuppyLinux吧。现在的U盘已经卖到了“白菜价”，如果你有一个闲置的U盘也来体验一下PuppyLinux吧，只要有256MB就足够让它运行了。走出“窗外”，感受一下“窗户”外的新鲜。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;官方网：&lt;a href=&quot;http://www.puppylinux.com/&quot;&gt;http://www.puppylinux.com/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;我用的是汉化加Winne版本~&lt;a href=&quot;http://puppy.cnbits.com/software/小芭比431之wine集成版&quot;&gt;http://puppy.cnbits.com/software/小芭比431之wine集成版/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;并且使用&lt;a href=&quot;http://puppy.cnbits.com/software/pup2usb&quot;&gt;pup2usb: Puppy Linux硬盘／U盘安装程序&lt;/a&gt;在2003像Ubuntu那样安装~&lt;/p&gt;

&lt;p&gt;使用效果很不错~在那么老的机上也不卡~功能很强~100M的Linux持续研究中~&lt;/p&gt;
</content>
                 <tag>Linux</tag> 
                 <tag>电脑技巧</tag> 
                <pubTime>2010-07-02T23:37:21+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/pagecookery-enable-gzip.html</loc>
        <lastmod>2010-06-28T15:14:03+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>PageCookery启用GZip压缩的方法</title>
                <content>
&lt;p&gt;总是觉得我的PageCookery微博：http://t.yourtion.com不是很快~想到WordPress可以通过启用GZip压缩加速~于是研究一下GZip的压缩~终于成功了和大家分享~&lt;/p&gt;

&lt;p&gt;首先介绍一下GZip：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;GZIP最早由Jean-loup Gailly和Mark Adler创建，用于UNIX系统的文件压缩。我们在Linux中经常会用到后缀为.gz的文件，它们就是GZIP格式的。&lt;/p&gt;

  &lt;p&gt;现今已经成为Internet 上使用非常普遍的一种数据压缩格式，或者说一种文件格式。HTTP协议上的GZIP编码是一种用来改进WEB应用程序性能的技术。&lt;/p&gt;

  &lt;p&gt;大流量的WEB站点常常使用GZIP压缩技术来让用户感受更快的速度。这一般是指WWW服务器中安装的一个功能,当有人来访问这个服务器中的网站时,服务器中的这个功能就将网页内容压缩后传输到来访的电脑浏览器中显示出来.一般对纯文本内容可压缩到原大小的40％.这样传输就快了,效果就是你点击网址后会很快的显示出来.当然这也会增加服务器的负载.&lt;/p&gt;

  &lt;p&gt;一般服务器中都安装有这个功能模块的.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;一般启用GZip的方法有在服务器上通过更改PHP.ini还有些.htaccess文件~但是我的服务器都不行~于是另辟他径~找了关于PHP的GZip函数~最后成功~&lt;/p&gt;

&lt;p&gt;首先在/lib/class_template.php中找到&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$template&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;lt;?php $current = \''&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;current&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'\'; ?&amp;gt;'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetHTML&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这一段~改成：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$template&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;lt;?php $current = \''&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;current&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'\'; 
if(Extension_Loaded(\'zlib\')) Ob_Start(\'ob_gzhandler\'); 
	Header(&quot;Content-type:text/html&quot;);?&amp;gt;'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetHTML&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后在/template/footer.html最下方添加：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?PHP&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;Extension_Loaded&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'zlib'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Ob_End_Flush&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后保存上传后去站长工具那检测就能看到：&lt;/p&gt;

&lt;p&gt;网址 &lt;a href=&quot;http://tool.chinaz.com/Redirect.aspx?url=http://t.yourtion.com&quot;&gt;http://t.yourtion.com&lt;/a&gt; 检测结果如下:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;是否压缩 是&lt;/li&gt;
  &lt;li&gt;压缩类型 gzip&lt;/li&gt;
  &lt;li&gt;原始文件大小 36060 字节&lt;/li&gt;
  &lt;li&gt;压缩后文件大小 5892 字节&lt;/li&gt;
  &lt;li&gt;压缩率（估计值） 83.66%&lt;/li&gt;
&lt;/ul&gt;
</content>
                 <tag>PageCookery</tag>  <tag>PHP</tag> 
                 <tag>PageCookery</tag> 
                <pubTime>2010-06-28T15:14:03+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/call-pagecookery-on-wordpress.html</loc>
        <lastmod>2010-06-27T11:00:40+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress调用PageCookery的方法</title>
                <content>
&lt;p&gt;刚刚架设了PageCookery的微博，http://t.yourtion.com&lt;/p&gt;

&lt;p&gt;然后就研究怎么跟现在的WordPress结合一下~分享一下如何在wordpress中调用PageCookery的内容。&lt;/p&gt;

&lt;p&gt;将下面的代码插入到你想显示PageCookery微博的地方。&lt;/p&gt;

&lt;p&gt;代码如下：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;sidebarbox&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;target=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;_blank&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://t.yourtion.com/&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;h2&amp;gt;&lt;/span&gt;我的微博~http://t.yourtion.com~&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;require_once&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ABSPATH&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;WPINC&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/class-feed.php'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$feed&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;SimplePie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$feed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set_feed_url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'http://t.yourtion.com/rss.xml'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$feed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set_cache_location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'DOCUMENT_ROOT'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/wp-content/cache'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$feed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set_file_class&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'WP_SimplePie_File'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$feed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set_cache_duration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$feed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$feed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;handle_content_type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$items&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$feed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_items&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$items&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$item&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;k&quot;&gt;echo&lt;/span&gt;  &lt;span class=&quot;s1&quot;&gt;'&amp;lt;ul style=&quot;podding:20px;&quot;&amp;gt;&amp;lt;li&amp;gt;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_description&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;a href=&quot;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;h3&amp;gt;回复他&amp;lt;/h3&amp;gt;&amp;lt;/a&amp;gt;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;'&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;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;如上所示，我们主要应用WordPress的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fetch_feed&lt;/code&gt;函数来读取微博客RSS的内容，只需要将该代码插入到你的wordpress模板中即可。&lt;/p&gt;

&lt;p&gt;其中，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set_cache_duration(3700)&lt;/code&gt;; 的意思是3700秒读取一次rss，看是否有更新；&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;get_items(0,5)&lt;/code&gt;的目的是控制显示多少条微博。&lt;/p&gt;

&lt;p&gt;echo后面跟的是希望显示的内容，如果希望以列表模式显示，并列出微博客发布的时间，可以将源代码对应echo的部分修改为：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt;  &lt;span class=&quot;s1&quot;&gt;'&amp;lt;li&amp;gt;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_description&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;br /&amp;gt;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;a href=&quot;http://t.yourtion.com/&quot;&amp;gt;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Y-m-j G:i'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;/a&amp;gt;'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&amp;lt;/li&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;完成如上操作后，可以调整样式表，改为自己喜欢的排版模式。&lt;/p&gt;

&lt;p&gt;如果对所显示的内容不满意，可以到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PageCookery&lt;/code&gt;的对应目录中修改&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cron/rss_update.php&lt;/code&gt;文件，来变更RSS显示的内容。&lt;/p&gt;

&lt;p&gt;关于出现：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Warning: ./cache/791730c068090a99527392a2d75c1392.spc is not writeable in /home/jcom/public_html/yourtion/wp-includes/class-simplepie.php on line 1780
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;修改&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/wp-content/cache&lt;/code&gt;为有权限写入的文件夹路径即可~&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$feed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set_cache_location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'DOCUMENT_ROOT'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/wp-content/cache'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>PageCookery</tag>  <tag>WordPress</tag> 
                 <tag>PageCookery</tag> 
                <pubTime>2010-06-27T11:00:40+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/supesite-mysql-query-error-solution.html</loc>
        <lastmod>2010-06-25T01:12:25+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>SupeSite info: MySQL Query Error解决方法</title>
                <content>
&lt;p&gt;在安装supesite6.0/x-space4.0后登陆个人空间时，出现这样的错误:&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;SupeSite&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MySQL&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Query&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Error&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Guest&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;Time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2010&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&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;mi&quot;&gt;21&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pm&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Script&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;xspace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;php&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;SQL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;author&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;views&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;replies&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dateline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lastpost&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`discuz`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`[Table]mythreads`&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`discuz`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`[Table]threads`&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'1'&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tid&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;displayorder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;author&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tid&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DESC&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;LIMIT&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;mi&quot;&gt;10&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;k&quot;&gt;Table&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'discuz.[Table]mythreads'&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;doesn&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'t exist
Errno.: 1146
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这是表缺失的关系，可以通过在phpMyadmin执行以下语句：&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TABLE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;EXISTS&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`cdb_myposts`&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;`uid`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;mediumint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;`tid`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;mediumint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;`pid`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&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;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;`position`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;smallint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;`dateline`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&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;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;`special`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;tinyint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;nb&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;PRIMARY&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;KEY&lt;/span&gt;  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`uid`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`tid`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;KEY&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`tid`&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`tid`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`dateline`&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;ENGINE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MyISAM&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CHARSET&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TABLE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;EXISTS&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`cdb_mythreads`&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;`uid`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;mediumint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;`tid`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;mediumint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;`special`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;tinyint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;nb&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;`dateline`&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&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;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;PRIMARY&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;KEY&lt;/span&gt;  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`uid`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`tid`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;KEY&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`tid`&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`tid`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`dateline`&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;ENGINE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MyISAM&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CHARSET&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;新建表就行。&lt;/p&gt;

&lt;p&gt;注意：如果是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gbk&lt;/code&gt;的把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;utf8&lt;/code&gt;替换成&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gbk&lt;/code&gt;，还有就是cdb是你论坛数据库的前缀~&lt;/p&gt;

&lt;p&gt;如果有改论坛数据库前缀的也要注意更改。&lt;/p&gt;
</content>
                 <tag>MySQL</tag> 
                 <tag>康盛</tag> 
                <pubTime>2010-06-25T01:12:25+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/html-5-link-prefetching.html</loc>
        <lastmod>2010-06-24T11:27:41+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>为网站提速—HTML 5链接预取功能</title>
                <content>
&lt;p&gt;HTML 5的链接预取功能(link prefetching)是一个埋在沙里的宝石，至今还很少人知道它的价值。你可能已经知道了那古老而又闻名的图片预加载功能，链接预取功能就是将此概念由图片扩展到了网页内容（不需要任何AJAX代码）。&lt;/p&gt;

&lt;p&gt;它是这样工作的，在页面上添加一个像这样的链接：&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;link rel=&quot;next&quot; href=&quot;page2.html&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;这样，当你的机器空闲时，浏览器就会自动的在后台把page2.html下载下来。 当用户最终点击了page2.html的链接时，浏览器会从缓存里把这个页面取出来，所以这个页面的加载速度会出乎意料的快。&lt;/p&gt;

&lt;p&gt;目前只有火狐浏览器支持这个功能。但是因为火狐目前是世界上拥有第二大用户群的浏览器，所以只要你在HTML页面了加上这样的一句代码，仍有相当大的一部分访问者能体验到这十分明显的页面加载速度的提高。你可以在许多情况下可以使用链接预取功能：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;当你有一篇篇幅很长的文章，或在线教程，或图册等，需要分成多页显示时。&lt;/li&gt;
  &lt;li&gt;在你的网站首页预加载那些用户最可能访问的下一页。(可能是一个商品网站上“重点推荐”商品页面，或博客网站上最近的一篇博客)&lt;/li&gt;
  &lt;li&gt;搜索查询页面预加载搜索出来的前几条。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;对于静态的内容你还可以使用rel标记实现预取功能：&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;link rel=&quot;prefetch&quot; href=&quot;/images/big.jpeg&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;这里还有其它一些有趣的事需要注意：&lt;/p&gt;

&lt;p&gt;链接预取功能不久将会在Opera, Chrome 和 Safari 浏览器里实现，但对于Internet Explorer，你估计要等到2020年。&lt;/p&gt;

&lt;p&gt;如果这种功能被广泛的使用，它会影响你的网站日志和访问统计。请考虑这样的情况，你的一个页面预存取了好几个页面，可用户实际上没有访问到这几个页面。 你的服务器（或统计工具）并不知道这两者之间的区别。&lt;/p&gt;

&lt;p&gt;为了分清这个，Firefox会在HTTP头信息里发送X-moz: prefetch信息，但你需要在服务器端有什么东西能识别这种信息。&lt;/p&gt;

&lt;p&gt;原文地址：http://www.aqee.net/2010/06/08/how-html-5-link-prefetching-can-make-your-site-load-faster-with-one-line-of-code/&lt;/p&gt;
</content>
                 <tag>HTML</tag> 
                 <tag>HTML</tag> 
                <pubTime>2010-06-24T11:27:41+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/pagecookery-microblog-on-line.html</loc>
        <lastmod>2010-06-23T17:59:00+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>我的PageCookery微博上线啦~</title>
                <content>
&lt;p&gt;经过一整天的努力~我的PageCookery微博 http://t.yourtion.com 正式上线啦~&lt;/p&gt;

&lt;p&gt;大家多多支持~它也会同时同步到新浪微博和嘀咕哦·~~~&lt;/p&gt;

&lt;p&gt;介绍一下PageCookery先~然后是安装教程~http://pagecookery.com/&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;PageCookery 是一款国产的微博客，采用 Php+Mysql 架构而成，是国内首款公开发行的单用户版微薄程序，目前已支持 digu.com 双向同步，支持发送博文至 Wordpress。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/06/PageCookery.png&quot;&gt;&lt;img src=&quot;/images/2010/06/PageCookery.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;安装教程：&lt;/p&gt;

&lt;p&gt;一、上传安装文件。&lt;/p&gt;

&lt;p&gt;和其他博客程序一样，到官网下载PageCookery的最新安装程序，通过FTP上传到主机空间，当然还需要设置访问该微博的二级域名或者是二级目录，至于用哪个可根据自己情况来选择；&lt;/p&gt;

&lt;p&gt;二、修改&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.php&lt;/code&gt;配置文件。&lt;/p&gt;

&lt;p&gt;根据文件中的注释说明填写相关内容，当然前提是你已经创建一个数据库；&lt;/p&gt;

&lt;p&gt;微博的Title也是在这里设置，最后保存。需要注意的是必须将该文件保存为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;utf-8&lt;/code&gt;格式；&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;############ 数据库配置 ############&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 数据库主机&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DATABASE_HOST&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'localhost'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 数据库用户名&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DATABASE_USER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'****'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 数据库密码&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DATABASE_PSSWORD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'***'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 数据库名称&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DATABASE_DB_NAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'****'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;############ 站点配置 ############&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 网站名称&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;SITE_NAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Yourtion Say'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 微博访问路径, 请以 / 结尾&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;BASE_URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'http://t.yourtion.com/'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;############  下面的内容无需修改 ############&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;COOKERY_FRAMEWORK_DIR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'./'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DEBUG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;FALSE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;COOKIE_PREFIX&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;strtoupper&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;md5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'HTTP_HOST'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])),&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;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'_'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;三、设置目录和文件权限。&lt;/p&gt;

&lt;p&gt;设置cache目录、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rss.xml&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;music.json&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;photos.json&lt;/code&gt;文件为属性权限为 777；&lt;/p&gt;

&lt;p&gt;四、导入数据表。&lt;/p&gt;

&lt;p&gt;登录到已经创建的数据库中选择&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;导入（import）&lt;/code&gt;，浏览&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sql/install/database.sql&lt;/code&gt;，设置文件字符集为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;utf-8&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;执行成功后，将有7张表导入到数据库中；&lt;/p&gt;

&lt;p&gt;五、安装。&lt;/p&gt;

&lt;p&gt;准备就绪，接下来就访问你设置的地址进行安装吧。输入一个用户名和密码登录即可进入系统，还等什么，赶快来一条试试吧。&lt;/p&gt;
</content>
                 <tag>PageCookery</tag> 
                 <tag>PageCookery</tag> 
                <pubTime>2010-06-23T17:59:00+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/css-learning-ten-shorthand-formulas.html</loc>
        <lastmod>2010-06-22T20:13:38+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>CSS学习中十条速记口诀</title>
                <content>
&lt;p&gt;如果在用CSS设计布局时遇到BUG，请认真阅读以下内容，非常容易记忆的，不知道哪位高人把CSS BUG编成了顺口溜了！看看好不好记住呢?&lt;/p&gt;

&lt;p&gt;一、IE边框若显若无，须注意，定是高度设置已忘记；&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;六、学布局须思路，路随布局原理自然直，轻松驾驭html，流水布局少hack，代码清爽，兼容好，友好引擎喜欢迎。&lt;/p&gt;

&lt;p&gt;七、所有标签皆有源，只是默认各不同，span是无极，无极生两仪—内联和块级，img较特殊，但也遵法理，其他只是改造各不同，一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*&lt;/code&gt;号全归原，层叠样式理须多练习，万物皆规律。&lt;/p&gt;

&lt;p&gt;八、图片链接排版须小心，图片链接文字链接若对齐，padding和vertical-align:middle要设定，虽差微细倒无妨。&lt;/p&gt;

&lt;p&gt;九、IE浮动双边距，请用display：inline拘。&lt;/p&gt;

&lt;p&gt;十、列表横向排版，列表代码须紧靠，空隙自消须铭记。&lt;/p&gt;
</content>
                 <tag>CSS</tag> 
                 <tag>HTML</tag> 
                <pubTime>2010-06-22T20:13:38+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/brush-supercid-dopod-565.html</loc>
        <lastmod>2010-06-21T18:56:16+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>多普达565解锁刷机SuperCID教程及相关软件下载</title>
                <content>
&lt;p&gt;最近838泡了汤~没办法只有入手多普达565一台过度一下~~随便献上刷机的教程和软件~因为很多软件的下载链接都失效了·找了很久才收集完全~包括解锁、免联网刷SuperCID、还有刷机工具以及在用的一个WM5的ROM。很不错·希望对你有帮助~怎么也是一代强机啊··&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=MzQ3NDczMzc=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;01 Unlock.rar&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=MzQ3NDczMzc=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;02 SuperCID.rar&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=MzQ3NDczMzc=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;03 SPL064.rar&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=MzQ3NDczMzc=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;04 SPL0109 WM5.rar&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=MzQ3NDczMzc=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;04 SPL0109 WM6.rar&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=MzQ3NDczMzc=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;05 MTTY.rar&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=MzQ3NDczMzc=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;补丁.rar&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;以上文件的打包：&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=MzQ3NDc3OTc=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;565-Rom-Update-Tools-Typhoon.rar&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;WM5的ROM：&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=MzQ3NDc4ODk=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;565 WM5 long-0530ROM.rar&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/06/xn-home-ot0gh48w1lza.jpg&quot; alt=&quot;home键菜单.jpg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/06/ms_splash.jpg&quot; alt=&quot;ms_splash.JPG&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/06/xn-vrv802asa6806a.jpg&quot; alt=&quot;来电画面.jpg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/06/xn-1-dr6a67cwydotcsu1cix3f.jpg&quot; alt=&quot;原创修改主题1.jpg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;多普达 565 577W 595 586等 无需联网，dos环境，SuperCID手动修改教程&lt;/p&gt;

&lt;p&gt;最近SPV-Services的网站打不开，所以在刷机时不能联网改supercid了。这里转载个来自IOICN的在dos环境下不用联网改cid为supercid的方法。只需要一些dos的小操作就可以搞定了。&lt;/p&gt;

&lt;p&gt;注意：这个只是改supercid。相当于正式刷机教程的第二步，解锁需要先进行！&lt;/p&gt;

&lt;p&gt;1.首先要下载ActivePerl软件 &lt;a href=&quot;http://www.skycn.com/soft/1211.html&quot;&gt;http://www.skycn.com/soft/1211.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;下载以后安装然后把附件里面补丁程序解压缩以后复制到perl\bin目录下。
接下来开始正式操作！
（别忘记先给手机解锁，解锁软件补丁包内含。还有要手机和电脑同步！）&lt;/p&gt;

&lt;p&gt;2.点击开始-运行 然后输入CMD
接下来进入刚才安装的PERL的目录
进入X:\PERL\BIN（X是你安装的分区，默认安装到C盘）&lt;/p&gt;

&lt;p&gt;注：如果不熟悉cmd命令，请参考：&lt;/p&gt;

&lt;p&gt;假设ActivePerl安装到C盘，此时在cmd输入
C: 回车
再输入
cd PERL\BIN 回车
就可以进入文件夹了&lt;/p&gt;

&lt;p&gt;一次性输入&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ppm &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;Win32-API-0.41WJ.ppd
ppm &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;XdaDevelopers-NbfUtils.ppd
ppm &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;Crypt-DES.ppd
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（小技巧可以用复制然后点击CMD的窗口栏 点击鼠标右键选择粘贴-回车）&lt;/p&gt;

&lt;p&gt;3.安装完插件以后，开始修改SUPERCID
和刚才安装方法一样依次输入（还是在X:\PERL\BIN\目录下）
pdocread -n 1 0x000000 0x10000 -b 0x4000 bdk1-00-cid.nb
这一步是往手机上安装插件，这时候手机上会有提示，按”是”继续&lt;/p&gt;

&lt;p&gt;4.继续一次性输入&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;perl typhooncidedit.pl bdk1-00-cid.nb
perl typhooncidedit.pl &lt;span class=&quot;nt&quot;&gt;-w&lt;/span&gt; new_SuperCID.bin &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; 11111111 bdk1-00-cid.nb
perl typhooncidedit.pl new_SuperCID.bin
pdocwrite &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; 1 new_SuperCID.bin 0x000000 0x10000 &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; 0x4000
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;5.这一步运行完以后显示CopyFileToTFFS(new_SuperCID.bin:0, 0, 00010000)
那就成功了！！&lt;/p&gt;

&lt;p&gt;检测：然后可以用MTTY（附件有下载）来检测一下是否真的SUPERCID修改成功&lt;/p&gt;

&lt;p&gt;手机进入三色屏然后干掉同步软件（使用任务管理器关闭wcescomm.exe进程），USB连接手机以后运行MTTY。
在CMD〉下输入info 2&lt;/p&gt;

&lt;p&gt;会返回如下信息：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;GetDeviceInfo=0x00000002

Load Binary NORMAL partition: data from DiskOnChip to RAM
Start to read bianry partition.
Read binary partition successfully.
+ SD Controller init

- SD Controller init

+StorageInit

***** user area size = 0x1E980000 Bytes

Load Binary NORMAL partition: data from DiskOnChip to RAM
Start to read bianry partition.
Read binary partition successfully.
HTCSSuperCID ||' HTCE

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;请注意最后一行，出现红字HTCSSuperCID这个就说明修改supercid成功了。&lt;/p&gt;

&lt;p&gt;刷机教程！&lt;/p&gt;

&lt;p&gt;刷机前言：不用说也知道最好是先备份一下哦！&lt;/p&gt;

&lt;h3 id=&quot;1解锁&quot;&gt;1.解锁：&lt;/h3&gt;

&lt;p&gt;启动&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SDA_ApplicationUnlock&lt;/code&gt;软件后，直接按remove lock，然后重新启动手机，搞定。&lt;/p&gt;

&lt;h3 id=&quot;2改cid为supercid&quot;&gt;2.改cid为supercid：&lt;/h3&gt;

&lt;p&gt;启动supercid，该软件需要连接网络，出现页面后,点击页面左边”CID Tool (Alpha)”，电脑会传一个文件到手机,要求安装,直接点”是”，然后等待片刻，电脑软件界面出现一个”set CID＝11111111”按钮，点击它，搞定cid。&lt;/p&gt;

&lt;h3 id=&quot;3升级spl&quot;&gt;3.升级SPL：&lt;/h3&gt;

&lt;p&gt;检测SPL版本：按住拍照键，再按开机键1秒，就可以进入手机三色屏（更简单的进入三色屏的方法：手机关机，按住照相键，插上USB接口，等待片刻就进入了），往下数第二个颜色里，可看到SPL版本，如果是已经是1.01.0109，就直接刷机，如果是1.01.0109，就升级它。&lt;/p&gt;

&lt;p&gt;升级SPL：首先关掉电脑上的同步软件，把activesync也关掉（在同步图标上点击右键，选择”连接设置”，取消”允许USB连接”），接着让手机进入三色屏，连接电脑，电脑上启动”Patched_RUU”，把界面上能钩的地方钩上，点击”下一步”，直到看见”Update”按钮，点击它，等待几分钟，电脑和手机屏幕都升至100％，搞定。&lt;/p&gt;

&lt;p&gt;###4.刷机：&lt;/p&gt;

&lt;p&gt;这步同样要关掉电脑上的同步软件，重启手机进入三色屏，进入前会提示 NEED AN IU (0) ？当然按0，进入后检查一下SPL版本，应该是109了。打开刷机软件mtty，选择USB连接，点”OK”，进入界面后，按下回车，出现命令行，输入lE:\2005.bin ，命令中，l是小写L，后面的就是ROM的路径，就是ROM存在你电脑的什
么位置，再按回车键，我是把mtty和rom都拷到E盘根目录，方便刷机。然后就是等待3-4分钟，等完成后，根据提示重新启动手机，开机后就是WM5！&lt;/p&gt;
</content>
                
                 <tag>电脑技巧</tag> 
                <pubTime>2010-06-21T18:56:16+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/wordpress-replacement-301-redirect.html</loc>
        <lastmod>2010-06-16T14:01:31+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress 更换域名数据库操作以及301重定向设置</title>
                <content>
&lt;p&gt;从TK域名进军com了···介绍一下怎么做数据库的更新和301重定向&lt;/p&gt;

&lt;p&gt;修改数据库&lt;/p&gt;

&lt;p&gt;在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;phpMyAdmin&lt;/code&gt; 中选择新建的数据库，然后点击 “&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SQL&lt;/code&gt;”，并在输入以下代码：&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;UPDATE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wp_options&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;option_value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;option_value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'http://yourtion.tk'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'http://yourtion.com'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;option_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'home'&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;OR&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;option_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'siteurl'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;UPDATE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wp_posts&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;post_content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;post_content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'http://yourtion.tk'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'http://yourtion.com'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;UPDATE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wp_posts&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;guid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;guid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'http://yourtion.tk'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'http://yourtion.com'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;操作时注意把 yourtion.tk 改为你的旧域名，把 yourtion.com 改为你的新域名。
这步完成了之后，你访问新的域名时，就会看到和原来域名一模一样的 WordPress 博客了。&lt;/p&gt;

&lt;p&gt;以上步骤下来，其实就完成了一件事，那就是复制了一个一模一样的 WordPress 博客。在确保新博客一切链接正常之后，需要把旧域名重新定向到新域名的博客，使得别人访问你的旧域名时，就会转到你的新域名博客，其操作方法如下：&lt;/p&gt;

&lt;p&gt;301 永久重定向&lt;/p&gt;

&lt;p&gt;在原来域名的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt; 文件上添加以下代码：&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;RewriteEngine&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;on&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{HTTP_HOST}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;^yourtion.tk$&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;[OR]&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteCond&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%{HTTP_HOST}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;^www.yourtion.tk$&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteRule&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;^/?$&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;http\:\/\/yourtion\.com&quot;&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;[R=301,L]&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;RewriteRule&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;(.*)&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;http\:\/\/yourtion\.com\/$1&quot;&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;[R=301,L]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;如果你之前没有 .htaccess 文件，可以把以上代码复制粘贴到记事本上，并以 “ .htaccess” 作为文件名保存，然后上传到原来域名所对应的 WordPress 文件夹根目录。那么 yourtion.tk可以正常跳转到 yourtion.com&lt;/p&gt;

&lt;p&gt;到这里，整个域名的更换算是完成了，以后你就可以直接在新域名对应的 WordPress 上写博客了。&lt;/p&gt;

&lt;p&gt;最后你就去各大搜索引擎提交你的新网址还有记得更新SiteMap哦···&lt;/p&gt;
</content>
                 <tag>.htaccess</tag>  <tag>WordPress</tag>  <tag>域名</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-06-16T14:01:31+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/replace-domain-see-search-engines.html</loc>
        <lastmod>2010-06-12T11:38:38+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>从本博更换域名看各个搜索引擎收录~</title>
                <content>
&lt;p&gt;终于换上.com的米了··是找FunKey代购的雅虎优惠域名~18块首年~还是很不错的~&lt;/p&gt;

&lt;p&gt;六月10号晚上六点多购买成功~然后开始一系列的域名解析和绑定还有跳转的工作~大概八点的时候新域名Yourtion.com正式开始工作原来的Yourtion.tk也继续使用~但是使用301永久重定向指向新域名。&lt;/p&gt;

&lt;p&gt;因为在Google的网站管理员工具那里提交了sitemap和重定向~所以第二天就可以搜索到十五个结果~其他的搜索引擎还是没有动静~看来Google还是很NB的···&lt;/p&gt;

&lt;p&gt;原来的PR和Alexa排名就要重新积累了~截图纪念一下我的Yourtion.TK&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/06/01.jpg&quot;&gt;&lt;img src=&quot;/images/2010/06/01.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/06/02.jpg&quot;&gt;&lt;img src=&quot;/images/2010/06/02.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>域名</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2010-06-12T11:38:38+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/chuange-one-year-old-record.html</loc>
        <lastmod>2010-06-11T00:11:33+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>创E一周岁记…</title>
                <content>
&lt;p&gt;六月十一！一个平凡与不平凡的日子！创E生日了！不知不觉创E已经一周岁了！我们也光荣地退休了！创E这个孩子也就正式交到下一届班子手上了！&lt;/p&gt;

&lt;p&gt;看着他们开始做自己的活动，看着他们团队渐渐成形，看着他们在换届大会的表现，看着他们用三天做出一份八十五页的策划……我知道，他们已经完全有能力去延续创E这个“神话”！为我们继续哺育与教育创E这个孩儿…要知道，生娘不及养娘大！创E这个孩子的未来，掌握在一代又一代创E人的手上，只要你们用心去呵护他，我相信他会健康地成长下去……&lt;/p&gt;

&lt;p&gt;我们三剑客〔谁起的名字？〕从一开始建立创E的一帆风顺到阻力重重，就尤如母亲怀胎初期的轻松到后来即将出生的挣扎！怀胎四月的成立历程原来只是一个序幕，创E这个孩子终于呱呱落地了！当我们正式开始运行管理的时候，我们才发现一切不是那么简单，就如刚刚出生的孩子一样一切对我们来说都是新的，我们懂得的还是太少太少，我们不仅要哺育他让他生存下来，还要教会他如何去生活，第一次开讲座，第一次和别的社团合作搞活动，第一次自己独立做活动……创E这个孩儿渐渐从爬行到慢慢站起来，然后开始蹒跚学步！&lt;/p&gt;

&lt;p&gt;我们三剑客能为你们做的不多，孕育出创E这个孩儿，现在的他虽然表面上茁壮地成长着，但是我们都知道他已经开始营养失衡，你们最重要的是让他健康，否则他就可能会畸形发展甚至就此夭折，所以我们留下的可能就一烂摊子…所谓养儿一百岁，长忧九十九，随着他的成长，你们要做的还有很多，我们留给你们的经验有限，很多东西要你们发挥创E的精神，不断创新，不断精益求精，不用拘泥与我们的做法，唯一记住的一点，不要忘记三剑客当初创立的理念：“做一个不骗钱的社团！”一个孩子可以无才，但绝对不能无德，才德全尽谓之圣人，才德兼亡谓之愚人，德胜才谓之君子，才胜德谓之小人。所以宁为君子莫为小人！就如WAP说的正直，KING说的原则底线…这就是我们三剑客对创E这孩子的健康成长的唯一希望……一年的时间不长也不短，希望在创E成长的同时你们也学到东西，让你们的个人成长跟创E的发展一同进行……&lt;/p&gt;

&lt;p&gt;还有就是说说一个团队，或者我们没有办法招收到最强的人，但是我们可以建立一个最强的团队，就如现在的你们一样，或者每个人都有各自的长处与缺点，团队的好处就是让你们每个人都发挥自己的长处并且让缺点最小化。中国人现今最缺乏的就是团队协作精神，总是以为自己了不起，因为他们都没有真正领略到团队的强大，一个好的团队可以获得的是一加一大于二的力量，所以也希望你们可以继续发扬这种团队协作的精神，也着重地培养接下来一代又一代创E人这种团队协作的精神，放手让他们去做，相信他们的能力，就像我们当初信任你们一样，然后在背后默默地支持他们，让他们也可以充分磨合……&lt;/p&gt;

&lt;p&gt;一年了！好快阿！继续大学生活……&lt;/p&gt;

</content>
                
                 <tag>大学生活</tag> 
                <pubTime>2010-06-11T00:11:33+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/custom-wordpress-time-display-format.html</loc>
        <lastmod>2010-06-10T21:04:17+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress时间显示格式自定义</title>
                <content>
&lt;p&gt;在帮King改他的私人情侣博客模版~找了一些找了，总算是把时间显示为想要的格式了。于是将获得的一些信息记下，供备忘，亦供朋友们参考。&lt;/p&gt;

&lt;p&gt;WordPress 通过一系列的时间日期函数控制时间日期的输出，下面介绍几个常用的函数：&lt;/p&gt;

&lt;p&gt;1、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;the_date_xml()&lt;/code&gt; 函数&lt;/p&gt;

&lt;p&gt;调用格式：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;the_date_xml&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;输出格式：YYYY-MM-DD&lt;/p&gt;

&lt;p&gt;如：2005-05-14&lt;/p&gt;

&lt;p&gt;2、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;the_date()&lt;/code&gt;函数&lt;/p&gt;

&lt;p&gt;说明：此 函数一般用于显示时间日期。根据官方文档的说法，当一个页面上有多篇发布于同一天的档案时，the_date() 函数仅在最先引用处显示，在这种情况下最好使用 the_time() 函数。见：http://codex.wordpress.org/Template_Tags/the_date&lt;/p&gt;

&lt;p&gt;调用格式：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;the_date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'format'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'before'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'after'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;参数表：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;format&lt;/code&gt;：（字符串型）定义时间日期格式的参数。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;before&lt;/code&gt;：（字符串型）日期前放置的文本，无缺省值。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;after&lt;/code&gt;：（字符串型）日期后放置的文本，无缺省值。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;echo&lt;/code&gt;：（布尔型）显示日期 (TRUE)，或返回供 PHP 使用的日期(FALSE)。缺省值为 TRUE。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;the_time()&lt;/code&gt; 函数&lt;/p&gt;

&lt;p&gt;说明：此函数用于显示时间日期。根据官方文档的说法，此函数必须被使用在循环内。见：http://codex.wordpress.org/Template_Tags/the_time&lt;/p&gt;

&lt;p&gt;调用格式：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;php&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;the_time&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;('&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;');&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;参数表：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;format&lt;/code&gt;：（字符串型）定义时间日期格式的参数。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;4、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;get_the_time()&lt;/code&gt; 函数&lt;/p&gt;

&lt;p&gt;说明：根据官方文档的说法，此函数仅向 PHP 返回时间信息，并不显示时间日期，且必须被使用在循环内。见：http://codex.wordpress.org/Template_Tags/get_the_time&lt;/p&gt;

&lt;p&gt;调用格式：&lt;/p&gt;
&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;php&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;get_the_time&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;('&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;');&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;参数表：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;format&lt;/code&gt;：（字符串型）定义时间日期格式的参数。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;以上三个函数format 参数可以使用的各项值：&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a&lt;/code&gt; = 一般在12小时制显示时使用，显示当前是 am（上午）或 pm（下午）
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; = 功能同上，区别是 am 或 pm 为大写&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d&lt;/code&gt; = 一月中的哪一天，固定以两位数显示&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;F&lt;/code&gt; = 文字全称表示的月份&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g&lt;/code&gt; = 12小时制的小时数，位数根据实际的时间决定
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;G&lt;/code&gt; = 24小时制的小时数，位数根据实际的时间决定&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h&lt;/code&gt; = 12小时制的小时数，固定以两位数显示
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;H&lt;/code&gt; = 24小时制的小时数，固定以两位数显示&lt;/p&gt;

&lt;p&gt;注：如当前时间是早上8点，用 h 参数输出的结果为 08，用 g 参数输出的结果为 8，换成大写后仅改变时制。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt; = 当前分钟数
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;I&lt;/code&gt; = 输出一个零，不知何用，望知道的兄弟指教。（大写 i）&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;j&lt;/code&gt; = 一月中的哪一天，位数根据实际的日期决定&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;l&lt;/code&gt; = 文字表示的星期（小写 L）
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;L&lt;/code&gt; = 输出一个零，不知何用，望知道的兄弟指教。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;m&lt;/code&gt; = 数字表示的月份
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M&lt;/code&gt; = 英文缩写的月份&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s&lt;/code&gt; = 当前秒数
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;S&lt;/code&gt; = 一般跟随参数 j 使用，效果是在天数后加上序数词后坠（st, nd ,rd 等）&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Y&lt;/code&gt; = 4位数的年份
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;y&lt;/code&gt; = 2位数的年份&lt;/p&gt;

&lt;p&gt;注：参数区分大小写，写在参数引号内的非参数字符不做处理，直接输出。&lt;/p&gt;

&lt;p&gt;例如，以下格式字串：&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;l&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;F&lt;/code&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;j&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Y&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;将生成如下格式的日期：&lt;/p&gt;

&lt;p&gt;星期五, 九月 24, 2004&lt;/p&gt;

&lt;p&gt;5、single_month_title() 函数&lt;/p&gt;

&lt;p&gt;调用格式：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;single_month_title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'prefix'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;参数表：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;prefix：年和月的前缀&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;输出格式：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;prefix&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MONTH&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;prefix&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;YEAR&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;如&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;prefix&lt;/code&gt; 参数为”*“，显示结果将会是如下的样子：&lt;/p&gt;

&lt;p&gt;*February * 2004&lt;/p&gt;

&lt;p&gt;最终帮King改的时间函数为the_time(‘Y年m月d日,H时s分i秒’)
显示效果就是：发表于: 2010年06月12日,23时14分32秒&lt;/p&gt;

&lt;p&gt;大家可以举一反三。找到自己想要的效果&lt;/p&gt;
</content>
                 <tag>PHP</tag>  <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-06-10T21:04:17+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/j2me-choicegroup-access-option-values.html</loc>
        <lastmod>2010-06-10T13:26:31+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>j2me使用ChoiceGroup使用和获取选项值</title>
                <content>
&lt;p&gt;多选框在程序中使用相当广泛~选择某些功能什么都要靠它~~&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;javax.microedition.midlet.*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;javax.microedition.lcdui.*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ChoiceGroupTest&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MIDlet&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ItemStateListener&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 继承ItemStateListener这个接口&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Display&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;display1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Form&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nc&quot;&gt;ChoiceGroup&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 声明&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ChoiceGroupTest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 构建函数&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;display1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Display&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getDisplay&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ChoiceGroupTest&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;cg&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ChoiceGroup&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;请选择喜爱的编程语言：&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Choice&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;MULTIPLE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 创建ChoiceGroip.第一个是显示提示内容，第二个是类型&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;cg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;C&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 选项1&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;cg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;C++&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 选项2&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;cg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Java&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 选项3&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setItemStateListener&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;startApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MIDletStateChangeException&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 程序一开始就运行并抛出错误&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;display1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCurrent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 程序一开始运行就显示&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;pauseApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 当程序被中断时候执行&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;destroyApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unconditional&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 程序结束时候运行&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;itemStateChanged&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Item&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 创建抽象类&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// cg.getSize获得ChoiceGroup的选项数目&lt;/span&gt;
		&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isSelected&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 判断选项是否选中，如果选中就显示&lt;/span&gt;
			&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
				&lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 把选中的内容串起来&lt;/span&gt;
			&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;你选择了：&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 选择的内容在控制台显示出来&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
                 <tag>j2me</tag>  <tag>移动开发</tag> 
                 <tag>j2me</tag> 
                <pubTime>2010-06-10T13:26:31+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/j2me-ticker-scrolling-in-calendar.html</loc>
        <lastmod>2010-06-09T11:04:55+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>j2me实现Ticker滚动显示日期Calendar</title>
                <content>
&lt;p&gt;使用Ticker显示滚动消息和使用日期函数获取时间~~&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;javax.microedition.midlet.*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;javax.microedition.lcdui.*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.util.*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TickerTest&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MIDlet&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Display&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;display1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Form&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;TickerTest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 构建函数&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;display1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Display&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getDisplay&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;滚动效果测试--http://Yourtion.TK&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;nc&quot;&gt;Calendar&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;calendar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Calendar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 通过getInstance()来初始化calendar&lt;/span&gt;
		&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strYear&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;calendar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Calendar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;YEAR&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;年&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 获取当年年份&lt;/span&gt;
		&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strMonth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;calendar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Calendar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;MONTH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;月&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 获取月份~+1是因为系统从0开始&lt;/span&gt;
		&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strDay&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;calendar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Calendar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;DAY_OF_MONTH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;日&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 获取当天天数&lt;/span&gt;
		&lt;span class=&quot;nc&quot;&gt;Ticker&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ticker1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Ticker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;当前日期：&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strYear&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strMonth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strDay&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 滚动显示的内容&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setTicker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ticker1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 滚动显示文字&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;startApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MIDletStateChangeException&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 程序一开始就运行并抛出错误&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;display1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCurrent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 程序一开始运行就显示&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;pauseApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 当程序被中断时候执行&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;destroyApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unconditional&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 程序结束时候运行&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
                 <tag>j2me</tag>  <tag>移动开发</tag> 
                 <tag>j2me</tag> 
                <pubTime>2010-06-09T11:04:55+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/enhanced-auto-complete-eclipse.html</loc>
        <lastmod>2010-06-08T12:47:22+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>增强Eclipse自动补全</title>
                <content>
&lt;p&gt;最近在用Eclipse写J2me程序~但是你会发现Eclipse只有在写”.”后面才会自动补全~很不方便。现在就介绍然后让它全都自动补全。&lt;/p&gt;

&lt;p&gt;打开Eclipse的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;窗口（Window）&lt;/code&gt; -&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;首选项（Perferences）&lt;/code&gt; -&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Java&lt;/code&gt;-&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;编辑器（Editor&lt;/code&gt;）-&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;内容辅助（Content）&lt;/code&gt;，最下面一栏 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;自动激活（Auto）-Java的自动激活触发器（Activation）&lt;/code&gt;会看到只有一个”.”存在。&lt;/p&gt;

&lt;p&gt;表示：只有输入”.”之后才会有代码提示，我们要修改的地方就是这里，可是Eclipse默认只允许输入4个自定义字符。&lt;/p&gt;

&lt;p&gt;先把上图中”.”的地方输入几个随便的字符，例如”qwer”，点最下面的”OK”来保存设置。&lt;/p&gt;

&lt;p&gt;然后打开Eclipse的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;文件（File）&lt;/code&gt; -&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;导出（Export）&lt;/code&gt;，在窗口中展开 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;常规（General）&lt;/code&gt; -&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;首选项（Perferences）&lt;/code&gt;–&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;全部导出（Export all）&lt;/code&gt;然后点击 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;下一步（NEXT）&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;然后点击&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;浏览（Browse）&lt;/code&gt;选择任意的一个路径，保存配置文件，然后点击&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;完成（Finish）&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;用记事本打开刚才保存的那个配置文件（扩展文件名：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*.epf&lt;/code&gt;），按搜索”ctrl + F”，&lt;/p&gt;

&lt;p&gt;输入刚才设置的”qwer”，找到刚才字符串。把”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aaaa&lt;/code&gt;“修改为”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;abcdefghijklmnopqrstuvwxyz&lt;/code&gt;.”，然后保存，退出记事本。&lt;/p&gt;

&lt;p&gt;打开Eclipse的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;文件（File）&lt;/code&gt; -&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;导入（Import）&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;然后在打开的窗口里展开 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;常规（General）&lt;/code&gt; -&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;首选项（Perferences）&lt;/code&gt;，点击&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;下一步（NEXT）&lt;/code&gt; ，选中刚才修改过的配置文件，点击 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;完成（Finish）&lt;/code&gt; 。&lt;/p&gt;

&lt;p&gt;现在，再打开&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;窗口（Window）&lt;/code&gt; -&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;首选项（Perferences）&lt;/code&gt; ，并依次展开 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Java&lt;/code&gt; -&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;编辑器（Editor）&lt;/code&gt; -&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;内容辅助（Content）&lt;/code&gt;的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Java的自动激活触发器（Activation）&lt;/code&gt;，会发现已经超过了4个字符，也就是说我们输入任何字母和”.”都会有代码提示了。&lt;/p&gt;
</content>
                
                 <tag>电脑技巧</tag> 
                <pubTime>2010-06-08T12:47:22+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/j2me-buttons-events.html</loc>
        <lastmod>2010-06-07T15:39:29+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>j2me的按钮和事件</title>
                <content>
&lt;p&gt;这两天开始写关于退出按键的程序~~&lt;/p&gt;

&lt;p&gt;发现用Java很麻烦的感觉~写个东西老是要继承类啊什么的·&lt;del&gt;对于习惯傻瓜编程的我很不习惯&lt;/del&gt;写个退出都那么麻烦··郁闷就是···&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;javax.microedition.midlet.*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;javax.microedition.lcdui.*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;CommandTest&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MIDlet&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;CommandListener&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 继承按键监听&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Display&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;display1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Form&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;CommandTest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;display1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Display&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getDisplay&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;测试退出按钮&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;nc&quot;&gt;Command&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;exitCommand&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Command&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;退出&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Command&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;STOP&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 声明并初始化exitCommand按钮&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addCommand&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;exitCommand&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 面板上添加刚才的按钮&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCommandListener&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;startApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MIDletStateChangeException&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;display1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCurrent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;pauseApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;destroyApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unconditional&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;notifyDestroyed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;commandAction&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Command&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Displayable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;diaplayable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 继承commandAction方法，既点击时候执行的函数&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;destroyApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 执行退出&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
                 <tag>j2me</tag>  <tag>Java</tag>  <tag>移动开发</tag> 
                 <tag>j2me</tag> 
                <pubTime>2010-06-07T15:39:29+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/j2me-helloworld.html</loc>
        <lastmod>2010-06-05T16:24:39+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>第一个j2me程序“HelloWorld”</title>
                <content>
&lt;p&gt;开始写j2me~今天写了最简单最经典的入门程序“Hello World”。分享一下！&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;javax.microedition.midlet.*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;javax.microedition.lcdui.*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HelloWorld&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MIDlet&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Display&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;display1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Form&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;HelloWorld&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//构建函数&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;display1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Display&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getDisplay&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;HelloWorld&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;nc&quot;&gt;StringItem&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strItem&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;StringItem&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Hi&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;这是Yourtion第一个J2me入门程序&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strItem&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;startApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MIDletStateChangeException&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 程序一开始就运行并抛出错误&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;display1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCurrent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;showForm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//程序一开始运行就显示&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;pauseApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//当程序被中断时候执行&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;destroyApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unconditional&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//程序结束时候运行&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
                 <tag>j2me</tag>  <tag>Java</tag>  <tag>移动开发</tag> 
                 <tag>j2me</tag> 
                <pubTime>2010-06-05T16:24:39+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/jdk-environment-variable-settings.html</loc>
        <lastmod>2010-06-04T16:24:20+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>JDK环境变量的设置</title>
                <content>
&lt;p&gt;下载：http://java.sun.com/javase/downloads/index.jsp&lt;/p&gt;

&lt;p&gt;安装,配置j2sdk：&lt;/p&gt;

&lt;p&gt;执行j2sdk安装程序，自定义路径，我的安装路径为：C:\j2sdk1.4.2_04&lt;/p&gt;

&lt;p&gt;配置j2sdk:配置环境变量:&lt;/p&gt;

&lt;p&gt;我的电脑-&amp;gt;属性-&amp;gt;高级-&amp;gt;环境变量-&amp;gt;系统变量中添加以下环境变量：&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;py&quot;&gt;JAVA_HOME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\j&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;2sdk1.4.2_04&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;CLASSPATH&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\j&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;2sdk1.4.2_04&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\l&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;ib&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;ools.jar;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\j&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;2sdk1.4.2_04&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\l&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;ib&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\d&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;t.jar;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\j&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;2sdk1.4.2_04&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;in;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\j&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;2sdk1.4.2_04&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;in;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;写一个简单的java程序来测试J2SDK是否已安装成功：&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;hello&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[])&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;将程序保存为文件名为hello.java的文件。&lt;/p&gt;

&lt;p&gt;打开命令提示符窗口，进入到hello.java所在目录，键入下面的命令&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;javac hello.java
java hello
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;此时若打印出来hello则安装成功，若没有打印出这句话，仔细检查以上配置是否正确。&lt;/p&gt;

&lt;p&gt;注意系统文件夹选项中应确定“隐藏已知文件类型的扩展名”不勾选（我的电脑&amp;gt;工具&amp;gt;查看）&lt;/p&gt;
</content>
                 <tag>j2me</tag>  <tag>Java</tag> 
                 <tag>j2me</tag> 
                <pubTime>2010-06-04T16:24:20+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/again-encounter-concrete-wall.html</loc>
        <lastmod>2010-05-28T19:02:30+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>再次遭遇“混凝土”墙~~</title>
                <content>
&lt;p&gt;刚刚换过IP的我居然在第二天再次被墙~依旧是在那个IP卡住~看了最近墙变高了~~&lt;/p&gt;

&lt;p&gt;发邮件过去想他再帮我换一次~结果回复如下：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hello,&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;As stated before Backy LLC does not change servers for free clients. We  provide the server that you are on if you wish to be relocated you will  be required to purchase a paid hosting upgrade. You have paid nothing  for the service not even with ads. As a result I am sorry however there  is nothing wrong with the server its an issue on your end with your ISP  and as a result you will have to move to a paid hosting package to get  the account migrated to a different server.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Sincerely,&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;William Backy&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;CEO/Owner Backy LLC&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;这样就只能换服务器，找了很久结果决定用freehostia的服务器·但是上传发现它居然不能访问外网，没办法·只能再换别的··找到一个x10Hosting的居然要限制IP，结果只能挂代理上去··申请~解析··现在就正常了···&lt;/p&gt;

&lt;p&gt;希望不要再次杯具···&lt;/p&gt;
</content>
                 <tag>服务器</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2010-05-28T19:02:30+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/blog-ip-replaced.html</loc>
        <lastmod>2010-05-23T10:04:26+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>博客因G F W访问不正常~已更换IP~恢复正常~</title>
                <content>
&lt;p&gt;这两天突然发现博客上不了~但是DNS解析什么都是正常！所以我昨天就发邮件给Backy LLC那边~那边的回复是：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hello,&lt;/p&gt;

  &lt;p&gt;The website is up and running just fine for me. Please submit your ip address and during normal business hours we will look into the issue for you.&lt;/p&gt;

  &lt;p&gt;Since you are a free client we do not provide 24x7 support.&lt;/p&gt;

  &lt;p&gt;Sincerely,&lt;/p&gt;

  &lt;p&gt;William Backy  CEO/Owner Backy LLC&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;既然那边服务器正常就是我们网络的问题啦~~我便Tracert 了我的域名~结果发现在219.158.4.110这个地方卡住了~那个Tracert结果如下：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Being this is a few day.Here is the Tracing :  

Tracing route to yourtion.tk &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;74.86.183.194]  
over a maximum of 30 hops:

1 &amp;lt;1 ms &amp;lt;1 ms &amp;lt;1 ms 192.168.180.1  
2 14 ms 14 ms 4 ms 210.38.163.205  
3 &amp;lt;1 ms &amp;lt;1 ms &amp;lt;1 ms 210.38.163.174  
4 4 ms 10 ms 8 ms 221.5.72.137  
5 &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; Request timed out.  
6 8 ms 8 ms 8 ms 221.4.2.157  
7 10 ms 9 ms 9 ms 221.4.0.29  
8 9 ms 10 ms 9 ms 219.158.11.229  
9 40 ms 40 ms 40 ms 219.158.4.110  
10 &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; Request timed out.  
11 &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; Request timed out.  
12 &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; Request timed out.  
13 &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; Request timed out.  
14 &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; Request timed out.  
15 &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; Request timed out.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;可以看到在219.158.4.110IP之后就失去了音讯~再查一下这个IP~就会得到以下结果“查询结果[1]: 219.158.4.110 ==» 219.158.4.110 ==» 3684566126 ==» 中国 联通骨干网”。那么我就可以肯定我的博客所在的IP被G F W屏蔽了·~所以我再次写信希望跟换IP。对方给我答复如下：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The website is up and running just fine for me. Please submit your ip address and during normal business hours we will look into the issue for you.&lt;/p&gt;

  &lt;p&gt;Since you are a free client we do not provide 24x7 support.&lt;/p&gt;

  &lt;p&gt;Sincerely,&lt;/p&gt;

  &lt;p&gt;William Backy  CEO/Owner&lt;/p&gt;

  &lt;p&gt;Backy LLC&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;然后今天就给我换了服务器~IP换了~因为是他们解析的DNS！&lt;del&gt;我自己不用做什么~博客又正常了···希望大家继续支持&lt;/del&gt;&lt;/p&gt;

</content>
                 <tag>服务器</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2010-05-23T10:04:26+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/vmware-server-2-error-1625.html</loc>
        <lastmod>2010-05-15T12:12:52+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>VMware Server 2 出错 1625</title>
                <content>
&lt;p&gt;VMware Server 2　安装时出现&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ERROR2755: Server returned unexpected error 1625 attempting to install package
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;报错。&lt;/p&gt;

&lt;p&gt;这是由于尝试在运行 Microsoft Windows Server 2003 或 Microsoft Windows XP 的计算机上安装大型 Microsoft Windows Installer (.msi) 程序包或大型Microsoft Windows Installer 修补程序 (.msp) 包时要打补丁包Windows Server 2003 更新（KB925336）&lt;/p&gt;

&lt;p&gt;可以从 Microsoft 下载中心下载以下文件：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?displaylang=zh-cn&amp;amp;FamilyID=8effe1d9-7224-4586-be2b-42c9ae5b9071&quot;&gt;立即下载 Windows Server 2003 更新（KB925336）程序包&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;就能解决&lt;/p&gt;

&lt;p&gt;随便介绍一下Vmware Workstation和VMware Server的区别：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;VM屏幕录像－Workstation的屏幕录像可以录制VM的所有屏幕操作,并保存为一个AVI文件.Server则没有屏幕录像功能。&lt;/li&gt;
  &lt;li&gt;主机－虚拟机间拖拽－可以让主机上的对象拖拽到虚拟机上。Server不支持主机－虚拟机间文件拖拽。&lt;/li&gt;
  &lt;li&gt;VM组－Workstation支持以组的方式来管理多个VM。Server不具备此功能。&lt;/li&gt;
  &lt;li&gt;VM克隆－Workstation克隆功能可以快速地拷贝一个VM。Server不支持。&lt;/li&gt;
  &lt;li&gt;快照－Workstation和Server都支持普通快照。&lt;/li&gt;
  &lt;li&gt;多重快照－Workstation支持多重快照，Server仅支持单一快照。&lt;/li&gt;
  &lt;li&gt;CPU支持－Workstation和Server都支持2－way虚拟处理器。&lt;/li&gt;
  &lt;li&gt;虚拟机内存支持－Workstation提供了每个VM最高8GB的内存支持，而Server只支持每VM最高3.6GB内存。&lt;/li&gt;
  &lt;li&gt;多用户访问－Workstation一次只允许一个用户访问。而Server基于服务的实现方式允许多用户并发访问，而且还提供了一个用于远程管理的Web控制台功能。&lt;/li&gt;
  &lt;li&gt;作为服务运行－Workstation和Server最大的区别在于。Server作为一个后台服务来运行，而Workstation则作为一个标准的桌面应用程序。Workstation提供了更好的交互性能，而Server更适合多用户服务器整合的场景。Workstation更适合于开发环境，Server则更适合于生产环境。&lt;/li&gt;
  &lt;li&gt;价格－Workstation卖到189美元，Server免费。&lt;/li&gt;
&lt;/ol&gt;
</content>
                
                 <tag>服务器</tag> 
                <pubTime>2010-05-15T12:12:52+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/baidu-domain-on-the-google.html</loc>
        <lastmod>2010-05-12T08:14:03+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>关于Google的Baidu域名~~</title>
                <content>
&lt;p&gt;先说两个域名：&lt;a href=&quot;http://baidu.com.sb&quot;&gt;http://baidu.com.sb&lt;/a&gt;和http://baidu.im&lt;/p&gt;

&lt;p&gt;看到这样一则新闻：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;根据网友描述，新民网记者登陆了“涉嫌”抢注的域名&lt;a href=&quot;http://www.baidu.com.sb&quot;&gt;www.baidu.com.sb&lt;/a&gt;，该页面迅速指向google的全球页面http://www.google.com/，记者随即查证到，&lt;a href=&quot;http://www.baidu.com.sb&quot;&gt;www.baidu.com.sb&lt;/a&gt;的IP指向： 64.233.189.104，&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;按照公开数据，为美国加利福尼亚州山景市谷歌公司所在地。而通过全球域名管理机构ICANN查询，sb域名是所罗门群岛国家顶级域名。另外新民网记者也注意到google还持有&lt;a href=&quot;http://www.google.com.sb&quot;&gt;www.google.com.sb&lt;/a&gt;域名。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;然后就突然想起另外一个可以跳转到Google的百度域名：http://baidu.im.这个好像是个人恶搞的··&lt;/p&gt;

&lt;p&gt;今天又 看到新闻，Google已经对这件事作出回应：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;IT商业新闻网向谷歌大中华区市场部公关总监王锦红核实此消息时，王锦红出言谨慎，表示baidu.com.sb跳转至google页面与谷歌无关，并打了个比喻反问记者，“当输入你们的网址时，跳转至百度时，就一定是你们干的吗？”。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;当记者询问此消息是否为假消息或恶作剧时，她回应说“此事最好直接询问此消息的最初来源地”。王锦红否认了此消息，认为此事与谷歌无关，言外之意，不排除恶作剧的假消息。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;业内人士也认为这是人家的恶作剧~虽然Google已经退出中国。但是还是习惯了Google一下，用Gmail，用Gtalk，用Google翻译~还是离不开Google。虽然经常会被亲爱的GFW屏蔽一下····&lt;/p&gt;
</content>
                 <tag>域名</tag> 
                 <tag>杂杂的</tag> 
                <pubTime>2010-05-12T08:14:03+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/admass.html</loc>
        <lastmod>2010-04-30T13:55:18+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Admass</title>
                <content>
&lt;p&gt;我们的挑战杯项目《Admass虚拟宝物广告批发商》居然经过一轮又一轮的挣扎进入学校，进入省~现在进了决赛~真是小强中的小强（队长说的）。写篇东西纪念一下~&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/04/Admass.jpg&quot;&gt;&lt;img src=&quot;/images/2010/04/Admass.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Admss历程如下：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;三月五！Admass交稿经管院~&lt;/li&gt;
  &lt;li&gt;三月十号！Admass在经管出线~&lt;/li&gt;
  &lt;li&gt;三月十七！Admass交到学校~&lt;/li&gt;
  &lt;li&gt;三月二十七！Admass学校出线~&lt;/li&gt;
  &lt;li&gt;四月十二！Admass上交省里初赛~&lt;/li&gt;
  &lt;li&gt;四月二十！Admass进入决赛（&lt;a href=&quot;http://www.gdcyl.org/xxb/ShowArticle.asp?ArticleID=78376&quot;&gt;http://www.gdcyl.org/xxb/ShowArticle.asp?ArticleID=78376&lt;/a&gt;）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/04/Admass2.jpg&quot;&gt;&lt;img src=&quot;/images/2010/04/Admass2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;得知我们进来决赛~要去答辩~我们的反应是这样的（QQ签名）：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;静茵：看着Admass一路的跌跌撞撞，似乎不全力以赴，苍天都得收了我~
洽金：Admass是小强之中的小强，难不成要我用菜花头来面对它？？
鸿辉：哇！挑战杯，进了决赛，怎么搞~~
我说：不会吧Admass~挑战杯又进了？平台啊~闭关修炼~~&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;先说说我们的团队吧~&lt;/p&gt;

&lt;h3 id=&quot;管理成员介绍&quot;&gt;管理成员介绍：&lt;/h3&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&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;blockquote&gt;
  &lt;p&gt;随着网络游戏的快速发展，广告也在其中找到一个巨大的媒介载体空间，其中，植入式广告因其良好的隐蔽性和不可躲避性引起业界的广泛关注。我们团队正是抓住中国广告市场这一块空白，并且在得到嘉应学院信息网络中心技术与设备支持的情况下，”Admass虚拟宝物广告批发商”这个项目应运而生。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Admass是一个以社区植入式广告与Social game植入式广告为主要运营方向的新型广告平台。主要做的是为商家寻找适合的植入式广告，同时为社区和游戏运营商寻找合适的游戏广告植入素材。Admass平台通过提供商家一种新型的广告宣传方式，以及提供社区和游戏运营商一个全新的展现平台，主张将商家品牌植入到社区和Social game中，以此吸引消费者的注意。这一切由品牌虚拟游戏开始。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;img src=&quot;/images/2010/04/zrclip_001p219234a4.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;我们就是一步步走到现在~要感谢的人很多很多~包括给了我们很多帮助的商家：天长地久婚纱摄影，私享，大易景观设计等等~&lt;/p&gt;

&lt;p&gt;还有就是我们的指导老师，薛静、余云珠和黄戈文老师~&lt;/p&gt;

&lt;p&gt;还有Harry等等帮我们完善了项目的朋友们~&lt;/p&gt;

&lt;p&gt;最后就是一直支持我们的朋友和同学师弟师妹们~&lt;/p&gt;

&lt;p&gt;我们会继续努力~做到最好的···&lt;/p&gt;
</content>
                
                 <tag>大学生活</tag> 
                <pubTime>2010-04-30T13:55:18+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/css-hack-quick-summary.html</loc>
        <lastmod>2010-04-28T11:10:26+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>CSS Hack 汇总速查</title>
                <content>
&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;今天刚好研究一个网站的下拉菜单~忽然发现FireFox和IE6没问题了&lt;/td&gt;
      &lt;td&gt;~但是IE7却跑到别的地方去~所有找了相关的资料~分享一下~希望对大家有用~&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;首先说说什么是css-hack&quot;&gt;首先说说什么是CSS hack：&lt;/h3&gt;

&lt;p&gt;CSS hack(http://www.cssplay.org.cn/css-hack/index.html)&lt;/p&gt;

&lt;p&gt;由于不同的浏览器，比如 Internet Explorer 6,Internet Explorer 7,Mozilla Firefox等，对CSS的解析认识不一样，因此会导致生成的页面效果不一样，得不到我们所需要的页面效果。&lt;/p&gt;

&lt;p&gt;这个时候我们就需要针对不同的浏览器去写不同的CSS，让它能够同时兼容不同的浏览器，能在不同的浏览器中也能得到我们想要的页面效果。&lt;/p&gt;

&lt;p&gt;这个针对不同的浏览器写不同的CSS code的过程，就叫CSS hack,也叫写CSS hack。&lt;/p&gt;

&lt;h3 id=&quot;css-hack的原理是什么&quot;&gt;CSS Hack的原理是什么&lt;/h3&gt;
&lt;p&gt;由于不同的浏览器对CSS的支持及解析结果不一样，还由于CSS中的优先级的关系。我们就可以根据这个来针对不同的浏览器来写不同的CSS。&lt;/p&gt;

&lt;p&gt;比如 IE6能识别下划线”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_&lt;/code&gt;“和星号” &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*&lt;/code&gt; “，IE7能识别星号” &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*&lt;/code&gt; “，但不能识别下划线”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_&lt;/code&gt;“，而firefox两个都不能认识。等等&lt;/p&gt;

&lt;p&gt;书写顺序，一般是将识别能力强的浏览器的CSS写在后面。下面如何写里面说得更详细些。&lt;/p&gt;

&lt;h3 id=&quot;屏蔽ie浏览器也就是ie下不显示&quot;&gt;屏蔽IE浏览器（也就是IE下不显示）&lt;/h3&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;font&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;12px&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;!important&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;c&quot;&gt;/*FF,OP可见，特别提醒：由于Opera最近的升级，目前此句只为FF所识别*/&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;:empty&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;font&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;12px&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;!important&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;c&quot;&gt;/*safari可见*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这里select是选择符，根据情况更换。第二句是MAC上safari浏览器独有的。&lt;/p&gt;

&lt;h3 id=&quot;仅ie7与ie50可以识别&quot;&gt;仅IE7与IE5.0可以识别&lt;/h3&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;*+&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;…&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;当面临需要只针对IE7与IE5.0做样式的时候就可以采用这个HACK。&lt;/p&gt;

&lt;h3 id=&quot;仅ie7可以识别&quot;&gt;仅IE7可以识别&lt;/h3&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;*+&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;…!important;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;当面临需要只针对IE7做样式的时候就可以采用这个HACK。&lt;/p&gt;

&lt;h3 id=&quot;ie6及ie6以下识别&quot;&gt;IE6及IE6以下识别&lt;/h3&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;…&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;/* 这个地方要特别注意很多博客都写成了是IE6的HACK其实IE5.x同样可以识别这个HACK。其它浏览器不识别。*/&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;/**/&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;…&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;nt&quot;&gt;这句与上一句的作用相同&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;。&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;仅ie6不识别屏蔽ie6&quot;&gt;仅IE6不识别，屏蔽IE6&lt;/h3&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/*屏蔽IE6*/&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:none;&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;nt&quot;&gt;这里主要是通过CSS注释分开一个属性与值&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;，&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;注释在冒号前&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;。&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;仅ie6与ie5不识别屏蔽ie6与ie5&quot;&gt;仅IE6与IE5不识别，屏蔽IE6与IE5&lt;/h3&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;/**/&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/*IE6,IE5不识别*/&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:none;&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;nt&quot;&gt;这里与上面一句不同的是在选择符与花括号之间多了一个CSS注释&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;。&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;不屏蔽IE5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;仅ie5不识别屏蔽ie5&quot;&gt;仅IE5不识别，屏蔽IE5&lt;/h2&gt;
&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;/*IE5不识别*/&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;…&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这一句是在上一句中去掉了属性区的注释。只有IE5不识别，IE5.5可以识别。&lt;/p&gt;

&lt;p&gt;盒模型解决方法&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;selct&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IE5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x宽度&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
	&lt;span class=&quot;nl&quot;&gt;voice-family&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;inherit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
	&lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;正确宽度&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;盒模型的清除方法不是通过!important来处理的。这点要明确。&lt;/p&gt;

&lt;p&gt;清除浮动&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;:after&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
	&lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;block&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
	&lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
	&lt;span class=&quot;nl&quot;&gt;clear&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;both&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
	&lt;span class=&quot;nl&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;hidden&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在Firefox中，当子级都为浮动时，那么父级的高度就无法完全的包住整个子级，那么这时用这个清除浮动的HACK来对父级做一次定义，那么就可以解决这个问题。&lt;/p&gt;

&lt;p&gt;截字省略号&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; 
	&lt;span class=&quot;nl&quot;&gt;-o-text-overflow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ellipsis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
	&lt;span class=&quot;nl&quot;&gt;text-overflow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ellipsis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
	&lt;span class=&quot;nl&quot;&gt;white-space&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;nowrap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
	&lt;span class=&quot;nl&quot;&gt;overflow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;hidden&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这个是在越出长度后会自行的截掉多出部分的文字，并以省略号结尾，很好的一个技术。只是目前Firefox并不支持。&lt;/p&gt;

&lt;h3 id=&quot;只有opera识别&quot;&gt;只有Opera识别&lt;/h3&gt;
&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;all&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;min-width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;……&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;针对Opera浏览器做单独的设定。&lt;/p&gt;

&lt;p&gt;以上都是写CSS中的一些HACK，这些都是用来解决局部的兼容性问题，如果希望把兼容性的内容也分离出来，不妨试一下下面的几种过滤器。这些过滤器有的是写在CSS中通过过滤器导入特别的样式，也有的是写在HTML中的通过条件来链接或是导入需要的补丁样式。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IE5.x的过滤器，只有IE5.x可见&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tty&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&quot;\&quot;;/*&quot;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&quot;*/}} @import 'ie5win.css'; /*&quot;&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;c&quot;&gt;/* */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;ie5mac的过滤器一般用不着&quot;&gt;IE5/MAC的过滤器，一般用不着&lt;/h3&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;/*\*//*/
@import &quot;ie5mac.css&quot;;
/**/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;ie-的if条件hack&quot;&gt;IE 的if条件Hack&lt;/h3&gt;
&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;&amp;lt;!--[if IE]&amp;gt; Only IE &amp;lt;![endif]--&amp;gt;&lt;/span&gt;
所有的IE可识别
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--[if IE 5.0]&amp;gt; Only IE 5.0 &amp;lt;![endif]--&amp;gt;&lt;/span&gt;
只有IE5.0可以识别
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--[if gt IE 5.0]&amp;gt; Only IE 5.0+ &amp;lt;![endif]--&amp;gt;&lt;/span&gt;
IE5.0包换IE5.5都可以识别
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--[if lt IE 6]&amp;gt; Only IE 6- &amp;lt;![endif]--&amp;gt;&lt;/span&gt;
仅IE6可识别
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--[if gte IE 6]&amp;gt; Only IE 6/+ &amp;lt;![endif]--&amp;gt;&lt;/span&gt;
IE6以及IE6以下的IE5.x都可识别
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--[if lte IE 7]&amp;gt; Only IE 7/- &amp;lt;![endif]--&amp;gt;&lt;/span&gt;
仅IE7可识别

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;以上内容可能并不全面，欢迎大家能和我一起把这些技巧都汇总起来，为以后工作的查询提供一个方便，同时在这里感谢那些研究出这些HACK的作者们。&lt;/p&gt;
</content>
                 <tag>CSS</tag> 
                 <tag>HTML</tag> 
                <pubTime>2010-04-28T11:10:26+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/phone-based-plug-in-mobilepress.html</loc>
        <lastmod>2010-04-25T10:52:57+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress手机化插件MobilePress连汉化主题</title>
                <content>
&lt;p&gt;&lt;img src=&quot;/images/2010/04/zrclip_001pe64d5c0.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;手机已经我们上网不可或缺的一个互联网终端，越来越多的人开始用手机来浏览网页，不过很多网站的对于手机而言都不是很友好，之前我写过一篇关于WordPress的手机浏览&lt;a href=&quot;/wap-access-and-manage-wordpress.html&quot;&gt;《WordPress的WAP访问与管理》&lt;/a&gt;，但是WP-T-WAP需要你访问wap目录，而且好像有时也不太正常。&lt;/p&gt;

&lt;p&gt;今天介绍的MobilePress可以自动检测手机类型，并使你的网站适合于iPhone、Opera Mini、Windows Mobile以及其他的手机浏览器来浏览，当用户浏览网页时，自动检测手机类型，并且可以设置只针对某些手机显示（如只针对iPhone优化）。&lt;/p&gt;

&lt;p&gt;这个插件对访问本域名的客户端直接识别并自动转向移动站点，不用另换域名，而且支持评论，可以显示网站fav.ico；连GoogleAD也给显示出来了，使用之后觉得这个插件的界面比wp-t-wap好很多，后台还可以设定默写移动浏览器的转向识别，手机管理方面之后再介绍一个吧。&lt;/p&gt;

&lt;p&gt;下载地址：&lt;a href=&quot;http://wordpress.org/extend/plugins/mobilepress/&quot;&gt;http://wordpress.org/extend/plugins/mobilepress/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;强烈推荐使用！&lt;/p&gt;

&lt;p&gt;后台截图如下：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/04/zrclip_002p79c95589.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;此插件使用很简单，只需要上传，激活即可，上面是选项设置的页面，可以重新自定义站点名称和描述，不填则使用wordpress默认的。Force Mobile Site是指是否需要强制PC浏览下成为适合手机浏览的版本，这个一般选No，除非你想看看在PC浏览中显示为合适手机浏览的效果。&lt;/p&gt;

&lt;p&gt;手机访问截图如下：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/04/zrclip_003p1999c82f.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/04/zrclip_004p3a15cda9.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/04/zrclip_005p4d115198.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/04/zrclip_007n3e0e882c.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;主题我已经汉化，顺便提供汉化了的主题下载。&lt;/p&gt;

&lt;p&gt;下载汉化主题：&lt;a href=&quot;/images/download/Yourtion.rar&quot;&gt;Yourtion.rar&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;下载解压到： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/wp-content/plugins/mobilepress/system/themes/&lt;/code&gt; 目录下替换&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Defual&lt;/code&gt;即可。&lt;/p&gt;
</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress插件</tag> 
                <pubTime>2010-04-25T10:52:57+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/recently-backyllc-replacement-server.html</loc>
        <lastmod>2010-04-20T11:37:44+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>最近BackyLLC更换服务器~</title>
                <content>
&lt;p&gt;前段时间博客的访问一直不是很正常~在学校某些宿舍正常，自己那栋宿舍却不正常，就是在同个网段的几部计算机也会有不正常的。导致我非常郁闷~在宿舍被迫要用搜狗加速代理上网~但是用端口上CP却正常~最近更换了DNS解析之后发现部分数据丢失~对此深表抱歉~~&lt;/p&gt;

&lt;p&gt;结果前天连CP也进不来了··所以我早上11点的时候发询问到BackyLLC客服~因为那时是美国那边晚上11点吧~以为要第二天才能收到回复~结果没一会手机就提示有邮件了··我还以为是提问回摺，结果一看~居然已经得到回复~&lt;/p&gt;

&lt;p&gt;我收到的回复如下：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hello,&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;I am showing that you are not using Backy LLCs nameservers. I am not sure why people do not read our company emails but this issue was emailed out to everyone twice before all this stuff happened.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;We moved servers and if you failed to use our nameservers your website would stop working as you did not get the automatic updates. Backy LLC does not warranty any domain/hosting account if you are not using our nameservers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Update to ns1.backycorp.com and ns2.backycorp.com and you will be good to go.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;FYI the new server ip address is 74.86.183.194. In the future it is highly recommended that you use our nameservers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Sincerely,&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;William Backy
CEO/Owner Backy LLC&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Ticket Details
Ticket ID: BSU-565445
Department: Free Hosting Support
Priority: High
Status: Closed&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;大概内容是说我没有吧主DNS设置成他们提供的·~那样他们更新服务器的IP我就无法得知和及时更改~因为我之前用的是Godaddy的DNS~这次没办法就切换回他的DNS~我也建议使用BackyLLC的朋友把DNS设置过去~这样也可以反正被墙&lt;/p&gt;

&lt;p&gt;之前博客访问不正常可能也是这个原因引起~就是他们在进行服务器迁移~但是我更新的数据是在旧服务器上~没有被迁移过去~~~确实是人品问题啊···&lt;/p&gt;

&lt;p&gt;这次的经历更加让我对国外服务器的服务刮目相看~晚上11点~还是那么快速的回复我的信息~我还是一个普通的免费用户~国外的服务商确实很注重客户的体验~昨天在万网提交一个关于域名的提问~结果等到今天早上才有答复~差别啊···&lt;/p&gt;

&lt;p&gt;我提交问题是在“2010年4月19日 上午11:05”然后在“2010年4月19日 上午11:06”收到关于问题已经被查看的信息：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hello,&lt;/p&gt;

  &lt;p&gt;I am looking into your issue. I will have an update for you shortly.&lt;/p&gt;

  &lt;p&gt;Sincerely,&lt;/p&gt;

  &lt;p&gt;William Backy&lt;/p&gt;

  &lt;p&gt;CEO/Owner Backy LLC&lt;/p&gt;

  &lt;p&gt;Ticket Details&lt;/p&gt;

  &lt;p&gt;Ticket ID: BSU-565445&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;然后在“2010年4月19日 上午11:10”就收到上面的回复~前后才5分钟不到啊···&lt;/p&gt;
</content>
                 <tag>服务器</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2010-04-20T11:37:44+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/baidu-ping-service-wordpress.html</loc>
        <lastmod>2010-04-08T12:00:34+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Wordpress的Ping服务（加快百度收录的百度Ping）</title>
                <content>
&lt;p&gt;更新网站，然后等待搜索引擎来收录，这种被动式的方法现在已经过时了。现在很多博客系统都加入了Ping 服务功能，所谓Ping&lt;/p&gt;

&lt;p&gt;服务，实际上是一种更新通知服务，它可以将您的博客更新自动通知博客目录和搜索引擎，加快网站被搜索引擎收录的速度。ping服务对博客来说是件非常重要的工具，它可以在你发表文章后迅速通知搜索引擎，feed托管服务商和在线RSS阅读器更新。这对博客来说是相当不错的。&lt;/p&gt;

&lt;p&gt;WordPress可以通过选项-撰写-更新服务来修改Ping清单，如下图所示：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/04/zrclip_002n11fd1050.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;以下是我正在使用的Ping列表：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;http://ping.baidu.com/ping/RPC2&lt;/li&gt;
  &lt;li&gt;http://rpc.pingomatic.com/&lt;/li&gt;
  &lt;li&gt;http://blogsearch.google.com/ping/RPC2&lt;/li&gt;
  &lt;li&gt;http://api.my.yahoo.com/RPC2&lt;/li&gt;
  &lt;li&gt;http://api.my.yahoo.com/rss/ping&lt;/li&gt;
  &lt;li&gt;http://ping.feedburner.com&lt;/li&gt;
  &lt;li&gt;http://www.zhuaxia.com/rpc/server.php&lt;/li&gt;
  &lt;li&gt;http://www.xianguo.com/xmlrpc/ping.php&lt;/li&gt;
  &lt;li&gt;http://www.feedsky.com/api/RPC2&lt;/li&gt;
  &lt;li&gt;http://blog.iask.com/RPC2&lt;/li&gt;
  &lt;li&gt;http://ping.blog.qikoo.com/rpc2.php&lt;/li&gt;
  &lt;li&gt;http://rpc.technorati.com/rpc/ping&lt;/li&gt;
  &lt;li&gt;http://www.blogsdominicanos.com/ping/&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;但是要注意的是ping太多会影响你发表文章的速度，特别是像我们这些国外主机的，能省则省。&lt;/p&gt;
</content>
                 <tag>SEO</tag>  <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-04-08T12:00:34+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/powereasy-upload-image-error-solution.html</loc>
        <lastmod>2010-03-27T13:48:29+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>解决动易中批量上传图片出现错误的方法</title>
                <content>
&lt;p&gt;之前一个动易的SiteWeaver老是上传图片出现问题···在网上找了一下··那些方法都不是很详细~自己总结一下··写了个详细的版本~~把里面一些问题补全了··&lt;/p&gt;

&lt;h3 id=&quot;一问题出现类似下面的提示&quot;&gt;一、问题：出现类似下面的提示&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Request&lt;/code&gt; 对象 错误 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;'asp 0104 ：80004005'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;不允许的操作&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D:\sw\../Include/PowerEasy.Upfile.asp, 行57&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;更改win2003的IIS 6.0对asp的上传文件大小为200k限制，aspx的上传程序没有影响。&lt;/p&gt;

&lt;p&gt;在IIS6.0中，默认设置是特别严格和安全的，最大只能传送 204,800 个字节，这样可以最大限度地减少因以前太宽松的超时和限制而造成的攻击。&lt;/p&gt;

&lt;p&gt;IIS 6 出于安全考虑, 默认最大请求是200K（也即最大提交数据限额为200KByte，204800Byte）。（在 IIS 6.0 之前的版本中无此限制）&lt;/p&gt;

&lt;p&gt;解决方案：&lt;/p&gt;

&lt;p&gt;1、先打开Internet 信息[服务]（IIS）管理器
（本地计算机 ）→属性→允许直接编辑配置数据库(N)&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_001p5ea97150.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;（图1） 【一定要勾先”允许直接编辑配置数据库(N)”】&lt;/p&gt;

&lt;p&gt;2、然后在[服务]里关闭iis admin service服务&lt;/p&gt;

&lt;p&gt;3、找到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;windows\system32\inesrv&lt;/code&gt;下的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;metabase.xml&lt;/code&gt;,
用计事本打开，找到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ASPMaxRequestEntityAllowed&lt;/code&gt; 把他修改为需要的值，默认为204800，即200K
把它修改为1024000（1M）&lt;/p&gt;

&lt;p&gt;4、然后重启iis admin service服务&lt;/p&gt;

&lt;p&gt;5、重新启动网站&lt;/p&gt;

&lt;h3 id=&quot;二问题出现类似下面的提示&quot;&gt;二、问题：出现类似下面的提示&lt;/h3&gt;

&lt;p&gt;Internet Explorer不能连接到您请求的网页。此页可能暂时不可用。&lt;/p&gt;

&lt;p&gt;解决方法: 图片太大导致asp页面脚本超时，请选择网速较好的时间上传，或者用ftp上传图片，或者联系服务器管理员修改iis里面asp页面脚本超时时间。&lt;/p&gt;

&lt;h3 id=&quot;三问题出现下面的提示&quot;&gt;三、问题：出现下面的提示&lt;/h3&gt;

&lt;p&gt;错误类型：&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ADODB.Stream (0x800A0BBC)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;写入文件失败。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/sw/Include/PowerEasy.Upfile.asp, 第 399 行&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;解决方法：查找&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PowerEasy.Upfile.asp&lt;/code&gt;331行左右代码&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;For i = 0 To Files.Count - 1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;在下面加入&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;On Error Resume Next&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;上传的问题基本就这么多··总的来说·· SiteWeaver是ASP里面很强的一个东西··&lt;/p&gt;
</content>
                 <tag>服务器</tag> 
                 <tag>电脑技巧</tag> 
                <pubTime>2010-03-27T13:48:29+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/change-server-greatly-improved-speed.html</loc>
        <lastmod>2010-03-26T14:12:44+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>再次更换服务器~速度极大改善~</title>
                <content>
&lt;p&gt;经过前天的服务器遭到攻击事件~开始不放心TW的服务器··不是对他的服务器没信心~是对自己人对他攻击的不放心啊···因为换Firber-Host失败&lt;del&gt;所以再次尝试Backy LLC的空间·~也就是Funkey在用的空间的免费版&lt;/del&gt;之前的多次申请都失败了··虽然Order Confirmation。然后过段时间就回复说：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Dear guo yourtion (chuange),&lt;/p&gt;

  &lt;p&gt;This email is to notify you that your order did not pass Backy LLC’s internal fraud review process. We cannot disclose the exact reason for your decline however please referance some of the possible reasons below. Your IP address from your actual location is too far away. Your Domain Name does not meet Backy LLC’s moral standards. You failed to provide correct contact information You attempted to change contact details after an order was classified as fraud.&lt;/p&gt;

  &lt;p&gt;Please Note that these are just possible reasons and that Backy LLC will be unable to provide you with any further information in regards to our fraud detection process.&lt;/p&gt;

  &lt;p&gt;Sincerely,  Backy LLC Sales Dept&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;然后就失败告终~~这一次因为空间down了···也就再次跑去申请··  没想到早上居然收到Welcome to Backy LLC Free Hosting的回复：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Dear guo yourtion (chuange),&lt;/p&gt;

  &lt;p&gt;PLEASE READ THIS EMAIL IN FULL AND PRINT IT FOR YOUR RECORDS&lt;/p&gt;

  &lt;p&gt;Thank you for your order from us! Your hosting account has now been setup and this email contains all the information you will need in order to begin using your account.&lt;/p&gt;

  &lt;p&gt;If you have requested a domain name during sign up, please keep in mind that your domain name will not be visible on the internet instantly. This process is called propagation and can take up to 48 hours. Until your domain has propagated, your website and email will not function, we have provided a temporary url which you may use to view your website and upload files in the meantime.&lt;/p&gt;

  &lt;p&gt;Free Hosting Support: Backy Corp only provides FREE hosting clients with help desk support which is not monitored 24x7 should you wish to get access to 24x7 support you will need to upgrade to a paid hosting package by contacting our billing department on the help desk. FREE hosting clients do not get access to Live Chat for support related issues. Live chat is only for sales.&lt;/p&gt;

  &lt;p&gt;New Account Information&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;在TW那边备份主目录&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_002n310e33bd.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;然后欢迎就OK了··  感觉速度快了很多···CP的功能也多了·&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_003p681a90b6.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;多了PostgreSQL的支持  日志也多了不少：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_004n7b476d35.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;其他就基本差不多··运行内存从TW的128M到Backy LLC的64M差别不大~&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_005n55f04ac2.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_006p53d63f83.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
</content>
                 <tag>服务器</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2010-03-26T14:12:44+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/tw-server-under-attack.html</loc>
        <lastmod>2010-03-25T13:26:51+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>TW服务器遭到攻击~关于昨天网站无法访问~</title>
                <content>
&lt;p&gt;前天晚上10点多开始~我突然发现我的网站速度不太正常~昨天上午开始直接上不了~&lt;/p&gt;

&lt;p&gt;难道的中国封了服务器，还是国外的服务器挂掉了呢··&lt;del&gt;但是域名解析正常~CP和网站都没有Ping的回应&lt;/del&gt; tracert那个地址发现到一个美国IP就没有回应~&lt;/p&gt;

&lt;p&gt;那样基本断定不是被G F W封掉~我把服务器换到原来注册的Fiber-Host也是没用~我就怀疑是美国那边的线路有问题·&lt;del&gt;发了Email给那边客服也没有回应&lt;/del&gt;&lt;/p&gt;

&lt;p&gt;今天上午起床访问就正常了···等到早上10点多收到客服的Email，内容如下：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hello,&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;We had to temporarily block all Chinese subnets due to DDOS attacks upon our server originating from China.  However, we have unblocked the Chinese subnets and are currently monitoring the situation to see if the DDOS attacks have stopped.  You should now be able to access your site.  I just checked it and was able to access it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;If you need further assistance, please let us know.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Thanks,&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;TWRPS&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;原来是遭受了来自中国的DDoS攻击·&lt;del&gt;所以暂时屏蔽了中国的IP&lt;/del&gt;国外的服务器一般都不会说直接挂掉~~还挂那么久的···&lt;/p&gt;

&lt;p&gt;希望不要再攻击啦·····&lt;/p&gt;

&lt;p&gt;顺便推荐一下社团的两个活动网站：&lt;/p&gt;

&lt;p&gt;地球一小时：http://eh.chuangewl.cn&lt;/p&gt;

&lt;p&gt;模拟炒股：http://cg.chuangewl.cn&lt;/p&gt;
</content>
                 <tag>服务器</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2010-03-25T13:26:51+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/delphi-access-ns-ms-method.html</loc>
        <lastmod>2010-03-19T20:36:10+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Delphi中ns和ms时间的获取方法</title>
                <content>
&lt;p&gt;今天突然和老师开始研究Delphi的编程~之前都是听说过~但是没有真的用过~老师说很不错~然后开始研究发现还真的不错啊···说说精确时间的获取~明天再讲讲关于DNS的问题~因为刚刚在做DNS解析的软件~&lt;/p&gt;

&lt;p&gt;要介绍的利用Windows API函数实现精确记时的方法。利用高性能频率记数法。利用这种方法要使用两个API函数&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;QueryPerformanceFrequency&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;QueryPerformanceCounter&lt;/code&gt;。&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;QueryPerformanceFrequency&lt;/code&gt;函数获得高性能频率记数器的震荡频率。&lt;/p&gt;

&lt;p&gt;调用该函数后，函数会将系统频率记数器的震荡频率（每毫秒）保存到一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LargeInteger&lt;/code&gt;中。不过利用该函数在几台机器上做过试验，结果都是1193180。读者朋友可以在自己的机器上试一下&lt;/p&gt;

&lt;p&gt;而&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;QueryPerformanceCounter&lt;/code&gt;函数获得系统频率记数器的震荡次数，结果也保存到一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Largenteger&lt;/code&gt;中。&lt;/p&gt;

&lt;p&gt;很显然，如果在计时中首先使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;QueryPerformanceFrequency&lt;/code&gt;获得高性能频率记数器每毫秒的震荡次数，然后在计时开始时使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;QueryPerformanceCounter&lt;/code&gt;函数获得当前系统频率记数器的震荡次数。&lt;/p&gt;

&lt;p&gt;在计时结束时再调用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;QueryPerformanceCounter&lt;/code&gt;函数获得系统频率记数器的震荡次数。将两者相减，再将结果除以频率记数器每毫秒的震荡次数，就可以获得某一事件经过的准确时间。(次数除以频率等于时间)&lt;/p&gt;

&lt;p&gt;我使用的代码是:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-delphi&quot;&gt;uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ActnMan, ActnColorMaps, XPMan, StdCtrls, IdBaseComponent,
IdComponent, IdUDPBase, IdUDPClient, IdDNSResolver,DateUtils,IdException;

var
t1,t2:int64;
r1,r2,r3:double;

QueryPerformanceFrequency(c1);//WINDOWS API 返回计数频率(Intel86:1193180)(获得系统的高性能频率计数器在一毫秒内的震动次数)
try
QueryPerformanceCounter(t1);//WINDOWS API 获取开始计数值
//需要计时的程序代码
QueryPerformanceCounter(t2);//获取结束计数值

r1:=(t2-t1)/c1;//取得计时时间，单位秒(s)
r2:=(t2-t1)/c1*1000;//取得计时时间，单位毫秒 (ms)
r3:=(t2-t1)/c1*1000000;//取得计时时间，单位微秒

&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;最后输出就可以了！~~~~&lt;/p&gt;

&lt;p&gt;好像可以精确到ns~&lt;/p&gt;
</content>
                 <tag>Delphi</tag> 
                 <tag>Delphi</tag> 
                <pubTime>2010-03-19T20:36:10+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/windows-2003-iis-6-fastcgi-php.html</loc>
        <lastmod>2010-03-15T22:55:51+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>Windows 2003 IIS 6 下配置 FastCGI 的 PHP</title>
                <content>
&lt;p&gt;下午重新安装了创E的服务器。Windows Server 2003 和 IIS 6 的，虽然之前也可以跑过 PHP，但用的是ISAPI，不知所以然，这次下的PHP5.2.3 不支持ISAPI了。google 一翻，终于实现手工配置 IIS 6 下以 FastCGI 跑 PHP。&lt;/p&gt;

&lt;p&gt;环境：
操作系统：Windows 2003 Server SP2
PHP 版本：php-5.3.2-Win32&lt;/p&gt;

&lt;h3 id=&quot;下载-fastcgi-for-iis6&quot;&gt;下载 FastCGI For IIS6&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://www.iis.net/expand/FastCGI&quot;&gt;http://www.iis.net/expand/FastCGI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;下载之后，双击运行进行安装。&lt;/p&gt;

&lt;p&gt;安装后在 C:\WINDOWS\system32\inetsrv 目录下产生了五个文件。&lt;/p&gt;

&lt;p&gt;同时在 IIS 的 “Web 服务扩展”里多了 FastCGI Handler。&lt;/p&gt;

&lt;h3 id=&quot;下载-php532-windows版&quot;&gt;下载 PHP5.3.2 Windows版&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://www.php.net/downloads.php&quot;&gt;http://windows.php.net/download/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;下载 .zip 格式的版本，下载后解压至 D:\PHP 目录，并给 IIS 启动帐户组或用户赋予读取和运行权限。&lt;/p&gt;

&lt;p&gt;你可以根据自己的意愿解压到别的目录。&lt;/p&gt;

&lt;h3 id=&quot;php-fastcgi&quot;&gt;PHP FastCGI&lt;/h3&gt;

&lt;p&gt;打开 C:\WINDOWS\system32\inetsrv\fcgiext.ini 文件。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;; This is the configuration file for the FastCGI handler for IIS 6.0.
; The FastCGI handler will look for this file in the same directory as
; fcgiext.dll. By default, the FastCGI installer will place this file into
; the %windir%\system32\inetsrv directory.

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;我个人的理解是，只要”Web 服务扩展”里的 FastCGI Handler 为允许时，在加载 fcgiext.dll 时，会读取 fcgiext.ini 配置文件的内容，根据里面的配置为每个网站提供映射。&lt;/p&gt;

&lt;p&gt;在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[Types]&lt;/code&gt; 下添加以下配置：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[Types]
php=PHP
[PHP]
ExePath=D:\PHP\php-cgi.exe
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;“php”表示扩展名，”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PHP&lt;/code&gt;“是配置节名称，以”&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[PHP]&lt;/code&gt;“定义。&lt;/p&gt;

&lt;h3 id=&quot;配置phpini&quot;&gt;配置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php.ini&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;将 D:\PHP\php.ini-recommended 复制一个，然后重命名为　D:\PHP\php.ini&lt;/p&gt;

&lt;p&gt;打开 D:\PHP\php.ini，修改：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;extension_dir = &quot;D:\PHP\ext&quot;
fastcgi.impersonate = 1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其它的根据实际需要对 php.ini 进行设置修改，这里只针对能跑 php，修改完记得重启 IIS。&lt;/p&gt;

&lt;h3 id=&quot;配置网站&quot;&gt;配置网站&lt;/h3&gt;

&lt;p&gt;右键网站 =&amp;gt; 属性 =&amp;gt; 主目录 =&amp;gt; 配置 =&amp;gt; 添加，&lt;/p&gt;

&lt;p&gt;在可执行文件路径：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\WINDOWS\system32\inetsrv\fcgiext.dll&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;然后文件扩展名写：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PHP&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;写个php测试下吧&quot;&gt;写个php测试下吧&lt;/h3&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;phpinfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;看到PHP的信息的话就说明你的服务器可以跑 php 了。&lt;/p&gt;

&lt;p&gt;打开后如果出现提示：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;No input file specified.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;估计是没配置 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fastcgi.impersonate&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;如果觉得过程麻烦，请看：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://hi.baidu.com/imdao/blog/item/16583512f11cb654f819b858.html&quot;&gt;http://hi.baidu.com/imdao/blog/item/16583512f11cb654f819b858.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;如果你还觉得麻烦，那就到 &lt;a href=&quot;http://www.zend.com/&quot;&gt;http://www.zend.com&lt;/a&gt; 下载 Zend Core，这个就什么都不用配置，安装完就可以使用了，连 MySQL 都有。&lt;/p&gt;

&lt;p&gt;重启IIS后,打开测试页出现如下提示:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;FastCGI Error
The FastCGI Handler was unable to process the request.
---------------------------------------------------------
Error Details:

Error Number: 5 (0x80070005).
Error Description: 拒绝访问。
HTTP Error 500 - Server Error.
Internet Information Services (IIS)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这个错误是由于在解压PHP之后,没有对IIS启动帐户赋予该目录的读取和运行权限.修改文件夹安全属性,问题解决.&lt;/p&gt;

</content>
                 <tag>PHP</tag>  <tag>服务器</tag> 
                 <tag>服务器</tag> 
                <pubTime>2010-03-15T22:55:51+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/wp-plugin-automatically-cut-off.html</loc>
        <lastmod>2010-03-12T08:36:34+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>一个很不错的WP自动截断插件~</title>
                <content>
&lt;p&gt;之前安装过一个WP自动截断插件~是按照段落的~感觉很好·~但是换服务器的时候居然丢失了··找了很久都没找到·~&lt;/p&gt;

&lt;p&gt;其他的一些插件都是按照字数去截断~感觉很不方便~而且显示效果都不是很好~~而且还不能自己定制截断后显示的字符~&lt;/p&gt;

&lt;p&gt;昨晚晚找了很久终于找到了···原来叫做wp-summary-automatically  不敢独享~拿出来大家看看···希望你也喜欢~&lt;/p&gt;

&lt;p&gt;后台截图如下：  &lt;img src=&quot;/images/2010/03/zrclip_002n1a69fb53.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;下载地址：http://deloz.net/1000000344.html&lt;/p&gt;

&lt;p&gt;或者下载文件：&lt;a href=&quot;http://dl.dbank.com/c0wblwppwn&quot;&gt;wp-summary-automatically.rar&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>WordPress</tag>  <tag>插件</tag> 
                 <tag>WordPress插件</tag> 
                <pubTime>2010-03-12T08:36:34+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/jiaying-university-network-solutions-v1.html</loc>
        <lastmod>2010-03-02T22:18:34+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>嘉应学院网络常见问题解决方案 V1.0</title>
                <content>
&lt;h2 id=&quot;很久前写的一份东西放上来希望对在校的网管有帮助应该会不断完善的谢谢大家支持&quot;&gt;很久前写的一份东西&lt;del&gt;放上来~希望对在校的网管有帮助&lt;/del&gt;应该会不断完善的&lt;del&gt;谢谢大家支持·&lt;/del&gt;&lt;/h2&gt;

&lt;h3 id=&quot;网络设置的问题&quot;&gt;网络设置的问题&lt;/h3&gt;

&lt;p&gt;﻿&lt;a href=&quot;/images/2010/03/1.jpg&quot;&gt;&lt;img src=&quot;/images/2010/03/1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;这种原因比较多出现在需要手动指定IP、网关、DNS服务器联网方式下，仔细检查计算机的网络设置。&lt;/p&gt;

&lt;h3 id=&quot;ip设置常见错误类型&quot;&gt;IP设置常见错误类型&lt;/h3&gt;

&lt;p&gt;此状况出现的两种原因是:&lt;/p&gt;

&lt;p&gt;1.子网掩码设置出错最常见的是255.255.255.0&lt;/p&gt;

&lt;p&gt;正常的是255.255.254.0&lt;/p&gt;

&lt;p&gt;或者255.255.252.0&lt;/p&gt;

&lt;p&gt;2.网关设置出错.
&lt;!-- more --&gt;
请各位同学务必仔细检查设置的IP地址、子网掩码、网关准确无误。&lt;/p&gt;

&lt;p&gt;Ping 127.0.0.1和本机IP可以测试本机网卡以及协议是否安装正确&lt;/p&gt;

&lt;p&gt;﻿&lt;img src=&quot;/images/2010/03/2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;如果是这里出现问题估计是该网卡或者网络驱动、协议出现问题&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;注意：未拨号前网关是Ping不通的，这个跟802.1x协议有关&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;dns服务器的问题&quot;&gt;DNS服务器的问题&lt;/h3&gt;

&lt;p&gt;当IE无法浏览网页时，可先尝试用IP地址来访问，如果可以访问，那么应该是DNS的问题，造成DNS的问题可能是连网时获取DNS出错或DNS服务器本身问题.&lt;/p&gt;

&lt;p&gt;我们学校自己架设了210.38.161.130的DNS有时对某些域名有问题，可以尝试把首选改为202.96.128.86.&lt;/p&gt;

&lt;h3 id=&quot;dns设置出错&quot;&gt;DNS设置出错&lt;/h3&gt;

&lt;p&gt;学校的DNS是210.28.161.130 以及202.96.128.86&lt;/p&gt;

&lt;p&gt;第一个是学校自己架设的DNS服务器，&lt;/p&gt;

&lt;p&gt;第二个是电信的DNS。&lt;/p&gt;

&lt;p&gt;如果把DNS的值设置错了,会导致解析不了域名,QQ等聊天工具仍然可以上网的情况.&lt;/p&gt;

&lt;h3 id=&quot;网络防火墙的问题&quot;&gt;网络防火墙的问题&lt;/h3&gt;

&lt;p&gt;如果网络防火墙设置不当，如安全等级过高、不小心把IE放进了阻止访问列表、错误的防火墙策略等，可尝试检查策略、降低防火墙安全等级或直接关掉试试是否恢复正常。&lt;/p&gt;

&lt;h3 id=&quot;杀毒软件问题&quot;&gt;杀毒软件问题&lt;/h3&gt;

&lt;p&gt;常见的杀软有:卡巴斯基,金山毒霸,瑞星,NOD32,驱航舰,小红伞,麦咖啡,江民KV系列,大蜘蛛等等.&lt;/p&gt;

&lt;p&gt;存在不兼容的有卡巴斯基、瑞星、NOD32的3.0、驱航舰以及金山毒霸套装。&lt;/p&gt;

&lt;p&gt;如果是一直寻找服务器的话可以先尝试关闭杀毒软件和防火墙&lt;/p&gt;

&lt;h3 id=&quot;ie浏览器本身的问题&quot;&gt;IE浏览器本身的问题&lt;/h3&gt;

&lt;p&gt;当IE浏览器本身出现故障时，自然会影响到浏览了；如果你的浏览器设置了代理选项，请把代理选项去掉；或者IE被恶意修改破坏也会导致无法浏览网页。这时可以尝直接把IE还原为默认设置。&lt;/p&gt;

&lt;p&gt;硬件类&lt;/p&gt;

&lt;h3 id=&quot;网卡问题&quot;&gt;网卡问题&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;网卡检查方法:采用前面提过的ping方法,&lt;/li&gt;
  &lt;li&gt;网卡可能会由于该系统的出现屏蔽问题,导致上不了网,卸载该网卡重新安装测试&lt;/li&gt;
  &lt;li&gt;网卡可能会因为灰尘很多或者松动,导致短路上不了,出现的是注销成功,集成网卡就无视这一项&lt;/li&gt;
  &lt;li&gt;如果这两项均无效,可以断定为网卡有故障, 如果是集成的,只能重配一张网卡.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;手提电脑无线网卡&quot;&gt;手提电脑无线网卡&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;这种问题常见于一些手提电脑出现登陆超时问题.&lt;/li&gt;
  &lt;li&gt;这种问题出现的是无线网卡没有给禁用.&lt;/li&gt;
  &lt;li&gt;禁用无线网卡即可.&lt;/li&gt;
  &lt;li&gt;网络邻居à属性à找到改无线网卡à禁用即可.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;网线问题&quot;&gt;网线问题&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;网线问题出现的可能性比较小,但也请注意一下.&lt;/li&gt;
  &lt;li&gt;新购入网线使用的时候,比较容易发生的问题,一般的是网线的水晶头里面的线有问题.一般是,橙白–1，橙–2，绿白–3，蓝–4，蓝白–5，绿–6，棕白–7，棕—8&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;如果是这样就是正常的!&lt;/p&gt;

&lt;h3 id=&quot;室内交换机问题&quot;&gt;室内交换机问题&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;交换机问题会导致整个宿舍上不了,也有可能是整个宿舍只有一个人能上得了网络,有可能是该宿舍有同学开了主动防御或者ARP攻击。会出现的现象是整个宿舍的交换机同闪同灭的.&lt;/li&gt;
  &lt;li&gt;解决办法:拔交换机电源10秒左右重新插起。&lt;/li&gt;
  &lt;li&gt;还要注意交换机到宿舍端口的线是否已连接&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;关于使用路由器而不是交换机&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/3.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;将宿舍端口线接入1 2 3 4 口，即把路由器当交换机用。&lt;/p&gt;

&lt;p&gt;在登陆时，如果自动出现选择网卡选项&lt;/p&gt;

&lt;p&gt;请先确认你的本地连接没有被禁用，如果有无线网卡请先停用无线网卡及1394连接，只启用有线网卡的本地连接！&lt;/p&gt;

&lt;p&gt;在登陆时，如果自动出现选择网卡选项，寻找网络适配器，请安装winpcap 。点这里下载。然后重新登陆。&lt;/p&gt;

&lt;p&gt;解决方法如下：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;拨号软件弹出窗口要选择网络适配器，没有选项，基本上都是因为安全卫士360的问题，5.2.0.1020版本的，卸载掉，就可以解决了，再安装最新版本的就OK。&lt;/li&gt;
  &lt;li&gt;还有种方法，打开360–实时保护–高级设置–恢复，这样360会把文件和驱动恢复，卸载客户端和WINPCAP，重新装客户端，完成后先不要重启，拨号，360会提示是否加载驱动，点  “是” ，拨号，就OK了&lt;/li&gt;
  &lt;li&gt;如果不能解决，可能你的电脑需要重新安装操作系统才能解决这个问题&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;拨号时显示登录超时&quot;&gt;拨号时显示”登录超时&lt;/h3&gt;

&lt;p&gt;•  如果是本地连接显示“X”，“网络电缆未接好或者被拔出”，即是网线没有插好或者宿舍的端口坏掉，请报修。（注意是直接连在宿舍网络端口的情况，如果是小交换机就先看看小交换机加电没！）&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;• ip地址/子网掩码/默认网关/DNS设置错误（请仔细核对网络中心分配给你的房间/床号对应的那五组数据）&lt;/p&gt;

&lt;h3 id=&quot;经常性的断线问题及其解决方法&quot;&gt;经常性的断线问题及其解决方法&lt;/h3&gt;

&lt;p&gt;• 1）如果周围的同学也是一样经常掉线，很可能是因为本栋宿舍ARP攻击太严重，请安装网络中心提供的AntiARP软件并报网管或网络中心。&lt;/p&gt;

&lt;p&gt;•  2）如果只有你一台机器经常掉线，很可能是网络上有相同的MAC地址，请抄下本机的MAC地址到网络中心查询。（正版的网卡每一个都拥有唯一的MAC地址；非正版的网卡极易出现一批网卡相同MAC的情况。）&lt;/p&gt;

&lt;p&gt;到网络中心办理业务注意事项&lt;a href=&quot;file:///C:/Users/Administrator/AppData/Local/Temp/WindowsLiveWriter-429641856/supfiles1D59EA/clip_image012[3].jpg&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;如遇到问题，可以网络故障申报台&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://210.38.160.62/jync/&quot;&gt;http://210.38.160.62/jync/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;登记故障&lt;/p&gt;

&lt;p&gt;到网络中心414房间来报修和查对密码的时候带上你的身份证或学生证，无此二证之一者不予办理！&lt;/p&gt;

&lt;h3 id=&quot;常见故障申报后处理如下&quot;&gt;常见故障申报后处理如下&lt;/h3&gt;

&lt;p&gt;（以下时间均指工作日，非工作日顺延）
1.解除IP/MAC绑定下午4点前登记的当天解决；4点后登记第二天解决。
2.还原密码：忘记密码的用户可选择这一项。还原密码为身份证号后8位（如果有X，X大写）。时间同IP&lt;/p&gt;

&lt;p&gt;3.其他故障则 根据具体的情况具体处理，处理时间根据故障严重程度不同而不同。用户可通过“查看已报故障”跟踪处理情况。&lt;/p&gt;

&lt;p&gt;**强调：用户必须具体描述故障情况。笼统的写“不能上网”之类的，将被打回，不予处理。有关故障的描述越详细，处理速度将越快 **&lt;/p&gt;
</content>
                 <tag>网络工程</tag> 
                 <tag>网络工程</tag> 
                <pubTime>2010-03-02T22:18:34+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/suffering-record-on-space.html</loc>
        <lastmod>2010-02-22T22:21:26+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>更换空间磨难记~</title>
                <content>
&lt;p&gt;2010年2月19日晚，因为想申请个000webhost的空间给创E用，结果第二天发现自己的空间给000webhost封了，账号被取消。&lt;/p&gt;

&lt;p&gt;记得昨晚 刚刚被空间取消创E的申请的时候，自己的博客马上发生异常，利用后台的Backup功能马上备份了一份，刚好king介绍一个空间给我（http://www.ifunkey.com/3479.html），我便马上跑去申请。然后更新域名的解析，发现一直不会生效，用FTP把东西上传了，第二天才发现解析生效，但是网站一直不行。&lt;/p&gt;

&lt;p&gt;重新上传了一个全新的WordPress，然后连接数据库，把全新的WordPress安装成功后，再把数据库覆盖，结果发现那些数据是N久前的···可恶的000居然不是实时备份··看一下Gmail的数据库备份，是15号的，将就着覆盖上去，幸亏新年那几天没发文章，就是有些评论丢失了·部分刚写的文章在 ZoundryRaven里面还有副本，损失还不算严重，把wp-content上传回去，结果好多插件没有更新啊··&lt;/p&gt;

&lt;p&gt;还有一部分日志的图片丢失，但是博客总算回来了·哎···多灾多难啊···先写一点吧，有空再补充。如果空间再出问题，就决定用Godaddy 的.com域名加10G空间~~&lt;/p&gt;
</content>
                
                 <tag>博客大事记</tag> 
                <pubTime>2010-02-22T22:21:26+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/good-effect-of-flash-tag-cloud.html</loc>
        <lastmod>2010-02-19T19:13:00+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>效果很好的Flash标签云</title>
                <content>
&lt;p&gt;昨天king说我的Flash标签云有问题，所以传了一个他自己在用的支持中文的版本给我，今天网友life@sync说希望我传上去，自然不敢独享，上传到skydrive。大家一起分享。&lt;/p&gt;

&lt;p&gt;如果文件下载链接不行的话就麻烦到Dbank下载。&lt;/p&gt;

&lt;p&gt;Dbank链接：&lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=MzQzMDQyNDk=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;wp-cumulus.zip&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;用法有需要的话留言一下·我补充上去~Sorry哦·&lt;/p&gt;
</content>
                 <tag>插件</tag> 
                 <tag>WordPress插件</tag> 
                <pubTime>2010-02-19T19:13:00+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/about-yupoo-wordpress2-9-problem.html</loc>
        <lastmod>2010-02-14T10:14:00+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>关于Yupoo相册插件在WordPress2.9的问题</title>
                <content>
&lt;p&gt;之前写了一篇&lt;a href=&quot;/windows-livewrite-error-wordpress-solution.html&quot;&gt;关于WordPress用WindowsLiveWrite出错解决方法&lt;/a&gt;的文章，原来不能用wlw更新分类的问题也就解决了。&lt;/p&gt;

&lt;p&gt;但是过了两天我却发现wlw又没办法更新分类出现了以下错误：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;尝试登陆时发生意外错误：&lt;/p&gt;

  &lt;p&gt;服务器响应无效 - 从日志服务器接收的对blogger.getUsersBlogs方法的响应无效：&lt;/p&gt;

  &lt;p&gt;Invalid response document returned from XmlRpc server&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;还会出现提示，要求输入用户名和密码，但是输入正确之后还是弹出这个。&lt;/p&gt;

&lt;p&gt;用之前介绍的Zoundry Raven也是提示出错，&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;unclosed token: line 155, column 0

zoundry.blogpub.xmlrpc.xmlrpcserverimpl.ZXmlRpcException: {ZBlogServerException['metaWeblog.getCategories' type:Error, code:0 msg:unclosed token: line 155, column 0]}
at zoundry\blogpub\xmlrpc\xmlrpcserverimpl.pyo:1005 [getCategories()] -&amp;gt; None
at zoundry\blogapp\services\pubsystems\blog\xmlrpc.pyo:18 [_listCategories()] -&amp;gt; None
at zoundry\blogapp\services\pubsystems\blog\blogpublisher.pyo:519 [listCategories()] -&amp;gt; None
at zoundry\blogapp\services\pubsystems\blog\blogcommands.pyo:338 [listCategoriesForBlog()] -&amp;gt; None
at zoundry\blogapp\services\pubsystems\blog\blogcommands.pyo:331 [listCategories()] -&amp;gt; None
at zoundry\blogapp\services\pubsystems\blog\blogcommands.pyo:326 [doCommand()] -&amp;gt; None
at zoundry\blogapp\ui\util\publisherutil.pyo:396 [updateCategories()] -&amp;gt; None
at zoundry\blogapp\ui\util\publisherutil.pyo:509 [_updateCategories()] -&amp;gt; None
at zoundry\blogapp\ui\util\publisherutil.pyo:487 [_run()] -&amp;gt; None
at zoundry\appframework\services\backgroundtask\backgroundtaskimpl.pyo:265 [run()] -&amp;gt; None
Caused By:
xml.parsers.expat.ExpatError: {unclosed token: line 155, column 0}
at zoundry\blogpub\xmlrpc\zpatch\xmlrpclib.pyo:560 [close()] -&amp;gt; None
at zoundry\blogpub\xmlrpc\zpatch\xmlrpclib.pyo:1441 [_parse_response()] -&amp;gt; None
at zoundry\blogpub\xmlrpc\zpatch\xmlrpclib.pyo:1230 [request()] -&amp;gt; None
at zoundry\blogpub\xmlrpc\zpatch\xmlrpclib.pyo:1565 [__request()] -&amp;gt; None
at zoundry\blogpub\xmlrpc\zpatch\xmlrpclib.pyo:1163 [__call__()] -&amp;gt; None
at zoundry\blogpub\xmlrpc\xmlrpcserverimpl.pyo:829 [_metaWeblogGetCategories()] -&amp;gt; None
at zoundry\blogpub\xmlrpc\xmlrpcserverimpl.pyo:1314 [_metaWeblogGetCategories()] -&amp;gt; None
at zoundry\blogpub\xmlrpc\xmlrpcserverimpl.pyo:1002 [getCategories()] -&amp;gt; None

Thread: [bgtask:id:00000126cbd8439500c000a8000100986ea0ce2b]

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样就让我非常郁闷，就是我基本肯定是插件出问题。因为当我禁用所有插件之后就可以正常更新和发布，所有我用排除法一个个把插件开启，并测试更新，当我启用到YuPooAlbum这个插件的时候，就出问题，那就确定了根源了。&lt;/p&gt;

&lt;p&gt;原因分析：&lt;/p&gt;

&lt;p&gt;YuPooAlbum这个插件在我之前一篇文章《&lt;a href=&quot;/wordpress-2-9-seven-new-files.html&quot;&gt;WordPress 2.9不再有的七个文件和对应新版本&lt;/a&gt;》有提到，里面说到在Wordpress2.9下面会提示缺少&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp-includes/gettext.php&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp-includes/streams.php&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;但是当我把文件改成对应文件后 YupooAlbum插件依旧无法工作。虽然后来做一些更改之后插件算是正常，但是经常会找不到照片，我也就一直研究中，插件也就一直开着，我怀疑Wordpress2.9的文件除了改名还改变了原有文件的一些参数。导致插件调用出错。禁用插件后一切正常。希望YuPoo能推出新版本的插件。&lt;/p&gt;

&lt;p&gt;如果你也遇到这样的问题也可以试试是不是插件出错了。&lt;/p&gt;
</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-02-14T10:14:00+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/zoundry-raven-write-wordpress-blog.html</loc>
        <lastmod>2010-02-10T14:31:00+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>用Zoundry Raven写WordPress博客</title>
                <content>
&lt;p&gt;之前一直用wlw（WindowsLiveWriter）写博客，虽然有不少插件，但是wlw经常会出现一些莫名其妙的问题，加上wlw不是绿色软件，每次重装系统都要重装，还要同步很多东西。所以感觉相当麻烦。&lt;/p&gt;

&lt;p&gt;最近发现这个叫Zoundry Raven，它为WordPress专门优化过，很符合WordPress发布环境。&lt;/p&gt;

&lt;p&gt;其中最好的优化是wp的slug（日志的缩略名），wlw和ScribeFire都不支持的，但是在Zoundry Raven里你可以方便设置。&lt;/p&gt;

&lt;p&gt;下面我们开始介绍Zoundry Raven：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_007p21ddbd4c.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;首先去下载： &lt;a href=&quot;http://www.dbank.com/download.action?t=40&amp;amp;k=MzUyNzY5NDU=&amp;amp;pcode=LCwxMjAzODksMTIwMzg5&amp;amp;rnd=4&quot;&gt;zRaven-1.0.375.exe&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;我是直接在云端下载的，至于云端是什么？你可以 &lt;a href=&quot;http://g.cn/&quot;&gt;Google&lt;/a&gt; 一下或者 &lt;a href=&quot;http://baidu.com/&quot;&gt;百度&lt;/a&gt; 一下。我应该会写篇文章介绍一下云端这个软件。&lt;/p&gt;

&lt;p&gt;然后一运行就测到我电脑的wlw，问你是否导入，导入之后你wlw里面的东西也就导进来。省去设置的麻烦。&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;img src=&quot;/images/2010/03/zrclip_008n25b198.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;可以看到左边有很多博客都是支持的。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_009p58ab6f2f.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;他会自动检测到WordPress，输入账号密码就OK&lt;/p&gt;

&lt;p&gt;他连API地址都帮你搞定，WP的API链接是http://你的博客/xmlrpc.php&lt;/p&gt;

&lt;p&gt;然后他就会更新你的博客内容到你电脑，这样你的电脑也就有了你博客的备份，一举两得啊！&lt;/p&gt;

&lt;p&gt;主界面如下，点&lt;img src=&quot;/images/2010/03/zrclip_010n5f15450b.png&quot; alt=&quot;&quot; /&gt;开始写Blog啦·····&lt;/p&gt;

&lt;p&gt;你还可以在博客账号那里右键，选择”模版”，把你的模版下载下来，方便预览。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_011p9aa7466.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;接下来介绍一下Zoundry Raven的特性：&lt;/p&gt;

&lt;p&gt;首先，可以一次发文章到多个站点，点击撰写页面右上角的&lt;img src=&quot;/images/2010/03/zrclip_013p5991011c.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;就可以添加你要发布的站点了&lt;/p&gt;

&lt;p&gt;然后，上面这个选项，才是重头戏。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_014p3eaa356.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;分类就不用说啦。&lt;/p&gt;

&lt;p&gt;常规这个选项卡有好多功能。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_015p675d1269.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;可以发布为草稿（wlw好像不能），设置发布时间；&lt;/p&gt;

&lt;p&gt;为图片加上 LightBox 效果选项（wlw也是没有的）；&lt;/p&gt;

&lt;p&gt;缩略名这个选项可以设置文章别名（亮点之一）下面还能设置日志密码。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_016p3221a408.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_017p53121cd.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;可以看到，里面还有ping那些收录网站，trackback别人的文章。而且对于WordPress来说，支持&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_018n2438b45.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;最后一点，Zoundry Raven支持WordPress的more标签，&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/03/zrclip_019n73e8737.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Zoundry Raven还有好多好用的功能，你可以慢慢发掘。&lt;/p&gt;
</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-02-10T14:31:00+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/create-wordpress-gestbook-no-plugin.html</loc>
        <lastmod>2010-02-07T17:30:20+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>无插件创建WordPress留言板</title>
                <content>
&lt;p&gt;首先把主题目录下的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;single.php&lt;/code&gt;复制一份，改名为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guestbook.php&lt;/code&gt;; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;comments.php&lt;/code&gt;文件复制并改名为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guestcomments.php&lt;/code&gt;;&lt;/p&gt;

&lt;p&gt;然后打开&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guestbook.php&lt;/code&gt;文件,在&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这段代码下面,添加以下代码:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;/*
Template Name: GuestBook
*/&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;并修改&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;comments_template&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;为&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;comments_template&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/guestcomments.php'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最后保存文件.&lt;/p&gt;

&lt;p&gt;添加一个页面,页面模板选&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guestbook.php&lt;/code&gt;,保存。留言板就建成了。&lt;/p&gt;

&lt;p&gt;最后按照你的风格和习惯修改留言板的内容和风格，把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guestbook.php&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guestcomments.php&lt;/code&gt;的内容修改好，例如：&lt;/p&gt;

&lt;p&gt;让最新留言显示在顶部，把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guestcomments.php&lt;/code&gt;中：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$comments&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$comment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;替换成&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;array_reverse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$comments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$comment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;还有就是把所有“xxx条评论”改成“xxx条留言“把“发布评论”按钮的提示改成“发布留言“等等细节修改。&lt;/p&gt;

&lt;p&gt;让它更加适合留言板的风格。&lt;/p&gt;

&lt;p&gt;你的留言板就建成了。&lt;a href=&quot;/guestbook.html&quot;&gt;我的留言板&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-02-07T17:30:20+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/windows-livewrite-error-wordpress-solution.html</loc>
        <lastmod>2010-02-07T08:49:00+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>关于WordPress用WindowsLiveWrite出错解决方法</title>
                <content>
&lt;p&gt;之前写过一篇日志关于&lt;a href=&quot;/windows-live-writer-released-wordpress.html&quot;&gt;用Windows live writer离线发布Wordpress日志&lt;/a&gt;。一开始使用很正常，有一天突然发现我的类别更新不了，他会提示：从日志服务器接收的对 wp.getCategories 方法的响应无效:的问题。如下图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/image8.png&quot;&gt;&lt;img src=&quot;/images/2010/image8.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;让我一直摸不清头脑，不知道到底是那里出了问题。经过多天的研究和Goolge之后都没有很详细的解答。突然有一天看到一篇关于后台增加分类后就无法更新的问题。我根据他的方法去把我增加的分类删除之后还是一样出现那个错误。&lt;/p&gt;

&lt;p&gt;偶然看到很多Blog都在说：“尝试连接到您的日志时出错:服务器响应无效 – 从日志服务器接收的对 blogger.getUsersBlogs 方法的响应无效:Invalid response document returned from XmlRpc server必须先纠正此错误才能继续操作。”这个错误，好像跟我的有几分相似。都是说wordpress返回的的XmlRpc无法被wlw识别。可具体是那个部分不对却没给提示。&lt;/p&gt;

&lt;p&gt;他们说这是因为wordpress本身的一个bug。在utf-8编码下，xml-rpc返回的格式不正确，缺了三个字节，所以wlw就会提示出错。解决的方法是找到博客目录的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp-includes&lt;/code&gt;下的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;class.ixr.php&lt;/code&gt;，然后用一个文本编辑工具打开它，查找：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;strlen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;替换为：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;strlen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$xml&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;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;我按照这个方法修改之后就真的没问题了··看来这个Bug影响不小啊。&lt;/p&gt;

&lt;p&gt;总结一下解决方法：&lt;/p&gt;

&lt;p&gt;1、首先先禁用刚刚启用的插件；&lt;/p&gt;

&lt;p&gt;2、更换主题，或者直接用回原主题；&lt;/p&gt;

&lt;p&gt;3、把原版的xmlrpc.php替换上去试一下；&lt;/p&gt;

&lt;p&gt;4、如果是提示服务器错误405：则到后台撰写里启用远程发布里的xmlrpc即可：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/image9.png&quot;&gt;&lt;img src=&quot;/images/image9.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/image10.png&quot;&gt;&lt;img src=&quot;/images/image10.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5、尝试连接到您的日志时出错:服务器响应无效&lt;/p&gt;

&lt;p&gt;从日志服务器接收的对 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;blogger.getUsersBlogs&lt;/code&gt; 方法的响应无效:Invalid response document returned from XmlRpc server必须先纠正此错误才能继续操作–的错误提示按照上面的方法解决！&lt;/p&gt;

&lt;p&gt;这篇文章就是用wlw写的然后发布的~&lt;/p&gt;

&lt;p&gt;基本上就是这样啦··希望这篇文章对你有帮助！！&lt;/p&gt;

</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-02-07T08:49:00+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/wordpress-home-call-qq-sign.html</loc>
        <lastmod>2010-02-06T10:38:00+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress首页调用QQ签名</title>
                <content>
&lt;p&gt;看到我的博客的朋友一定注意到我的页面旁边一个QQ签名的实时显示，如下图：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/image.png&quot;&gt;&lt;img src=&quot;/images/2010/image.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;是怎么实现的呢？？下面一步步告诉你。希望对你有帮助。&lt;/p&gt;

&lt;p&gt;首先登陆QQ滔滔首页：&lt;a href=&quot;http://www.taotao.com/&quot;&gt;http://www.taotao.com/&lt;/a&gt;并且登陆（如果是IE的话快速登陆很快）：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/image1.png&quot;&gt;&lt;img src=&quot;/images/2010/image1.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;然后在上面导航栏选择插件：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/image2.png&quot;&gt;&lt;img src=&quot;/images/2010/image2.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;可以看到有Flash、图片、好友圈还有JavaScript四种插件。很多教程都是说使用JavaScript的方法，但是我在自己的WordPress上实验老是获取不到QQ号。&lt;/p&gt;

&lt;p&gt;所以这一次我大胆地选择使用Flash版本。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/image3.png&quot;&gt;&lt;img src=&quot;/images/2010/image3.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;在样式那选择你喜欢的样式，还要注意的一点是，Flash的字体背景是透明的，我黑色背景就只能是选”秋色盎然“，不然的话字体在我的博客上看不到。让吧代码发坐下来，我的代码如下：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;embed&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;object&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;classid=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;codebase=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;180&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;400&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/embed&amp;gt;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;如果你是想像我一样在侧边栏显示的话，在后台主题的小工具&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/image4.png&quot;&gt;&lt;img src=&quot;/images/2010/image4.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/image5.png&quot;&gt;&lt;img src=&quot;/images/2010/image5.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;然后将代码复制到里面，最重要的一部就是根据你主题的侧边栏大小修改Flash的长度还有你喜欢的高度&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/image6.png&quot;&gt;&lt;img src=&quot;/images/2010/image6.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;修改代码中两个 width=”180” 和height=”400”为你想要的值。&amp;amp;num=20则为你要显示心情的条数。可以自己修改。最后保存就可以了·······&lt;/p&gt;

&lt;p&gt;插件还有图片的形式。你也可以使用图片进行调用&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/2010/image7.png&quot;&gt;&lt;img src=&quot;/images/2010/image7.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;代码如下：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;img&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://p.taotao.com/images/head/50/49/74/13/350497413_1.png&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;alt=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;scr=”“&lt;/code&gt;部分替换为你的图片地址即可。&lt;/p&gt;

&lt;p&gt;但是图片的话限制相对比较多，宽度是150到200.签名型图片则大小固定，虽然可以通过代码限定大小，但是效果可能不好。大家可以看着用。&lt;/p&gt;
</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-02-06T10:38:00+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/picture-with-wordpress.html</loc>
        <lastmod>2010-02-05T11:09:58+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress的头像使用</title>
                <content>
&lt;p&gt;这两天查了头像插件方面的资料，也在自己的博客应用了。不敢独享，大家一起研究一下。&lt;/p&gt;

&lt;p&gt;以下资料来自：http://fairyfish.net/2007/06/24/gravatars2/&lt;/p&gt;

&lt;p&gt;目前在 WordPress 支持 Gravatar 的插件（就我所知）有三个：&lt;/p&gt;

&lt;p&gt;第一个是 Gravatar 官方推出的 WP Gravatar，这个插件比较简单，实现的功能很少，仅仅显示头像，如果留言者没有在 Gravatar 上注册头像，它就会显示一个默认的 Gravatar 官方的头像。&lt;/p&gt;

&lt;p&gt;第二个是 skippy dot net 的 Gravatars，它的基本功能和官方的功能基本上一致，没什么很大的区别。&lt;/p&gt;

&lt;p&gt;最后一个，也是本站使用的 ZenPax 的 Gravatars2，该插件是在 skippy dot net 的 Gravatars 基础上改进的，首先就是它在本地注册的用户，可以直接在本地上传图像，如果不想在 Gravatar 上注册头像的话。另外，它在你服务器上缓存了头像，节省访问 gravatar.com 服务器的时间。&lt;/p&gt;

&lt;p&gt;最后本人最喜欢的它一个功能是，默认头像可以设置到一个文件夹下面，它可以随机选取一张头像给未在 Gravatar 上注册的留言者，这样就可以让留言区域的头像比较丰富，而不会显得单一，因为在国内到 Gravatar 上注册的人不是很多。&lt;/p&gt;

&lt;p&gt;呵呵，像本站就使用了洋葱头的一组头像。下面就给大家介绍下 Gravatars2 的安装和使用： 在使用之前，你要确认你没有使用别的 Gravatar 插件，如有，请停止它。&lt;/p&gt;

&lt;p&gt;目前该插件的版本是2.62，你可以到这里下载，下载之后解压缩之后，把文件上传到合适的位置（压缩包中文件的层次关系就已经告诉你了合适的位址），然后把 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp-content&lt;/code&gt; 目录下的 gravatar 文件夹设置为可写，然后到插件管理界面激活 Gravatars2 插件，也可以激活&lt;/p&gt;

&lt;p&gt;Gravatars2-WPCron这个插件用于定时去 gravatar.com 服务器上获取头像缓存到本地，或者你也可以把 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gravatars2-cache-refresh.php&lt;/code&gt;（该文件在压缩包中）这个文件上传到你的 WordPress 根目录下，然后通过 Unix 的 Crorn 去执行它。&lt;/p&gt;

&lt;p&gt;这个 Cron Job 如下所示：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;0 &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; /full_path_to_blog/gravatars2-cache-refresh.php 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;到 Options » Gravatars，把 Cache gravatars? 设置为 yes。然后上传一个包含图像文件夹到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp-content/gravatar/&lt;/code&gt;目录下， 把默认头像图片选择刚才上传的文件夹，就可以实现默认头像丰富多彩。&lt;/p&gt;

&lt;p&gt;其他设置皆为默认即可。 然后在你的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;style.css&lt;/code&gt; 文件中插入以下样式头像的代码：&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;.gravatar&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;solid&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;clear&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;both&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后在你的 comments.php 中的留言循环体中输入以下代码即可就算安装完成了：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; 
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;function_exists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'gravatar'&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;nf&quot;&gt;gravatar_image_link&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;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;以下是我个人的经验 首先，所谓的comments.php 中的留言循环体是指在你主题文件夹里的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;comments.php&lt;/code&gt;文件中有Comment Loop注释部分。&lt;/p&gt;

&lt;p&gt;最新版本的Gravatars2的CSS代码如下：&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;.gravatar&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;solid&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#fff&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;nc&quot;&gt;.postgrav&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;margin-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;margin-left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;solid&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;我安装了之后发现，现在的WordPress版本都支持gravatar，就是不安插件也没问题。那为什么还要用插件呢？因为插件可以更好的管理头像还有可以缓存头像到服务器，加快访问速度~~所以呢还是建议使用插件的···&lt;/p&gt;
</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-02-05T11:09:58+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/server-down-ddos-attack.html</loc>
        <lastmod>2010-02-04T13:35:13+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>服务器又挂了~DDoS攻击</title>
                <content>
&lt;p&gt;早上博客上不了~~~一上服务商控制面板的页面，居然看到以下提示：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Server #42 is under the DDOS attack (IP Nullrouted)
We have just received a HUGE (over 3GB/s incoming traffic) DDoS attack targeting the Server #42. Our CISCO guard firewall was unable to handle such attack, so one of the server IP 64.120.149.59 address was disabled (all the rest websites on this server are working fine).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;If your website is using this IP (due to unique IP rotation system only 3% websites are using this IP) it will be unavailable for the next 6 hours. As soon attack will subside, this IP address will be enabled and your website will start working again. We thank you for your patience and understanding.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;only 3%？？？？这么小的概率我都中？？？？？&lt;/p&gt;

&lt;p&gt;我的博客真是命途多舛啊······之前是服务器无缘无故挂掉，现在是受到DDOS攻击？？？郁闷的我···但是king的却没事··郁闷···现在基本恢复正常。&lt;/p&gt;

&lt;p&gt;下面顺便解释一下DDOS攻击(来自百度百科：http://baike.baidu.com/view/23271.htm)：&lt;/p&gt;

&lt;p&gt;DoS的攻击方式有很多种，最基本的DoS攻击就是利用合理的服务请求来占用过多的服务资源，从而使服务器无法处理合法用户的指令。&lt;/p&gt;

&lt;p&gt;DDoS攻击手段是在传统的DoS攻击基础之上产生的一类攻击方式。单一的DoS攻击一般是采用一对一方式的，当被攻击目标CPU速度低、内存小或者网络带宽小等等各项性能指标不高,它的效果是明显的。随着计算机与网络技术的发展，计算机的处理能力迅速增长，内存大大增加，同时也出现了千兆级别的网络，这使得DoS攻击的困难程度加大了 - 目标对恶意攻击包的”消化能力”加强了不少，例如你的攻击软件每秒钟可以发送3,000个攻击包，但我的主机与网络带宽每秒钟可以处理10,000个攻击包，这样一来攻击就不会产生什么效果。&lt;/p&gt;

&lt;p&gt;这时候分布式的拒绝服务攻击手段（DDoS）就应运而生了。你理解了DoS攻击的话，它的原理就很简单。如果说计算机与网络的处理能力加大了10倍，用一台攻击机来攻击不再能起作用的话，攻击者使用10台攻击机同时攻击呢？用100台呢？DDoS就是利用更多的傀儡机来发起进攻，以比从前更大的规模来进攻受害者。&lt;/p&gt;

&lt;p&gt;高速广泛连接的网络给大家带来了方便，也为DDoS攻击创造了极为有利的条件。在低速网络时代时，黑客占领攻击用的傀儡机时，总是会优先考虑离目标网络距离近的机器，因为经过路由器的跳数少，效果好。而现在电信骨干节点之间的连接都是以G为级别的，大城市之间更可以达到2.5G的连接，这使得攻击可以从更远的地方或者其他城市发起，攻击者的傀儡机位置可以在分布在更大的范围，选择起来更灵活了。&lt;/p&gt;

&lt;p&gt;DDOS的主要几个攻击&lt;/p&gt;

&lt;p&gt;1.SYN变种攻击&lt;/p&gt;

&lt;p&gt;发送伪造源IP的SYN数据包但是数据包不是64字节而是上千字节这种攻击会造成一些防火墙处理错误锁死，消耗服务器CPU内存的同时还会堵塞带宽。&lt;/p&gt;

&lt;p&gt;2.TCP混乱数据包攻击&lt;/p&gt;

&lt;p&gt;发送伪造源IP的 TCP数据包，TCP头的TCP Flags 部分是混乱的可能是syn ,ack ,syn+ack ,syn+rst等等，会造成一些防火墙处理错误锁死，消耗服务器CPU内存的同时还会堵塞带宽。&lt;/p&gt;

&lt;p&gt;3.针对用UDP协议的攻击&lt;/p&gt;

&lt;p&gt;很多聊天室，视频音频软件，都是通过UDP数据包传输的，攻击者针对分析要攻击的网络软件协议，发送和正常数据一样的数据包，这种攻击非常难防护，一般防护墙通过拦截攻击数据包的特征码防护，但是这样会造成正常的数据包也会被拦截，&lt;/p&gt;

&lt;p&gt;4.针对WEB Server的多连接攻击&lt;/p&gt;

&lt;p&gt;通过控制大量肉鸡同时连接访问网站，造成网站无法处理瘫痪，这种攻击和正常访问网站是一样的，只是瞬间访问量增加几十倍甚至上百倍，有些防火墙可以通过限制每个连接过来的IP连接数来防护，但是这样会造成正常用户稍微多打开几次网站也会被封，&lt;/p&gt;

&lt;p&gt;5.针对WEB Server的变种攻击&lt;/p&gt;

&lt;p&gt;通过控制大量肉鸡同时连接访问网站，一点连接建立就不断开，一直发送发送一些特殊的GET访问请求造成网站数据库或者某些页面耗费大量的CPU,这样通过限制每个连接过来的IP连接数就失效了，因为每个肉鸡可能只建立一个或者只建立少量的连接。这种攻击非常难防护，后面给大家介绍防火墙的解决方案&lt;/p&gt;

&lt;p&gt;6.针对WEB Server的变种攻击&lt;/p&gt;

&lt;p&gt;通过控制大量肉鸡同时连接网站端口，但是不发送GET请求而是乱七八糟的字符，大部分防火墙分析攻击数据包前三个字节是GET字符然后来进行http协议的分析，这种攻击，不发送GET请求就可以绕过防火墙到达服务器，一般服务器都是共享带宽的，带宽不会超过10M 所以大量的肉鸡攻击数据包就会把这台服务器的共享带宽堵塞造成服务器瘫痪，这种攻击也非常难防护，因为如果只简单的拦截客户端发送过来没有GET字符的数据包，会错误的封锁很多正常的数据包造成正常用户无法访问，后面给大家介绍防火墙的解决方案&lt;/p&gt;

&lt;p&gt;7.针对游戏服务器的攻击&lt;/p&gt;

&lt;p&gt;因为游戏服务器非常多，这里介绍最早也是影响最大的传奇游戏，传奇游戏分为登陆注册端口7000,人物选择端口7100，以及游戏运行端口7200,7300,7400等,因为游戏自己的协议设计的非常复杂，所以攻击的种类也花样倍出，大概有几十种之多，而且还在不断的发现新的攻击种类，这里介绍目前最普遍的假人攻击，假人攻击是通过肉鸡模拟游戏客户端进行自动注册、登陆、建立人物、进入游戏活动从数据协议层面模拟正常的游戏玩家，很难从游戏数据包来分析出哪些是攻击哪些是正常玩家。&lt;/p&gt;

&lt;p&gt;以上介绍的几种最常见的攻击也是比较难防护的攻击。一般基于包过滤的防火墙只能分析每个数据包，或者有限的分析数据连接建立的状态，防护SYN,或者变种的SYN,ACK攻击效果不错,但是不能从根本上来分析tcp，udp协议，和针对应用层的协议,比如http,游戏协议，软件视频音频协议，现在的新的攻击越来越多的都是针对应用层协议漏洞,或者分析协议然后发送和正常数据包一样的数据，或者干脆模拟正常的数据流，单从数据包层面，分析每个数据包里面有什么数据，根本没办法很好的防护新型的攻击。&lt;/p&gt;

&lt;p&gt;SYN攻击解析&lt;/p&gt;

&lt;p&gt;SYN攻击属于DOS攻击的一种，它利用TCP协议缺陷，通过发送大量的半连接请求，耗费CPU和内存资源。TCP协议建立连接的时候需要双方相互确认信息,来防止连接被伪造和精确控制整个数据传输过程数据完整有效。所以TCP协议采用三次握手建立一个连接。
第一次握手：建立连接时，客户端发送syn包到服务器，并进入SYN_SEND状态，等待服务器确认；&lt;/p&gt;

&lt;p&gt;第二次握手：服务器收到syn包，必须确认客户的SYN 同时自己也发送一个SYN包 即SYN+ACK包，此时服务器进入SYN_RECV状态；&lt;/p&gt;

&lt;p&gt;第三次握手：客户端收到服务器的SYN＋ACK包，向服务器发送确认包ACK此包发送完毕，客户端和服务器进入ESTABLISHED状态，完成三次握手。&lt;/p&gt;

&lt;p&gt;SYN攻击利用TCP协议三次握手的原理，大量发送伪造源IP的SYN包也就是伪造第一次握手数据包，服务器每接收到一个SYN包就会为这个连接信息分配核心内存并放入半连接队列，如果短时间内接收到的SYN太多，半连接队列就会溢出，操作系统会把这个连接信息丢弃造成不能连接，&lt;/p&gt;

&lt;p&gt;当攻击的SYN包超过半连接队列的最大值时，正常的客户发送SYN数据包请求连接就会被服务器丢弃, 每种操作系统半连接队列大小不一样所以抵御SYN攻击的能力也不一样。那么能不能把半连接队列增加到足够大来保证不会溢出呢，答案是不能，每种操作系统都有方法来调整TCP模块的半连接队列最大数&lt;/p&gt;

&lt;p&gt;例如Win2000操作系统在注册表 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters&lt;/code&gt; 里 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TcpMaxHalfOpen&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TcpMaxHalfOpenRetried&lt;/code&gt; ，Linux操作系统用变量&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tcp_max_syn_backlog&lt;/code&gt;来定义半连接队列的最大数。但是每建立一个半连接资源就会耗费系统的核心内存，操作系统的核心内存是专门提供给系统内核使用的内存不能进行虚拟内存转换是非常紧缺的资源windows2000&lt;/p&gt;

&lt;p&gt;系统当物理内存是4g的时候 核心内存只有不到300M，系统所有核心模块都要使用核心内存所以能给半连接队列用的核心内存非常少。Windows 2003 默认安装情况下，WEB SERVER的80端口每秒钟接收5000个SYN数据包一分钟后网站就打不开了。标准SYN数据包64字节 5000个等于 5000*64 *8(换算成bit)/1024=2500K也就是 2.5M带宽 ，如此小的带宽就可以让服务器的端口瘫痪，由于攻击包的源IP是伪造的很难追查到攻击源,，所以这种攻击非常多。&lt;/p&gt;
</content>
                 <tag>服务器</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2010-02-04T13:35:13+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/sitemap-submit-major-search-engines.html</loc>
        <lastmod>2010-02-03T11:45:25+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>各大搜索引擎sitemap提交地址</title>
                <content>
&lt;p&gt;http://news.baidu.com/newsop.html#ks&lt;/p&gt;

&lt;p&gt;Yahoo!提交网站地图Sitemap: 通过网址&lt;a href=&quot;http://www.baidu.com/search/url_submit.html&quot;&gt;http://siteexplorer.search.yahoo.com&lt;/a&gt;管理提交；&lt;/p&gt;

&lt;p&gt;MSN提交网站地图Sitemap: 用URL直接提交：http://api.moreover.com/ping?u=http://your.domainname/sitemap.xml这是向MSN直接提交网站地图的后门URL&lt;/p&gt;

&lt;p&gt;向ASK提交网站地图Sitemap: 直接提交；http://submissions.ask.com/ping?sitemap=http://your.domainname/sitemap.xml&lt;/p&gt;

&lt;p&gt;向百度Baidu提交网站地图Sitemap: 没办法，现在百度不支持Sitemap。但可通过&lt;a href=&quot;http://www.baidu.com/search/url_submit.html&quot;&gt;http://www.baidu.com/search/url_submit.html&lt;/a&gt;来提交你的网址；&lt;/p&gt;

&lt;p&gt;Google提交网站地图Sitemap: 通过网址&lt;a href=&quot;http://www.google.com/webmasters&quot;&gt;http://www.google.com/webmasters&lt;/a&gt;管理提交；&lt;/p&gt;
</content>
                
                 <tag>电脑技巧</tag> 
                <pubTime>2010-02-03T11:45:25+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/htaccess-ten-tips-wordpress.html</loc>
        <lastmod>2010-02-02T14:36:59+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress的.htaccess十个技巧</title>
                <content>
&lt;h3 id=&quot;重定向wordpress的订阅地址&quot;&gt;重定向wordpress的订阅地址&lt;/h3&gt;

&lt;p&gt;除了修改WordPress的模板文件来定制其输出的RSS Feed链接地址外，还可以使用.&lt;a href=&quot;http://paranimage.com/htaccess-wen-jian-shi-yong-jiao-cheng-4htaccess-wen-jian-shi-yong-xiao-jie/&quot;&gt;htaccess文件&lt;/a&gt;来进行设置(替换yourrssfeedlink为自己的Feedburner地址)。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# temp redirect wordpress content feeds to feedburner
&amp;lt;IfModule mod_rewrite.c&amp;gt;
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !FeedBurner    [NC]
RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
RewriteRule ^feed/?([_0-9a-z-]+)?/?$ http://feeds2.feedburner.com/catswhocode [R=302,NC,L]
&amp;lt;/IfModule&amp;gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;参考：&lt;a href=&quot;http://www.wprecipes.com/how-to-redirect-wordpress-rss-feeds-to-feedburner-with-htaccess&quot;&gt;How to redirect WordPress rss feeds to feedburner&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;去除wordpress分类链接中的category前缀&quot;&gt;去除WordPress分类链接中的“/category/”前缀&lt;/h3&gt;

&lt;p&gt;默认情况下，WordPress的分类链接显示的样式为：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-http://xxx.com/blog/category/tech```&quot;&gt;其实其中的category部分没有任何意义，如果想去掉它可以修改.htaccess文件(替换yourblog为自己的网址)。

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;RewriteRule ^category/(.+)$ http://www.yourblog.com/$1 [R=301,L]&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
参考：[How to remove category from your WordPress url](http://www.wprecipes.com/how-to-remove-category-from-your-wordpress-url)


##### 3. 使用浏览器缓存


可以修改```.htaccess```文件让访问者使用浏览器缓存来优化其访问速度。

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;FileETag MTime Size&lt;/p&gt;
&lt;ifmodule mod_expires.c=&quot;&quot;&gt;
&amp;lt;filesmatch &quot;\.(jpg|gif|png|[CSS](http://paranimage.com/category/dede/css/)|js)$&quot;&amp;gt;
ExpiresActive on
ExpiresDefault &quot;access plus 1 year&quot;
&amp;lt;/filesmatch&amp;gt;
&lt;/ifmodule&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
参考： Comment accelerer le temps de chargement de votre blog


### 压缩静态数据


可以修改```.htaccess```文件来压缩需要访问的数据（传输后在访问端解压），从而可以减少访问流量和载入时间。

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;AddOutputFilterByType DEFLATE text/&lt;a href=&quot;http://paranimage.com/category/dede/html/&quot;&gt;html&lt;/a&gt; text/plain text/xml application/xml application/xhtml+xml text/&lt;a href=&quot;http://paranimage.com/category/dede/javascript/&quot;&gt;javascript&lt;/a&gt; text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
### 重定向日期格式的WP Permalink链接地址为Postname格式


如果你目 前的Permalink地址为/%year%/%monthnum%/%day%/%postname%/ 的格式，那么我强烈推荐你直接使用/%postname%/ ，这样对搜索引擎要舒服得多。

首先你需要在WordPress的后台设置输出的Permalinks格式为/%postname%/ 。

然后修改.htaccess文件来重定向旧的链接，不然别人以前收藏你的网址都会转成404哦！(替换yourdomain为自己的网址)

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;RedirectMatch 301 /([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ http://www.yourdomain.com/$4&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
参考： [Redirect day and name permalinks to postname](http://www.wprecipes.com/redirect-day-and-name-permalinks-to-postname)


### 阻止没有referrer来源链接的垃圾评论


设置```.htaccess```文件可以阻止大多数无Refferrer来源的垃圾评论机器人Bot Spammer。其会查询访问你网站的来源链接，然后阻止其通过```wp-comments-post.php```来进行垃圾评论。

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post.php*
RewriteCond %{HTTP_REFERER} !.&lt;em&gt;yourblog.com.&lt;/em&gt; [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
参考： [How to deny comment posting to no referrer requests](http://www.wprecipes.com/how-to-deny-comment-posting-to-no-referrer-requests)


### 定制访问者跳转到维护页面


当你进行网站升级，模板修改调试等操作时，最好让访问者临时 跳转到一个声明的维护页面(和404错误页面不同)，来通知网站暂时无法访问，而不是留下一片空白或者什么http bad错误。（替换maintenance.html为自己定制的维护页面网址，替换123.123.123.123为自己目前的IP地址，不然你自己访 问也跳转哦）

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteCond %{REMOTE_ADDR} !^123.123.123.123
RewriteRule $ /maintenance.html [R=302,L]&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
参考：[Comment faire une page d’accueil pour les internautes](http://www.woueb.net/2007/07/25/comment-faire-une-page-d-accueil-pour-les-internautes/)


### 设置你的WordPress防盗链


盗链是指其它网站直接使用你自己网站内的资源，从而浪费网站的流量和带宽，比如图片，上传的音乐，电影等文件。（替换mysite为自己的网址和/images/notlink.jpg为自己定制的防盗链声明图片）

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;RewriteEngine On
#Replace ?mysite.com/ with your blog url
RewriteCond %{HTTP_REFERER} !^http://(.+.)?mysite.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
#Replace /images/nohotlink.jpg with your “don’t hotlink” image url
RewriteRule .*.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
参考：[How to protect your WordPress blog from hotlinking](http://www.wprecipes.com/how-to-protect-your-wordpress-blog-from-hotlinking)


### 只允许自己的IP访问wp-admin


如果你不是团队合作Blog，最好设置只有自己能够访问WP的后台。前提是你的IP不是像我一样动态的哦。（替换xx.xx.xx.xx为自己的IP地址）

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName “Example Access Control”
AuthType Basic&lt;/p&gt;
&lt;LIMIT GET=&quot;&quot;&gt;
order deny,allow
deny from all
allow from xx.xx.xx.xx
&lt;/LIMIT&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
参考：[Protecting the WordPress wp-admin folder](http://www.reubenyau.com/protecting-the-wordpress-wp-admin-folder/)


### 阻止指定IP的访问


如果你想要阻止指定IP的访问，来防止其垃圾评论，那么你可以创建自己的Backlist黑名单。(替换xx.xx.xx.xx为指定的IP地址)

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;Limit GET=&quot;&quot; POST=&quot;&quot;&gt;
order allow,deny
deny from xx.xx.xx.xx
allow from all
&lt;/Limit&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;参考：&lt;a href=&quot;http://lorelle.wordpress.com/2007/09/20/the-easiest-way-to-ban-a-wordpress-spammer/&quot;&gt;The easiest way to ban a WordPress spammer&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;英文原文: &lt;a href=&quot;http://www.catswhocode.com/blog/10-awesome-htaccess-hacks-for-wordpress&quot;&gt;10 awesome .htaccess hacks for WordPress&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;中文译文: &lt;a href=&quot;http://e-spacy.com/blog/10-htaccess-hacks-for-wordpress.html&quot;&gt;10个WordPress的.htaccess技巧&lt;/a&gt;&lt;/p&gt;
</content>
                 <tag>.htaccess</tag>  <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-02-02T14:36:59+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/blog-officially-opened.html</loc>
        <lastmod>2010-02-01T16:04:45+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>博客正式对外开放</title>
                <content>
&lt;p&gt;经历半个月的筹备，我的个人博客正式对外开放&lt;/p&gt;

&lt;p&gt;首先要感谢000webhost提供的免费空间和Wordpress的支持。其次是Pixel 2.0.0 这个博客主题的制作者 Sam。我会在他主题的基础上汉化和加入所需的功能。&lt;/p&gt;

&lt;p&gt;刚刚开始写博，加上放假时间比较充裕。所以尽可能坚持每天更新。会是转载今天看到不错的文章加上评论；也可能写一些自己的想法；又或者写一些今天学到的东西···&lt;/p&gt;

&lt;p&gt;总之，我的博客还是需要大家的支持和鼓励。希望他愈来愈好！！&lt;/p&gt;

</content>
                 <tag>WordPress</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2010-02-01T16:04:45+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/wordpress-2-9-seven-new-files.html</loc>
        <lastmod>2010-02-01T15:57:28+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress 2.9不再有的七个文件和对应新版本</title>
                <content>
&lt;p&gt;早上在研究WordPress的YupooAlbum插件，但是发现在Wordpress2.9下面会提示缺少&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp-includes/gettext.php&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp-includes/streams.php&lt;/code&gt;。经过一番研究发现：&lt;/p&gt;

&lt;p&gt;WordPress 2.9 不再有以下七个文件:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;wp-admin/edit-form-advanced.php&lt;/li&gt;
  &lt;li&gt;wp-admin/edit-link-form.php&lt;/li&gt;
  &lt;li&gt;wp-admin/edit-page-form.php&lt;/li&gt;
  &lt;li&gt;wp-admin/import/btt.php&lt;/li&gt;
  &lt;li&gt;wp-admin/import/jkw.php&lt;/li&gt;
  &lt;li&gt;wp-includes/gettext.php&lt;/li&gt;
  &lt;li&gt;wp-includes/streams.php&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;相应的功能集成于以下文件:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;wp-admin/includes/image-edit.php&lt;/li&gt;
  &lt;li&gt;wp-admin/includes/meta-boxes.php&lt;/li&gt;
  &lt;li&gt;wp-includes/class-json.php&lt;/li&gt;
  &lt;li&gt;wp-includes/class-oembed.php&lt;/li&gt;
  &lt;li&gt;wp-includes/default-embeds.php&lt;/li&gt;
  &lt;li&gt;wp-includes/meta.php&lt;/li&gt;
  &lt;li&gt;wp-includes/post-thumbnail-template.php&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;引用原文：&lt;a href=&quot;http://www.mittineague.com/blog/2009/12/wordpress-functions-2-9/&quot;&gt;WordPress Functions 2.9&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;但是当我把文件改成对应文件后 YupooAlbum插件依旧无法工作。继续研究中。&lt;/p&gt;
</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-02-01T15:57:28+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/iframe-pre-loaded-web-page.html</loc>
        <lastmod>2010-02-01T15:30:29+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>IFRAME内嵌和预载网页</title>
                <content>
&lt;p&gt;iframe元素的功能是在一个文档里内嵌一个文档，创建一个浮动的帧。其部分属性简介如下：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;name：内嵌帧名称&lt;/li&gt;
  &lt;li&gt;width：内嵌帧宽度(可用像素值或百分比)&lt;/li&gt;
  &lt;li&gt;height：内嵌帧高度(可用像素值或百分比)&lt;/li&gt;
  &lt;li&gt;frameborder：内嵌帧边框&lt;/li&gt;
  &lt;li&gt;marginwidth：帧内文本的左右页边距&lt;/li&gt;
  &lt;li&gt;marginheight：帧内文本的上下页边距&lt;/li&gt;
  &lt;li&gt;scrolling：是否出现滚动条(“auto”为自动，“yes”为显示，“no”为不显示)&lt;/li&gt;
  &lt;li&gt;src：内嵌入文件的地址&lt;/li&gt;
  &lt;li&gt;style：内嵌文档的样式(如设置文档背景等)&lt;/li&gt;
  &lt;li&gt;allowtransparency：是否允许透明&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;明白了以上属性后，我们可用以下代码实现，在main.htm中把samper.htm文件的内容显示在一个高度为80、宽度为100%、自动显示边框的内嵌帧中：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;iframe&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;import_frame&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;100%&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;80&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;samper.htm&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;frameborder=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;auto&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/iframe&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;不错吧，马上“Ctrl+C”、“Ctrl+V”试试。&lt;/p&gt;

&lt;p&gt;有时我们为强调页面的某项内容，想让它先于页面的其他内容显示。同样用iframe即可轻松实现：&lt;/p&gt;

&lt;p&gt;先把要强调显示的内容另存为一个文件，如first.htm，然后通过一个预载页index.htm，内容如下：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;refresh&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3,url=index2.htm&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
页面加载中，请稍候……
&lt;span class=&quot;nt&quot;&gt;&amp;lt;iframe&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;first.htm&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;display:none&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
主文件index2.htm
&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;iframe&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;first.htm&quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;加入其他属性限制&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;first.htm的内容就会先于页面的其他内容出现在您的浏览器里了，是不是很简单？再“Ctrl+C”、“Ctrl+V”一次？&lt;/p&gt;
</content>
                
                 <tag>HTML</tag> 
                <pubTime>2010-02-01T15:30:29+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/windows-live-writer-released-wordpress.html</loc>
        <lastmod>2010-01-27T14:44:08+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>用Windows live writer离线发布Wordpress日志</title>
                <content>
&lt;p&gt;可以说，windows live writer是微软的最好产品之一，它支持博客离线发布日志（轻松插入照片、视频、地图、标签及其他超酷内容。强大的编辑功能帮您处理表格、拼写检查器和快速超链接。），目前支持的&lt;a href=&quot;http://chenjinghua.net/resources/blogging-platforms&quot;&gt;博客平台&lt;/a&gt;有wordpress、TypePad、Moveable Type、Windows livespaces、Blogger、Sharepoint、livejournal、Community Server等，详细功能请查看windows live writer官方网站的介绍。&lt;/p&gt;

&lt;p&gt;鉴于本博客使用的是wordpress平台，本文只介绍windows live writer在wordpress中的安装、配置和应用。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Windows live writer安装&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;点击下载&lt;a href=&quot;http://g.live.com/1rewlive/zh-cn/WLInstaller.exe&quot;&gt;windows live writer中文版&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;安装。安装比较简单，Microsoft .NET Framework是安装必备软件，若你的电脑中没有此组件，系统会自动下载并安装该组件（在 Windows Vista 上进行安装时，不需要此组件）。&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;首先，在你的WordPress里设置离线发布：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/wps_clip_image0.png&quot; alt=&quot;wps_clip_image-0&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/wps_clip_image2.png&quot; alt=&quot;wps_clip_image-2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Windows live writer配置&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;启动windows live writer，出现欢迎信息，由于我们使用的是wordpress平台而非Windows livespaces，所以直接点击下一步进入添加日志帐户。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;在选择日志类型对话框中，选择&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;其它日志服务&lt;/code&gt;。&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/wps_clip_image04.png&quot; alt=&quot;wps_clip_image-0[4]&quot; /&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;然后点击下一步，添加日志主页、登录用户名和密码&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/wps_clip_image06.png&quot; alt=&quot;wps_clip_image-0[6]&quot; /&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;点击下一步，windows live writer就会检测您的日志设置。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;在诊断你的博客过程中，会弹出一个“是否允许writer创建临时日志”的对话框，点击“是”进入下一步&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/wps_clip_image08.png&quot; alt=&quot;wps_clip_image-0[8]&quot; /&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;在弹出的如下“日志配置成功”对话框里点击完成，即完成了基本的windows live writer配置&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/wps_clip_image010.png&quot; alt=&quot;wps_clip_image-0[10]&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Windows live writer应用&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2010/wps_clip_image012.png&quot; alt=&quot;wps_clip_image-0[12]&quot; /&gt;&lt;/p&gt;
</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-01-27T14:44:08+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/wap-access-and-manage-wordpress.html</loc>
        <lastmod>2010-01-26T21:12:42+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress的WAP访问与管理</title>
                <content>
&lt;p&gt;我们不是任何时候都有机会通过宽带上网，但是一般都会将手机随身携带，通过手机查看更新博客似乎是一个不错的选择，今天要介绍的这个插件wp-t-wap就是wordpress博客手机更新的好工具。&lt;/p&gt;

&lt;h3 id=&quot;wp-t-wap的作用&quot;&gt;WP-T-WAP的作用&lt;/h3&gt;

&lt;p&gt;方便的进行wordpress博客手机的管理与使用。具体功能有：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;浏览、添加、修改、删除文章&lt;/li&gt;
  &lt;li&gt;浏览、发表、删除、审批评论&lt;/li&gt;
  &lt;li&gt;发布图文日志（发布时附带一张图片）&lt;/li&gt;
  &lt;li&gt;单个文章分页显示（在需要分页的地方添加“&amp;lt;!–nextpage–&amp;gt;”的HTML代码）&lt;/li&gt;
  &lt;li&gt;日志保存为草稿&lt;/li&gt;
  &lt;li&gt;显示相邻文章链接&lt;/li&gt;
  &lt;li&gt;首页显示最新评论&lt;/li&gt;
  &lt;li&gt;首页显示热门文章（需要安装WP-PostViews插件）&lt;/li&gt;
  &lt;li&gt;相关文章（需要安装WP 2.3 Related Posts插件）&lt;/li&gt;
  &lt;li&gt;分类文章列表&lt;/li&gt;
  &lt;li&gt;标签文章列表&lt;/li&gt;
  &lt;li&gt;自定义WAP网站标题&lt;/li&gt;
  &lt;li&gt;中英文双语国际化&lt;/li&gt;
  &lt;li&gt;域名绑定&lt;/li&gt;
  &lt;li&gt;支持 Wordpress MU&lt;/li&gt;
  &lt;li&gt;支持 imax-width 插件&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;wp-t-wap的使用方法&quot;&gt;WP-T-WAP的使用方法&lt;/h3&gt;

&lt;p&gt;1、安装&lt;/p&gt;

&lt;p&gt;解压到 plugins  目录（&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;plugins/wp-t-wap/*.*&lt;/code&gt;），然后启动插件即可通过类似http://www.mysite.com/wap 或 http://www.mysite.com/wap/index.php 的地址访问。&lt;/p&gt;

&lt;p&gt;（&lt;strong&gt;注意&lt;/strong&gt;：必须有读写  WP 站点根目录的 wap 目录的权限，否则，将安装失败。）&lt;/p&gt;

&lt;p&gt;2、设置&lt;/p&gt;

&lt;p&gt;WP 网站后台的“常规设置”-&amp;gt;“WAP 插件”里（WP 2.5 中稍有不同），可设置“显示方式”、“自定义标题”和“版本信息”。&lt;/p&gt;

&lt;p&gt;3、绑定域名&lt;/p&gt;

&lt;p&gt;直接将域名绑定到 WP 站点根目录的 “wap” 目录上。例如，WP 站点根目录是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/http/www&lt;/code&gt; ，那么应该将 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wap.mysite.com&lt;/code&gt;  域名绑定到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/http/www/wap&lt;/code&gt;  目录上。&lt;/p&gt;

&lt;p&gt;（一般先在网站的“虚拟主机”管理界面中绑定域名到目录，然后到“域名管理”中添加域名解析）&lt;/p&gt;

&lt;h3 id=&quot;wp-t-wap作者及下载&quot;&gt;WP-T-WAP作者及下载&lt;/h3&gt;

&lt;p&gt;这又是一款国人开发的优秀插件，作者为&lt;a href=&quot;http://www.tanggaowei.com/&quot;&gt;TangGaowei&lt;/a&gt;。&lt;/p&gt;

&lt;p&gt;下载地址：&lt;a href=&quot;http://wordpress.org/extend/plugins/wp-t-wap/&quot;&gt;http://wordpress.org/extend/plugins/wp-t-wap/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;另外，推荐一个手机访问可以自动跳转的插件：&lt;/p&gt;

&lt;h2 id=&quot;go2wap&quot;&gt;Go2Wap&lt;/h2&gt;

&lt;p&gt;=== Go2Wap (a plugin for Wordpress)===
Author: Neekey
Version  1.0.0
支持Wordpress 2.3以上,支持最新Wordpress 2.6&lt;/p&gt;

&lt;p&gt;将 go2wap.php 放置于Wordpress插件目录 ‘/wp-content/plugins/’下并在后台启用该插件.&lt;/p&gt;

&lt;p&gt;Bug report,discuss:http://photozero.net/go2wap_news&lt;/p&gt;

&lt;p&gt;Bug,建议,意见反馈:http://photozero.net/go2wap_news&lt;/p&gt;

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

</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-01-26T21:12:42+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/qzone-comments-article-to-wordpress.html</loc>
        <lastmod>2010-01-25T22:33:23+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>将QQ空间的文章评论转到wordpress</title>
                <content>
&lt;p&gt;最近寻思着把自己QQ空间里的文章都转移到wordpress来，毕竟wordpress使用起来更方便些。于是自己google了一下午尝试了很多方法最后终于成功了，特写下这篇文章记录下，也是给有需要的朋友一个方便！&lt;/p&gt;

&lt;p&gt;可能比较繁琐，但是我相信没有复制粘贴繁琐哈！需要的朋友就跟着我一步一步来吧！&lt;/p&gt;

&lt;p&gt;首先进入blogbus提供的博客搬家服务页面：&lt;a href=&quot;http://banjia.blogbus.com/&quot;&gt;http://banjia.blogbus.com/&lt;/a&gt;
在页面底部输入框输入你的QQ空间地址并点击，在完成后的页面点击把xml文件下载到本地；&lt;/p&gt;

&lt;p&gt;这个xml文件是blogbus可导入的格式，但是导入wprdpress的话我们还需要进一步加工才行；&lt;/p&gt;

&lt;p&gt;为了继续我们首先要下载一个文件：blogbus.zip&lt;/p&gt;

&lt;p&gt;把下载下来的压缩包里面的 blogbus.php 文件上传到你的 WordPress 安装目录的&lt;/p&gt;

&lt;p&gt;wp-admin/import/目录下,这样在 WordPress 后台导入菜单下多了一个 BlogBus 导入按钮，然后使用它把你之前下载下来的xml文件中的文章和评论导入到 WordPress 中去。
以下是完整过程：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;进入你的 WordPress 后台，点击 工具 =&amp;gt; 导入 =&amp;gt; BlogBus。点击上传文件然后选择刚下载下来的xml文件并导入即可开始。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;部分版本wordpress可能会在导入页面出现错误，没关系，我们可以直接访问以下url进入导入页面：http://您的url/wp-admin/admin.php?import=blogbus&lt;/p&gt;

&lt;p&gt;以上是导入页面，成功页面我就不演示啦，各位有兴趣的朋友去尝试下吧！&lt;/p&gt;

&lt;p&gt;写得辛苦，转载请注明出处，谢谢！&lt;/p&gt;

&lt;p&gt;本文来源于:一路向北！ http://beself.cn&lt;/p&gt;
</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-01-25T22:33:23+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/wordpress-bound-multi-domain.html</loc>
        <lastmod>2010-01-25T21:39:44+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>WordPress 多域名绑定</title>
                <content>
&lt;p&gt;有时候需要为 WordPress 绑定多个域名，并且不是跳转方式，解决 WordPress 的多域名绑定问题。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;方法一：&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt; 编辑根目录下的 wp-config.php 文件，添加以下代码：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;	&lt;span class=&quot;nv&quot;&gt;$home&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'http://'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'HTTP_HOST'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$siteurl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'http://'&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'HTTP_HOST'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'WP_HOME'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$home&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'WP_SITEURL'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$siteurl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;我们知道，PHP 中的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$_SERVER['HTTP_HOST']&lt;/code&gt; 用于获得来路域名。这样，就能根据来路为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WP_HOME&lt;/code&gt; 和 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WP_SITEURL&lt;/code&gt; 变量赋值，实现 WordPress 多域名绑定。&lt;/p&gt;

&lt;p&gt;为防止域名改变而造成图片不可用，必须在控制面板的“设置 (Options) – 杂项 (Misc)”里将“文件的完整 URL 地址”设为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp-content/uploads&lt;/code&gt;（与“默认上传路径”参数相同）。&lt;/p&gt;

&lt;p&gt;方法二：
原理是WordPress支持宏定义，可以覆盖后台数据库的option选项。与我们相关的两个option选项是 site_url 和 wp_home。要想覆盖数据库里的选项，定义大写的同名的宏即可。&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;php&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;($&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;_SERVER&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;['&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;HTTPS&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;']))&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;(&quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;WP_SITEURL&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&quot;,&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;http:&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;yourtion.cz.cc&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&quot;);&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;(&quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;WP_HOME&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&quot;,&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;http:&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;yourtion.cz.cc&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&quot;);&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;elseif&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;($&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;_SERVER&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;['&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;HTTP_HOST&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;]=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;='yourtion.tk'):&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;(&quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;WP_SITEURL&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&quot;,&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;http:&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;yourtion.com&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&quot;);&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;(&quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;WP_HOME&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&quot;,&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;http:&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;yourtion.com&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&quot;);&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;endif&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
                 <tag>WordPress</tag> 
                 <tag>WordPress技术</tag> 
                <pubTime>2010-01-25T21:39:44+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/building-blog-2010-01-24.html</loc>
        <lastmod>2010-01-25T21:24:08+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>开博历程·第四天（2010-01-24）</title>
                <content>
&lt;p&gt;早上起来看到昨晚一点半000webhost.com回复的邮件。还有三ru域名解析错误的邮件。接下来就是等待000webhost.com的空间开通。&lt;/p&gt;

&lt;p&gt;无所事事跑去继续研究收费空间和域名解析。突然就研究到了中国的强大的GFW。强到让我害怕···之后又去研究了一下全球知名的域名注册商godaddy.com和他提供的免费域名解析服务。&lt;/p&gt;

&lt;p&gt;把tk域名和如域名的解析迁移过去。效果还不错。继续努力。&lt;/p&gt;
</content>
                 <tag>Blog</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2010-01-25T21:24:08+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/building-blog-2010-01-23.html</loc>
        <lastmod>2010-01-24T21:22:47+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>开博历程·第三天（2010-01-23）</title>
                <content>
&lt;p&gt;今天白天整天都出去了，所以白天都没弄博客。回来之后King已经去注册了那个要写信才能注册的000webhost.com，而且已经进入等待阶段。&lt;/p&gt;

&lt;p&gt;我也赶忙去注册个玩玩。好不容易用我那没过四级的英文加上伟大的Google写出一段煽情的文字，然后等回复。然后在十一点的时候跑去注册ru域名。居然一下成功两个？？那么神奇·接下来就是不断地找dns解析网站。却发现没有哪个空间有A记录···最后自己找了个A记录加上去。那个000webhost.com的回复不是二十分钟就回？？&lt;/p&gt;

&lt;p&gt;等到快十二点都不理我？难道是英文太烂看不懂？算了·回去睡觉先。明天再说。&lt;/p&gt;

&lt;p&gt;英文信内容：&lt;/p&gt;
&lt;blockquote&gt;

  &lt;p&gt;&lt;strong&gt; I can‘t receive the confirmation letter&lt;/strong&gt;&lt;/p&gt;

  &lt;p&gt;I’m a student and I love PHP very much.So I want to have my own blog and website.But I can’t bear the fees of charge space.And i know 000webhost’s space is very good.So I came to register one.But I can‘t receive the confirmation letter after I finish register.&lt;/p&gt;
&lt;/blockquote&gt;
</content>
                 <tag>Blog</tag>  <tag>域名</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2010-01-24T21:22:47+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/building-blog-2010-01-22.html</loc>
        <lastmod>2010-01-23T21:20:52+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>开博历程·第二天（2010-01-22）</title>
                <content>
&lt;p&gt;因为pbmaster.com的ns服务器与tk域名的组合十分不稳定。所以今天又开始了寻找新免费空间与域名的历程。&lt;/p&gt;

&lt;p&gt;相继注册了weebly.com的自助建站还有全是德文还是什么意大利问的Xoom空间。但是都相继失败告终。最后成功注册了zymic.com的空间却发现还是会出现WordPress的解析问题。还有就是不断去抢ru域名，但是都没成功。好难好难···&lt;/p&gt;

&lt;p&gt;今天除了注册空间域名外，成功将QQ空间的文章和评论导入自己的站点。但是包括分类和标签都没有。还要自己手工慢慢加上去。至于导入的教程。稍后会贴上来。&lt;/p&gt;
</content>
                 <tag>Blog</tag>  <tag>域名</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2010-01-23T21:20:52+08:00</pubTime>
            </display>
        </data>
    </url>
    
    <url>
        <loc>https://blog.yourtion.com/building-blog-2010-01-21.html</loc>
        <lastmod>2010-01-22T12:55:24+08:00</lastmod>
        <changefreq>always</changefreq>
        <priority>0.5</priority>
        <data>
            <display>
                <title>开博历程·第一天（2010-01-21）</title>
                <content>
&lt;p&gt;King看到我申请了免费的空间和域名，说：“不如我们开博客吧？”&lt;/p&gt;

&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;然后就开始了轰轰烈烈的开博历程，一开始使用.cz.cc的域名和 awardspace.com的200m免费空间加10M数据库。结果发现King注册不了？-_-&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;更大的问题是awardspace居然有500k的文件限制？？？有个po文件和一个js上不去。宣告这个空间不适合。&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;然后是King找到的 freehostnow.org的1G空间和5个数据库，好不容易上传完成却发生php的head错误，原因未明···&lt;/p&gt;

&lt;p&gt;最后终于找到﻿pbmaster.com的250m空间，比较稳定和可靠。而且本身有提供wp-2.8.5。所以确定支持wp是没问题的。还注册了yourtion.tk顶级域名。一番幸苦和努力之后终于在晚上8点钟完成&lt;a href=&quot;http://yourtion.tk&quot;&gt;http://yourtion.tk&lt;/a&gt;的架设，之后是插件的安装。更加郁闷的问题出现了·TK域名不是很稳定·有时能访问有时不能？？⊙﹏⊙b汗&lt;/p&gt;

&lt;p&gt;算了，很晚了。明天继续研究·······&lt;/p&gt;
</content>
                 <tag>Blog</tag>  <tag>域名</tag> 
                 <tag>博客大事记</tag> 
                <pubTime>2010-01-22T12:55:24+08:00</pubTime>
            </display>
        </data>
    </url>
    
</urlset>
