<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[赫謙小便籤]]></title>
  <link href="http://hechien.github.com/octopress/atom.xml" rel="self"/>
  <link href="http://hechien.github.com/octopress/"/>
  <updated>2012-07-30T15:32:11+08:00</updated>
  <id>http://hechien.github.com/octopress/</id>
  <author>
    <name><![CDATA[赫謙]]></name>
    <email><![CDATA[hechien@me.com]]></email>
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[HTTP Basic Authentication in Rails 3]]></title>
    <link href="http://hechien.github.com/octopress/blog/http-basic-authentication-in-rails-3/"/>
    <updated>2012-07-30T15:31:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/http-basic-authentication-in-rails-3</id>
    <content type="html"><![CDATA[<p>有的時候想要偷懶採用比較簡單的認證方式時其實用HTTP Basic Authentication就可以了，但是在Rails中要怎樣實現呢？</p>

<p>答案是這個：<code>authenticate_or_request_with_http_basic</code></p>

<p>把這個加在<code>application_controller.rb</code>內用<code>before_filter</code>去弄就好，像是</p>

<div><script src='https://gist.github.com/3205501.js?file=code_1.rb'></script>
<noscript><pre><code>class ApplicationController &lt; ActionController::Base
  before_filter :authenticate, except: [:index, :show]

  def authenticate
    authenticate_or_request_with_http_basic('Auth!') do |username, password|
      username == &quot;user&quot; &amp;&amp; password == &quot;pass&quot;
    end
  end
end</code></pre></noscript></div>


<p>然後，另外一個比較簡單的方式是：<code>http_basic_authenticate_with</code>，用了這個我們就不需要再自己寫<code>before_filter</code>弄了，像是：</p>

<div><script src='https://gist.github.com/3205501.js?file=code_2.rb'></script>
<noscript><pre><code>class ApplicationController &lt; ActionController::Base
  http_basic_authenticate_with username: 'user', password: 'pass', realm: 'Auth!', except: [:index, :show]
end</code></pre></noscript></div>


<p>其中，<code>realm</code>是會提示給使用者看的訊息。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Rails 的 DateTime#change]]></title>
    <link href="http://hechien.github.com/octopress/blog/change-datetime-by-change-in-rails/"/>
    <updated>2012-07-25T16:38:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/change-datetime-by-change-in-rails</id>
    <content type="html"><![CDATA[<p>最近在寫一個東西，要取得時間並且扔到SQL內做BETWEEN運算，所以我這樣寫</p>

<pre><code>    now = Time.now
    objs = Obj.where({created_at: (now..(now+1.minutes))})
</code></pre>

<p>這樣執行後我發現會有問題，因為我其實只要把精準度調到分鐘，但是傳入的卻是到秒，也就是說我要的是類似 <code>2012-01-01 10:20:00</code> 這樣的格式，但是傳入的會是 <code>2012-01-01 10:20:30</code> 這樣的格式</p>

<p>所以為了解決這個辦法，我只好寫了很髒的code</p>

<pre><code>    now = Time.now; now -= now.sec.seconds
</code></pre>

<p>這真的夠髒了 &#8230;</p>

<p>後來為了某個功能(也許下篇會說)跑去APIDock查API，發現到Rails擴充了<code>DateTime</code>加入了<code>change</code>這個功能，才發現原來我API真的不熟啊 &#8230; Orz</p>

<p>所以要怎麼用呢？</p>

<p>假設我現在時間是<code>2012-01-02 03:04:05</code>，想要把秒數改為<code>30</code>的話，我可以這樣做：</p>

<pre><code>    now = "2012-01-02 03:04:05"
    now.change({sec: 30})
</code></pre>

<p>除了改秒數，也能改年份，所有可以改的參數：</p>

<ul>
<li>year</li>
<li>month</li>
<li>day</li>
<li>hour</li>
<li>min</li>
<li>sec</li>
<li>offset</li>
<li>start</li>
</ul>


<p>但是要注意，如果修改時間部分的話(也就是<code>hour</code>、<code>min</code>、<code>sec</code>)會根據順序去重新設定值。這是什麼意思呢？</p>

<p>假設我只修改<code>hour</code>的話，會把<code>min</code>跟<code>sec</code>給改為<code>00</code>；如果我只修改<code>min</code>的話，那只有<code>sec</code>會被改變為<code>00</code>。</p>

<p>所以如果我只要修改<code>hour</code>而其餘不變的話，就得把整個<code>hour</code>,<code>min</code>,<code>sec</code>都給傳進去才會正常。</p>

<div><script src='https://gist.github.com/3155780.js?file=test.rb'></script>
<noscript><pre><code>now = Time.now
#=&gt; 2012-07-21 21:08:55 +0800

now.change({year: 2015})
#=&gt; 2015-07-21 21:08:55 +0800

now.change({min: 30})
#=&gt; 2012-07-21 21:30:00 +0800

now.change({hour: 14, min: 10})
#=&gt; 2012-07-21 14:10:00 +0800</code></pre></noscript></div>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Sinatra 與 Bundler共舞]]></title>
    <link href="http://hechien.github.com/octopress/blog/sinatra-with-bundler-and-github-gem/"/>
    <updated>2012-07-16T14:38:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/sinatra-with-bundler-and-github-gem</id>
    <content type="html"><![CDATA[<p>Bundler是個好東西，但是Sinatra似乎不會直接讀取到用Bundler裝的Rubygems &#8230;</p>

<p>Okay，上網找了一下，知道了該怎做才對</p>

<div><script src='https://gist.github.com/3120418.js?file=sinatra_main.rb'></script>
<noscript><pre><code>require 'bundler/setup'
require 'apns'</code></pre></noscript></div>


<p>另外，Bundler如果要用到Github上的套件，可以這樣寫</p>

<div><script src='https://gist.github.com/3120418.js?file=Gemfile'></script>
<noscript><pre><code>gem 'apns', git: 'https://github.com/jpoz/APNS.git', require: 'apns', branch: :master</code></pre></noscript></div>


<p>除了可指定<code>branch</code>外，也能指定<code>ref</code>或者是<code>tag</code>，十分彈性。</p>

<p>詳情可參考：<a href="http://gembundler.com/git.html">http://gembundler.com/git.html</a></p>

<p>打完收工。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[N+1 Queries]]></title>
    <link href="http://hechien.github.com/octopress/blog/n-plus-1-queries/"/>
    <updated>2012-07-13T10:16:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/n-plus-1-queries</id>
    <content type="html"><![CDATA[<h1>什麼是 N+1 Query</h1>

<p>在Rails中有個ActiveRecord，它可以很容易產生資料庫關連、操作的東西。</p>

<p>但是關連這種東西一用不好就有可能造成災難，看看範例。</p>

<h1>範例？</h1>

<p>我有一個<code>CrashLog</code> model belongs_to <code>Product</code>，然後在<code>CrashLog</code>內用Delegate對應到<code>Product</code>的<code>name</code></p>

<pre><code>    # crash_log.rb
    delegate :name, to: :product, prefix: true
</code></pre>

<p>如此一來可以用<code>c = CrashLog.first; c.product_name</code>來直接存取到<code>product.name</code></p>

<p>可是當你用迴圈的時候就有可能遇到 N+1 Query。</p>

<p>譬如說我在首頁上面寫的是 <code>@crash_logs = CrashLog.all</code></p>

<p>結果SQL跑出上百筆類似以下的東西：</p>

<div><script src='https://gist.github.com/3102285.js?file=n_plus_1.sql'></script>
<noscript><pre><code>  CrashLog Load (2.3ms)  SELECT &quot;crash_logs&quot;.* FROM &quot;crash_logs&quot; 
  Product Load (0.2ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  Product Load (0.2ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  Product Load (0.2ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  Product Load (0.2ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  Product Load (0.3ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  Product Load (0.2ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  Product Load (0.2ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 96 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 92 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 94 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 95 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 97 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 93 LIMIT 1
  CACHE (0.0ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; = 91 LIMIT 1</code></pre></noscript></div>


<p>但是如果當我改成 <code>@crash_logs = CrashLog.includes :product</code> 就會變成另外一種結果</p>

<div><script src='https://gist.github.com/3102285.js?file=not_n_plus_1.sql'></script>
<noscript><pre><code>  CrashLog Load (2.5ms)  SELECT &quot;crash_logs&quot;.* FROM &quot;crash_logs&quot; 
  Product Load (0.2ms)  SELECT &quot;products&quot;.* FROM &quot;products&quot; WHERE &quot;products&quot;.&quot;id&quot; IN (94, 93, 95, 96, 91, 92, 97)</code></pre></noscript></div>


<p>怎麼樣？很恐怖吧！</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[用FactoryGirl建立假資料]]></title>
    <link href="http://hechien.github.com/octopress/blog/factory-girl-with-db-seeds-for-fake-data/"/>
    <updated>2012-07-13T10:14:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/factory-girl-with-db-seeds-for-fake-data</id>
    <content type="html"><![CDATA[<h2>安裝FactoryGirl</h2>

<p>先在 <code>Gemfile</code> 內寫：</p>

<pre><code>    gem 'rspec-rails'
    gem 'factory_girl_rails'
</code></pre>

<p>執行 <code>bundle install</code></p>

<p>上面這種方式會順便把<code>RSpec</code>給裝起來，反正沒壞處</p>

<p>接著打開 <code>config/application.rb</code></p>

<p>加入</p>

<pre><code>    config.generators do |g|
      g.test_framework :rspec, :fixture =&gt; true, :views =&gt; false, :fixture_replacement =&gt; :factory_girl
      g.fixture_replacement :factory_girl, :dir =&gt; "spec/factories"
    end
</code></pre>

<p>這樣做的話會在建立Model的時候一併建立相關檔案。</p>

<h2>第一步</h2>

<p>假設我們建立 <code>Post</code> model</p>

<p><code>rails g model Post title:string content:string author:string state:string; rake db:migrate</code></p>

<p>現在可以開始建立測試資料了，打開 <code>spec/factories/posts.rb</code></p>

<p>我們先新增一個正常的資料結構</p>

<pre><code>    FactoryGirl.define do
      factory :post do
        title "MyString"
        content "MyString"
        author "HeChien"
        state "public"
      end
    end
</code></pre>

<p>這樣子，我們就可以在<code>rails console</code>內透過<code>FactoryGirl.create :post</code>來建立一筆Post資料了</p>

<h3>怎麼了？你忘了？說好的，亂數呢？</h3>

<p>誰跟你說好了=_= &#8230; 不過要亂數的話 &#8230;</p>

<p>假設我們要讓<code>title</code>變亂數，那就把<code>title</code>改為</p>

<pre><code>    title "MyString" # 原本是這樣
    sequence(:title) { |n| "Title -- #{n}" } # 改成這樣
</code></pre>

<p>如此一來就會產生<code>"Title -- 1"</code>、<code>"Title -- 2"</code>之類的資料了</p>

<p>但是有的時候我們想要產生客製化的資料，譬如像是又亂數標題又是<code>state</code>為<code>closed</code>的文章的話要怎辦？</p>

<p>那就看下一節啊</p>

<h2>第二步 - 不同狀態不同內容</h2>

<p>同樣都是定義在<code>Post</code>中，我們可能需要不一樣的狀態、內容，所以我們可以這樣做</p>

<pre><code>    # 1. title為亂數，content為亂數，發佈為published，author為亂數，叫做 :random_life
    # 2. title為"Hello, world"，content為"XD"，發佈為closed，author為預設，叫做 :posted_by_hechien
    # 改成以下這樣

    FactoryGirl.define do
      factory :post do
        title "MyString"
        content "MyString"
        author "HeChien"
        state "public"

        factory :random_life do
          sequence(:title) { |n| "Title -- #{n}" }
          sequence(:content) { |n| "Randome #{n} Content" }
          state "published"
          sequence(:author) { |n| "Author: #{n}" }
        end

        factory :posted_by_hechien do
          title "Hello, world"
          content "XD"
          state "closed"
        end
      end
    end
</code></pre>

<p>如此一來，我們就可以用</p>

<p><code>FactoryGirl.create :random_life</code> 來產生幾乎都亂數的資料，以及用 <code>FactoryGirl.create :posted_by_hechien</code> 來產生與我本人有關的資料XD</p>

<h2>第三步 - Relationship :&#8221;></h2>

<p>臉紅個屁！</p>

<p>總是會需要建立關連的，譬如說<code>Post</code>與<code>Comment</code>。</p>

<pre><code>    FactoryGirl.define do
      factory :comment do
        post do
          FactoryGirl.create :post
        end
        author "MyString"
        content "MyString"
      end
    end
</code></pre>

<p>好了，你已經知道怎麼做了 (誤</p>

<h2>與 <code>db/seeds.rb</code> 邂逅</h2>

<pre><code>    100.times { FactoryGirl.create :random_life }
    10.times  { FactoryGirl.create :posted_by_hechien }
    20.times  { FactoryGirl.create :post }
</code></pre>

<p><code>rake db:seed</code> 打完收工</p>

<p>但事實上，假資料要用這個建立 => <a href="https://github.com/ryanb/populator">https://github.com/ryanb/populator</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Rails 3與Ajax的邂逅]]></title>
    <link href="http://hechien.github.com/octopress/blog/rails3-meets-ajax/"/>
    <updated>2012-07-03T16:01:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/rails3-meets-ajax</id>
    <content type="html"><![CDATA[<p>昨天晚上花了一點點時間寫了<a href="http://murmur-coder.herokuapp.com">Murmur Coder</a>，後來加上了Ajax的功能讓發出表單內容後可以不需要重新整理頁面就能夠根據response去顯示畫面。</p>

<p>其實Ajax這種話題應該是已經被講到爛了才對，不過我還是做一下註記好了，畢竟這種方式很Cool &#8230; Rails 把這些東西包在<code>rails.js</code>內了，所以我們可以很簡單的就去實作Ajax的功能。</p>

<p>最近這幾年比較流行的JavaScript寫法似乎是Obtrusive JavaScript，所以我在這邊會簡單的聊一下。</p>

<p>在以往常見的JavaScript寫法，是把一些Event會發生的事件直接寫在HTML Tag上，例如：</p>

<p><code>&lt;p onclick="alert('Hello, world');"&gt;Click me&lt;/p&gt;</code></p>

<p>直接把<code>onclick</code>寫在<code>p</code>標籤內，這種inline的寫法就有點像是直接把CSS寫在<code>style</code>屬性內一樣噁心。之後好像Prototype、jQuery之類的JavaScript framework出來了，因為能夠透過CSS Selector的方式去抓DOM，所以就能夠變成是：</p>

<pre><code>    &lt;p&gt;Click me&lt;/p&gt;
    &lt;script&gt;$('p').click(function(){alert("Hello, world");})&lt;/script&gt;
</code></pre>

<p>這種把HTML與JavaScript分離的作法就叫做Obtrusive JavaScript，讓JavaScript隱藏在某個角落內，使HTML、JavaScript能夠各司其職。</p>

<p>回到我們的主題，就因為Obtrusive JavaScript的概念，所以Rails在整合Ajax的時候十分容易。</p>

<p>我們來看看如何修改<code>form_for</code>吧 &#8230; 假設原本是 <code>form_for @murmur do |form|</code> 的話，就變成是： <code>form_for(@murmur, remote: true) do |form|</code> &#8230; 剩下的Rails已經幫你搞定了</p>

<p>不過開始測試時會發現：「那我要怎樣處理Callback？」、「錯誤咧？怎麼辦啊？」</p>

<p>嘖嘖，這個時候就是交給<code>rails.js</code>來處理囉 &#8230; <code>rails.js</code> 中提供了四個Callback function：</p>

<ul>
<li><code>ajax:beforeSend</code>: 用於在送出之前的狀態</li>
<li><code>ajax:success</code>: 用在執行成功的狀態，基本上Response status code為200, 201等都會進來這邊</li>
<li><code>ajax:complete</code>：不論結果，只要Request執行結束就會跑來這邊，適合重設表單等工作</li>
<li><code>ajax:error</code>：當遇到錯誤的時候會顯示這邊，像是Status code為4xx, 5xx時就會跑來這邊了</li>
</ul>


<p>因為我是直接寫CoffeeScript的，所以我就直接貼CoffeeScript code</p>

<div><script src='https://gist.github.com/3018510.js?file=murmurs.js.coffee'></script>
<noscript><pre><code>$ -&gt;
  submit_button = $('form#new_murmur input[name=&quot;commit&quot;]')
  submit_button_origin_value = submit_button.val()

  $('form#new_murmur')
  .bind 'ajax:beforeSend', (e, xhr, settings) -&gt;
    submit_button.val(&quot;正在送啦&quot;)

  .bind 'ajax:success', (e, data, status, xhr) -&gt;
    $(this).get(0).reset()
    $(&quot;#murmurs-list&quot;).html(xhr.responseText)

  .bind 'ajax:complete', (e, xhr, status) -&gt;
    submit_button.val(submit_button_origin_value)

  .bind 'ajax:error', (e, xhr, status, error) -&gt;
    form = $(this)
    [errors, errorText] = [null, null]
    try
      errors = $.parseJSON xhr.responseText
    catch err
      errors = {message: &quot;可能 ... 主機被我的貓拿來當玩具玩了吧？&quot;}

    errorText = &quot;呃，是有一些錯誤啦 ... \n&lt;ul&gt;&quot;

    for error in errors
      errorText += &quot;&lt;li&gt;#{error}: #{errors[error]}&lt;/li&gt;&quot;

    errorText += &quot;&lt;/ul&gt;&quot;

    form.find('div.error_explanation').html(errorText)</code></pre></noscript></div>


<p>簡單的說，就是<code>bind</code>住那四個callbacks就好。只不過在Controller中要記住的就是，如果response content type不是HTML的話，可能會進不了success，這點要注意一下 &#8230;.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[用Devise與Omniauth實作Facebook自定callback回傳]]></title>
    <link href="http://hechien.github.com/octopress/blog/facebook-oauth-custom-callback-with-devise-and-omniauth/"/>
    <updated>2012-06-19T14:21:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/facebook-oauth-custom-callback-with-devise-and-omniauth</id>
    <content type="html"><![CDATA[<p>在測試OAuth登入的時候，新浪與Twitter都會原封不動的把原本傳過去的網址(包含Querystring)一起傳回到Callback網址上，可是Facebook不管怎樣就是辦不到，害我沒辦法讓Mobile Safari收到Callback後Redirect到指定的App去。</p>

<p>原本以為是Omniauth中我有參數沒設到，或者是Facebook設定不對，但是一直trace code卻什麼都沒發現，只好退而求其次，用別的方式去硬幹這部份。</p>

<p>我的作法是，先到 <code>config/routes.rb</code> 去硬刻一個route給Facebook這種不會把Querystring跟著弄回來的Providers用，所以如下</p>

<div><script src='https://gist.github.com/2952624.js?file=routes.rb'></script>
<noscript><pre><code>devise_controllers = {
  omniauth_callbacks: &quot;users/omniauth_callbacks&quot;
}
devise_scope :user do
  get 'logout' =&gt; 'devise/sessions#destroy'
  get '/users/auth/:provider/callback/:url_identify' =&gt; 'users/omniauth_callbacks#passthru'
end
devise_for :users, {controllers: devise_controllers}</code></pre></noscript></div>


<p>然後在App端這邊發送Request的時候就必須從 <code>http://host/users/auth/facebook?url_identify=xxx</code> 改成 <code>http://host/users/auth/facebook/callback/xxx</code> 了。</p>

<p>然後在 <code>omniauth_callbacks_controller.rb</code> 中手動加入 <code>passthru</code> 這個 action</p>

<div><script src='https://gist.github.com/2952624.js?file=omniauth_callbacks_controller.rb'></script>
<noscript><pre><code>def passthru
  session[:url_identify] = nil
  session[:url_identify] = params[:url_identify].to_s
  redirect_to &quot;/users/auth/#{params[:provider]}&quot;
end</code></pre></noscript></div>


<p>這樣子在指定的provider action中就能正常吃到url_identify了。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[實作Drag and Drop上傳方式，傳到Rails + Paperclip]]></title>
    <link href="http://hechien.github.com/octopress/blog/how-to-implement-drag-and-drop-upload-with-rails-and-paperclip/"/>
    <updated>2012-06-18T10:28:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/how-to-implement-drag-and-drop-upload-with-rails-and-paperclip</id>
    <content type="html"><![CDATA[<p>終於搞出來了 &#8230; 我的媽呀，基礎知識全部忘掉就是了 &#8230; 丟臉</p>

<p>Okay &#8230; 記錄一下實作，不過怎樣用Rails建立Paperclip上傳機制這部份我就不多說了</p>

<p>主要是這段JavaScript code</p>

<div><script src='https://gist.github.com/2937600.js?file=uploader.js'></script>
<noscript><pre><code>      $(document).bind('drop', function(e){
        e.preventDefault();
        e.stopPropagation();
        upload(e.originalEvent.dataTransfer.files);
      }).bind('dragenter dragover', function(e){
        e.preventDefault();
        e.stopPropagation();
      });

      var upload = function(files){
        if(typeof(FormData) != 'undefined'){
          var form = new FormData();
          form.append('path', '/');
          for(i = 0; i &lt; files.length; i++){
            form.append('assets[][asset]', files[i]);
          }

          $.ajax({
            url: '/assets/upload_by_drag_and_drop',
            data: form,
            type: 'POST',
            contentType: false,
            processData: false,
            success: function(data){
              console.log(data);
            }
          });
        }
      }</code></pre></noscript></div>


<p>還有這段Rails code</p>

<div><script src='https://gist.github.com/2937600.js?file=upload_by_drag_and_drop.rb'></script>
<noscript><pre><code>assets = params[:assets]
assets.each do |asset|
  Asset.create(asset)
end</code></pre></noscript></div>


<p>是的，就只有這樣，哈</p>

<p>正在想著把這個部分再用jQuery封裝得好看一點 &#8230;</p>

<p>其實很簡單，就是JavaScript吃到drop event的時候，把收集到的檔案資訊整理起來，用FormData封裝，然後送到後台去這樣。</p>

<p>因為用到XMLHttpRequest，所以乾脆用jQuery來跑好了</p>

<p>註：drop事件、FormData似乎都是HTML 5後才有support的功能，而且不是每個Browser都有Support，所以記得還是得實作傳統的上傳機制 &#8230;</p>

<p>UPDATED: 2012/06/16 02:25 &#8211;</p>

<p>已經更改成用jQuery的ajax來上傳了，這樣就省得再用XMLHttpRequest了</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[在Rails中如何重新設定counter_cache的值？]]></title>
    <link href="http://hechien.github.com/octopress/blog/how-to-reset-counter-cache-in-rails-3/"/>
    <updated>2012-06-18T10:25:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/how-to-reset-counter-cache-in-rails-3</id>
    <content type="html"><![CDATA[<p>Rails中有一個<code>counter_cache</code>可以用，這東西的用途就是破壞正規化的(XD) &#8230;</p>

<p>一般來說，當我們要計算關連的資料有幾筆的話，我們會用 <code>SELECT COUNT(id) FROM</code>comments<code>WHERE</code>post_id<code>= 1</code> 這種方式來計算，可是如果當request 量一大且資料量也大的時候這樣子其實超級麻煩的，所以可以透過<code>counter_cache</code>來直接cache住關連的資料筆數。</p>

<p>但是有時候可能因為某些原因導致沒有正確記錄到cache值，這時候我們就可以用<code>reset_counters</code>來自動重新整理這些值 &#8230;</p>

<p>也許你會覺得奇怪，為什麼不要直接把值寫入<code>comments_count</code>這種欄位內就好呢？那是因為 &#8230;. 這個值是readonly的囧！</p>

<p>為了保護欄位值的正確只好這樣做，所以我們只好用<code>reset_counters</code>來處理這個部分了。</p>

<p>使用的方式是 <code>Model.reset_counters(id, association_name)</code></p>

<p>若以上面的例子來說的話，就是 <code>Post.reset_counters(1, :comments)</code></p>

<p>如何？很簡單吧？</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[用Subdomain時自定Devise的Mailer Template]]></title>
    <link href="http://hechien.github.com/octopress/blog/custom-devise-mailer-template-with-subdomain/"/>
    <updated>2012-06-05T17:03:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/custom-devise-mailer-template-with-subdomain</id>
    <content type="html"><![CDATA[<p>這問題其實也是忽然間被雷到 &#8230; 在這樣做之前要先去修改 <code>config/initializers/devise.rb</code>，設定自定的Mailer，然後我們還要自己手動產生一個Mailer。</p>

<!-- more -->


<p>我原本的作法是用Namespace來寫整個站，所以View的分類就是已經有分好資料夾了，我直接貼code可以嗎XD</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'>  <span class="sx">%w&#39;confirmation_instructions reset_password_instructions unlock_instructions&#39;</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="nb">method</span><span class="o">|</span>
</span><span class='line'>    <span class="n">define_method</span> <span class="s2">&quot;</span><span class="si">#{</span><span class="nb">method</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">do</span> <span class="o">|</span><span class="n">record</span><span class="o">|</span>
</span><span class='line'>      <span class="n">send_mail_with_record_and_action</span><span class="p">(</span><span class="n">record</span><span class="p">,</span> <span class="nb">method</span><span class="o">.</span><span class="n">to_s</span><span class="p">)</span>
</span><span class='line'>    <span class="k">end</span>
</span><span class='line'>  <span class="k">end</span>
</span><span class='line'>
</span><span class='line'>  <span class="kp">private</span>
</span><span class='line'>
</span><span class='line'>  <span class="k">def</span> <span class="nf">send_mail_with_record_and_action</span><span class="p">(</span><span class="n">record</span><span class="p">,</span> <span class="n">action</span><span class="p">)</span>
</span><span class='line'>    <span class="n">initialize_from_record</span><span class="p">(</span><span class="n">record</span><span class="p">)</span>
</span><span class='line'>    <span class="n">headers</span> <span class="o">=</span> <span class="n">headers_for</span><span class="p">(</span><span class="n">action</span><span class="o">.</span><span class="n">to_s</span><span class="p">)</span>
</span><span class='line'>    <span class="n">headers</span><span class="o">[</span><span class="ss">:template_path</span><span class="o">]</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">#{</span><span class="n">record</span><span class="o">.</span><span class="n">from_app</span><span class="si">}</span><span class="s2">/mailer&quot;</span>
</span><span class='line'>    <span class="n">mail</span> <span class="n">headers</span>
</span><span class='line'>  <span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>


<p>由於devise有<code>confirmation_instructions</code>、<code>reset_password_instructions</code>、<code>unlock_instructions</code>三個，而我只是要導到不同的app目錄去，所以就這樣子refactor，讓headers中的<code>template_path</code>可以是自訂的目錄。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[用jQuery的toggleClass來動態切換背景圖片]]></title>
    <link href="http://hechien.github.com/octopress/blog/jquery-toggleclass-dynamic-background/"/>
    <updated>2012-05-29T18:13:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/jquery-toggleclass-dynamic-background</id>
    <content type="html"><![CDATA[<p>公司的某個開發中網站要實作一個登入按鈕會閃爍的功能，這個按鈕有兩張圖片(我知道CSS Sprite，但即便我有Compass我也懶得弄 &#8230;)來做相互切換。</p>

<p>原本的作法我是用一個index去當counter用，然後用<code>setInterval</code>的方式每秒用<code>$(obj).css({background: 'url()'})</code>的方式，但是這樣有一個問題就是會每次切換的時候都跟Server要圖片，這很麻煩真的 &#8230; 所以我就改成用指定class切換Background就好了。</p>

<!-- more -->




<figure class='code'><figcaption><span>application.css </span></figcaption>
 <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='scss'><span class='line'>  <span class="nc">.login</span><span class="p">{</span>
</span><span class='line'>    <span class="na">background-image</span><span class="o">:</span> <span class="sx">url(/assets/common/login_2.png)</span><span class="p">;</span>
</span><span class='line'>
</span><span class='line'>    <span class="k">&amp;</span><span class="nc">.star</span><span class="p">{</span>
</span><span class='line'>      <span class="na">background-image</span><span class="o">:</span> <span class="sx">url(/assets/common/login_1.png)</span><span class="p">;</span>
</span><span class='line'>    <span class="p">}</span>
</span><span class='line'>  <span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>在登入的部份寫成這樣，然後Script寫成：</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='coffeescript'><span class='line'>  <span class="nx">setInterval</span> <span class="o">-&gt;</span>
</span><span class='line'>    <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;.login&#39;</span><span class="p">).</span><span class="nx">toggleClass</span><span class="p">(</span><span class="s1">&#39;star&#39;</span><span class="p">);</span>
</span><span class='line'>  <span class="p">,</span><span class="mi">1000</span>
</span></code></pre></td></tr></table></div></figure>


<p>是的，搞定。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[HTML5 Video 標籤初探]]></title>
    <link href="http://hechien.github.com/octopress/blog/html5-video-transform-first-view/"/>
    <updated>2012-05-25T10:29:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/html5-video-transform-first-view</id>
    <content type="html"><![CDATA[<div><script src='https://gist.github.com/2785414.js?file='></script>
<noscript><pre><code>&lt;!doctype html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;meta charset=&quot;utf-8&quot;&gt;
    &lt;script src=&quot;http://code.jquery.com/jquery-1.7.2.min.js&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;style&gt;
      video{
        /*-webkit-transform: rotate3d(3, 4, 3, 45deg) sca;*/
        /*-webkit-transform: rotate3d(40, 1, 30, 45deg);*/
        margin: auto auto;
        margin-top:200px;
      }
    &lt;/style&gt;
    &lt;script&gt;
      // References:
      //   http://www.eleqtriq.com/2010/05/understanding-css-3d-transforms/
      //   http://www.w3schools.com/css3/css3_3dtransforms.asp
      $(function(){
        var index = 0;
        setInterval(function(){
          if((index === 9) || (index === 27)) index+=1;
          if (index === 37) index = 1;
          $('video').css({
            '-webkit-transform': 'rotateX('+(index*10)+'deg) rotateY('+(index*10)+'deg) rotateZ('+(index*10)+'deg)'
          });
          index++;
        }, 100);
      });
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;video class=&quot;persistentNativePlayer nativeEmbedPlayerPid&quot; poster=&quot;http://cdnbakmi.kaltura.com/p/243342/sp/24334200/thumbnail/entry_id/0_ntovmku5/version/100004/height/480&quot; id=&quot;pid_kaltura-video&quot; style=&quot;display: block; width: 480px; height: 271px; top: 0px; &quot; kwidgetid=&quot;_243342&quot; kuiconfid=&quot;5349042&quot; kentryid=&quot;0_ntovmku5&quot; src=&quot;http://cdnapi.kaltura.com/p/243342/sp/24334200/playManifest/entryId/0_ntovmku5/flavorIds/0_nvp2quz3,0_o0bikcqg/format/applehttp/protocol/http/a.m3u8?ks=NmRmYmMxOWIzNWUzMWE3Mzg1MmU5MzhjY2YzNjg2ZmQ3OGM2YTNkYXwyNDMzNDI7MjQzMzQyOzEzMzc5OTYwMTQ7MDsxMzM3OTA5NjE0LjIxNjY7MDt2aWV3Oio7Ow==&amp;amp;referrer=aHR0cDovL2h0bWw1dmlkZW8ub3JnLw==&quot; autoplay=&quot;autoplay&quot; loop=&quot;-1&quot;&gt;&lt;/video&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre></noscript></div>


<p>可以在這邊看到範例：<a href="http://hechien.host22.com/html5video.html">http://hechien.host22.com/html5video.html</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Rails 3 與 Subdomain 的初次邂逅]]></title>
    <link href="http://hechien.github.com/octopress/blog/rails-3-yu-subdomain-de-chu-ci-xie-hou/"/>
    <updated>2012-05-21T11:58:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/rails-3-yu-subdomain-de-chu-ci-xie-hou</id>
    <content type="html"><![CDATA[<p>終於成功解決掉這個問題了 &#8230; 在進行這個操作之前請先到 <code>/etc/hosts</code> 內手動新增對應：</p>

<p><code>127.0.0.1 site1.product.local site3.product.local</code></p>

<p>請務必寫上這樣，我一開始寫成 <code>site1.local</code> 時會一直發生找不到根目錄的問題，所以必須這樣寫。</p>

<!-- more -->


<p>然後要做的就是在 <code>config/rotues.rb</code> 內修改一下，加上 <code>constraints({subdomain: "site1"}) do ... end</code> 這樣，假設：</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'>  <span class="n">constraints</span><span class="p">({</span><span class="n">subdomain</span><span class="p">:</span> <span class="s2">&quot;site1&quot;</span><span class="p">})</span> <span class="k">do</span>
</span><span class='line'>    <span class="n">resources</span> <span class="ss">:users</span>
</span><span class='line'>  <span class="k">end</span>
</span><span class='line'>
</span><span class='line'>  <span class="n">constraints</span><span class="p">({</span><span class="n">subdomain</span><span class="p">:</span> <span class="s2">&quot;site2&quot;</span><span class="p">})</span> <span class="k">do</span>
</span><span class='line'>    <span class="n">resources</span> <span class="ss">:users</span>
</span><span class='line'>  <span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>


<p>即可</p>

<p>但是必須注意的是，如果你原本是使用Namespace的話，就必須加上 <code>scope module: :xxx</code> 這個Block，如下：</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'>  <span class="n">constraints</span><span class="p">({</span><span class="n">subdomain</span><span class="p">:</span> <span class="s2">&quot;site1&quot;</span><span class="p">})</span> <span class="k">do</span>
</span><span class='line'>    <span class="n">scope</span> <span class="n">module</span><span class="p">:</span> <span class="s2">&quot;site1&quot;</span> <span class="k">do</span>
</span><span class='line'>      <span class="n">resources</span> <span class="ss">:users</span>
</span><span class='line'>    <span class="k">end</span>
</span><span class='line'>  <span class="k">end</span>
</span><span class='line'>
</span><span class='line'>  <span class="n">constraints</span><span class="p">({</span><span class="n">subdomain</span><span class="p">:</span> <span class="s2">&quot;site2&quot;</span><span class="p">})</span> <span class="k">do</span>
</span><span class='line'>    <span class="n">scope</span> <span class="n">module</span><span class="p">:</span> <span class="s2">&quot;site2&quot;</span> <span class="k">do</span>
</span><span class='line'>      <span class="n">resources</span> <span class="ss">:users</span>
</span><span class='line'>    <span class="k">end</span>
</span><span class='line'>  <span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>


<p>如此一來，原本是 <code>/site1/users</code> 會變成 <code>site1.product.local/users</code> 並且指定到 <code>app/controllers/site1/users_controller.rb</code> 了。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[為什麼我用Mac？]]></title>
    <link href="http://hechien.github.com/octopress/blog/why-i-use-the-mac/"/>
    <updated>2012-05-19T15:42:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/why-i-use-the-mac</id>
    <content type="html"><![CDATA[<p>這是很有趣的問題，不是嗎？</p>

<p>我是一名軟體工程師、網站開發人員、網頁設計師、學生、兒子 … etc (但其中並沒有包含<strong>男朋友</strong>這個身分&#8230;)，總之，我有著很多的身分，但我為什麼不選擇大多數人用的PC，裡面裝著Windows或Linux？</p>

<!-- more -->


<p>國小升上三年級的暑假吧，學校開了電腦課，那個暑假我拿到一本DOS指令的書，那年可能是1997年。那是屏東縣潮州鎮的一所學校，我不知道為什麼，Windows 95已經在1995年發售的情況下，學校還在用DOS，但它真的奠定了我的基礎：「注音的第一聲要按空白鍵」。</p>

<blockquote><p>我的人生是從微軟開始的，從它的MS-DOS、Windows 95、Windows 98、Windows ME、Windows 2000、Windows XP、Windows 2003 Server .net、Windows Vista、Windows 7我全部都接觸過，其中Windows 98、Windows XP我玩得最盛。</p></blockquote>

<p>四年級時學校終於開始上電腦課(等我六年級的時候，五年級也開始有電腦課了)，那個時候學校電腦也還是MS-DOS，要把磁片放進去然後輸入指令，叫出小作家或者其他遊戲來玩，在那個時候對我來說是很神奇的事情(現在依舊覺得神奇，為什麼還不用Windows 95)。猶記得每次開機後畫面上都會出現 <code>C:\&gt;</code>，老師說：「這個代表已經成功開機了」，然而有一天出現了<code>E:\&gt;</code>還<code>F:\&gt;</code>，老師這時表示：「我們學校現在已經牽了網路」，但其實我在那個時候還不懂網路到底是什麼。</p>

<p>1998年吧，高雄NOVA(現在倒了)似乎有辦了活動，而那次我媽有帶我過去走走，那似乎是我第一次走進所謂的資訊商場，裡面有很多人在逛在看，擺著一堆電腦螢幕、主機 … etc，剛好我站在INTEL的宣傳活動前面，PG(Promoter Girl)拿著麥克風喊說：「舉手搶答～ 請問現在最快的CPU是什麼？」(其實問題是不是這樣我忘記了，那也不是很重要)，在那當下一堆人舉手，結果那個<strong>姐姐</strong>(拜託，我當時才小四<del>，好險小三才當過一年而已</del>)直接把麥克風督到我嘴邊(請不要亂幻想)要我說答案，我只好很害羞的說：「Intel」 …. 嗯，當時是因為不知道Intel是什麼而害羞，至於現在&#8230;.</p>

<p>是的，最後我拿到獎品 => Intel 的撲克牌一副 <del>(但我比較想要那個PG的電話)</del></p>

<p>而一位參加者大哥則是把他手上的袋子送給我，裡面好像是一些教學光碟、雜誌之類的，這讓我知道了什麼叫做純愛手札(誤)。</p>

<p>準備升上國一了，跟媽媽去大亞電腦那邊問一些電腦的事情，最後確認學校會上電腦課(因為有電腦教室)所以才點頭買下我第一台電腦，那台是 Intel Pentium III 733 Mhz，剛買進來的時候只有64 MB RAM，40G的硬碟，後來進去國一的時候我用Front Page做網頁，當時覺得Dreamweaver很難用、覺得Flash好難 … 之後玩Access覺得資料庫很枯燥乏味。我國二學Visual Basic，寫了不少程式來玩，我在國中的時候完全就是微軟的支持者，Macintosh是只存在於我電腦字典裡面的一個名詞而已，而Apple頂多出現在台視新聞後面那個五顏六色的蘋果Logo，除此之外我根本不知道他們在幹什麼。</p>

<p>國三，我接觸到了Linux。我在順發買了一本書，那本裡面送的是Red Hat Linux 7.3 + CLE 1.0，我照著書把系統安裝起來、中文化後，發現到網路不能用，我只好想辦法去燦坤另外買一張NIC來用，自己根據驅動光碟內的純文字說明檔來自己編譯Driver。</p>

<blockquote><p>那個時候整個文件都英文，在沒有網路的情況之下我只能夠一邊看單字一面猜一面拿字典來翻，雖然很苦，但我發現這讓我的英文閱讀能力好了不少</p>

<p>那時候的指令大概就是 <code>cd</code> 到Driver目錄，然後下 <code>./configure; make; make install</code> 而已，但沒想到那張卡是當年出了名的惡魔卡 …. D-Link的!!!</p></blockquote>

<p>後來到了高中，我用Linux學著架站，也同時學著用PWS(這個一定沒多少人用過)、IIS來架站，並且學ASP(王國榮的書都很不錯，強烈推薦)來撰寫網頁程式，在那個時候我也還是不知道什麼是蘋果、什麼是Mac。</p>

<p>高中後來讀不下去轉去五專，我在五專自修PHP，而且在那個時候我玩Linux玩得最盛，總在推廣Linux的好處，也讓我媽的電腦從Windows變成Linux，用起來也真的沒問題 … 我參加過Ubuntu Linux Install Festval、也曾經很不成熟的想要成立PTLug，但在那當時Linux是我的全部、Open Source是我的最愛，讓大家都用Ubuntu Linux是我的夢想我的目標，十分厭惡Windows那種所謂只愛錢的公司 … 直到2006年。</p>

<p>2006年，我開始正式接觸到<code>Ruby on Rails</code>，他們的screencast是用Textmate開發，用那個軟體開發起來真的是神速啊，之後我就對這個介面留上了心，也開始在Linux上裝上類似Mac的介面。</p>

<blockquote><p>當時的Linux還有一個很炫的特效，那個特效是可以用立體的方式切換桌面等，我已經忘記那個名字了，那段時間我真的很著迷這種沒有意義的東西。</p></blockquote>

<p>之後，我發現到Linux還是沒辦法完全模擬出我真正想要的感覺，在2007年左右我得到一份工作時我便跟該公司要求一台Mac，我用那台Mac開發網站、做作業報告 … etc。在那半年的時間裡面(我只待了半年，因為壓力實在太大，而且又重考統測)我只感覺到Mac真的只是比較好用，但其實也還好，所以把電腦退回公司後我繼續用Linux當主力系統，後來我發現我完全沒辦法習慣Linux的介面以及操作方式，後來就另外貸款買了一台Mac，那年是2008年，我現在正用這台Mac打這篇文章。</p>

<blockquote><p>Ubuntu Linux 曾經發生過一件事情讓我很不能夠接受，也成為我當時的疙瘩。</p>

<p>有一次我在更新系統之後發現我不能執行gdm，整個X Server啟動不起來，後來用純文字模式上IRC問別人到底怎麼回事，用w3m搜尋才知道原來這次版本中有一個開發者不小心搞爛了顯示的Driver才發生這種事情，隨後就打了Patch重新送上線，更新過後才正常…</p>

<p>這種事情其實真的很嚴重，如果只是單純使用純文字模式的話倒是沒啥影響，但是對於使用者來說這個可真的是罪該萬死的，也因此Linux就失去了我的信任。不是因為Linux不好，而是因為Linux在當時還是搞不懂使用者要的是什麼。</p></blockquote>

<p>2009年我到台南工作，因為工作是要寫iOS的App所以也一定只能用Mac，但是在這之前我還是不知道Mac到底好在哪裡，我一樣不喜歡用iTunes、覺得iPhoto麻煩 … 可是在開發軟體的過程當中我慢慢的發現到一個重點：我開始看其他的軟體介面不爽了</p>

<p>我在2005年的時候曾經寫了一個程式叫做「Ruby執行檔製作精靈」(這支程式後來還被Toget選上精選軟體)，那個可以讓Windows上寫的Ruby Script轉成執行檔，但是操作的介面非常複雜，可是我在當時卻覺得它非常容易使用。有看到重點了嗎？對，我開始在思考使用者介面的事情，而且是不知不覺間開始有這種意識：「我怎麼做出了一個難用的垃圾出來？」。後來，我的朋友阿白他也買了一台Mac，買了之後沒多久他告訴我一句話：「用了Mac之後我的靈感一直來」我才發現到，我之所以那段時間不想要再用Linux、Windows的原因很簡單，就是那真的太難用了！</p>

<p>開始真正理解到設計的重要之後，我一直在思考自己做的東西到底能不能夠更加精簡、更加好用，我開始知道什麼叫做使用者介面(UI)以及使用者體驗(UE)，這兩者不是其他公司一昧的模仿就能夠模仿出一套精神的，必須要模仿之後還要加上自己的研究跟想法才真的可以做出完美的東西。已經一個東西擺在前面給你抄了，你卻還抄得十分鱉腳的話，那真的被人家罵抄襲也是活該了 …</p>

<p>所以，我開始思考自己做的東西到底哪邊還能再修改，而觀察的對象就是Mac的設計，不論是硬體還是軟體還是整個操作流程，我發現我越思考越觀察就越覺得過去玩到的東西都真的太不貼近人性，所以我也就越來越排斥那些我曾經接觸過的東西。我再說一次，不是那些東西不好，而是那些東西太過自以為是，自以為使用者什麼都想要自己手動設定，把全世界的使用者都當成工程師那樣，把選項做得十分複雜、把警告訊息弄得十分嚴重、把操作介面用得十分雜亂，到頭來大家都只知道電腦要根據所謂「固定的步驟」去使用，而完全忘記電腦應該要「直覺」的去使用才對。</p>

<p>我在Mac上看到了這種直覺。Safari是Mac上的預設瀏覽器，它的核心是Webkit，這個東西很有趣的一個重點在於它的上傳檔案方式。我們都知道，在IE、Firefox裡面上傳檔案必須要按下「瀏覽」按鈕，然後在一層一層資料夾中找出你要的檔案之後選擇，這樣才算完全的選擇檔案。但Safari(包含Google Chrome)並不是這樣而已，你可以直接把檔案「拖」到那個「瀏覽」按鈕上面後放開，這樣就能夠瞬間選擇你要的檔案，你沒辦法打開你的檔案總管後把檔案拖到IE或Firefox的瀏覽按鈕上，你必須自己慢慢找出來，如果今天它只放在桌面那就只是小事，如果它放在十幾二十層的目錄裡面時，你會哭死。</p>

<p>另外一個直覺的舉例也同樣拿這個檔案上傳當例子，剛剛我們提到按下瀏覽的時候會出現選擇檔案的視窗，在Windows底下是可以把檔案拖進去的，如此一來Windows會很「自作聰明」的把檔案<strong>移動</strong>到那個目錄底下，然後選擇；但是在Mac底下卻完全不是這麼一回事！Mac會知道你拖進去的檔案到底在哪裡，然後自動切換到那個目錄並且選擇該檔案。我的天，這種小功能是多麼的貼心啊？你完全不需要擔心它會被<strong>移動</strong>到哪裡去，能夠快速簡單的指定檔案的所在位置，這個就是最基本的「直覺操作」啊！</p>

<p>網路上有許多這類的例子，像是國外的麥當勞有提供免費的無線上網(Wi-Fi)，所以他們印出了一份教學的DM，有人發現到Windows需要這樣做：<code>開始 =&gt; 控制台 =&gt; 網路 =&gt; 無線網路</code> … 對不起，我不想打下去了</p>

<p>然而Mac只有三個步驟： <code>點選電腦右上角的無線圖示 =&gt; 選擇麥當勞的網路 =&gt; 開心上網</code>，這讓我想起這個廣告 <a href="http://www.youtube.com/watch?v=6uXJlX50Lj8">http://www.youtube.com/watch?v=6uXJlX50Lj8</a></p>

<p>所以為什麼我用Mac？因為我越來越想知道我還能夠替使用者處理掉多少使用者不需要真的去關心的事情，就從Mac的身上學習。2011年中，我買了一台Macbook Air，它沒有光碟機、它輕巧、它沒有太多我不需要的插孔(左邊插槽分別是電源、USB跟耳麥孔、右邊則是影像輸出、USB跟SD卡槽)，我外出只需要帶一個電源線就夠了，頂多多一個SD卡，真的很方便。</p>

<p>Macbook的電源變壓器上也有貼心的點，它能夠張開兩邊的東西用來當做捲線器，而且插頭的部份可以拔掉換成延長線或者是其他國家的接口，這些都是我很少有機會看到的設計(有啦，我記得最近某些公司抄很大 ….)。這是蘋果用心的地方，他們或許做的不是很完美，但是卻也很盡心盡力的在完善自己的產品。</p>

<p>Mac OS X在Leopard之後也內建了Ruby，甚至直接包了一個RubyCocoa.framework可以用(但這部份我沒有研究)。有很多好用的工具也都是在Mac上面有，像是Textmate(不過我最近愛上Sublime Text 2，這個則是Windows、Linux都有)，對於一個網站開發者、網頁設計師而言，真的可以從中學到很多設計的技巧、用到很多很不錯的設計工具。</p>

<p>為什麼我用Mac？因為近朱者赤近墨者黑，要不然孟母也不用三遷了。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[2012年的目標]]></title>
    <link href="http://hechien.github.com/octopress/blog/2012nian-de-mu-biao/"/>
    <updated>2012-05-12T11:42:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/2012nian-de-mu-biao</id>
    <content type="html"><![CDATA[<p>希望自己在2012年可以做好這些事情</p>

<p>討論內容在：<a href="https://www.facebook.com/hechien/posts/431153790229954">https://www.facebook.com/hechien/posts/431153790229954</a></p>

<h2>一定要做的事</h2>

<ol>
<li>每天固定抄寫幾檔的最高、最低、開盤、收盤、昨收、交易量</li>
<li>三年級下學期搞定專題 (不含 UI/UE)</li>
<li>暑假把專題的UI/UE調好</li>
<li>耶誕節前解決專題並且正式開始測試</li>
<li>想好除資訊業外其他可以發展的領域</li>
<li>撰寫好一本網頁設計的書</li>
<li>撰寫好一本Ruby on Rails的書</li>
<li>把<code>CoffeeScript</code>、<code>SCSS</code>、<code>Compass</code>、<code>Middleman</code>與CSS Frameworks練熟</li>
<li>六月開始至少每個月三部Mac教學影片、一部Mac Podcast教學、一篇Mac教學文章</li>
<li>至少今年辦兩場Mac聚會 (大小不拘)</li>
</ol>


<h2>逼自己去嘗試</h2>

<ol>
<li>每天誦三次心經</li>
<li>每天讀ㄧ篇道德經</li>
<li>每天一篇Rework的內容</li>
<li>每個禮拜一篇以上與工作或技術無關的文章</li>
<li>重新學好奇門遁甲與易經</li>
</ol>


<p>希望自己能夠好好的實踐這些事情。
今天是2012/05/12，加油。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Image Magick Resize 語法]]></title>
    <link href="http://hechien.github.com/octopress/blog/image-magick-resize-yu-fa/"/>
    <updated>2012-05-10T11:36:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/image-magick-resize-yu-fa</id>
    <content type="html"><![CDATA[<p>因為現在透過Paperclip這邊有一點小問題，所以先做一下小記錄</p>

<!-- more -->


<p>底下這個部分我再找時間整理成表格</p>

<h2>語法 |  說明</h2>

<p>scale%  | Height and width both scaled by specified percentage.
scale-x%xscale-y% | Height and width individually scaled by specified percentages. (Only one % symbol needed.)
width | Width given, height automagically selected to preserve aspect ratio.
xheight | Height given, width automagically selected to preserve aspect ratio.
widthxheight |  Maximum values of height and width given, aspect ratio preserved.
widthxheight^ | Minimum values of width and height given, aspect ratio preserved.
widthxheight! | Width and height emphatically given, original aspect ratio ignored.
widthxheight> | Shrinks images with dimension(s) larger than the corresponding width and/or height dimension(s).
widthxheight&lt; | Enlarges images with dimension(s) smaller than the corresponding width and/or height dimension(s).
area@ | Resize image to have specified area in pixels. Aspect ratio is preserved.</p>

<p>大致上就是這樣吧。</p>

<p><a href="http://www.imagemagick.org/script/command-line-processing.php?ImageMagick=q63ko1qv7bq52429iuqfdgp4v2#geometry">參考網址</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[OmniAuth + Devise + OpenID]]></title>
    <link href="http://hechien.github.com/octopress/blog/omniauth-plus-devise-plus-openid/"/>
    <updated>2012-05-08T11:46:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/omniauth-plus-devise-plus-openid</id>
    <content type="html"><![CDATA[<p>最近內部討論結果覺得有可能需要Support Open ID的登入機制，因此就去survey了一下Devise擴展Open ID的方式。因為Devise本身支援OmniAuth，所以就直接以<code>Devise OmniAuth OpenID</code>的方式搜尋了一下，便找到這篇：<a href="http://blog.xdite.net/posts/2011/12/05/omniauth-clean-auth-provider-4/">http://blog.xdite.net/posts/2011/12/05/omniauth-clean-auth-provider-4/</a></p>

<p>其實這篇照做就可以了，只不過因為原始碼是從<a href="http://ruby-taiwan.org">http://ruby-taiwan.org</a>那邊來的，所以有一些code是不能用的 &#8230; 需要自己稍微做調整一下</p>

<p>這個實作版本是Rails 3.2.3、Devise 2.0.4、OmniAuth 1.0.3</p>

<p>裡面的Code在<code>omniauth_callbacks.rb</code>中第9行左右有個問題，User必須要用includes把authorizations給引入進來，不然會噴 &#8230; XD</p>

<p>可能是因為原本的Code用MongoID當做Data source的關係，所以原本的Code內並沒有寫includes這一塊吧 &#8230;</p>

<p>然後要記得在<code>user.rb</code>實作<code>bind_service</code>，不然原本的code去bind使用者的部份會有問題 &#8230;</p>

<p>要把<code>omniauth_callbacks.rb</code>放在<code>app/models/user</code>底下、把<code>omniauth_callbacks_controller.rb</code>放在<code>app/controllers/users</code>底下，總之在model的資料夾是<code>user</code>而controller的資料夾是<code>users</code>就對了。</p>

<p>大致上就這樣。</p>

<p>喔對，很重要的一點就是 &#8230; 現在網路上很多範例都會叫你去<code>config/initializers/omniauth.rb</code>內設定provider，這樣做的話一定會噴掉 &#8230; 我在這邊花很多時間才搞定囧，請記住，<strong>不必</strong>寫在這個地方！</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[MySQL啟動、執行出現errno 13的問題]]></title>
    <link href="http://hechien.github.com/octopress/blog/mysqlqi-dong-%2C-zhi-xing-chu-xian-errno-13de-wen-ti/"/>
    <updated>2012-05-05T16:16:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/mysqlqi-dong-,-zhi-xing-chu-xian-errno-13de-wen-ti</id>
    <content type="html"><![CDATA[<p>剛剛朋友的MySQL Server忽然掛掉，沒辦法正常匯入 &#8230; 查了log後看到以下訊息：</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>120505 12:08:27 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
</span><span class='line'>120505 12:08:27  InnoDB: Initializing buffer pool, size = 8.0M
</span><span class='line'>120505 12:08:27  InnoDB: Completed initialization of buffer pool
</span><span class='line'>120505 12:08:27  InnoDB: Operating system error number 13 in a file operation.
</span><span class='line'>InnoDB: The error means mysqld does not have the access rights to
</span><span class='line'>InnoDB: the directory.
</span><span class='line'>InnoDB: File name ./ibdata1
</span><span class='line'>InnoDB: File operation call: 'open'.
</span><span class='line'>InnoDB: Cannot continue operation.
</span><span class='line'>120505 12:08:27 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended</span></code></pre></td></tr></table></div></figure>


<p>科科，炸了=_=</p>

<p>上網找了一下看到這篇<a href="http://stackoverflow.com/questions/3907666/mysql-wont-start-ibdata1-corrupt-operating-system-error-number-13-permis">Mysql won&#8217;t start - ibdata1 corrupt? - operating system error number 13 - permissions issue</a></p>

<p>讚，頭彩 &#8230; 馬上讀一下發現到這個指令： <code>perror 13</code>，輸入之後告訴我 Error code 13代表的是Permission denied，就覺得很奇怪 &#8230;</p>

<p>跳到 <code>/var/lib/mysql</code> (MySQL根目錄，資料檔都放在這底下) 後，下 <code>ls -l</code>發現某些檔案的權限亂掉 &#8230; 所以用 <code>chown -R mysql *</code>來修復權限，至少把owner改為<code>mysql</code>就可以了。</p>

<p>結束之後重新啟動，果然正常 &#8230; 開開心心匯入資料去</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[我沒有天份，只有努力]]></title>
    <link href="http://hechien.github.com/octopress/blog/wo-mei-you-tian-fen-%2Czhi-you-nu-li/"/>
    <updated>2012-05-02T23:16:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/wo-mei-you-tian-fen-,zhi-you-nu-li</id>
    <content type="html"><![CDATA[<p>我對於規劃這種事情實在是不太在行</p>

<p>我也很會去評估自身能力，決定到底該不該做一些事情</p>

<p>但往往都會因為低估而退卻、高估而失敗</p>

<p>所以我對於估計這種事情也是不太在行</p>

<p>但我只知道一件事，那就是「現在不行，努力過後，以後可以」</p>

<p>我今天早上看到Mr. Jamie寫的文章，標題很有趣，就叫做「<a href="http://mrjamie.cc/2012/04/20/talent/">天份是什麼，能吃嗎？</a>」</p>

<p>我非常認同這篇文章，因為我自己就是過來人，但也有些許不認同這些文章 &#8230; 因為我也看過一句話：「成功是九十九分的努力，加上一分的天份；大家都在闡述那九十九分的努力有多重要，但卻忘記那一分的天份才是關鍵」。</p>

<p>每個人都有天份，但天份不能拿來當做任何事情的藉口 &#8230;</p>

<p>我曾經被某人嗆過，我有天份，但不要太囂張</p>

<p>何其無辜，我花了十年的時間學會的東西，被人家認為是有天份，真是可笑 &#8230;</p>

<p>記住，每個人都有天份，但關鍵點是在於努力</p>

<p>不是說每個人努力就能成功，但努力過後，你可以更接近機會，而只有機會才會帶領你邁向成功。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[SCSS小技巧：更結構化的寫margin、padding、font..etc]]></title>
    <link href="http://hechien.github.com/octopress/blog/scssxiao-ji-qiao-%3Ageng-jie-gou-hua-de-xie-margin%2C-padding%2C-font-dot-etc/"/>
    <updated>2012-05-02T17:08:00+08:00</updated>
    <id>http://hechien.github.com/octopress/blog/scssxiao-ji-qiao-:geng-jie-gou-hua-de-xie-margin,-padding,-font-dot-etc</id>
    <content type="html"><![CDATA[<p>之前忘記在哪邊看到一篇文章，裡面寫了一個SCSS(SASS)的小技巧，可是我當時沒有辦法把文章给加到閱讀列表中，只好憑印象來測，最後終於測出來了。</p>

<p>我們常常可能寫以下的CSS code</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class='css'><span class='line'><span class="nt">margin-top</span><span class="o">:</span> <span class="nt">30px</span><span class="o">;</span>
</span><span class='line'><span class="nt">margin-right</span><span class="o">:</span> <span class="nt">10px</span><span class="o">;</span>
</span><span class='line'><span class="nt">font-size</span><span class="o">:</span> <span class="nt">24pt</span><span class="o">;</span>
</span><span class='line'><span class="nt">font-family</span><span class="o">:</span> <span class="nt">Arial</span><span class="o">;</span>
</span><span class='line'><span class="nt">padding-top</span><span class="o">:</span> <span class="nt">20px</span><span class="o">;</span>
</span><span class='line'><span class="nt">padding-right</span><span class="o">:</span> <span class="nt">15px</span><span class="o">;</span>
</span></code></pre></td></tr></table></div></figure>


<p>但其實這樣寫挺雜亂的，有了SCSS我們就應該要放下屠刀立地成佛啊！(誤</p>

<p>請改成以下寫法(與上面做比對)：</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
</pre></td><td class='code'><pre><code class='scss'><span class='line'><span class="na">margin</span><span class="o">:</span><span class="p">{</span>
</span><span class='line'>  <span class="na">top</span><span class="o">:</span> <span class="mi">30</span><span class="kt">px</span><span class="p">;</span>
</span><span class='line'>  <span class="na">right</span><span class="o">:</span> <span class="mi">10</span><span class="kt">px</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="na">font</span><span class="o">:</span><span class="p">{</span>
</span><span class='line'>  <span class="na">size</span><span class="o">:</span> <span class="mi">24</span><span class="kt">pt</span><span class="p">;</span>
</span><span class='line'>  <span class="na">family</span><span class="o">:</span> <span class="n">Arial</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="na">padding</span><span class="o">:</span><span class="p">{</span>
</span><span class='line'>  <span class="na">top</span><span class="o">:</span> <span class="mi">20</span><span class="kt">px</span><span class="p">;</span>
</span><span class='line'>  <span class="na">right</span><span class="o">:</span> <span class="mi">15</span><span class="kt">px</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>怎麼樣？是不是很簡潔整齊呢？</p>
]]></content>
  </entry>
  
</feed>
