tag:blogger.com,1999:blog-279776012024-03-05T22:28:54.299+08:00筆記本而已筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.comBlogger84125tag:blogger.com,1999:blog-27977601.post-34222795734126372752017-07-21T11:33:00.001+08:002017-07-21T14:40:01.607+08:00Web 技術中的 Session 是什麼?轉載原文: <a href="http://fred-zone.blogspot.tw/2014/01/web-session.html" target="_blank">Web 技術中的 Session 是什麼?</a><br />
<br />
<hr />
<b>本文目標</b><br />
<br />
<span style="color: #666666;">在 Web 的世界裡,Session 已經是被廣泛使用的一種技術,大多數的 Web 開發者,肯定都能運用自如。在現今的各類 Web 應用程式的開發框架和工具中,Session 也已經被包裝成容易使用的模式,所以本文也就不再多討論 Session 怎麼去使用,而是著重在 Session 的原理和實現上。要知道,無論是使用哪一種語言,這 Session 概念上都是通用的,沒有什麼不一樣。</span><br />
<br />
<hr />
<b>Session 是什麼?</b><br />
<br />
<span style="color: #666666;">Session 之所以會存在,是因為 HTTP 為 stateless 的設計,Server 和 Client 不會一直保持連線狀態,也不會有雙方狀態的即時更新,所以,Server 並不知道 Client 的狀態(像是是否已經登入)。因此,後來的網站開發者,採用 Session 這樣的設計來解決這問題。有趣的是,Session 機制在最早的 CGI 年代,是完全要程式設計師徒手寫出來的,搞死了很多人,不像現在的網站開發者有現成的許多解決方案可以選擇,不必完全了解也可以使用。</span><br />
<br />
<hr />
<b>Session 的原理</b><br />
<br />
<span style="color: #666666;">很多人在討論 Session 時,不免與 Cookie 牽扯上關係,反而不小心偏了重點,所以在了解 Session 時必須有個觀念,就算沒有 Cookie 的存在,Session 機制也可以正常運作。Cookie 在 Session 機制中,可以扮演許多角色,也可以對原始的 Session 機制做許多改良,但不用急著過早討論。從 Session 為什麼被需要來切入,自運作原理來了解,反而比較實際也易懂。最後再來討論 Cookie 在裡面所扮演的角色,才會比較清楚。</span><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">簡單來說,Session 的機制就像是你去飲料店下了單以後,得到號碼牌,然後你走開幾步,店員就忘了你是誰。所以,如果你想去取飲料,你就得靠這張號碼牌,去跟店員領,店員會跟據這號碼牌,認定你是顧客、是否點過餐、知道你點了什麼東西,然後可以接著給你屬於你的飲料。</span><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">理解 Session 的原理後,回到 HTTP 上就是一樣的。只是,在網頁技術中,有兩種方法讓 Client 取得號碼牌,一個是用 Cookie,另一個是直接輸出並嵌入頁面之中的方法(就是要你把號碼背起來)。</span><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">拿號碼牌去 Server 要資料,主要也分為兩種方法,Cookie 和運用標準的 Query string/POST body方法。(其實只要能把號碼傳到 Server 上,任何方法都行)</span><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">只不過,因為實作上的困難度考量,還有現今的 Browser 預設都支援 Cookie,所以在現有的網站框架中,都預設採用 Cookie 來發號碼牌和兌換資料。Cookie 的交換會在建立連線時,在背景自動完成,因此開發者不必考慮Client/Server的號碼牌交換問題。因為 Browser 會在建立連線後,第一時間就自動在背景把 Cookie 上傳到 Server,Server 也在回傳資料時,第一時間自動把 Cookie 回傳給 Client。</span><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">所以,除非是有必要(像是 Browser/Client 不支援 Cookie 的情況),才會保留另一種實作。</span><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">BTW, 飲料店拿號碼牌的例子應該很容易解釋清楚 Session 的原理。</span><br />
<br />
<hr />
<b>Cookie-based Session</b><br />
<br />
<span style="color: #666666;">這邊要注意的是,有一種 Session 會讓很多很多人感到混亂,就是 cookie-based session。問題在於名稱上的誤導,你可能會想,既然幾乎所有的 Session 機制都會用到 cookie,是否都可以稱做 cookie-based session?</span><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">其實大多數人說的 cookie-based session ,指的是儲存資料方式的不同,不是指領號碼牌時,是否有用到 cookie。(不過如果早個十年,當時講的 cookie-based session,可能多半指的就是領號碼牌時,有沒有用到 cookie。摔碗!)</span><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">很多人在討論 Cookie 與 Session 的關係時,兩種用到 Cookie 的地方,時常混在一起講,這就不免要雞同鴨講筆戰一番了。</span><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">事實上,在最原始的 Session 設計,大多開發者都將資料存在 Server 上,也就是你點了什麼飲料,都是記錄在 Server 裡,可能是 Database、記憶體或是檔案,可以以任何一種形式儲存。然後,當你去領飲料時,店員會輸入你的號碼,用你的號碼得知你是否點過餐、點了什麼東西。</span><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">一般的小網站,這樣的解決方案並沒有什麼問題。但是對今天這種超大流量的網站服務來說,因為他們有無數台對外的 Server,有如無數個服務窗口,讓顧客總是隨機進入其中一個窗口來兌換飲料,所以後端怎麼存放和共享這個 session 資料,又要兼顧效能和方便維護,就變成是很大的問題。</span><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">因此 Cookie-based Session 就被提出為一個解決方案,把資料暫存放在 Cookie 中,讓 Client 自己負責保存。簡單來說,就是把你點什麼飲料,通通直接寫在號碼牌上。Server 就可以直接看你的號碼牌上寫了什麼,而不必花大量時間去後面建立大規模的 Server 來處理 Session 。</span><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">不過,這邊要特別提到,因為 cookie 有 4K 資料大小的限制,很多網站服務會選擇 cookie-based 和後端儲存並行的方案。</span><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">或許有人會問到 Cookie 是否有可能被篡改?這類安全問題,通常會使用加密手段來解決。一般來說,Cookie-based session 的 cookie 會被加密,只有 Server 才知道如何解開,Client 並沒有能力可以存取,只是得到一個看不懂的包裹,所以不會有安全性的問題(當然還是有機會被破)。</span><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">由於仍然存在風險,這也是其中一個原因,為什麼有些網站仍然會採用 cookie-based 和後端儲存 Session 並行的解決方案,或是會避免把敏感資料放在 Cookie-based Session 上。</span><br />
<br />
<hr />
<b>什麼是 Session 傳值?</b><br />
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">時常會聽到『使用 Session 傳值』這類說法,其實就是利用 Session 機制儲存資料,讓不同頁面之間可以互相傳遞資料。其原理通常是使用 Query String 或 POST body 等方法,把資料往 Server 傳之後,在 Server 端將 Client 上傳的資料存在 Session 之中。之後的連線或開啟其它頁面時,因為你拿的號碼牌是同一個,所以在不同的頁面之下,仍然可以讀到前一次所儲存在 Session 的狀態。</span><br />
<hr />
<div>
<br /></div>
筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com1tag:blogger.com,1999:blog-27977601.post-19829730122023440222017-07-20T18:19:00.000+08:002017-07-20T18:19:02.958+08:00在 Chrome 關閉並且重新開啟多個視窗 (每個視窗都有一個以上分頁)從右上角選單中,用[結束(X)](Ctrl + Shift + Q)選項來關閉 chrome,就可以儲存全部視窗狀態。<br />
<br />
<span style="color: red;">不要</span>直接按 "X" 關閉<br />
<br />
參考來源 : <a href="https://productforums.google.com/forum/#!topic/chrome/8cv-X2jwWbg" target="_blank">Closing and reopening multiple windows (each having multiple tabs)</a>筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-1148689216238260682016-11-25T09:06:00.000+08:002016-11-25T11:13:09.500+08:00< script ... type="text/x-tmpl" > 是甚麼語法? 作用為何?最近在學習使用 jQuery plugin "<a href="http://plugins.jquery.com/blueimp-file-upload/">jQuery-file-upload</a>" 的時候,在其所提供的 PHP 範例出現了一段這樣的語法 :
<br />
<pre class="prettyprint lang-html"><script id="template-download" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-download fade">
{% if (file.error) { %}
<td></td>
<td class="name"><span>{%=file.name%}</span></td>
...
</pre>
乍看之下感到很納悶,我用的是 PHP 範例,怎麼會出現類似 ASP 的 % 符號? 再仔細一看,<script> 標籤中出現了 type="text/x-tmpl" 沒見過的 <a href="https://zh.wikipedia.org/wiki/%E5%A4%9A%E7%94%A8%E9%80%94%E4%BA%92%E8%81%AF%E7%B6%B2%E9%83%B5%E4%BB%B6%E6%93%B4%E5%B1%95">MIME type</a>,猜想這應該是沒學過的語法,上網 google 了之後找出了答案,這是使用 javascript 作為 template engine 將資料輸出成為 html 格式的用法。<br />
<br />
把 <script> 標籤的 type 設定為 text/x-tmpl 類型,目的是為了防止瀏覽器將 <script>...</script> 中的內容翻譯成 javascript。也就是刻意讓瀏覽器認不出這段 <script> 的用途,因而跳過這部分。<br />
<br />
剩下的工作就是讓專門的 javascript 樣板引擎,將這段內容中的資料,套用一般程式的<a href="https://zh.wikipedia.org/wiki/%E6%8E%A7%E5%88%B6%E6%B5%81%E7%A8%8B">流程控制</a>輸出成 html 格式。<br />
<br />
將變數資料輸出成 html 格式是 server-side 樣板語言(PHP,ASP)的主要功能。只不過在這裡使用 javascript 作為 client-side 的 html 樣板語言。<br />
<br />
text/x-tmpl 並非公定標準的 <a href="https://zh.wikipedia.org/wiki/%E5%A4%9A%E7%94%A8%E9%80%94%E4%BA%92%E8%81%AF%E7%B6%B2%E9%83%B5%E4%BB%B6%E6%93%B4%E5%B1%95">MIME type</a>,而是由樣板引擎的作者自行制定的,其中流程控制的部分也用了特殊的標籤,比如 "{% .... %}",目的是為了和 html 標籤作區別以免混淆。<br />
<br />
client-side 樣板引擎有來自不同作者的各種版本,此篇的語法是來自 <a href="https://github.com/blueimp/">Sebastian Tschan</a>,他最著名的作品是 <a href="http://plugins.jquery.com/blueimp-file-upload/">jQuery-file-upload</a><br />
<br />
-----<br />
參考資料:<br />
<br />
<ul>
<li><a href="http://stackoverflow.com/questions/10025856/what-is-x-tmpl">what is x-tmpl</a></li>
<li><a href="https://github.com/blueimp/JavaScript-Templates"><blueimp> JavaScript-Templates</a></li>
</ul>
<!-- script load -->
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?skin=desert"></script>
筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-6025153992641292872016-10-29T12:05:00.000+08:002016-10-31T09:19:13.867+08:00"invoke" 在程式語言中該怎麼翻譯 (定義)<br />
<a name='more'></a>時常在不同程式的文件中,看到這個字 "invoke",通常都以 "function" 作為主詞連著用,就是 "invoke a function" ...之類的。
<br />
<br />
invoke 查詢網路字典(yahoo,google),得到的翻譯如下:
<br />
<br />
<ul>
<li>調用(資源)</li>
<li>祈求(神等)庇護,乞靈於</li>
<li>以法術咒語招(鬼怪等)</li>
<li>懇求,祈求,乞求[(+on/upon)]</li>
<li>訴諸(法律等);行使(法權等)</li>
<li>喚起;引起;造成</li>
</ul>
<br />
<div>
invoke 在不同的主詞,不同的情況,有不同的定義,在 programming 領域中又該怎麼定義,使用它呢?
</div>
<br />
<div>
這個問題一直困擾我很久,過去我都用 "召喚 or 調用 function" 來解釋,最近才開始認真搜尋彙整資料,得出精確的定義。
</div>
<div class="stress-block">
invoke = execute = run = launch = start = (<span style="color: #cc0000;">自動</span>) 被呼叫並執行
<br />
call = (<span style="color: #cc0000;">手動</span>) 呼叫並執行
</div>
<div>
對 invoke 的研究,起源於 <a href="http://www.w3schools.com/js/js_function_invocation.asp" target="_blank">w3school </a>上面看到的一段話 "<span style="color: red;">... a JavaScript function can be invoked without being called</span>"</div>
<div>
<br /></div>
<div>
這段話的翻譯也就是 "javascript function 不需要被呼叫,也能自動執行"</div>
<div>
<br /></div>
<div>
對一般工程師來說,call function 的意思就是 "呼叫函數並且執行它","call" 就等於 "執行",但是上面這段話把 "call" 和 "invoke(執行)" 兩件事分開了。</div>
<div>
<br /></div>
<div>
google 之後,在 <a href="https://en.wikipedia.org/wiki/Execution_(computing)" target="_blank">wiki 對於 execution (computing) 的解釋</a> 中查到了一段話 "<span style="color: red;"> ...a user starting (or launching or invoking) a program, ...</span>"。</div>
<div>
<br /></div>
<div>
既然 wiki 將 invoke 和 launch 和 start 當成是同義字,而 wiki 又是公認最為正確公平的百科全書之一,那就八九不離十可以得到 invoke 在程式領域中就是 "執行" 的結論。</div>
<div>
<br /></div>
<div>
那麼 "call function (呼叫函數)" 和 "invoke function (執行函數)" 到底有甚麼差異呢?</div>
<div>
在以往上課所學的基礎中,這兩個詞彙對我們來說是同義的,不會去思考它們的差異。</div>
<div>
<br /></div>
<div>
後來又四處 google,在 Quora 上找到了一篇問答 "<a href="https://www.quora.com/What-is-the-difference-between-call-and-invoke" target="_blank">What is the difference between call and invoke</a>",由一位印度籍的工程師 <a href="https://www.quora.com/profile/Tavish-Bhagat" target="_blank">Tavish Bhagat</a> 做出淺顯易懂的解釋。</div>
<div>
<br /></div>
<div>
以下引用他的回答全文:</div>
<div>
<br /></div>
<div>
-----</div>
<div>
<br /></div>
<div class="quote">
<div>
Function calling is when you call a function yourself in a program.</div>
<div>
<div>
<br /></div>
<div>
While function invoking is when it gets called automatically.</div>
<div>
For Example, consider this code..</div>
<div>
<br /></div>
<div>
struct s</div>
<div>
{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>int a,b,s;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>s()</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>a=2;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>b=3;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>void sum()</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>s=a+b;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
};</div>
<div>
<br /></div>
<div>
void main()</div>
<div>
{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>struct s obj; //line 1</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>obj.sum(); // line 2</div>
<div>
}</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Here, when line 1 is executed, the function(constructor, i.e. s) is invoked.</div>
<div>
When line 2 is executed, the function sum is called."</div>
</div>
<div>
<br /></div>
</div>
<div>
-----</div>
<div>
<br /></div>
<div>
結論: 以實例學習(learning from example),比抽象化的解釋要有效率。從工作中學,比從課本上學的要多。</div>
<div>
<br /></div>
筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-38287564364003290902016-10-19T19:39:00.001+08:002016-10-29T16:58:47.052+08:00在 javascript 中,分號(;) 出現在 function 的最前面,是做甚麼用的?<br />
<a name='more'></a><br />
javascript 常用到 "自動執行" 的函數,語法如下:<br />
<br />
(funciton(){ ... });<br />
<br />
這種 function 在網頁載入時會自動執行,不需要在 main() 當中呼叫。<br />
前面加上分號 ";",用途是防止前一個 function 忘了以 ";" 做結尾<br />
<br />
<pre class="prettyprint lang-js">// 忘了以 ";" 做結尾的 function
(funciton(){ ... })
// 和之前的 function 串接時,因為前端加上分號,所以避免了錯誤發生
;(funciton(){ ... });
</pre>
參考資料:
<br />
<ul>
<li><a href="http://stackoverflow.com/questions/1873983/what-does-the-leading-semicolon-in-javascript-libraries-do">What does the leading semicolon in JavaScript libraries do?</a></li>
</ul>
<!-- google Javascript code prettifier -->
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?skin=desert"></script>筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-37999402562801726102016-10-10T22:12:00.002+08:002016-10-29T17:25:25.280+08:00在 blogger 上可以使用的外連檔案來源 (如何在 blogger 中替程式碼上色)<br />
<a name='more'></a>最近因為 <a href="http://www.wfublog.com/2016/04/google-drive-disable-direct-link.html">google drive 關閉外連功能</a>,所以導致原本放在 google drive 的 javascript 無法在 blogger 使用,主要是 <a href="https://github.com/syntaxhighlighter">syntax highlighter</a> 這個 plugin。<br />
<br />
在測試了多種的可能性後,找到了 2 種解決方案,同時也推測出 blogger 對於從外部連接 的 javascript source 的接受度 (只是個人推測)<br />
<br />
<span style="background-color: #ffe599;">可行的方案:</span><br />
<ol>
<li>改用 google 自家推出的 <a href="https://github.com/google/code-prettify">code-prettify</a>,用法非常簡單易懂,功能上也不會和 syntax highlighter 差太多,也有多種 themes 可以選擇 (首推)</li>
<li>沿用舊的 syntax highlighter,但是它的 source code 必須放在知名的,可以信賴的,大型企業的 <a href="https://zh.wikipedia.org/wiki/%E5%85%A7%E5%AE%B9%E5%82%B3%E9%81%9E%E7%B6%B2%E8%B7%AF">CDN</a> 網站,比如說 <a href="https://www.cloudflare.com/">Cloud Flare</a></li>
</ol>
<div>
<span style="background-color: #ffe599;">blogger 對於外連的 js 接受度方面:</span></div>
<div>
<br /></div>
<div>
blogger 不接受個人架設的,沒沒無聞的,小型的 CDN,比如說 syntax highlighter 的作者 Alex Gorbatchev 很佛心的提供了個人網站的空間讓大家使用,但是在 blogger 文章中使用就是沒有任何效果。</div>
<div>
<br /></div>
<div>
本來一開始推測是 blogger 不接受普通 http (80 port) 的 source,後來發現放在 Cloud Flare 的 javascript 不管用 http 還是 https 協定都可以 work,所以得出這個結論。</div>
筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-22433953051729073722016-10-07T18:05:00.000+08:002016-10-29T17:19:56.171+08:00How to prevent selecting text on double click?<!-- css load -->
<!-- 本文開始 -->
<br />
<a name='more'></a>1) 使用 jQuery :
<br />
<pre class="prettyprint lang-js"> $(element).mousedown(function(){ return false; })
</pre>
2) 使用 css :
<br />
<pre class="prettyprint"> -webkit-user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
-ms-user-select: none;
</pre>
-----
參考資料:
<br />
<ul>
<li><a href="http://stackoverflow.com/questions/13708908/how-to-prevent-selecting-text-on-double-click">How to prevent selecting text on double click?</a></li>
</ul>
<!-- script load -->
<!-- google code prettifier -->
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?skin=desert"></script>筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-76162340085268466982016-10-03T15:18:00.004+08:002016-10-29T17:39:15.371+08:00function 縮寫名稱代表的完整含意<br />
<a name='more'></a>某些 function 名稱是縮寫,無法第一眼看出含意。<br />
<br />
如果只是死記這些 function 名稱和用法,而不了解它的全名,久而不用之後,很容易發生用法和名稱無法連接的情況。<br />
<br />
所以這種 function 如果能懂它的全名以及代表的意義,有助於長期性的記憶<br />
<br />
<br />
[PHP]<br />
----------<br />
function : sprintf()<br />
meanning : <span style="background-color: white; color: #242729; font-family: "helvetica"; font-size: 15px;">String PRINT Format(ed).</span><br />
<span style="background-color: white; color: #242729; font-family: "helvetica"; font-size: 15px;">參考資料 : </span><br />
<br />
<ul>
<li><a href="http://stackoverflow.com/questions/2300435/what-does-sprintf-stand-for" style="font-family: helvetica; font-size: 15px;">What does sprintf stand for?</a></li>
</ul>
<br />
<div>
----------</div>
筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-69621915912405050902016-09-15T13:25:00.000+08:002016-10-29T17:49:09.253+08:00Difference between PEAR,PECL and Composer<h3>
<a name='more'></a>PECL:( PHP Extension Community Library)</h3>
<div>
<br />
PECL stands for PHP Extension Community Library, it has extensions written in C, that can be loaded into PHP to provide additional functionality. You need to have administrator rights, a C compiler and associated toolchain to install those extensions.</div>
<br />
<h3>
PEAR:( PHP Extension and Application Repository)</h3>
<br />
PEAR is PHP Extension and Application Repository, it has libraries and code written IN php. Those you can simply download, install and include in your code.<br />
<br />
<h3>
COMPOSER:</h3>
<br />
Composer is a dependency management tool in php.<br />
<br />
<h3>
<span style="font-size: small; font-weight: normal;">----------</span><span style="font-size: small; font-weight: normal;">----------</span><span style="font-size: small; font-weight: normal;">----------</span><span style="font-size: small; font-weight: normal;">----------</span><span style="font-size: small; font-weight: normal;">----------</span></h3>
<h3>
Use case:</h3>
<br />
<span style="background-color: #ffe599;">PEAR is soon going to be deprecated.</span><br />
<br />
Using PECL you can install old php extensions, if you are not able to install those extensions from ubuntu repository.<br />
<br />
For example your server is running ubuntu LTS 14.04 and php version is 5.3, you will not be able to install oauth by apt-get install php5-oauth. It will give error.<br />
<br />
You can use composer in your own project to manage external libraries and dependencies. Composer has https://packagist.org/ to use different php libraries.<br />
<br />
<h3>
<span style="font-size: small; font-weight: normal;">----------</span><span style="font-size: small; font-weight: normal;">----------</span><span style="font-size: small; font-weight: normal;">----------</span><span style="font-size: small; font-weight: normal;">----------</span><span style="font-size: small; font-weight: normal;">----------</span></h3>
<div>
參考資料 : </div>
<div>
<ul>
<li><a href="http://stackoverflow.com/questions/1385346/what-are-differences-between-pecl-and-pear">stackoverflow</a></li>
<li><a href="https://medium.com/@deboj88/difference-between-pear-pecl-and-composer-6426223c55ff">medium.com</a></li>
</ul>
</div>
筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-80842414862555693882016-09-04T15:34:00.000+08:002016-09-04T15:34:37.292+08:00How to generate video thumbnails in php?<!-- ### syntax highlighter ### (start) -->
<!-- required JS files -->
<script src="https://googledrive.com/host/0ByDAwYWFfbZWUi1jMUFQUEdjX1k" type="text/javascript"></script> <!-- shCore.js -->
<!-- At least one brush, here we choose JS. You need to include a brush for every language you want to highlight -->
<script src="https://googledrive.com/host/0ByDAwYWFfbZWVUphVTd6TlMxZnM" type="text/javascript"></script> <!-- shBrushPhp.js -->
<!-- Include *at least* the core style and default theme -->
<link href="https://googledrive.com/host/0ByDAwYWFfbZWWEVZWEJUWl9sMFk" rel="stylesheet" type="text/css"></link> <!-- shCore.css -->
<link href="https://googledrive.com/host/0ByDAwYWFfbZWOGl6TUVCSjBzd28" rel="stylesheet" type="text/css"></link> <!-- shCoreDefalut.css -->
<link href="https://googledrive.com/host/0ByDAwYWFfbZWMk5laFFsZTVLNFU" rel="stylesheet" type="text/css"></link> <!-- shThemeDefault.css -->
<!-- Finally, to actually run the highlighter, you need to include this JS on your page -->
<script type="text/javascript"> SyntaxHighlighter.all() </script>
<!-- ### syntax highlighter ### (end) -->
<br />
<br />
A Video link without a thumbnail is like a smartphone without a camera, you can use it but no one would like to use it. If you want your visitors to see your video, you need to make sure that your video link has a thumbnail which is forcing users to click on the link.<br />
<br />
How can we do this?<br />
<h4>
</h4>
<h4>
</h4>
<h4>
</h4>
<h4>
</h4>
<h4>
1. Generate thumbnails for video using ffmpeg</h4>
<div>
<br /></div>
There is a easy way to generate thumbnails for video in Linux using ffmpeg, it is nice library for processing videos.<br />
<h3>
</h3>
<h3>
</h3>
<h3>
First Install FFmpeg on your server</h3>
<div>
<br /></div>
If you are using ubuntu then refer following link to install FFmpeg<br />
<br />
<a href="http://www.sysads.co.uk/2014/07/install-ffmpeg-2-3-ubuntu-14-04/">http://www.sysads.co.uk/2014/07/install-ffmpeg-2-3-ubuntu-14-04/</a><br />
<br />
<pre class="brush: php">// Code to generate video thumbnail
// Location where video thumbnail to store
$thumbnail_path = 'your_site_domain/media/images/thumbnail/';
$second = 1;
$thumbSize = '150x150';
// Video file name without extension(.mp4 etc)
$videoname = 'sample_video';
// FFmpeg Command to generate video thumbnail
$cmd = "{$ffmpeg_installation_path} -i {$video_file_path} -deinterlace -an -ss {$second} -t 00:00:01 -s {$thumbSize} -r 1 -y -vcodec mjpeg -f mjpeg {$path_to_store_generated_thumbnail} 2>&1";
exec($cmd, $output, $retval);
if ($retval)
{
echo 'error in generating video thumbnail';
}
else
{
echo 'Thumbnail generated successfully';
echo $thumb_path = $thumbnail_path . $videoname . '.jpg';
}
</pre>
<br />
<h4>
2. Vimeo api to get video thumbnail </h4>
<br />
Fetching the vimeo video thumbnail is very simple
<br />
<pre class="brush: php">$videoId = 128122927;
$thumbnail_size = ‘thumbnail_small’;
$hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/$videoId.php"));
return $hash[0][$thumbnail_size];
/*
return $hash[0]["thumbnail_small"];
return $hash[0]["thumbnail_medium"];
return $hash[0]["thumbnail_large"];
*/
</pre>
<h4>
</h4>
<h4>
</h4>
<h4>
3. Youtube video thumbnail API</h4>
<br />
Each YouTube video has 4 generated images.<br />
<br />
<h3>
Use either</h3>
<br />
http://img.youtube.com/vi//0.jpg<br />
http://img.youtube.com/vi//1.jpg<br />
http://img.youtube.com/vi//2.jpg<br />
http://img.youtube.com/vi//3.jpg<br />
<br />
<h3>
or</h3>
<br />
http://img.youtube.com/vi//default.jpg<br />
http://img.youtube.com/vi//hqdefault.jpg<br />
http://img.youtube.com/vi//mqdefault.jpg<br />
http://img.youtube.com/vi//maxresdefault.jpg<br />
<br />
All of the above urls are available over https too.Just change http to https in any of the above urls. Alternatively, you can use the YouTube API to get thumbnail images.<br />
<br />
----------<br />
<br />
參考資料 : <a href="https://techjoomla.com/blog/jgive/video-thumbnail-generation-in-jgive-crowdfunding-donations-joomla.html">How to generate video thumbnails in php?</a>筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-49230217377079654322016-08-31T17:53:00.003+08:002016-10-29T17:48:46.242+08:00Request exceeded the limit of 10 internal redirects due to probable configuration error<h4>
<span style="background-color: white; color: #242729; font-family: "helvetica"; font-size: 15px; line-height: 19.5px;"><a name='more'></a>Solution : </span></h4>
<span style="background-color: white; color: #242729; font-family: "helvetica"; font-size: 15px; line-height: 19.5px;">The .htaccess file in webroot should look like:</span><br />
<span style="background-color: white; color: #242729; font-family: "helvetica"; font-size: 15px; line-height: 19.5px;"><br /></span>
<br />
<pre class="default prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; margin: 0px; padding: 0px; white-space: inherit;"><span class="tag" style="border: 0px; color: #7d2727; margin: 0px; padding: 0px;"><IfModule</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> </span><span class="atn" style="border: 0px; color: #e64320; margin: 0px; padding: 0px;">mod_rewrite</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">.</span><span class="atn" style="border: 0px; color: #e64320; margin: 0px; padding: 0px;">c</span><span class="tag" style="border: 0px; color: #7d2727; margin: 0px; padding: 0px;">></span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</span><span class="tag" style="border: 0px; color: #7d2727; margin: 0px; padding: 0px;"></IfModule></span></code></pre>
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Helvetica; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
instead of this:</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; margin: 0px; padding: 0px; white-space: inherit;"><span class="tag" style="border: 0px; color: #7d2727; margin: 0px; padding: 0px;"><IfModule</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> </span><span class="atn" style="border: 0px; color: #e64320; margin: 0px; padding: 0px;">mod_rewrite</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">.</span><span class="atn" style="border: 0px; color: #e64320; margin: 0px; padding: 0px;">c</span><span class="tag" style="border: 0px; color: #7d2727; margin: 0px; padding: 0px;">></span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">
RewriteEngine On
RewriteBase /projectname
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</span><span class="tag" style="border: 0px; color: #7d2727; margin: 0px; padding: 0px;"></IfModule></span></code></pre>
<pre class="default prettyprint prettyprinted" style="border: 0px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><span style="font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , "courier new" , monospace , sans-serif; font-size: 13px;">
</span></pre>
<pre class="default prettyprint prettyprinted" style="border: 0px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><span style="font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , "courier new" , monospace , sans-serif; font-size: 13px;">參考資料:
<ul>
<li><a href="https://stackoverflow.com/questions/15850845/request-exceeded-the-limit-of-10-internal-redirects-due-to-probable-configuratio/15850937#15850937">stackOverFlow</a></li>
</ul>
</span></pre>
筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-33144978137904938792016-08-19T12:14:00.002+08:002016-10-29T17:48:01.600+08:00為何會有令人詬病的 big-5 ,原來也是 KMT 執政的遺毒<div>
<br />
<a name='more'></a>big-5 是在<span style="background-color: yellow;">1983 </span>年 12 月推出,當時是誰當政就不解釋了</div>
<div>
這裡節錄網路上找到文章的重點部分<br />
<br />
<br /></div>
...(前略)<br />
<div>
<br />
<blockquote class="tr_bq">
<span style="color: #674ea7; font-size: x-small;">事實上,放眼台灣史上制定交換碼的歷程,都是<span style="background-color: yellow;">各部會在搶功</span>。主計處、標準局、教育部,大家都想插一腳,始終沒生出一個能用的碼。 但民間業者也急著推出中文系統,就是在這種時空環境下,業者們才緊急討論出 BIG5 編碼,事實上 BIG5 只是業界標準,<span style="background-color: yellow;">但在政府單位一直鷸蚌相爭下</span>,BIG5 就此就穩穩坐上台灣業界標準,迄今仍舊不搖了。</span></blockquote>
<span style="font-size: x-small;"><span style="color: #674ea7;"><br /></span>
</span><br />
<blockquote class="tr_bq">
<span style="color: #674ea7; font-size: x-small;">但,BIG5 因為是臨時趕出來的,引發的問題也很多。 像 BIG5 的缺字問題就積弊已久,除了日文假名外,還有人名常用字等,如堃、煊這些字都沒有收錄,一直以來,都廣為使用者所詬病。</span></blockquote>
<br /></div>
<div>
...(後略)</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
----------</div>
<div>
<br /></div>
<div>
資料來源: <a href="https://175fd66bab27fccf9f16aa157d7261e6c150ae2a.googledrive.com/host/0BxHqn7o9vZBaWVZKVWhoUVNKa1U/tech.html">Unicode 補完計畫</a></div>
<div>
<br /></div>
筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-29922858136465756052016-08-09T22:03:00.003+08:002016-10-29T17:47:26.933+08:00讓 Windows 上的 PHP 支援多國語言檔名 : php-wfio<!-- ### syntax highlighter ### (start) -->
<!-- required JS files -->
<script src="https://googledrive.com/host/0ByDAwYWFfbZWUi1jMUFQUEdjX1k" type="text/javascript"></script> <!-- shCore.js -->
<!-- At least one brush, here we choose JS. You need to include a brush for every language you want to highlight -->
<script src="https://googledrive.com/host/0ByDAwYWFfbZWVUphVTd6TlMxZnM" type="text/javascript"></script> <!-- shBrushPhp.js -->
<!-- Include *at least* the core style and default theme -->
<link href="https://googledrive.com/host/0ByDAwYWFfbZWWEVZWEJUWl9sMFk" rel="stylesheet" type="text/css"></link> <!-- shCore.css -->
<link href="https://googledrive.com/host/0ByDAwYWFfbZWOGl6TUVCSjBzd28" rel="stylesheet" type="text/css"></link> <!-- shCoreDefalut.css -->
<link href="https://googledrive.com/host/0ByDAwYWFfbZWMk5laFFsZTVLNFU" rel="stylesheet" type="text/css"></link> <!-- shThemeDefault.css -->
<!-- Finally, to actually run the highlighter, you need to include this JS on your page -->
<script type="text/javascript"> SyntaxHighlighter.all() </script>
<!-- ### syntax highlighter ### (end) -->
<br />
<a name='more'></a>官方網站 : <a href="https://github.com/kenjiuno/php-wfio">https://github.com/kenjiuno/php-wfio</a><br />
<br />
簡介 :<br />
<ul>
<li>Unicode(UTF-8 only) filename support for PHP 5.4, 5.5, 5.6, and 7.0 (x86 and x64) on Windows</li>
<li>修正 Windows 系統下,php (目前 7.0.x) 無法讀取多國語言檔名的問題</li>
</ul>
<br />
安裝 :<br />
<br />
1.Put php_wfio.dll into php\ext folder<br />
<br />
2.Edit your php.ini<br />
<pre class="brush: php"> [PHP]
extension_dir = "ext"; // Uncomment this line
extension=php_wfio.dll ; Add this line
</pre>
<br />
3. Run php.exe -m
<br />
<pre class="brush: php"> H:\php-5.4.25>php.exe -m
[PHP Modules]
...
wfio
...
[Zend Modules]
</pre>
<br />
4. Restart Http server
<br />
<br />
使用 :<br />
<br />
怎麼使用呢?最快的方法就是在所有需要讀檔的路徑前加上 wfio:// 就好了<br />
注意: 檔案 or 資料夾必須是完整路徑 (包含最上層的根目錄)<br />
<br />
基本用法舉例 :
<br />
<pre class="brush: php"> $cwd = wfio_getcwd8(); // $cwd = "C:\dir1\dir2\dir3\filename"
file_get_contents("wfio://".$cwd);
$cdir = scandir("wfio://".$cwd);
</pre>
<br />
經過讀取的檔名已經是 UTF-8<br />
無須再使用 mb_convert_encoding(), iconv() 之類的函數做轉碼<br />
<br />
其他更多的用法請參考官網 <a href="https://github.com/kenjiuno/php-wfio">https://github.com/kenjiuno/php-wfio</a><br />
<br />
<br />
<br />
-----<br />
資料來源:<br />
<ol>
<li><a href="https://www.ptt.cc/bbs/PHP/M.1449407058.A.548.html">[請益] Windows 讀取含有繁簡中及日文檔名</a></li>
<li><a href="https://fishome.tw/?p=478#comment-1947">魚樂小格</a> </li>
<li><a href="https://github.com/kenjiuno/php-wfio">php-wfio</a>(官網)</li>
</ol>
筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-67790842069554566122016-07-31T14:57:00.006+08:002016-10-29T17:47:12.624+08:00無線分享器 4 種模式的區別 - 路由,AP,中繼,橋接<div>
<br />
<a name='more'></a>首先要了解一個分享器的規則,凡經過 WAN port 的線路預設都會做 NAT 形成 private network,再從 LAN port 分享給其他設備。</div>
<div>
<br />
再來討論無線分享器的幾種模式:</div>
<div>
<br />
1.<span style="background-color: #ffe599;">「路由模式」(Router)</span><span style="background-color: white; color: #990000;"> </span><br />
<span style="background-color: white; color: #990000;"><br /></span>
<span style="background-color: white; color: #990000;">示意圖</span><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEju2Gfb1sOuculg8ZOqrudxuhKP1qjZshwn_Lq2ZsmbuI8n5DqUxcaaURw7fKluvqwitWhs_eWDsBuya5A6_0G5DUBjG1ziyiBfnXxHpj3-8z-HRlJA9iscOhB5u9uIpC_U1gsT0A/s1600/Mode-Router.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="163" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEju2Gfb1sOuculg8ZOqrudxuhKP1qjZshwn_Lq2ZsmbuI8n5DqUxcaaURw7fKluvqwitWhs_eWDsBuya5A6_0G5DUBjG1ziyiBfnXxHpj3-8z-HRlJA9iscOhB5u9uIpC_U1gsT0A/s320/Mode-Router.jpg" width="320" /></a></div>
<span style="background-color: white; color: #990000;"><br /></span></div>
<span style="background-color: white; color: #990000;"><span style="color: black;"><br /></span></span><span style="color: #990000;">網路線接法</span> : modem LAN port <=> 無線分享器 WAN port<br />
<br />
router 模式通常是預設值,因為舊型 modem 不具備 NAT。<br />
如果 modem 無法關掉 NAT,不建議使用這模式<br />
因為會變成 modem NAT + 分享器 NAT = 2 層 NAT<br />
(例如 192.168.0.xxx -> 192.168.1.xxxx )<br />
<div>
<br /></div>
<div>
<br />
2.<span style="background-color: #ffe599;">「AP 模式」(Access Point)</span><span style="background-color: white;"> </span></div>
<div>
<span style="background-color: white;"><br /><span style="color: #990000;">示意圖</span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEge3h_Nep1DZttk5bz-Ul1Nh9zRIDs0s_Ov1aMlC7_1rCdGl3WTwN4geqqq_yWBjQwe8vP1O-fxHraQ7KEfo-cilgi8RoIFKfNvXJgjVXluPlV7dDIyq9MqIa5gUJSg8-aExuS59A/s1600/Mode-AP.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="165" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEge3h_Nep1DZttk5bz-Ul1Nh9zRIDs0s_Ov1aMlC7_1rCdGl3WTwN4geqqq_yWBjQwe8vP1O-fxHraQ7KEfo-cilgi8RoIFKfNvXJgjVXluPlV7dDIyq9MqIa5gUJSg8-aExuS59A/s320/Mode-AP.jpg" width="320" /></a></div>
<div>
<span style="background-color: white;"><span style="color: #990000;"><br /></span></span></div>
<div>
<span style="background-color: white;"><span style="color: #990000;"><br /></span></span><span style="color: #990000;">網路線接法</span> : modem LAN port <=> 無線分享器 LAN port<br />
<br />
把有線網路,變成 WIFI 無線的,相當於無線的 HUB,記得將 modem wifi 關閉<br />
<br />
<br />
3.<span style="background-color: #ffe599;">「中繼模式」(Repeater or Relay)</span><span style="background-color: white;"> </span><br />
<div>
<span style="background-color: white;"><span style="color: #990000;">示意圖</span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe_irBTBKJ_aFSSOY6NQic9yaXUxmCP-K2qHdyRAOLB3firiNRfQzh2Q1aVrLnMhlNn8oNzw_4Q47NdUTBjoNm4VmBjr5H0s01T4lLijCDEA4KUoU0KKiCS2zMnESKKvpDy44zlQ/s1600/Mode-Reapter.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="183" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe_irBTBKJ_aFSSOY6NQic9yaXUxmCP-K2qHdyRAOLB3firiNRfQzh2Q1aVrLnMhlNn8oNzw_4Q47NdUTBjoNm4VmBjr5H0s01T4lLijCDEA4KUoU0KKiCS2zMnESKKvpDy44zlQ/s320/Mode-Reapter.jpg" width="320" /></a></div>
<div>
<span style="background-color: white;"><span style="color: #990000;"><br /></span></span></div>
<div>
<span style="background-color: white;"><span style="color: #990000;"><br /></span></span><span style="color: #990000;">網路線接法</span> : 不需要網路線連接</div>
<br />
把現有的 WIFI 信號範圍,延伸到更遠。<br />
延伸後的 WIFI 名稱,和原來的一致<br />
<br />
<br />
4.<span style="background-color: #ffe599;">「橋接模式」(Bridge)</span><br />
<br />
<div>
<span style="background-color: white;"><span style="color: #990000;">示意圖</span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJRiD3I7qhlNF1JUjXmXvzA_LbZF78FHGv-ans4M5EGiXuY3utu1lwy47-BZvZiBO3ciy1xq30UF1Y16aP2yfaUoOuuZd73Bm4axpv7FmLqg6MY2_4Q4tuT4xYmCiwn9EAlx8ouQ/s1600/Mode-Bridge.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="205" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJRiD3I7qhlNF1JUjXmXvzA_LbZF78FHGv-ans4M5EGiXuY3utu1lwy47-BZvZiBO3ciy1xq30UF1Y16aP2yfaUoOuuZd73Bm4axpv7FmLqg6MY2_4Q4tuT4xYmCiwn9EAlx8ouQ/s320/Mode-Bridge.jpg" width="320" /></a></div>
<div>
<span style="background-color: white;"><span style="color: #990000;"><br /></span></span></div>
<div>
<span style="background-color: white;"><span style="color: #990000;"><br /></span></span><span style="color: #990000;">網路線接法</span> : 不需要網路線連接</div>
<br />
延伸後的 WIFI 名稱,和原來的不同<br />
<ol>
</ol>
<div>
<br /></div>
<div>
-----</div>
<div>
參考資料:</div>
<div>
<ol>
<li><a href="http://www.cfan.com.cn/2016/0415/125757.shtml" target="_blank">帶你了解路由器AP、路由、中繼、橋接模式的區別 (簡體)</a></li>
</ol>
</div>
<div>
<br /></div>
</div>
筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-57270642798199615782016-07-28T11:09:00.000+08:002016-10-29T17:47:36.087+08:00一張圖看懂甚麼是 VLAN<a href="https://drive.google.com/open?id=0ByDAwYWFfbZWcElNRmx3bXdmWXM" target="_blank">圖片連結</a><br />
<br />
-----<br />
參考來源: <a href="http://www.allsyllabus.com/aj/note/Computer_Science/Computer%20Networks/s2/VLANs.php#.V5l24lX5iaE" target="_blank">All Syllabus</a>筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-21685939838251926702016-07-28T10:54:00.002+08:002016-10-21T22:14:54.607+08:00IP可用範圍 & 分辨網段 & Gateway意義<h3>
<span style="color: #cc0000;">
----------------------<br />IP 可用範圍<br />----------------------</span></h3>
<div>
140.118.123.100/26<br />
<br />
26 = 11111111.11111111.11111111.11000000 = 255.255.255.192 <br />
<br />
<span style="background-color: yellow;">後面 0 的數量</span>為 N,拿來計算 <span style="background-color: yellow;">2^N 次方</span> = 2^6 = 64。這個答案是這個子網路<span style="background-color: yellow;">所有的IP數</span>。<br />
<br />
所以 IP 網段從 140.118.123.100 (第一個) 到 140.118.123.164 (最後一個)<br />
其中這兩個IP不能配給一般電腦<br />
<br /></div>
<div>
所以可以配給電腦的是140.118.123.101 到 140.118.123.163 。 共 62個。</div>
<div>
<blockquote class="tr_bq">
ps.前後兩個ip不能用是因為第一個當網段名稱,最後一個當廣播位址</blockquote>
如果這是考題 ,你就要看清楚 是所有的IP數 還是配出的IP數<br />
<br />
<h3>
<span style="color: #cc0000;">
----------------------<br />分辨網段<br />----------------------</span></h3>
如何判定是否為相同網段?以下說明:<br />
<br />
假設我們要由A電腦連至C電腦:<br />
<br />
A電腦的IP與Subnet Mask做"AND"邏輯運算,得到答案"X"<br />
<br />
C電腦的IP與Subnet Mask做"AND"邏輯運算,得到答案"Y"<br />
<br />
如果X=Y,則為相同網段, <br />
<br />
反之,如果X不等於Y,即為不同網段<br />
<br />
<br />
<h3>
<span style="color: #cc0000;">
----------------------<br />Gateway 意義<br />----------------------</span></h3>
</div>
<div>
1.<br />
Gateway主要功能是用來"<span style="background-color: yellow;">連接兩個不同的網段</span>"。也就是說,如果系統判定目的端為不同網段,就會將封包丟給Gateway來做轉送,反之,如果判定為相同網段,即直接傳到目的端,不會經由Gateway.<br />
<br />
以下我們假設一個環境來說明,您可能會較清楚:<br />
<br />
IP分享器IP: 192.168.1.1 / 255.255.255.0 and WAN(經由ADSL)<br />
<br />
A電腦IP: 192.168.1.11 / 255.255.255.0 Gateway 192.168.1.1<br />
<br />
B電腦IP: 192.168.1.21 / 255.255.255.0 Gateway (空白)<br />
<ol>
<li>A電腦連至B電腦: 相同網段 (不經由Gateway,直接連線)</li>
<li>A電腦連至Internet: 不同網段 (封包由Gateway來轉送,經由ADSL連至Internet)</li>
<li>B電腦連至A電腦: <span style="background-color: yellow;">相同網段 (不經由Gateway,直接連線)</span></li>
<li>B電腦連至Internet: 不同網段 (封包由Gateway轉送,但因Gateway留空,故無法上網)</li>
</ol>
經由以上環境可以發現,如果您的電腦不需連上Internet,而<span style="background-color: yellow;">只需與內部同網段電腦互通,那Gateway 是可以不用設的。</span><br />
<br />
2.<br />
就是通道或出口的意思,一般用在網際網路連線分享時,有可能是由主機配發IP,其他的電腦透過該主機上網,那個主機的IP就是GateWay;或者是IP分享器,本身分配給其他電腦上網,那台IP分享器的IP就是Gateway。<br />
<br />
3.<br />
通常這種分配給內容電腦使用的IP通常使用192.168開頭的網段,通常配發的IP前三串數字會跟Gateway的前三串數字會一樣。例如IP - 192.168.16.101,Gateway - 192.168.16.2。---</div>
<div>
<br />
<h3>
----------------------</h3>
來源: <a href="http://bluemuta38.pixnet.net/blog/post/45543389-ip%E5%8F%AF%E7%94%A8%E7%AF%84%E5%9C%8D-%26-%E5%88%86%E8%BE%A8%E7%B6%B2%E6%AE%B5-%26-gateway%E6%84%8F%E7%BE%A9">Programs Knowledge</a></div>
筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-65395578895535877292016-07-26T21:54:00.000+08:002016-10-29T17:46:26.597+08:00蕃薯粉+蓮藕粉 自製地瓜粉圓<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"></span><br />
<a name='more'></a><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">材料: 地瓜一顆,蕃薯粉,蓮藕粉</span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">-----</span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br />
</span> <span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">作法: </span><br />
<ol>
<li>蕃薯粉 50 公克 + 蓮藕粉 25 公克,蓮藕粉顆粒較粗,要先搗碎一點</li>
<li>地瓜趁熱壓成泥,倒入蕃薯粉跟蓮藕粉裡攪拌均勻,可適量加水不至於太乾</li>
<li>地瓜泥揉至完全看不見粉,也不會太粘手,揉成長條狀來切塊</li>
<li>切塊後,灑上一些磨碎的蓮藕粉,就可放冷凍備用囉</li>
</ol>
<div>
<br /></div>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">來源: <a href="http://blog.xuite.net/katy681011/20070803/75272589" target="_blank">泓曜&秉勳小寶貝的成長日記</a></span>筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-48605092101366423022016-07-26T14:35:00.002+08:002016-10-29T17:47:46.847+08:00差異(differential) & 增量(incremental) 備份的不同處<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
<a href="https://drive.google.com/open?id=0ByDAwYWFfbZWNVZza3JXNnh4SnM" target="_blank">一張圖即可清楚說明</a></div>
<div>
<br /></div>
參考來源: <a href="https://kb.acronis.com/content/1536" target="_blank">Acronis 官網</a>筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-8503478047971560142016-07-17T17:15:00.002+08:002016-10-29T17:46:02.228+08:00如何重設 Windows 下 MySQL root 密碼<br />
<a name='more'></a>如果您忘了在Windows 上的MySQL密碼, 您可以利用以下方法去重設, 最好可以先確認一下您的 my.cnf 有沒有密碼.(on windows is my.ini)<br />
<br />
如果你用新版的MySQL版本, 例如5.0, 也許有些問題, 需再測試一下.<br />
<br />
<ol>
<li>停止您電腦的MySQL服務.</li>
<li>打開命令提示字元視窗(執行內打cmd亦可). 利用 cd 指令到 MySQL bin 的資料夾內, 例如 C:\MySQL\bin .</li>
<li>執行下列指令:<br /><span style="background-color: #b6d7a8;">mysqld.exe -u root --skip-grant-tables</span></li>
<li>離開目前的命令提示字元視窗, 再開一個新的.</li>
<li>一樣cd到 MySQL bin 的資料夾內.</li>
<li>輸入 mysql 然後直接Enter.</li>
<li>現在應該進入 mysql 內了. 輸入 <span style="background-color: #b6d7a8;">use mysql</span>, 執行後就會切換到 mysql db.</li>
<li>執行以下指令去更新密碼:<br /><span style="background-color: #b6d7a8;">UPDATE user SET Password = PASSWORD('NEW_PASSWORD') WHERE User = 'root';</span></li>
</ol>
<br />
離開命令提示字元視窗. 現在可以啟動 MySQL 服務了.<br />
<br />
<br />
參考來源: <a href="http://dba.tw/index.php?topic=457.0" target="_blank">TAIWAN DBA FORUM</a>筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-69981719085252983282016-06-27T11:26:00.002+08:002016-10-29T17:45:32.457+08:00以 XAMPP 在 localhost 安裝 Joomla (或其他CMS) 卡住的問題<span id="goog_1593631319"></span><a href="https://www.blogger.com/"></a><span id="goog_1593631320"></span><br />
<a name='more'></a>簡單來說,這是因為<br />
<ul>
<li>MySQL 預設儲存引擎: InnoDB (新) 和 MyISAM (舊) 特性上差異,新版 (MySQL > 5.5) 的 InnoDB 用到比較多的記憶體空間</li>
<li>新版的 <a href="https://zh.wikipedia.org/wiki/%E5%86%85%E5%AE%B9%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F" target="_blank">CMS </a>內容比過去更大,安裝上也需要比較久的時間</li>
<li>MySQL 和 PHP 的原始設定無法配合以上兩點,就造成系統誤認是當機</li>
</ul>
所以我們要做的就是修改 MySQL 和 PHP 的某些預設值,讓它們可以順利完成安裝,以下舉 Xampp 為例 :<br />
<br />
<div style="text-align: left;">
<span style="color: #e69138;"><b><span style="font-weight: normal;">//----- 修正步驟開始 -----</span></b></span></div>
<div style="text-align: left;">
</div>
<div>
<div>
Xampp should be set to <a class="jcepopup" data-mediabox-height="180" data-mediabox-width="500" href="http://www.weblinksonline.co.uk/run-as-administrator.html" target="_blank">run as Administrator<span class="jcemediabox-zoom-link"></span></a>.<br />
MySQL should be set to run as 'Service' by clicking the <span class="st" style="color: red; font-size: 2em;"><b>☒</b></span> next to it so it becomes a <span class="st" style="color: green; font-size: 2em;"><b>☑</b></span>
</div>
</div>
<div>
</div>
<div>
<span style="background-color: white;">In the <abbr class="tooltip"" title="Listed in sequential order to make it easy for you to search the settings">php.ini file change</abbr></span></div>
<div>
<ul>
<li><span style="background-color: yellow;">max_execution_time</span>=30 to max_execution_time=300<br />and</li>
<li><span style="background-color: yellow;">upload_max_filesize</span>=2M to upload_max_filesize=12M</li>
<li><span style="background-color: yellow;">post_max_size</span>=8M to post_max_size=12M</li>
</ul>
</div>
<div>
<span style="background-color: white;">Then in the my.ini</span></div>
<div>
<ul>
<li><span style="background-color: yellow;">innodb_buffer_pool_size</span> = 16M to innodb_buffer_pool_size = <span style="background-color: white;"><abbr title=" Or higher">32M</abbr></span></li>
<li><span style="background-color: yellow;">innodb_log_file_size</span> = 5M to innodb_log_file_size = 8M</li>
<li>Uncomment
<ul>
</ul>
# <span style="background-color: yellow;">bind-address</span>="127.0.0.1"<span style="color: #e69138;"></span><span style="color: #e69138;"><span style="font-weight: normal;"> </span></span></li>
</ul>
<span style="color: #e69138;"><span style="font-weight: normal;">//----- 修正步驟結束 -----</span></span><br />
<div style="text-align: left;">
<span style="font-weight: normal;"><br /></span></div>
<div style="text-align: left;">
<span style="font-weight: normal;">* 使用的軟體以及版本 : </span></div>
<ul>
<li><span style="font-weight: normal;">OS - Windows 10</span></li>
<li><span style="font-weight: normal;">XAMPP - Version 5.6.21 </span></li>
<li><span style="font-weight: normal;">PHP - Version 5.6.21</span></li>
<li>Apache - 2.4.17 (Win32) </li>
<li>MariaDB - 10.1.13</li>
</ul>
</div>
<br />
* 參考資料 : <br />
<ul>
<li><a href="http://www.weblinksonline.co.uk/tutorials/joomla-tutorials/install-joomla-localhost.html#xampp" target="_blank">Installing Joomla (or Wordpress) on localhost problems with Xampp, Wamp, Mamp and Uniform Server</a> </li>
<li> <a href="https://blog.gslin.org/archives/2012/11/24/3034/mysql-%E4%B8%AD%EF%BC%8Cmyisam-%E8%88%87-innodb-%E5%B8%B6%E4%BE%86%E7%9A%84%E5%B7%AE%E7%95%B0/" target="_blank">MySQL 中,MyISAM 與 InnoDB 帶來的差異...</a> </li>
</ul>
<br />筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-40518519647194902242016-06-02T15:23:00.002+08:002016-10-29T17:45:17.541+08:00Premiere Pro 視訊特效(Video Effect) 中英文對照參考表<span style="font-family: , serif;"><strong></strong></span><br />
<a name='more'></a><span style="font-family: , serif;"><strong>特效名稱</strong></span><br />
<br />
Adjust <span style="font-family: , serif;">色彩調整</span><br />
-Auto Color <span style="font-family: , serif;">自動色彩調整</span><br />
-Auto Contrast <span style="font-family: , serif;">自動對比調整</span><br />
-Auto Levels <span style="font-family: , serif;">自動色階調整</span><br />
-Convolution Kernel <span style="font-family: , serif;">以迴旋粒子特效改變亮度</span><br />
-Extract <span style="font-family: , serif;">灰階模式</span><br />
-Levels <span style="font-family: , serif;">亮度、對比度和色彩平衡</span><br />
-Lighting Effects <span style="font-family: , serif;">光源效果</span><br />
-ProcAmp <span style="font-family: , serif;">多項值調整</span><br />
-Shadow / Highlight <span style="font-family: , serif;">陰影與高光調整</span><br />
<br />
Blur & Sharpen <span style="font-family: , serif;">模糊化與銳利化</span><br />
-Antialis <span style="font-family: , serif;">消除鋸齒</span><br />
-Camera Blur <span style="font-family: , serif;">攝影機模糊</span><br />
-Channel Blur <span style="font-family: , serif;">色頻模糊</span><br />
-Compound Blur <span style="font-family: , serif;">複合模糊</span><br />
-Directional Blur <span style="font-family: , serif;">方向模糊</span><br />
-Fast Blur <span style="font-family: , serif;">快速模糊</span> (<span style="font-family: , serif;">同</span>Gaussian Blur<span style="font-family: , serif;">,但速度較快</span>)<br />
-Gaussian Blur <span style="font-family: , serif;">高斯模糊</span><br />
-Ghosting <span style="font-family: , serif;">鬼影效果</span>(<span style="font-family: , serif;">疊加畫格</span>)<br />
-Sharpen <span style="font-family: , serif;">銳利化</span><br />
-Unsharp Mask <span style="font-family: , serif;">遮色片銳利化調整</span><br />
<br />
Channel <span style="font-family: , serif;">色頻效果</span><br />
-Arithmetic<br />
-Blend <span style="font-family: , serif;">色頻混合</span><br />
-Calculations <span style="font-family: , serif;">色頻計算</span><br />
-Compound Arithmetic<br />
-Invert <span style="font-family: , serif;">反相</span><br />
-Set Matte<br />
-Solid Composite<br />
<br />
Color Correction <span style="font-family: , serif;">色彩校正</span><br />
-Brightness & Contrast <span style="font-family: , serif;">調整亮度與對比</span><br />
-Broadcast Colors <span style="font-family: , serif;">廣播色彩</span><br />
-Change Color <span style="font-family: , serif;">改變顏色</span><br />
-Change to Color <span style="font-family: , serif;">替換顏色</span><br />
-Channel Mixer <span style="font-family: , serif;">波段混合器</span><br />
-Color Balance <span style="font-family: , serif;">色彩平衡</span><br />
-Color Balance (HLS)<br />
-Equalize<br />
-Fast Color Corrector<br />
-Leave Color <span style="font-family: , serif;">去除指定以外的顏色</span><br />
-Luma Corrector<br />
-Luma Curve<br />
-RGB Color Corrector<br />
-RGB Curves<br />
-Three-Way Color Corrector<br />
-Tint<br />
-Video Limiter<br />
<br />
Distort <span style="font-family: , serif;">扭曲變形特效</span><br />
-Bend <span style="font-family: , serif;">扭曲效果</span><br />
-Corner Pin <span style="font-family: , serif;">四點變形</span><br />
-Lens Distortion <span style="font-family: , serif;">透鏡變形</span><br />
-Magnify <span style="font-family: , serif;">放大鏡效果</span><br />
-Mirror <span style="font-family: , serif;">鏡射</span><br />
-Offset <span style="font-family: , serif;">偏移</span><br />
-Spherize <span style="font-family: , serif;">球化</span><br />
-Transform <span style="font-family: , serif;">變形</span><br />
-Turbulent Displace <span style="font-family: , serif;">亂流置換</span><br />
-Twirl <span style="font-family: , serif;">漩渦</span><br />
-Wave Warp <span style="font-family: , serif;">波浪</span><br />
<br />
GPU Effects<br />
-Page Curl <span style="font-family: , serif;">捲頁效果</span><br />
-Refraction <span style="font-family: , serif;">折射效果</span><br />
-Ripple (Circular) <span style="font-family: , serif;">漣漪效果</span><br />
<br />
Generate <span style="font-family: , serif;">特殊視覺效果</span><br />
-4-Color Gradient 4<span style="font-family: , serif;">色漸層</span><br />
-Cell Pattern <span style="font-family: , serif;">細胞圖案</span><br />
-Checkerboard <span style="font-family: , serif;">棋盤格圖案</span><br />
-Circle <span style="font-family: , serif;">圓形</span><br />
-Eyedropper Fill<br />
-Grid <span style="font-family: , serif;">網格</span><br />
-Lens Flare <span style="font-family: , serif;">光暈效果</span><br />
-Lightning <span style="font-family: , serif;">閃電</span><br />
-Paint Bucket<br />
-Ramp <span style="font-family: , serif;">線性或放射性顏色</span><br />
-Write-on <span style="font-family: , serif;">筆跡效果</span><br />
<br />
Image Control <span style="font-family: , serif;">影像控制</span><br />
-Black White <span style="font-family: , serif;">灰階</span><br />
-Color Balance (RGB) <span style="font-family: , serif;">色彩平衡</span><br />
-Color Match <span style="font-family: , serif;">色彩符合</span><br />
-Color Pass <span style="font-family: , serif;">除去指定以外的顏色</span><br />
-Color Replace <span style="font-family: , serif;">色彩置換</span><br />
-Gamma Correction <span style="font-family: , serif;">伽瑪校正</span><br />
<br />
Keying <span style="font-family: , serif;">去背合成</span><br />
-Alpha Adjust <span style="font-family: , serif;">將</span>PS<span style="font-family: , serif;">圖層以</span>Alpha<span style="font-family: , serif;">色版儲存可於此使用</span><br />
-Blue Screen Key <span style="font-family: , serif;">藍幕去背</span>(<span style="font-family: , serif;">針對拍攝特殊藍幕使用</span>)<br />
-Chroma Key <span style="font-family: , serif;">指定背景顏色</span><br />
-Color Key <span style="font-family: , serif;">去除背景顏色</span><br />
-Difference Matte<br />
-Eight-Point Garbage Matte<br />
-Four-Point Garbage Matte<br />
-Image Matte Key <span style="font-family: , serif;">去除遮罩背景色</span><br />
-Luma Key <span style="font-family: , serif;">去除亮度</span><br />
-Non Red Key <span style="font-family: , serif;">去除紅色以外背景</span><br />
-RGB Difference Key <span style="font-family: , serif;">指定顏色範圍</span><br />
-Remove Matte<br />
-Sixteen-Point Garbage Matte<br />
-Track Matte Key <span style="font-family: , serif;">指定素材的亮度或</span>Alpha<span style="font-family: , serif;">為遮罩</span><br />
<br />
Noise & Grain <span style="font-family: , serif;">雜訊效果</span><br />
-Dust & Scratches <span style="font-family: , serif;">粉末與刮痕</span><br />
-Median <span style="font-family: , serif;">中間值</span><br />
-Noise <span style="font-family: , serif;">雜訊</span><br />
-Noise Alpha Alpha<span style="font-family: , serif;">雜訊</span><br />
-Noise HLS <span style="font-family: , serif;">手動雜訊</span><br />
-Noise HLS Auto <span style="font-family: , serif;">自動雜訊</span><br />
<br />
Perspective <span style="font-family: , serif;">透視效果</span><br />
-Basic 3D <span style="font-family: , serif;">基礎</span>3D<span style="font-family: , serif;">效果</span><br />
-Bevel Alpha Alpha <span style="font-family: , serif;">倒角</span><br />
-Bevel Edges <span style="font-family: , serif;">邊緣倒角</span><br />
-Drop Shadow <span style="font-family: , serif;">陰影效果</span><br />
-Radial Shadow<br />
<br />
Render <span style="font-family: , serif;">渲染特效</span><br />
-Ellipse <span style="font-family: , serif;">橢圓形</span><br />
<br />
Stylize <span style="font-family: , serif;">風格化</span><br />
-Alpha Glow <span style="font-family: , serif;">邊緣亮光化</span><br />
-Brush Strokes <span style="font-family: , serif;">筆刷效果</span><br />
-Color Emboss <span style="font-family: , serif;">彩色浮雕效果</span><br />
-Emboss <span style="font-family: , serif;">灰階浮雕效果</span><br />
-Find Edges <span style="font-family: , serif;">找尋邊緣</span><br />
-Mosaic <span style="font-family: , serif;">馬賽克</span><br />
-Posterize <span style="font-family: , serif;">正負片混合</span><br />
-Replicate<br />
-Roughen Edges<br />
-Solarize<br />
-Strobe Light<br />
-Texturize <span style="font-family: , serif;">紋理效果</span><br />
-Threshold <span style="font-family: , serif;">高反差</span><br />
<br />
Time <span style="font-family: , serif;">時間</span><br />
-Echo <span style="font-family: , serif;">殘影效果</span><br />
-Posterize Time <span style="font-family: , serif;">跳格特效</span><br />
-Time Warp <span style="font-family: , serif;">改變速度</span>(Pro 2.0<span style="font-family: , serif;">無</span>)<br />
<br />
Transform <span style="font-family: , serif;">幾何變化</span><br />
-Camera View <span style="font-family: , serif;">攝影機觀點</span><br />
-Crop<br />
-Edge Feather <span style="font-family: , serif;">邊緣羽化</span><br />
-Horizontal Flip <span style="font-family: , serif;">水平翻轉畫面</span><br />
-Horizontal Hold <span style="font-family: , serif;">水平傾斜</span><br />
-Roll <span style="font-family: , serif;">左右上下滾動</span><br />
-Vertical Flip <span style="font-family: , serif;">垂直翻轉畫面</span><br />
-Vertical Hold <span style="font-family: , serif;">向上翻捲</span><br />
<br />
Transition <span style="font-family: , serif;">轉場效果</span><br />
-Block Dissolve<br />
-Gradient Wipe<br />
-Linear Wipe<br />
-Radial Wipe<br />
-Venetian Blinds<br />
<br />
Utility<br />
-Cineon Converter <span style="font-family: , serif;">色頻變換</span><br />
<br />
Video <span style="font-family: , serif;">視訊效果</span><br />
-Timecode <span style="font-family: , serif;">顯示時間碼</span><br />
<br />
<span style="font-family: , serif;">-----</span><br />
<span style="font-family: , serif;"> 轉載自 <a href="http://goo.gl/qWZCe9" target="_blank"><MADer 資料庫></a> </span> 筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-31722178623325275092016-05-25T17:44:00.004+08:002016-10-29T17:45:01.569+08:00visual studio 2015 無法建立 C++ 專案<br />
<a name='more'></a>可能原因與解決辦法 : <br />
<ul>
<li>原因 1 : visual studio 沒有安裝 C++ 的相關元件 (compiler, tools ...etc)</li>
<li>解決辦法 : </li>
<ul>
<li>較新版的 visual studio (如 2015) 預設只安裝微軟自家的 C#, VB 元件,自行新增 C/C++ 元件即可<br />(win10) "設定 > 系統 > 應用程式與功能" 找到 visual studio 按下 "修改",接下來按指示操作即可</li>
</ul>
</ul>
<ul>
<li>原因 2 : visual studio 改變了預設的介面語系</li>
<li>解決辦法 : </li>
<ul>
<li>如果你安裝並使用了 visual studio 的其它語系 ( 如介面原來是中文,改成英文 ),開新專案時就會出現視窗跳掉,無法新增專案的情形,只要改回預設語系即可 ( 或是重新安裝想要的語系 ) </li>
</ul>
</ul>
參考資料 :<br />
<a href="http://goo.gl/ZccJZ5" target="_blank">stackOverFlow : "Visual Studio 2015: Can't create a new empty project c++"</a><br />
<a href="https://goo.gl/grYMA1" target="_blank">reddit : Visual studio 2015 can't create project of win32 console</a><br />
<br />筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com1tag:blogger.com,1999:blog-27977601.post-45758208248230845842016-05-20T15:04:00.001+08:002016-10-29T17:43:52.316+08:00【After Effects】打字+閃爍提示符號<span style="color: #6aa84f;"></span><br />
<a name='more'></a><span style="color: #6aa84f;">/* 【打字+閃爍提示符號】 Ver.160520-1</span><br />
<span style="color: #6aa84f;">歡迎自由取用散布,意見回饋與討論 <a href="http://lifeiskuso.blogspot.tw/">http://lifeiskuso.blogspot.tw/</a> </span><br />
<span style="color: #6aa84f;"><MegaTool> by MegaLoh @ 2016</span><br />
<span style="color: #6aa84f;">*/ </span><br />
<br />
<span style="color: #6aa84f;">// 每秒顯示字元</span><br />
charPerSec = 5;<br />
<br />
<span style="color: #6aa84f;">// 可自訂提示符號,預設為 "_"</span><br />
prompt = [ "_", " " ];<br />
<br />
<span style="color: #6aa84f;">// 目前打字顯示位置</span><br />
typePos= Math.round( time * charPerSec );<br />
<br />
i = Math.round(time % 1);<br />
text.sourceText = substr( 0, typePos) + prompt[i];筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-79454160185592705502016-04-25T14:00:00.000+08:002016-06-02T16:46:40.292+08:00static 與 const 關鍵字的用法與差異<br />
static 與 const 原文都有 "固定的" 或 "不變的" 意思,如果放在 C++ 的 class 當中又是怎麼使用呢? 讓我們用以下範例解釋:<br />
<br />
<pre class="brush: cpp;">#include <iostream>
using namespace std;
class Demo {
public:
Demo() {
cout << "*** construct new object ***" << endl;
static_count++;
count++;
}
static int get_static_count() {
cout << "static member \"static_count\" : " << static_count << endl;
return 0;
}
int get_count() {
cout << "non-static member \"count\" : " << count << endl;
return 0;
}
private:
const int const_count = 0;
static int static_count;
int count = 0;
};
int Demo::static_count = 0;
int main(void) {
Demo d1;
Demo::get_static_count();
d1.get_count();
cout << "----------------" << endl;
Demo d2;
d2.get_static_count();
d2.get_count();
cout << "----------------" << endl;
Demo d3;
d3.get_static_count();
d3.get_count();
cout << "----------------" << endl;
return 0;
}
</pre><br />
執行的結果如下所示:<br />
<br />
*** construct new object ***<br />
static member "sta_count" : 1<br />
non-static member "count" : 1<br />
----------------<br />
*** construct new object ***<br />
static member "sta_count" : 2<br />
non-static member "count" : 1<br />
----------------<br />
*** construct new object ***<br />
static member "sta_count" : 3<br />
non-static member "count" : 1<br />
----------------<br />
<br />
在這個範例中 class "Demo" 有2個成員,初始值都設為0<br />
<pre class="brush:cpp; first-line:23">static int sta_count;
int count = 0;</pre>static 類型的成員只能在 <span style="color: red;">class 之外</span>設值<br />
<pre class="brush:cpp; first-line:28">int Demo::static_count = 0;
</pre>我們用 class "Demo" 建立了 3 個物件,<br />
每次新物件建立時,sta_count 以及 count 都做 +1 的動作<br />
<br />
執行的結果顯示,"非" static 的變數每次都會隨著新物件 reset 為初始值<br />
而 static 類型的變數,在整個程式中就是單獨唯一的,不會隨著新物件建立而產生新的副本<br />
所以 static int sta_count 會累積數值,int count 不會<br />
<br />
而設定為 const 類型的變數,則不能作任何更動<br />
如 const_count ++ 編譯時會顯示錯誤<br />
<br />
筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0tag:blogger.com,1999:blog-27977601.post-14765101466302936552016-04-25T12:00:00.001+08:002016-10-29T17:30:09.327+08:00使用 Google 雲端放置網站用的 CSS 與 JavaScript 檔案 (過時)新版請參考<a href="http://lifeiskuso.blogspot.tw/2016/10/blogger-javascript-src.html" target="_blank">此篇</a><br />
<a name='more'></a><hr />
<ol>
<li><strike>在雲端建立放置檔案用的資料夾,權限為公開,但是記得設定唯讀 (如果有這個選項),上傳必要的檔案</strike></li>
<li><strike>檔案上點右鍵 -> "<span style="color: red;">取得檔案共用連結</span>" -> 複製連結</strike></li>
<li><strike>連結中會出現類似 "<span style="color: red;">?id=</span>0ByDAwYWFfbZWOHJoVXg2SnY2dU0" 的參數,複製 ?id= 後面的亂碼</strike></li>
<li><strike>貼在 "<span style="color: red;">https://googledrive.com/host/</span>" URL 之後,就可以直接連結到原始檔案了<br />(ex : "https://googledrive.com/host/0ByDAwYWFfbZWOHJoVXg2SnY2dU0")</strike></li>
</ol>
<hr />
<strike>參考資料 : <a href="http://blogger.gtwang.org/2013/10/how-to-host-css-or-javascript-files-in-blogger-using-google-drive.html">使用 Google 雲端硬碟(Drive)放置 Blogger 部落格使用的 CSS 與 JavaScript 檔案</a></strike>筆記本而已http://www.blogger.com/profile/00397600313563949084noreply@blogger.com0