<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8268379265042441298</id><updated>2024-10-24T03:07:08.257-07:00</updated><category term="note"/><category term="Blogspot"/><category term="highlighter"/><category term="seo"/><category term="server"/><category term="ubuntu"/><category term="Coding"/><category term="Python"/><category term="unit test"/><category term="widget"/><title type='text'>Csiesheep&#39;s note</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sheep-notes.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default'/><link rel='alternate' type='text/html' href='http://sheep-notes.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>資工羊 CsieSheep</name><uri>http://www.blogger.com/profile/02770955607620787305</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb2DMQsGRVEFkhVitWWUGLTGvMf2oCrpa1JtUNtkpu1cL2q9Kl6nW6k6EcL4Bg9IF7BuIb6YdwdlFKKRH0V9olbh1loWlyeOkerfjXWkmDr8csbS5HxwRHuFIWoGNTVRY/s220/IMG_4506.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8268379265042441298.post-3678642759353168920</id><published>2011-02-10T09:37:00.000-08:00</published><updated>2011-02-10T09:37:26.454-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="server"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><title type='text'>如何設定 sudo 權限?</title><content type='html'>sudo 的權限是設定在 /etc/sudoers (需要root權限才能修改)&lt;br /&gt;
&lt;br /&gt;
/etc/sudoers 的格式：&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;# 使用者   登入來源主機=(可切換的帳號)  可下達的指令
root  ALL=(ALL) ALL

# 群組   登入來源主機=(可切換的帳號)  可下達的指令
%sudo ALL=(ALL) ALL
&lt;/pre&gt;&lt;br /&gt;
如果想將 user1 可以用 sudo 來 執行 ls&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;user  ALL=(ALL) /bin/ls #需要是絕對路徑!&lt;/pre&gt;&lt;br /&gt;
方便設定一群 sudoers 的話，就是開一個 group (groupadd)，ex: admin&lt;br /&gt;
將 sudoers 加入 admin 群組中 (in /etc/group)&lt;br /&gt;
再加入一行至 /etc/sudoers&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;%admin ALL=(ALL) ALL&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://sheep-notes.blogspot.com/feeds/3678642759353168920/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://sheep-notes.blogspot.com/2011/02/sudo.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/3678642759353168920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/3678642759353168920'/><link rel='alternate' type='text/html' href='http://sheep-notes.blogspot.com/2011/02/sudo.html' title='如何設定 sudo 權限?'/><author><name>資工羊 CsieSheep</name><uri>http://www.blogger.com/profile/02770955607620787305</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb2DMQsGRVEFkhVitWWUGLTGvMf2oCrpa1JtUNtkpu1cL2q9Kl6nW6k6EcL4Bg9IF7BuIb6YdwdlFKKRH0V9olbh1loWlyeOkerfjXWkmDr8csbS5HxwRHuFIWoGNTVRY/s220/IMG_4506.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8268379265042441298.post-1466191500256806705</id><published>2011-02-10T08:58:00.000-08:00</published><updated>2011-02-10T09:06:02.114-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="server"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><title type='text'>How to find Ubuntu and kernel version?</title><content type='html'>Ubuntu version:&lt;br /&gt;&lt;pre class=&quot;brush: bash&quot;&gt;&lt;br /&gt;# cat /etc/issue&lt;br /&gt;Ubuntu 10.04 LTS \n \l&lt;/pre&gt;&lt;br /&gt;or&lt;br /&gt;&lt;pre class=&quot;brush: bash&quot;&gt;&lt;br /&gt;# cat /etc/lsb-release&lt;br /&gt;DISTRIB_ID=UbuntuDISTRIB_RELEASE=10.04DISTRIB_CODENAME=lucidDISTRIB_DESCRIPTION=&quot;Ubuntu 10.04 LTS&quot;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Kernel version:&lt;br /&gt;&lt;pre class=&quot;brush: bash&quot;&gt;&lt;br /&gt;# cat /proc/version&lt;br /&gt;Linux version 2.6.18-194.26.1.el5.028stab070.14 (root@rhel5-build-x64) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Thu Nov 18 16:34:01 MSK 2010&lt;/pre&gt;&lt;br /&gt;or&lt;br /&gt;&lt;pre class=&quot;brush: bash&quot;&gt;&lt;br /&gt;# uname -a&lt;br /&gt;Linux 207843 2.6.18-194.26.1.el5.028stab070.14 #1 SMP Thu Nov 18 16:34:01 MSK 2010 i686 GNU/Linux&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://sheep-notes.blogspot.com/feeds/1466191500256806705/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://sheep-notes.blogspot.com/2011/02/how-to-find-ubuntu-and-kernel-version.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/1466191500256806705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/1466191500256806705'/><link rel='alternate' type='text/html' href='http://sheep-notes.blogspot.com/2011/02/how-to-find-ubuntu-and-kernel-version.html' title='How to find Ubuntu and kernel version?'/><author><name>資工羊 CsieSheep</name><uri>http://www.blogger.com/profile/02770955607620787305</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb2DMQsGRVEFkhVitWWUGLTGvMf2oCrpa1JtUNtkpu1cL2q9Kl6nW6k6EcL4Bg9IF7BuIb6YdwdlFKKRH0V9olbh1loWlyeOkerfjXWkmDr8csbS5HxwRHuFIWoGNTVRY/s220/IMG_4506.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8268379265042441298.post-6523339043403678576</id><published>2010-09-18T05:51:00.000-07:00</published><updated>2010-09-18T07:06:22.633-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Coding"/><category scheme="http://www.blogger.com/atom/ns#" term="unit test"/><title type='text'>如何 減少 寫程式 的 風險，作出 較精確的 時程估計</title><content type='html'>最近兩周在完成一份工作&lt;br /&gt;
要把之前作的兩份研究，整合到另一個專案中&lt;br /&gt;
面對的問題大概是這樣子：&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6CheVZoJVMA3fNMA-c27hmhtMj6qkEXMBcwBy1E3liILsi-vIOKtT7ZaG7a6fxIuHNm28kQC1xIoSVLwRAWc2z8wf0TBRZ4yu3UiMRHv-Cp4LkmQZ2VLZoD-OZsF7Pv8FhEBvI1_1fw4/s1600/problem.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;143&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6CheVZoJVMA3fNMA-c27hmhtMj6qkEXMBcwBy1E3liILsi-vIOKtT7ZaG7a6fxIuHNm28kQC1xIoSVLwRAWc2z8wf0TBRZ4yu3UiMRHv-Cp4LkmQZ2VLZoD-OZsF7Pv8FhEBvI1_1fw4/s320/problem.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;記錄一下實作時的想法&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cccccc;&quot;&gt;一開始，是一片混亂，不知道從哪邊開始著手&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cccccc;&quot;&gt;不確定這兩個研究是否還可以順利操作&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cccccc;&quot;&gt;不知道如何規畫時間，不知道兩周是否能完成&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
之前在 Head First OOAD 書上提到 &lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #6aa84f;&quot;&gt;減少風險&lt;/span&gt;&lt;/b&gt; 的想法&lt;br /&gt;
最大的風險來自無知，要減少風險就是要 &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #6aa84f;&quot;&gt;&lt;b&gt;減少不確定的因素&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
那麼就先來設計程式的流程吧&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. Top-down 設計程式流程&lt;/b&gt;：&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO1u5RqroTVih7FFbxZvPqItFd2IU6W3hJ1ch7zJ5Ff5LocEt-7izNFsJRjjRiKfXm8R3MCeWInRgoGDmY8sZayse5mvqfDsP84FQD3_knyFxTKaYkLODpk4uA6q2SiHEE88h-6z3MxgI/s1600/overview.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW6msZyxb1qXfNjupWW73K-XcPSpRkS4XGzOpyA9Ri4nv0Fi5zWmuhyphenhyphena9SoBgwnaOvQKGOP8HWlOLvK9-ZpRCkNIUAVg4BPHNyv7rvIVYaHz2aL2YBYUnpn1nB5O5_QT57GZp-XC8MCOo/s1600/flow.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW6msZyxb1qXfNjupWW73K-XcPSpRkS4XGzOpyA9Ri4nv0Fi5zWmuhyphenhyphena9SoBgwnaOvQKGOP8HWlOLvK9-ZpRCkNIUAVg4BPHNyv7rvIVYaHz2aL2YBYUnpn1nB5O5_QT57GZp-XC8MCOo/s400/flow.png&quot; width=&quot;296&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;設計出 來源 --&amp;gt; 目標 的 overview flow (如左圖)&lt;br /&gt;
來確定每一個 function block (藍色方塊) 的 輸入 / 輸出 是什麼?&lt;br /&gt;
大致的想好 function block 的可行性&lt;br /&gt;
如果有需要 再為 function block 畫出其流程圖 (如右圖)&lt;br /&gt;
(function block 要到多細? 個人的感覺是，可以很快的想出其 pseudo code 時，就差不多了)&lt;br /&gt;
&lt;br /&gt;
先設計程式的流程，有幾個好處&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;b&gt;對程式流程有大概的了解&lt;/b&gt;，了解問題有多嚴重? XD&lt;/li&gt;
&lt;li&gt;&lt;b&gt;提早發現不確定的地方&lt;/b&gt;，不可行的地方，需要其他支援/技術的地方&lt;/li&gt;
&lt;li&gt;&lt;b&gt;實作時不會迷失方向&lt;/b&gt;，能設計出較好的介面&lt;/li&gt;
&lt;li&gt;&lt;b&gt;可以較精確的估計時程&lt;/b&gt;，這是最重要的，減少不確定性，才能作出合理的預估&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. 開始寫程式，要從什麼開始寫&lt;/b&gt;?&lt;br /&gt;
秉持著 &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #6aa84f;&quot;&gt;減少風險 --&amp;gt; 減少不確定的因素&lt;/span&gt; 的想法&lt;br /&gt;
我選擇從 頭尾的 block (Fetcher / Inserter) 開始寫，&lt;br /&gt;
因為這兩個是對外的介面，完成對外的介面，剩下的都是在自已可以掌控的範圍內，相較之下風險較小&lt;br /&gt;
&lt;br /&gt;
先寫出所有對外的介面，有什麼好處：&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;優先解決不確定的因素，剩下可以完全自已掌控的環境&lt;/li&gt;
&lt;li&gt;隔絕外界的干擾，讓你的程式可以與外界更獨立的運作，就算面對的外在環境改變，就只用改介面部份的程式就好&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
3. &lt;b&gt;寫程式的過程中，使用 unit test / recorded test&lt;/b&gt;&lt;br /&gt;
為什麼要寫 unit test? 以及 什麼是 unit test? 可以參考 fcamel 大大 所寫的文章 &lt;a href=&quot;http://fcamel.twbbs.org/archives/2009/06/13/849/&quot;&gt;為什麼要寫 unit test? 為什麼要先寫測試?&lt;/a&gt;&lt;br /&gt;
概念就是，為你的程式的每一個 function (unit)，寫測試，而且最好要先寫&lt;br /&gt;
寫測試的效果大家都知道，就是確保你的程式的正確性&lt;br /&gt;
除此避免 bug 外，它也是一種減少風險的方法&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;b&gt;避免過度設計 (over-design)&lt;/b&gt;：先寫測試，可以讓你了解 function 的輸入 和 輸出，只用寫出滿足輸入 / 輸出正確就行了，往往 &quot;這功能以後很可能會用到&quot; 的寫出來的功能，多半都是用不到。更何況，要用到，以後再寫就好。&lt;/li&gt;
&lt;li&gt;&lt;b&gt;提高程式的可讀性 (readability)&lt;/b&gt;：程式常常無法重新利用的原因，都是看不懂它在幹嘛 或是 跑出來的結果跟想像不一樣。測試 就 是許多的 use case，可以很快的幫助了解程式。&lt;/li&gt;
&lt;li&gt;&lt;b&gt;提高程式的重用性 (re-usability)&lt;/b&gt;：當一個 function 覺得難以測試時，就代表它該被拆成多個小 function。例如: 要寫一個 function 來以 統計 文件中 各個字 出現的數量，字以空白就分隔。這當然可以寫成一個 function 來解決，只是這測試起滿麻煩的；較好的寫法是，拆成3個 functions，一個讀入檔案，一個切空白，一個統計次數。如此一來 各 function 的定位簡單易懂，如此也提高了重用性，假設之後要 以 tab 作分隔 或是 算出文章的長度，都只用再改一個 function 就好了&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;以上，是最近的一些想法&lt;/div&gt;&lt;div&gt;運作的還滿順利的，時程都比較在掌握之中&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;記得 &lt;b&gt;人月神話&lt;/b&gt; 中提到的&lt;/div&gt;&lt;div&gt;完成一個專案，&lt;b&gt;1/2在 debug，1/3 在作規畫，只有1/6在寫程式&lt;/b&gt;&lt;/div&gt;&lt;div&gt;還滿符合這次的經驗 (最後，我大概花了4天在 de 一個 bug... orz)&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sheep-notes.blogspot.com/feeds/6523339043403678576/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/blog-post.html#comment-form' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/6523339043403678576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/6523339043403678576'/><link rel='alternate' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/blog-post.html' title='如何 減少 寫程式 的 風險，作出 較精確的 時程估計'/><author><name>資工羊 CsieSheep</name><uri>http://www.blogger.com/profile/02770955607620787305</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb2DMQsGRVEFkhVitWWUGLTGvMf2oCrpa1JtUNtkpu1cL2q9Kl6nW6k6EcL4Bg9IF7BuIb6YdwdlFKKRH0V9olbh1loWlyeOkerfjXWkmDr8csbS5HxwRHuFIWoGNTVRY/s220/IMG_4506.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6CheVZoJVMA3fNMA-c27hmhtMj6qkEXMBcwBy1E3liILsi-vIOKtT7ZaG7a6fxIuHNm28kQC1xIoSVLwRAWc2z8wf0TBRZ4yu3UiMRHv-Cp4LkmQZ2VLZoD-OZsF7Pv8FhEBvI1_1fw4/s72-c/problem.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8268379265042441298.post-937634425195551535</id><published>2010-09-09T09:53:00.000-07:00</published><updated>2010-09-12T07:46:04.381-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogspot"/><title type='text'>blogspot 熱門文章 widget</title><content type='html'>&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZr1M1rmXPoNq9xqKL-CQNdKl11f5b2cYuvzRCeZCgGS8D4hGShOwRR36_sWMXYCZNyLwnHvGcVlaawjwiH4wRNEIKmFs9nOyWIy3PSZesYi46TEBNBZUUnsrnrTRwvjr4MLxpZb6NutY/s1600/hot_post2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;195&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZr1M1rmXPoNq9xqKL-CQNdKl11f5b2cYuvzRCeZCgGS8D4hGShOwRR36_sWMXYCZNyLwnHvGcVlaawjwiH4wRNEIKmFs9nOyWIy3PSZesYi46TEBNBZUUnsrnrTRwvjr4MLxpZb6NutY/s320/hot_post2.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blogspot 發表了 熱門文章的 widget&lt;br /&gt;
&lt;div&gt;只要進入 &lt;a href=&quot;http://draft.blogger.com/home&quot;&gt;blogspot draft 的資訊主頁&lt;/a&gt;&lt;/div&gt;&lt;div&gt;就可以從 設計 中新增 熱門文章的 widget&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;缺點是目前的 熱門文章 widget 的功能還滿簡略的&lt;/div&gt;&lt;div&gt;可以選擇時間的範圍&lt;/div&gt;&lt;div&gt;可以選擇是否顯示圖片 和 簡述&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;外觀很簡單&lt;/div&gt;&lt;div&gt;置中的排法讓有圖片時，不太好看&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjEKJmn6pNhkXxvFQbb-MklopeUIz9I_H8DK9RJZ81sGMTHu_gAkqPYcTPLdV9pMgWsP2o4keXdyKYQFW8vPgXjHrH2R7CAuFko9N40umP2V28ExLb6kV87QI4cWI9NFycN4K1ycKbHmI/s1600/hot_post.jpg&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5514960190227549730&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjEKJmn6pNhkXxvFQbb-MklopeUIz9I_H8DK9RJZ81sGMTHu_gAkqPYcTPLdV9pMgWsP2o4keXdyKYQFW8vPgXjHrH2R7CAuFko9N40umP2V28ExLb6kV87QI4cWI9NFycN4K1ycKbHmI/s320/hot_post.jpg&quot; style=&quot;cursor: pointer; height: 320px; width: 206px;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;而簡述又太不簡了，會拉的很長&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJtQiCsfJHkb1JuecmnoqWNvhDvo5eIx8ew6S2f6ylZufkIY6IdDzO1HdvXBUIrTAeIu6kr1ZFgIkKZi2xiU4R0P3BqmmEx1tuc_bZ8i_BWkw4VEAbe-jxabaWyBf4kdnCx1sG9EZfww0/s1600/hot_post2.jpg&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5514960200903919666&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJtQiCsfJHkb1JuecmnoqWNvhDvo5eIx8ew6S2f6ylZufkIY6IdDzO1HdvXBUIrTAeIu6kr1ZFgIkKZi2xiU4R0P3BqmmEx1tuc_bZ8i_BWkw4VEAbe-jxabaWyBf4kdnCx1sG9EZfww0/s320/hot_post2.jpg&quot; style=&quot;cursor: pointer; height: 320px; width: 212px;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;目前是覺得用標題最佳&lt;/div&gt;&lt;div&gt;但是，至少希望有個排名的分數 或是 計數吧...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;總而言之，至少 blogspot 有注意到這個需求&lt;/div&gt;&lt;div&gt;相信正式版時會作的更完善的&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sheep-notes.blogspot.com/feeds/937634425195551535/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/blogspot-widget.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/937634425195551535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/937634425195551535'/><link rel='alternate' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/blogspot-widget.html' title='blogspot 熱門文章 widget'/><author><name>資工羊 CsieSheep</name><uri>http://www.blogger.com/profile/02770955607620787305</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb2DMQsGRVEFkhVitWWUGLTGvMf2oCrpa1JtUNtkpu1cL2q9Kl6nW6k6EcL4Bg9IF7BuIb6YdwdlFKKRH0V9olbh1loWlyeOkerfjXWkmDr8csbS5HxwRHuFIWoGNTVRY/s220/IMG_4506.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZr1M1rmXPoNq9xqKL-CQNdKl11f5b2cYuvzRCeZCgGS8D4hGShOwRR36_sWMXYCZNyLwnHvGcVlaawjwiH4wRNEIKmFs9nOyWIy3PSZesYi46TEBNBZUUnsrnrTRwvjr4MLxpZb6NutY/s72-c/hot_post2.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8268379265042441298.post-4851845939762892670</id><published>2010-09-09T08:53:00.000-07:00</published><updated>2010-09-12T07:47:26.311-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="seo"/><category scheme="http://www.blogger.com/atom/ns#" term="widget"/><title type='text'>Linkwithin 超好用 自動產生 延伸閱讀 連結</title><content type='html'>&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqvujZjAsyB_R6azi1jsAEgOltKGAoGT0ewp5sSwY1Z98TlwiNqwzWFxCUI2yX91Z68xW66aWp2rL-2nxyrDuTnC494mSRMdkSZ9fxk19BXu-X8tOp0VGKoNGND6oi1DlmaM4XMCdRb9I/s1600/link-wihin.jpg&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5514943643496036402&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqvujZjAsyB_R6azi1jsAEgOltKGAoGT0ewp5sSwY1Z98TlwiNqwzWFxCUI2yX91Z68xW66aWp2rL-2nxyrDuTnC494mSRMdkSZ9fxk19BXu-X8tOp0VGKoNGND6oi1DlmaM4XMCdRb9I/s320/link-wihin.jpg&quot; style=&quot;cursor: hand; cursor: pointer; height: 231px; width: 320px;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
當然，對每一篇 blog 自已加上 延伸閱讀&lt;br /&gt;
一定是最完善的推薦&lt;br /&gt;
但是，文章一多，要去翻出舊的文章來推薦，也是一件麻煩的事情&lt;br /&gt;
&lt;div&gt;更何況，要丟的美觀也是要花點工夫的&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;不用怕， &lt;a href=&quot;http://www.linkwithin.com/learn&quot;&gt;Linkwithin&lt;/a&gt; 幫你解決這個煩惱!&lt;/div&gt;&lt;div&gt;Linkwithin 是一個 免費 而且 沒有廣告的服務&lt;/div&gt;&lt;div&gt;你只用填上 e-mail 和 blog 網址&lt;/div&gt;&lt;div&gt;就會依據你的選擇來產生 widget code，可以很容易的安裝到你的 blog 上&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;它會根據你的文章的內容，來產生 相關的 延伸閱讀&lt;/div&gt;&lt;div&gt;延伸閱讀的文章，如果有圖，會顯示第一張圖&lt;/div&gt;&lt;div&gt;如果沒有，就顯示標題&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;試用過後，感覺還不錯&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sheep-notes.blogspot.com/feeds/4851845939762892670/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/linkwithin.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/4851845939762892670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/4851845939762892670'/><link rel='alternate' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/linkwithin.html' title='Linkwithin 超好用 自動產生 延伸閱讀 連結'/><author><name>資工羊 CsieSheep</name><uri>http://www.blogger.com/profile/02770955607620787305</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb2DMQsGRVEFkhVitWWUGLTGvMf2oCrpa1JtUNtkpu1cL2q9Kl6nW6k6EcL4Bg9IF7BuIb6YdwdlFKKRH0V9olbh1loWlyeOkerfjXWkmDr8csbS5HxwRHuFIWoGNTVRY/s220/IMG_4506.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqvujZjAsyB_R6azi1jsAEgOltKGAoGT0ewp5sSwY1Z98TlwiNqwzWFxCUI2yX91Z68xW66aWp2rL-2nxyrDuTnC494mSRMdkSZ9fxk19BXu-X8tOp0VGKoNGND6oi1DlmaM4XMCdRb9I/s72-c/link-wihin.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8268379265042441298.post-2090047780358159866</id><published>2010-09-08T07:43:00.000-07:00</published><updated>2010-09-12T07:48:04.585-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="highlighter"/><category scheme="http://www.blogger.com/atom/ns#" term="note"/><title type='text'>其他 highlight code syntax 方法</title><content type='html'>上一篇介紹了 &lt;a href=&quot;http://sheep-notes.blogspot.com/2010/09/syntaxhighter-blogspot-code.html&quot;&gt;SyntaxHighter: 在 blogspot 上顯示漂亮的 code 格式&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
還有其他的方法&lt;br /&gt;
1. &lt;a href=&quot;http://code.google.com/p/google-code-prettify/&quot;&gt;code-prettify&lt;/a&gt; &lt;br /&gt;
一個介紹它的網站，可以看一下它 highlight syntax 的外觀&lt;br /&gt;
沒有選擇這一個，純粹是因為我覺得 Syntaxhighlighter 比較漂亮，而且有&lt;span style=&quot;font-weight: bold;&quot;&gt;行數&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
2. &lt;a href=&quot;http://tohtml.com/&quot;&gt;Online syntax highlighting&lt;/a&gt;&lt;br /&gt;
超方便的 syntax highlighter&lt;br /&gt;
完全不用安裝，而是用 html 語法，來改變字的顏色和背景&lt;br /&gt;
有支援許多種語言&lt;br /&gt;
可惜我選不到喜歡的樣式，以及希望有行數&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
範例：&lt;br /&gt;
&lt;pre style=&quot;background: #000000; color: #d1d1d1;&quot;&gt;&lt;span style=&quot;color: #e66170; font-weight: bold;&quot;&gt;class&lt;/span&gt; X&lt;span style=&quot;color: #d2cd86;&quot;&gt;(&lt;/span&gt;object&lt;span style=&quot;color: #d2cd86;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #d2cd86;&quot;&gt;:&lt;/span&gt;
&lt;span style=&quot;color: #e66170; font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;__init__&lt;/span&gt;&lt;span style=&quot;color: #d2cd86;&quot;&gt;(&lt;/span&gt;self&lt;span style=&quot;color: #d2cd86;&quot;&gt;,&lt;/span&gt; x&lt;span style=&quot;color: #d2cd86;&quot;&gt;=&lt;/span&gt;set&lt;span style=&quot;color: #d2cd86;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #d2cd86;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #d2cd86;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #d2cd86;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #d2cd86;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #d2cd86;&quot;&gt;:&lt;/span&gt;
self&lt;span style=&quot;color: #d2cd86;&quot;&gt;.&lt;/span&gt;x &lt;span style=&quot;color: #d2cd86;&quot;&gt;=&lt;/span&gt; x
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
好用連結：&lt;br /&gt;
http://www.elliotswan.com/postable/&lt;br /&gt;
幫你轉換 &amp;lt;, &amp;gt; 等字元，在貼code時很好用!</content><link rel='replies' type='application/atom+xml' href='http://sheep-notes.blogspot.com/feeds/2090047780358159866/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/highlight-code-syntax.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/2090047780358159866'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/2090047780358159866'/><link rel='alternate' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/highlight-code-syntax.html' title='其他 highlight code syntax 方法'/><author><name>資工羊 CsieSheep</name><uri>http://www.blogger.com/profile/02770955607620787305</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb2DMQsGRVEFkhVitWWUGLTGvMf2oCrpa1JtUNtkpu1cL2q9Kl6nW6k6EcL4Bg9IF7BuIb6YdwdlFKKRH0V9olbh1loWlyeOkerfjXWkmDr8csbS5HxwRHuFIWoGNTVRY/s220/IMG_4506.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8268379265042441298.post-516821837432748502</id><published>2010-09-08T07:12:00.000-07:00</published><updated>2010-09-12T07:48:36.902-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogspot"/><category scheme="http://www.blogger.com/atom/ns#" term="highlighter"/><category scheme="http://www.blogger.com/atom/ns#" term="note"/><title type='text'>SyntaxHighter: 在 blogspot 上顯示漂亮的 code 格式</title><content type='html'>&lt;a href=&quot;http://alexgorbatchev.com/SyntaxHighlighter/&quot;&gt;SyntaxHighlighter&lt;/a&gt; 目前出到 3.0.83 版&lt;br /&gt;
以下是簡單的如何使用在 blogspot 上的流程，官網有詳細的說明&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
1. 安裝 SyntaxHighlighter的 core 和 theme&lt;br /&gt;
在 &amp;lt;header&amp;gt; ... &amp;lt;/header&amp;gt; 之間加上&lt;br /&gt;
&lt;pre class=&quot;brush: js&quot;&gt;&amp;lt;link href=&#39;http://alexgorbatchev.com.s3.amazonaws.com/pub/sh/3.0.83/styles/shCore.css&#39; rel=&#39;stylesheet&#39; type=&#39;text/css&#39;/&amp;gt;  
&amp;lt;script src=&#39;http://alexgorbatchev.com.s3.amazonaws.com/pub/sh/3.0.83/scripts/shCore.js&#39; type=&#39;text/javascript&#39;/&amp;gt;
&amp;lt;link href=&#39;http://alexgorbatchev.com.s3.amazonaws.com/pub/sh/3.0.83/styles/shThemeDefault.css&#39; rel=&#39;stylesheet&#39; type=&#39;text/css&#39;/&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
官方提供了一些 &lt;a href=&quot;http://alexgorbatchev.com/SyntaxHighlighter/manual/themes/default.html&quot;&gt;theme&lt;/a&gt; 的選擇&lt;br /&gt;
&lt;br /&gt;
2. 安裝你想要的語言的 brush&lt;br /&gt;
ex: Python&lt;br /&gt;
&lt;pre class=&quot;brush: js&quot;&gt;&amp;lt;script src=&#39;http://alexgorbatchev.com.s3.amazonaws.com/pub/sh/3.0.83/scripts/shBrushPython.js&#39; type=&#39;text/javascript&#39;/&amp;gt; 
&lt;/pre&gt;&lt;br /&gt;
官方提供的 &lt;a href=&quot;http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/&quot;&gt;brush&lt;/a&gt; 列表&lt;br /&gt;
&lt;br /&gt;
3. 啟動 SyntaxHighlighter&lt;br /&gt;
&lt;pre class=&quot;brush: js&quot;&gt;&amp;lt;script type=&#39;text/javascript&#39;&amp;gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all()
&amp;lt;/script&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
注意：blogspot 一定要加上 SyntaxHighlighter.config.bloggerMode = true;&lt;br /&gt;
&lt;br /&gt;
4. 使用&lt;br /&gt;
語法:&lt;br /&gt;
&lt;pre&gt;&amp;lt;pre class=&quot;brush: &amp;lt;code 的語言&amp;gt;&quot;&amp;gt;
... code ...
&amp;lt;/pre&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
例子: Python code&lt;br /&gt;
&lt;pre&gt;&amp;lt;pre class=&quot;brush: py&quot;&amp;gt;
class X(object):
def __init__(self, x=set([])):
self.x = x
&amp;lt;/pre&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
顯示：&lt;br /&gt;
&lt;pre class=&quot;brush: py&quot;&gt;class X(object):
def __init__(self, x=set([])):
self.x = x
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
使用實例： &lt;a href=&quot;http://sheep-notes.blogspot.com/2010/09/class-xobject-def-initself-xset-self.html&quot;&gt;Python: default value to a constructor&#39;s parameter&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://sheep-notes.blogspot.com/feeds/516821837432748502/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/syntaxhighter-blogspot-code.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/516821837432748502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/516821837432748502'/><link rel='alternate' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/syntaxhighter-blogspot-code.html' title='SyntaxHighter: 在 blogspot 上顯示漂亮的 code 格式'/><author><name>資工羊 CsieSheep</name><uri>http://www.blogger.com/profile/02770955607620787305</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb2DMQsGRVEFkhVitWWUGLTGvMf2oCrpa1JtUNtkpu1cL2q9Kl6nW6k6EcL4Bg9IF7BuIb6YdwdlFKKRH0V9olbh1loWlyeOkerfjXWkmDr8csbS5HxwRHuFIWoGNTVRY/s220/IMG_4506.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8268379265042441298.post-5349914280504104754</id><published>2010-09-07T08:07:00.000-07:00</published><updated>2011-02-10T08:48:18.122-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="note"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>Python: default value to a constructor parameter</title><content type='html'>我們有一個 class X&lt;br /&gt;constructor 有一個參數 x&lt;br /&gt;我們想給 x 預設值為一個空的 set&lt;br /&gt;直覺會這樣子寫：&lt;br /&gt;&lt;pre class=&quot;brush: python&quot;&gt;&lt;br /&gt;class X(object):&lt;br /&gt;  def __init__(self, x=set([])):&lt;br /&gt;    self.x = x&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;只是會發生不符合預期的結果：&lt;br /&gt;&lt;pre class=&quot;brush: python&quot;&gt;&lt;br /&gt;a = X()&lt;br /&gt;b = X()&lt;br /&gt;print a.x is b.x # True &amp;lt;-- not expected! a.x 和 b.x 指到了同一個 set([])&lt;br /&gt;&lt;br /&gt;a.x.add(1)&lt;br /&gt;print a.x # set([1])&lt;br /&gt;print b.x # set([1]) &amp;lt;-- not expected!&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;目前是這樣子來避開這個問題&lt;br /&gt;&lt;pre class=&quot;brush: python&quot;&gt;&lt;br /&gt;class X(object):&lt;br /&gt;  def __init__(self, x=None)):&lt;br /&gt;    self.x = x &lt;br /&gt;    if x is not None else set([])&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;跪求好的解法! 謝謝</content><link rel='replies' type='application/atom+xml' href='http://sheep-notes.blogspot.com/feeds/5349914280504104754/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/class-xobject-def-initself-xset-self.html#comment-form' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/5349914280504104754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/5349914280504104754'/><link rel='alternate' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/class-xobject-def-initself-xset-self.html' title='Python: default value to a constructor parameter'/><author><name>資工羊 CsieSheep</name><uri>http://www.blogger.com/profile/02770955607620787305</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb2DMQsGRVEFkhVitWWUGLTGvMf2oCrpa1JtUNtkpu1cL2q9Kl6nW6k6EcL4Bg9IF7BuIb6YdwdlFKKRH0V9olbh1loWlyeOkerfjXWkmDr8csbS5HxwRHuFIWoGNTVRY/s220/IMG_4506.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8268379265042441298.post-1409471940879672524</id><published>2010-09-02T06:31:00.001-07:00</published><updated>2010-09-12T07:49:22.685-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="seo"/><title type='text'>SEO: blogspot 自動產生 meta keyword 和 content</title><content type='html'>&lt;span style=&quot;font-size: 130%; font-weight: bold;&quot;&gt;meta標籤&lt;/span&gt;，必須放在  之中，用於說明網頁的內容&lt;br /&gt;
對 Search Engine Optimization (SEO) 來說，一直視為很重要的最佳化項目&lt;br /&gt;
&lt;br /&gt;
而其中最重要的就是兩個&lt;br /&gt;
&lt;br /&gt;
1. &lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;description&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
語法：&amp;lt;meta name=&quot;description&quot; content=&quot;sheep 的隨手筆記&quot;/&amp;gt;&lt;br /&gt;
說明：網頁的內容簡述。&lt;br /&gt;
search engine 會抓取 description 來了解網頁的概述，如果沒有，則會抓取網頁內容的最前面幾個字 (ex: 25個字)&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%; font-weight: bold;&quot;&gt;2. keywords&lt;/span&gt;&lt;br /&gt;
語法：&amp;lt;meta name=&quot;keywords&quot; content=&quot;sheep,note&quot;/&amp;gt;&lt;br /&gt;
說明：網頁的關鍵字。最好是以 &#39;,&#39; 來隔開&lt;br /&gt;
&lt;br /&gt;
每個網頁最好都加上此兩種 meta 標籤&lt;br /&gt;
而 blogspot 預設是沒有對 meta 作任何的撰寫的&lt;br /&gt;
有一個方便的方法來自動的在 blogspot 產生 meta tag&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
便是從 &quot;設計&quot; -&amp;gt; &quot;修改html&quot;&lt;br /&gt;
&lt;br /&gt;
在 &lt;span style=&quot;color: #993300;&quot;&gt;&amp;lt;b:skin/&amp;gt;&amp;lt;![CDATA[&lt;/span&gt;  之前，加上&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #993300;&quot;&gt;&amp;lt;b:if cond=&#39;data:blog.pageType == &amp;amp;quot;item&amp;amp;quot;&#39;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #993300;&quot;&gt;&amp;lt;meta expr:content=&#39;data:blog.title + data:blog.pageName&#39; name=&#39;Description&#39;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #993300;&quot;&gt;&amp;lt;meta expr:content=&#39;data:blog.title + data:blog.pageName&#39; name=&#39;Keywords&#39;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #993300;&quot;&gt;&amp;lt;/b:if&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
如此一來，在你的每一篇blog，都會自動的 產生 以 blog title 和 blog pageName 組成的 meta tag&lt;br /&gt;
當然還不夠好的是， 可以再把 keywords 取代以 &#39;,&#39; 作分隔&lt;br /&gt;
(只是我不會，有沒有大大可以提供方法(跪求))&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
然仍，此方法對 SEO 到底有多少幫助?&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Google 已經公開的提出，不使用 meta keywords 來作 ranking 的依據&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;object height=&quot;385&quot; width=&quot;640&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/jK7IPbnmvVU?fs=1&amp;amp;hl=zh_TW&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/jK7IPbnmvVU?fs=1&amp;amp;hl=zh_TW&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;
&lt;br /&gt;
原因當然就是因為 keywords 被濫用了&lt;br /&gt;
然而，據說在 Yahoo 的 search 還是有用&lt;br /&gt;
但是，未來如果跟 Bing 合作了，一切就很難說了</content><link rel='replies' type='application/atom+xml' href='http://sheep-notes.blogspot.com/feeds/1409471940879672524/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/seo-blogspot-meta-keyword-content.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/1409471940879672524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/1409471940879672524'/><link rel='alternate' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/seo-blogspot-meta-keyword-content.html' title='SEO: blogspot 自動產生 meta keyword 和 content'/><author><name>資工羊 CsieSheep</name><uri>http://www.blogger.com/profile/02770955607620787305</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb2DMQsGRVEFkhVitWWUGLTGvMf2oCrpa1JtUNtkpu1cL2q9Kl6nW6k6EcL4Bg9IF7BuIb6YdwdlFKKRH0V9olbh1loWlyeOkerfjXWkmDr8csbS5HxwRHuFIWoGNTVRY/s220/IMG_4506.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8268379265042441298.post-4040482991542774885</id><published>2010-09-01T07:15:00.000-07:00</published><updated>2010-09-12T07:49:38.415-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="note"/><title type='text'>rsync 來備份 mysql database (MyISAM)</title><content type='html'>&lt;a href=&quot;http://www.backup.idv.tw/good_doc/linux/backup/20030726/rsync.htm&quot;&gt;詳細的 rsync 的介紹&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
第一次用到 rsync 是用來作 mysql 的 database 的 備份&lt;br /&gt;
如何你的 database 是用 MyISAM 的 storage engine 的話&lt;br /&gt;
(&lt;a href=&quot;http://zh.wikipedia.org/zh-hk/MyISAM&quot;&gt;wiki 上 MyISAM 的介紹&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
每一個 database 就是一個 directory&lt;br /&gt;
每一個 table 是以三個檔案的形式來儲存&lt;br /&gt;
要備份，可以直接 cp 就好&lt;br /&gt;
&lt;br /&gt;
而用 rsync 的原因在於，&lt;br /&gt;
當 sync 的檔案有改變時，rsync 會去更新有改變的地方，並且可以跨機器的作 sync&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%; font-weight: bold;&quot;&gt;在同機器上作 database 的備份&lt;/span&gt;&lt;br /&gt;
&lt;ol style=&quot;font-family: arial;&quot;&gt;&lt;li&gt;cd mysql_path (ex: /var/lib/mysql)&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;sudo rsync -va database/ destination (需要有 root 權限才能 sync mysql 中的資料夾)&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;span style=&quot;font-size: 130%; font-weight: bold;&quot;&gt;在不同機器上作 database 的備份&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;ol style=&quot;font-family: arial;&quot;&gt;&lt;li&gt;(server1) cd mysql_path (ex: /var/lib/mysql)&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;(server1) sudo rsync -va database/ user@server2:tmp_destination&lt;/li&gt;
&lt;li&gt;(server2) cd mysql_path&lt;/li&gt;
&lt;li&gt;(server2) sudo rsync -va tmp_destination/ destination&lt;/li&gt;
&lt;li&gt;(server2) sudo chown -R mysql:mysql destination  (change directory owner and group)&lt;/li&gt;
&lt;/ol&gt;&lt;span style=&quot;font-size: 130%; font-weight: bold;&quot;&gt;rsync的小細節&lt;/span&gt;&lt;br /&gt;
rsync -va directory destination&lt;br /&gt;
會把 directory 整個sync到 destination 中，會變成  destination/directory&lt;br /&gt;
&lt;br /&gt;
rsync -va directory&lt;span style=&quot;color: red; font-weight: bold;&quot;&gt;/&lt;/span&gt; destination&lt;br /&gt;
會把 directory 下的所有東西 sync到 destination 中</content><link rel='replies' type='application/atom+xml' href='http://sheep-notes.blogspot.com/feeds/4040482991542774885/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/rsync.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/4040482991542774885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8268379265042441298/posts/default/4040482991542774885'/><link rel='alternate' type='text/html' href='http://sheep-notes.blogspot.com/2010/09/rsync.html' title='rsync 來備份 mysql database (MyISAM)'/><author><name>資工羊 CsieSheep</name><uri>http://www.blogger.com/profile/02770955607620787305</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb2DMQsGRVEFkhVitWWUGLTGvMf2oCrpa1JtUNtkpu1cL2q9Kl6nW6k6EcL4Bg9IF7BuIb6YdwdlFKKRH0V9olbh1loWlyeOkerfjXWkmDr8csbS5HxwRHuFIWoGNTVRY/s220/IMG_4506.JPG'/></author><thr:total>0</thr:total></entry></feed>