<?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-4636464703125334513</id><updated>2026-11-10T22:47:45.869+08:00</updated><category term="軟體"/><category term="設定"/><category term="ubuntu"/><category term="linux"/><category term="2011"/><category term="2010"/><category term="程式"/><category term="2012"/><category term="google"/><category term="apple"/><category term="服務"/><category term="iphone"/><category term="2013"/><category term="組合的力量"/><category term="開發"/><category term="python"/><category term="internet"/><category term="ipad"/><category term="mobile"/><category term="免費"/><category term="行動"/><category term="video"/><category term="android"/><category term="安裝"/><category term="mac"/><category term="programming"/><category term="smartphone"/><category term="windows"/><category term="地圖"/><category term="2014"/><category term="2017"/><category term="蘋果"/><category term="電子書"/><category term="創意"/><category term="taiwan"/><category term="世界"/><category term="2019"/><category term="ios"/><category term="maps"/><category term="microsoft"/><category term="mysql"/><category term="2009"/><category term="app store"/><category term="ipod"/><category term="os"/><category term="台灣"/><category term="2016"/><category term="R"/><category term="browser"/><category term="chrome"/><category term="database"/><category term="itunes"/><category term="world"/><category term="廣告"/><category term="電視"/><category term="2015"/><category term="apple tv"/><category term="cloud"/><category term="java"/><category term="kindle"/><category term="music"/><category term="raspberry pi"/><category term="usb"/><category term="地球"/><category term="爬蟲"/><category term="apache"/><category term="bash"/><category term="iptv"/><category term="shell"/><category term="smart tv"/><category term="sony"/><category term="streaming"/><category term="tv"/><category term="反科技"/><category term="可攜"/><category term="筆電"/><category term="2026"/><category term="earth"/><category term="googe"/><category term="search"/><category term="中國"/><category term="中文"/><category term="網路"/><category term="2018"/><category term="UI"/><category term="amazon"/><category term="arduino"/><category term="blog"/><category term="chromium"/><category term="elasticsearch"/><category term="html"/><category term="htpc"/><category term="php"/><category term="picasa"/><category term="wi-fi"/><category term="環保"/><category term="環境"/><category term="遠端桌面"/><category term="雲端"/><category term="WP7"/><category term="ai"/><category term="api"/><category term="canon"/><category term="cassandra"/><category term="excel"/><category term="google tv"/><category term="mxtube"/><category term="nginx"/><category term="ocr"/><category term="pi"/><category term="solr"/><category term="stb"/><category term="vlc"/><category term="vnc"/><category term="wubi"/><category term="壹電視"/><category term="節日"/><category term="聯想"/><category term="輸入法"/><category term="電影"/><category term=".net"/><category term="ICT"/><category term="NoSQL"/><category term="acer"/><category term="adsense"/><category term="angular"/><category term="arm"/><category term="beta"/><category term="bicycle"/><category term="bionic"/><category term="bluetooth"/><category term="business"/><category term="byod"/><category term="chinese"/><category term="code"/><category term="design"/><category term="diy"/><category term="doodle"/><category term="dropbox"/><category term="emm"/><category term="esp8266"/><category term="example"/><category term="facebook"/><category term="fonts"/><category term="game"/><category term="gdp"/><category term="git"/><category term="gpio"/><category term="gps"/><category term="gpu"/><category term="hami"/><category term="ifunbox"/><category term="iphon"/><category term="iprod"/><category term="jailbreak"/><category term="jb"/><category term="keyborad"/><category term="llm"/><category term="love"/><category term="mail"/><category term="mam"/><category term="management"/><category term="matplotlib"/><category term="mdm"/><category term="mongodb"/><category term="nokia"/><category term="nvidia"/><category term="phonegap"/><category term="proxy"/><category term="rar"/><category term="ror"/><category term="rtsp"/><category term="ruby"/><category term="samsung"/><category term="tensorflow"/><category term="travelmate"/><category term="ubun"/><category term="watch"/><category term="wave"/><category term="wbt100"/><category term="weather"/><category term="xmas"/><category term="yahoo"/><category term="光世代"/><category term="天氣"/><category term="投資"/><category term="攝影"/><category term="數據"/><category term="旅遊"/><category term="更新"/><category term="決策"/><category term="管理"/><category term="節能"/><category term="臉書"/><category term="臘八"/><category term="藍芽"/><title type='text'>豆腐腦</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>342</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-4165519229082845157</id><published>2026-11-10T22:47:45.869+08:00</published><updated>2026-11-10T22:47:45.869+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2026"/><category scheme="http://www.blogger.com/atom/ns#" term="數據"/><category scheme="http://www.blogger.com/atom/ns#" term="決策"/><title type='text'>數據不是萬靈丹：個人決策的輔助、盲點與邊界</title><content type='html'>&lt;p&gt;在個人利用數據做決策時，我們常誤以為只要數據夠多，答案就會自動浮現。但事實是，數據只是工具，人腦的認知限制與偏誤才是決策的核心變數。&lt;/p&gt;
&lt;h2&gt;先承認：人腦不是數據處理器&lt;/h2&gt;
&lt;p&gt;很多人以為決策就是輸入資訊、輸出結果，就像電腦運算一樣。但人類在處理和評估資訊時，能力是有極限的 &lt;sup&gt;[1]&lt;/sup&gt;。我們無法同時關注所有資訊，注意力會分散，記憶也容易遺忘 &lt;sup&gt;[2]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;更麻煩的是，我們的大腦有「系統一」和「系統二」兩種模式。系統一快速、直覺，但容易受情緒和刻板印象影響；系統二慢速、理性，但很耗費精力。當數據複雜時，我們往往依賴系統一的直覺，結果做出非理性的選擇。例如，我們可能因為媒體大量報導某類事件，就高估其發生的機率，而忽略統計數據顯示的真實比例 &lt;sup&gt;[3]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;承認自己不是數據處理器，並不意味著放棄理性。相反，這提醒我們需要外部工具來補足大腦的短板。既然我們無法完美地記住所有變數或計算所有機率，就應該設計流程，讓數據以我們能理解的方式呈現，而不是強迫大腦去處理超出負荷的資訊。&lt;/p&gt;
&lt;h2&gt;數據不足時，把直覺變成可檢驗的判斷&lt;/h2&gt;
&lt;p&gt;當數據完全缺失或不足時，我們不能乾等，也不能憑空猜測。這時候，結構化的提問能幫助我們把模糊的直覺轉化為具體的判斷 &lt;sup&gt;[4]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;例如，在預估市場銷售額時，如果專家說「沒概念」，預測人員可以透過一系列區間提問來引導：「會超過一千萬嗎？」「會低於四百萬嗎？」「六百萬是否較有可能？」透過這種逐步縮小範圍的方式，專家能給出更可靠的估計，如「七百萬元左右」 &lt;sup&gt;[4]&lt;/sup&gt;。這顯示即使沒有精確數據，透過結構化對話也能提取出有價值的資訊。&lt;/p&gt;
&lt;p&gt;此外，個人決策往往不是一蹴而就的，而是一個過程。我們可以先透過不同來源獲取資訊，再進行小規模試行，最後才做出全面決定 &lt;sup&gt;[5]&lt;/sup&gt;。這種「試錯」機制能降低風險，讓直覺在實踐中接受檢驗，而不是盲目相信第一感覺。&lt;/p&gt;
&lt;h2&gt;讓工具算、視覺化來看：輔助理性思考&lt;/h2&gt;
&lt;p&gt;既然人腦不擅長複雜計算，我們就應該讓工具來做這些事。決策支援軟體的核心功能，就是代為計算、列出選項，並檢查假設 &lt;sup&gt;[6]&lt;/sup&gt;。電腦擅長記憶、計算和比較，這些正是人類不擅長的工作 &lt;sup&gt;[3]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;資料視覺化則是另一個關鍵。它利用人類視覺系統對結構、邊界和運動的敏感感知，幫助我們從複雜數據中發現關聯。這並非要排除直覺，而是利用視覺化的優勢來輔助系統二進行理性評估。例如，一張清晰的圖表能讓我們一眼看出趨勢，而長篇的數據表格則可能讓我們迷失在細節中 &lt;sup&gt;[6]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;好的數據工具應該像一位嚴謹的助手，它不替你做決定，但它會把選項攤開，把計算做完，並提醒你檢查那些容易被忽略的假設。這樣，你的注意力就能集中在「判斷」而非「計算」上，從而提升決策品質。&lt;/p&gt;
&lt;h2&gt;模型與大數據：把選擇變機率，也要防預測失靈&lt;/h2&gt;
&lt;p&gt;數據建模能將二元的選擇（如「去」或「不去」）轉化為機率，讓我們更精確地評估風險 &lt;sup&gt;[7]&lt;/sup&gt;。然而，模型並非萬能。時間序列數據具有路徑依賴性，過去的規律未來不一定重演 &lt;sup&gt;[8]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;更危險的是，隨機過程和結構變動會讓預測失靈。例如，在2018年世界盃中，多個預測模型都認為德國隊能進入前三，但結果德國隊意外出局。這顯示當面對不確定的衝擊時，基於歷史數據的模型可能完全失效 &lt;sup&gt;[8]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;因此，專業知識必須介入數據解讀。例如，在運動數據分析專案中，結合運動員的專業經驗與數據解析，才能更準確地理解數據背後的意義 &lt;sup&gt;[7]&lt;/sup&gt;。數據提供機率，但專業知識提供上下文，兩者缺一不可。&lt;/p&gt;
&lt;h2&gt;社會數據與群體智慧：輔助還是偏誤放大器？&lt;/h2&gt;
&lt;p&gt;關於是否該參考「多數人的意見」，不同觀點存在張力。一方面，當選擇過多時，相信多數人與網路樞紐能簡化決策，因為我們傾向於向最大的網路樞紐靠攏，這能降低選擇困難 &lt;sup&gt;[9]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;但另一方面，群體影響也可能扭曲個人判斷。從眾壓力會讓我們服從群體規範，尤其是當資訊模糊時。社會比較過程也會影響我們，例如看到廣告中的理想形象後，我們可能對自身產生不滿，進而影響消費決策。此外，群體極化現象顯示，群體討論後可能做出更極端（更冒險或更保守）的決定，而非更理性的決定 &lt;sup&gt;[10]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;群體智慧是一把雙刃劍。在資訊不對稱且選擇複雜時，參考多數人可能是高效的捷徑；但在涉及個人價值觀或需要獨立判斷的情境下，從眾壓力可能導致盲從。關鍵在於辨識何時該借力於群體，何時該堅持獨立思考，並警惕群體討論可能帶來的極化效應。&lt;/p&gt;
&lt;h2&gt;個人資料與集體資料：守住隱私與用途邊界&lt;/h2&gt;
&lt;p&gt;在利用數據時，必須區分「個人資料」與「集體資料」的用途。個人資料（如信用卡號碼、購物史）只應用於協助個人做出更快、更明智的選擇，例如提供產品建議。若將個人資料用於市場分析或促銷，則可能侵犯隱私並帶來歧視風險 &lt;sup&gt;[11]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;集體資料（如整體需求、價格敏感度）則較適合用於判斷市場趨勢和調整經營策略 &lt;sup&gt;[11]&lt;/sup&gt;。將兩者混用，不僅違反隱私原則，也可能導致誤判。例如，利用個人資料來洞悉市場動向，雖然能鎖定狹小族群，但風險極高，不如使用集體需求資料來創造經營優勢 &lt;sup&gt;[12]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;數據使用的邊界在於「尊重」。個人資料是私密的，應僅用於服務個人；集體資料是公共的，可用於理解市場。混淆兩者不僅是倫理問題，也是策略錯誤。個人決策者在使用數據時，也應意識到數據來源的性質，避免將集體統計數據誤解為對個人的精確預測。&lt;/p&gt;
&lt;h2&gt;數據是輔助，不是答案&lt;/h2&gt;
&lt;p&gt;總結來說，個人利用數據做決策，重點不是把數據當答案，而是用工具補認知限制、用模型暴露假設、用社會與集體數據時守住邊界。我們必須承認人腦不是數據處理器 &lt;sup&gt;[1]&lt;/sup&gt;，因此需要決策支援軟體來輔助系統二 &lt;sup&gt;[6]&lt;/sup&gt;；我們必須警惕模型的盲點與預測失靈 &lt;sup&gt;[8]&lt;/sup&gt;，並理解社會數據可能帶來的偏誤 &lt;sup&gt;[10]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;最終，數據是輔助工具，而非最終答案。保留系統二的理性評估空間，並透過試行來驗證判斷 &lt;sup&gt;[5]&lt;/sup&gt;，才是個人利用數據做決策的正道。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;參考來源&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;人因工程學, p.149&lt;/li&gt;
&lt;li&gt;人因工程學, p.147&lt;/li&gt;
&lt;li&gt;認知與設計, p.169&lt;/li&gt;
&lt;li&gt;產品經理聖經, p.264&lt;/li&gt;
&lt;li&gt;創新的擴散, p.183&lt;/li&gt;
&lt;li&gt;認知與設計, p.172&lt;/li&gt;
&lt;li&gt;大數據決策分析盲點大突破10講：我分類故我在, p.136&lt;/li&gt;
&lt;li&gt;大數據決策分析盲點大突破10講：我分類故我在, p.90&lt;/li&gt;
&lt;li&gt;超級關係, p.128&lt;/li&gt;
&lt;li&gt;消費者行為概論, p.80&lt;/li&gt;
&lt;li&gt;刻不容緩, p.247&lt;/li&gt;
&lt;li&gt;刻不容緩, p.253&lt;/li&gt;
&lt;/ol&gt;</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/4165519229082845157/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/4165519229082845157' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/4165519229082845157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/4165519229082845157'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2026/11/blog-post_10.html' title='數據不是萬靈丹：個人決策的輔助、盲點與邊界'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-9010649426088353744</id><published>2026-11-04T18:00:46.059+08:00</published><updated>2026-11-04T18:00:46.059+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2026"/><category scheme="http://www.blogger.com/atom/ns#" term="投資"/><title type='text'>量化交易不是魔法：個人投資者如何避免成為韭菜</title><content type='html'>&lt;p&gt;量化交易聽起來高深莫測，但對個人投資者而言，它並非遙不可及的技術，而是一套基於數據與邏輯的決策方法。理解其核心，能幫助我們避開常見的投資陷阱，做出更理性的選擇。&lt;/p&gt;
&lt;h2&gt;一、 破除迷思：量化不等於高頻自動下單&lt;/h2&gt;
&lt;p&gt;很多人誤以為量化交易就是讓電腦在毫秒間自動下單的高頻交易，這其實是一個常見的誤區。事實上，量化交易的核心在於「策略分析」，也就是透過分析歷史與即時資料，來決定買什麼、何時買、何時賣。這與高頻交易利用極短暫的市場價差獲利是完全不同的概念 &lt;sup&gt;[1]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;對於個人投資者來說，下單方式並不重要，無論是人工手動下單、手機 APP 操作，還是設定好條件後由電腦自動執行，都只是執行流程的差異 &lt;sup&gt;[1]&lt;/sup&gt;&lt;sup&gt;[2]&lt;/sup&gt;。重點在於背後是否有經過驗證的策略。就像汽車的發動機，有了好的策略，即使採用最傳統的人工操作模式，也能完成交易過程。因此，初學者不應被「程式化」或「自動交易」的標籤嚇退，而應專注於學習如何制定有效的交易策略 &lt;sup&gt;[1]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;對於大多數非專業背景的個人投資者，將量化視為一種「紀律工具」而非「技術武器」更為實際。它幫助我們將情緒從決策中剝離，確保我們是按照預設的邏輯而非當下的恐懼或貪婪來操作。&lt;/p&gt;
&lt;h2&gt;二、 數據是基礎：從統計分析開始&lt;/h2&gt;
&lt;p&gt;量化投資離不開數據分析。金融資料分析是量化工作中不可或缺的一環，正確的數據分析能幫助投資者獲取利潤，誤判資訊則可能錯失良機。統計分析包括描述統計與推斷統計，目的是從雜亂的數據中提取對投資有用的資訊 &lt;sup&gt;[3]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;例如，在分析股票時，我們可以利用成交量與價格數據來制定策略。一個簡單的例子是結合成交量均線與價格均線：當成交量大於其均值，且短期均線向上穿破長期均線時，發出買入訊號；反之則發出賣出訊號。這種方法將複雜的市場行為簡化為可量化的規則，讓投資者能更客觀地判斷進出場時機 &lt;sup&gt;[4]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;此外，投資組合的回報率計算也是基礎功課。這包括計算最終組合價值、年收益回報、日收益率方差以及夏普比率等指標。這些指標能幫助我們評估策略的風險與回報特徵，而不仅仅是看最終賺了多少钱 &lt;sup&gt;[5]&lt;/sup&gt;。&lt;/p&gt;
&lt;h2&gt;三、 風險與個性：認識自己的局限&lt;/h2&gt;
&lt;p&gt;投資具有風險性，必須考量自身的個性與風險承受能力。不同的性格適合不同的投資方式。例如，支配型（Dominance）的人主見強、行動力高，可能適合高風險產品與主觀式交易，但需做好風險控管 &lt;sup&gt;[6]&lt;/sup&gt;。而跟隨型（Compliance）的人深思熟慮、關注細節，則更適合低風險商品與程式交易 &lt;sup&gt;[7]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;了解這些特質有助於我們選擇適合的投資商品。例如，存款雖然利率低，但幾乎無風險，適合追求穩定的人 &lt;sup&gt;[7]&lt;/sup&gt;。相對地，商品期貨市場需要持續的行動力與冷靜的判斷，容易激動的人不適合 &lt;sup&gt;[8]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;在進入量化交易前，先進行自我評估比學習任何程式語言都重要。如果一個人天生無法承受波動，強行使用高頻或高槓桿的量化策略，只會加速虧損。量化策略必須與個人的風險偏好匹配，才能長期存活。&lt;/p&gt;
&lt;h2&gt;四、 避免「韭菜」命運：專業與業餘的分野&lt;/h2&gt;
&lt;p&gt;網路公開課中常說：「小資、小白做股票，往往是韭菜的命」。這並非因為他們笨，而是因為不專業。任何行業，只有專家才是贏家 &lt;sup&gt;[2]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;以「一月效應」為例，許多人看到美股一月上漲的表象，便在年初重倉掃貨，月底出貨。但數據顯示，一月美股上漲的平均機率僅約 51%，而中國 A 股僅約 45%，混合指數更是低至 33%。如果只看表面現象進行投資，結果往往是虧損。這說明，缺乏對數據背後統計意義的理解，盲目跟隨市場傳聞或簡單規則，是個人投資者虧損的主要原因之一 &lt;sup&gt;[2]&lt;/sup&gt;。&lt;/p&gt;
&lt;p&gt;專業投資者懂得避開特例。當市場發生特殊事件（如政治變動、新制上路）時，行情變化可能不在預期內，此時應先退場觀望，避免在不可控的狀態下操作。同時，如果程式交易的結果不如預期，應該停止交易並重新檢驗程式，而不是手動干預或自行交易 &lt;sup&gt;[6]&lt;/sup&gt;。&lt;/p&gt;
&lt;h2&gt;五、 總結：建立系統化的投資思維&lt;/h2&gt;
&lt;p&gt;量化交易對個人投資者而言，不僅是技術，更是一套系統化的思維方式。它要求我們：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;釐清概念&lt;/strong&gt;：明白量化核心是策略分析，而非單純的自動下單 &lt;sup&gt;[1]&lt;/sup&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;掌握數據&lt;/strong&gt;：學會基本的統計分析與指標計算，用數據說話而非憑感覺 &lt;sup&gt;[3]&lt;/sup&gt;&lt;sup&gt;[4]&lt;/sup&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;認識自我&lt;/strong&gt;：根據自己的性格與風險承受能力，選擇適合的投資商品與策略 &lt;sup&gt;[6]&lt;/sup&gt;&lt;sup&gt;[7]&lt;/sup&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;保持紀律&lt;/strong&gt;：避免情緒化操作，在市場特例時懂得退讓，在策略失效時懂得檢視 &lt;sup&gt;[6]&lt;/sup&gt;&lt;sup&gt;[2]&lt;/sup&gt;。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;正如創業需要建立可整合的系統能力一樣，投資也需要建立一套能持續運作的決策系統 &lt;sup&gt;[9]&lt;/sup&gt;。不要追求一夕致富，而應在可控的狀態下，追求穩定持續的成長 &lt;sup&gt;[6]&lt;/sup&gt;。透過量化思維的訓練，個人投資者可以從被動的「韭菜」，轉變為主動的市場參與者。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;參考來源&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;零起點Python大資料與量化交易, p.54&lt;/li&gt;
&lt;li&gt;零起點Python大資料與量化交易, p.55&lt;/li&gt;
&lt;li&gt;量化投資, p.199&lt;/li&gt;
&lt;li&gt;量化投資, p.536&lt;/li&gt;
&lt;li&gt;零起點Python大資料與量化交易, p.180&lt;/li&gt;
&lt;li&gt;給工程師的第一本理財書：程式金融交易的118個入門關鍵技巧, p.23&lt;/li&gt;
&lt;li&gt;給工程師的第一本理財書：程式金融交易的118個入門關鍵技巧, p.24&lt;/li&gt;
&lt;li&gt;1st Billion Is The Hardest, p.97&lt;/li&gt;
&lt;li&gt;創業, p.37&lt;/li&gt;
&lt;/ol&gt;</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/9010649426088353744/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/9010649426088353744' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/9010649426088353744'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/9010649426088353744'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2026/11/blog-post_04.html' title='量化交易不是魔法：個人投資者如何避免成為韭菜'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-5274727483153362593</id><published>2026-11-02T09:40:30.772+08:00</published><updated>2026-11-02T09:40:30.773+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2026"/><category scheme="http://www.blogger.com/atom/ns#" term="管理"/><title type='text'>從通用汽車到管理現場：杜拉克如何把企業經驗變成時代診斷</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;一、生平線索：通用汽車經驗與《企業的概念》&lt;/h2&gt;&lt;p&gt;理解彼得·杜拉克（Peter Drucker）的管理思想，必須回到二十世紀中葉的企業現場，特別是通用汽車（General Motors）的經驗。在當時的商業環境中，通用汽車不僅是美國工業的象徵，更是管理學研究的關鍵案例。《左派商學院》指出，自1970年代起，管理學界開始重新審視二十世紀的經營典範，而《我在通用汽車的歲月：斯隆自傳》被視為商管經典之一，當時「對通用汽車好的事就是對美國好的事」幾乎是普遍的常識（《左派商學院》, p.63）。杜拉克正是運用他在通用汽車的觀察與經驗，奠定了日後諸多相關著作的基礎（《左派商學院》, p.63）。&lt;/p&gt;&lt;p&gt;1946年，杜拉克出版了影響深遠的著作《企業的概念》（*The Concept of Corporation*）。這本書不僅是管理學的里程碑，更被視為對當時現代企業運作法則的系統性說明。根據《創造性破壞》的記載，杜拉克在書中根據專業分工、大量生產，以及自然資產的有效運用等原則，闡述了當時企業的運作邏輯（《創造性破壞》, p.40）。這本著作標誌著杜拉克從實務觀察轉向理論建構的關鍵時刻，將通用汽車的具體經驗轉化為對現代企業本質的深刻洞察。&lt;/p&gt;&lt;p&gt;杜拉克的學術生涯並非始於書房，而是始於工廠與辦公室。通用汽車作為一個複雜的巨型組織，為他提供了觀察「自由」與「管控」張力的最佳實驗室。沒有這段深入企業核心的經驗，他後續關於組織設計與管理實務的論述將缺乏根基。&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;二、組織設計：自由、管控與分權化&lt;/h2&gt;&lt;p&gt;杜拉克對組織設計的核心貢獻，在於他如何處理大型企業中「自由」與「管控」之間的緊張關係。在《企業的概念》中，他深入分析了通用汽車面臨的結構性困境：通用汽車既無法像控股公司那樣，讓旗下部門擁有如獨立公司般的自由財務管控權；也無法像集權化組織那樣，由最高階層制訂所有決策，使部門主管的職權僅略高於工廠管理者（《創造性破壞》, p.305）。&lt;/p&gt;&lt;p&gt;這種兩難的緊張狀態，最終透過通用汽車總裁小艾爾佛瑞德·史隆（Alfred P. Sloan Jr.）的「分權化」概念得到解決。杜拉克認為，分權化不僅是一種管理技術，更是一種「社會秩序的要」（原文如此，意指社會秩序的要求/要素）（《創造性破壞》, p.305）。這一概念在1933年至1940年間發展而成，旨在確保組織營運部門承擔責任，同時透過嚴密的會議與報告制度來維持整體協調（《創造性破壞》, p.305）。&lt;/p&gt;&lt;p&gt;杜拉克進一步指出，企業若要成為創造者與經營者，必須學習同時接納「連續性假設」與「不連續性假設」，並在管控與許可之間達成平衡（《創造性破壞》, p.305）。這種平衡並非靜態的，而是動態的組織社會秩序。透過分權化，企業得以在保持整體方向一致性的同時，賦予下層單位足夠的彈性與自主權，從而應對快速變化的市場環境。&lt;/p&gt;&lt;p&gt;杜拉克的洞見在於，他沒有將「分權」視為單純的權力下放，而是視為一種維持組織活力的社會契約。這種視角超越了當時主流的機械式管理觀，為後來的矩陣式組織與多角化經營提供了理論基礎。&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;三、創新與創業：機會、意外與制度&lt;/h2&gt;&lt;p&gt;在杜拉克的管理體系中，創新並非僅屬於技術領域，而是組織的核心能力。他明確指出：「每個組織，而不光是企業，都需要一個核心能力：創新」（《快樂腦》, p.24）。此外，他將創新與行銷視為企業最重要的兩項投資活動，認為其餘活動多屬於成本（《WBSA商務企劃專員資格認證學習手冊》, p.17）。&lt;/p&gt;&lt;p&gt;杜拉克對創新的理解，特別強調「意料之外的事件」作為創新來源的重要性。他在1984年的著作《創新與創業家精神》中提到：「意料之外的事件，能使我們跳出先入為主的觀念、假設、及原先確定的事物，所以它是一個相當有用的創新來源」（《WBSA商務企劃專員資格認證學習手冊》, p.128）。以7-ELEVEN為例，其24小時營業模式的誕生源於一次鐵捲門故障的意外，店長與顧問在守夜期間發現了夜間顧客的需求，從而將原本打烊的商店轉變為全年無休的便利商店（《WBSA商務企劃專員資格認證學習手冊》, p.128）。&lt;/p&gt;&lt;p&gt;然而，創新的發生不僅依賴於機會的捕捉，更取決於組織制度是否扼殺了創造力。杜拉克曾向一群老練的經理人提問：如果公司裡有「枯木」（指失去創造力的員工），這些人是在面試前就是枯木，還是進入公司後才變成枯木的？（《馬斯洛人性管理經典》, p.39）。這個問題引導我們反思，企業最重要的工作或許不是改變員工，而是尋找扼殺創造力的制度殺手。例如，美國林務局原本要求員工填寫長達四頁的建議表格，導致四年間僅收到252件提案；當改為簡易摘要且無回應即可自行實施後，第一年便收到6000件提案（《馬斯洛人性管理經典》, p.39）。&lt;/p&gt;&lt;p&gt;杜拉克將創新從「天才的靈光一閃」重新定義為「可管理的系統過程」。他強調制度設計對創新的抑制或促進作用，這使得創新管理從邊緣議題轉為企業戰略的核心。&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;四、市場與消費者：行銷之恥、趨勢與流行&lt;/h2&gt;&lt;p&gt;杜拉克對行銷的批判，源於他對消費者觀點的堅持。他將消費者主義視為「行銷之恥」（shame of marketing），因為製造廠商往往視消費者為「對消費者有興趣但又不真正瞭解消費者的某個人」，且期望消費者去區分產品良窳，這既是消費者無能力也不願意做的事（《行銷思想》, p.170）。杜拉克認為，行銷應強調消費者觀點而非銷售者觀點，並進行消費者多樣化選購行為的研究，以主動瞭解消費者真正的需求（《行銷思想》, p.170, p.172）。&lt;/p&gt;&lt;p&gt;在市場趨勢的判斷上，杜拉克提出了區分「趨勢」與「一時流行」的關鍵標準。他認為，「改變」是指人們實際所做的，而「一時流行」則是人們所談論的（《策略行銷管理》, p.139）。這意味著真正的趨勢必須有具體的內容與行動，並有資料佐證，而非憑空想像。相比之下，一時流行往往缺乏穩固基礎，可能突然消退。例如，Schwinn公司曾誤判登山機車為一時流行，導致市場地位受損（《策略行銷管理》, p.139）。&lt;/p&gt;&lt;p&gt;杜拉克的行銷觀具有強烈的倫理與實務雙重色彩。他不僅批判行銷的扭曲，更提供了一套基於「實際行為」而非「口頭宣稱」的趨勢識別方法，這對於當今充滿噪音的市場環境仍具高度參考價值。&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;五、人性與組織：現場洞見與心理學評價的分歧&lt;/h2&gt;&lt;p&gt;杜拉克對人性的理解，主要來自於工業與管理現場的觀察，而非實驗室心理學。馬斯洛（Maslow）在《馬斯洛人性管理經典》中肯定杜拉克對人性的論述與「第三勢力」心理學的內容非常相近，並指出杜拉克是藉由對工業和管理現況的觀察而做出結論（《馬斯洛人性管理經典》, p.27）。馬斯洛甚至認為，杜拉克對人性的瞭解絕不輸給羅嘉思（Carl Rogers）或弗洛姆（Erich Fromm）的傑出貢獻，並預見工業現況將成為研究人類心理學的實驗室（《馬斯洛人性管理經典》, p.27）。&lt;/p&gt;&lt;p&gt;然而，對於杜拉克的方法論，材料中呈現了不同的評價。馬斯洛在另一處批評杜拉克及其同事「看到科學心理學就馬上放棄」，認為他們丟掉了科學心理學中價值不菲的「金礦」，儘管其中也包含許多無意義的回聲（《馬斯洛人性管理經典》, p.29）。馬斯洛認為，工業心理學開啟了新的資料來源，提供了實證基礎，而杜拉克可能因對專業社會科學或心理學「一無所知」而錯過了這些深層資源（《馬斯洛人性管理經典》, p.27, p.29）。&lt;/p&gt;&lt;p&gt;這種分歧揭示了杜拉克思想的雙面性。一方面，他提供了極具實務效用的現場洞見，使管理學貼近真實組織運作；另一方面，他缺乏嚴謹的科學心理學基礎，使得其理論在學術嚴謹性上受到質疑。這並非單純的對錯問題，而是「實務智慧」與「科學理論」之間的張力。&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;六、影響與限度：洞見、預言與實證研究的張力&lt;/h2&gt;&lt;p&gt;杜拉克的影響力廣泛而深遠，但其學術貢獻的形式與效果卻存在著顯著的張力。《左派商學院》指出，杜拉克的著作及洞見影響了很多人和很多的組織，但他本身沒有太多的文章（《左派商學院》, p.159）。這種影響更多體現在實務層面的範式轉移，而非學術期刊上的密集發表。&lt;/p&gt;&lt;p&gt;然而，杜拉克的預言並非總是即時生效。在《創造性破壞》中，作者提到杜拉克在1969年出版的《不連續的時代》中預言了危機的到來，但可惜他的言論主張無法擊垮七〇年代的思潮（《創造性破壞》, p.40）。當時的經營主管面臨通貨膨脹與高利率，對於杜拉克的建言「充耳不聞」（《創造性破壞》, p.40）。這顯示了實務洞見在面對短期經濟壓力時的局限性。&lt;/p&gt;&lt;p&gt;與此同時，策略管理領域的學術發展也經歷了從個人經驗到實證研究的轉變。《策略行銷管理》指出，長久以來策略領域都是由個人經驗與見解的觀念性貢獻所主導，直到最近實證研究才開始受到重視（《策略行銷管理》, p.39）。這與《左派商學院》中提到的杜拉克影響廣泛但文章不多的現象形成呼應，顯示管理學從「大師洞見」走向「科學驗證」的過程是遲緩且充滿張力的。&lt;/p&gt;&lt;p&gt;杜拉克的歷史地位在於他是一個「時代診斷者」而非「預言家」。他的價值不在於預言是否被立即接受，而在於他將企業現場的複雜現象轉化為可被檢驗的管理問題。當實證研究後來成熟時，許多杜拉克的直覺判斷被驗證為正確，這證明了其現場洞見的持久價值。&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;結語&lt;/h2&gt;&lt;p&gt;從通用汽車的組織設計，到創新的制度來源，再到對行銷與人性的深刻批判，彼得·杜拉克的影響不在於預言的準確性或文章的数量，而在於他成功地把企業經驗變成了時代診斷。他將通用汽車式的企業現場、消費者行動、創新機會與組織制度，轉化為可被檢驗的管理問題。儘管其理論在科學心理學基礎上受到批評，且預言常被短期現實忽略，但他建立的框架——特別是關於分權化、創新來源與消費者觀點的論述——至今仍構成現代管理實踐的核心底層邏輯。&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;---&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;參考來源&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;策略行銷管理 | p.39、p.139、p.147、p.347 |&lt;/li&gt;&lt;li&gt;馬斯洛人性管理經典 | p.27、p.29、p.39、p.177 |&lt;/li&gt;&lt;li&gt;WBSA商務企劃專員資格認證學習手冊 | p.17、p.128 |&lt;/li&gt;&lt;li&gt;左派商學院 | p.32、p.63、p.66、p.159 |&lt;/li&gt;&lt;li&gt;行銷思想 | p.170、p.172 |&lt;/li&gt;&lt;li&gt;創造性破壞 | p.18、p.40、p.305 |&lt;/li&gt;&lt;li&gt;快樂腦 | p.24、p.39、p.169 |&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/5274727483153362593/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/5274727483153362593' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/5274727483153362593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/5274727483153362593'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2026/11/blog-post.html' title='從通用汽車到管理現場：杜拉克如何把企業經驗變成時代診斷'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-3115622427303856468</id><published>2026-10-27T22:55:28.693+08:00</published><updated>2026-10-27T22:55:28.694+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2026"/><title type='text'>蝴蝶製造偶然，蜜蜂把偶然養成潮流</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;蝴蝶製造偶然，蜜蜂把偶然養成潮流&lt;/h2&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;蝴蝶效應：被略過的細微條件&lt;/h3&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;在複雜系統中，那些平常容易被略過的微小條件，往往潛藏著引發重大且難以預測結果的力量。這正是「蝴蝶效應」的核心意涵。正如《北京的蝴蝶,東京的蜜蜂》所描述，上勝町的樹葉產業成立機緣，源於橫石知二在難波的料理店偶然看到女大學生讚美襯託主菜的紅葉。本來毫無關聯的兩個事件在「此地，此時」的偶然機緣下交會在一起，如果女大學生是到別家餐廳用餐，或者橫石知二當天沒有和同事到該餐廳聚餐，上勝町的阿嬤們將不會有機會達到年收入超過一千萬日圓的成就，四國的山間小鎮也不會有美國人遠渡重洋前來觀摩考察（《北京的蝴蝶,東京的蜜蜂》, p.262）。這種現象描寫的是自然界中複雜無法預測的「混沌」（Chaos），而人類社會或商業社會也適用這個理論（《北京的蝴蝶,東京的蜜蜂》, p.262）。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;《N世代衝撞》進一步引用氣象學家和數學家愛德華·羅倫茲（Edward Lorenz）所創造的「蝴蝶效應」名詞，指出蝴蝶在世界的一端鼓動其翅膀可能會引發一連串的連鎖反應，而在世界的另一端製造出氣候大災難（《N世代衝撞》, p.312）。由這個理論推演，在錯綜複雜的系統裡，最初的情況都可能帶來非常敏感的最終後果，開始的小小改變都可能很戲劇化地影響著最終結果（《N世代衝撞》, p.312）。《行銷3.0》則透過戴伊（George S. Day）與舒麥克（Paul J. H. Schoemaker）針對一百一十九家國際企業的研究，證實了在一個相互連結的經濟中，「蝴蝶效應」的確存在，世上某個角落的一個小改變，可能會讓另一個角落發生巨大變革（《行銷3.0》, p.102）。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;這三本書共同指向一個關鍵洞察：偶然並非隨機噪音，而是系統敏感性的體現。對於商業觀察者而言，識別這些「細微條件」比預測結果本身更為重要，因為正是這些看似無關的微小互動，構成了複雜系統中變革的起點。&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;蜜蜂隱喻：從深山偶然到銀座養蜂&lt;/h3&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;與蝴蝶效應強調「不可預測的偶然」不同，蜜蜂隱喻則聚焦於領導者如何將偶然轉化為可控的產業機會。《北京的蝴蝶,東京的蜜蜂》指出，在很多情況，偶然是成功的關鍵要素，如果能夠將偶然轉化成必然，則可以帶來一連串的成功，這需要不可或缺的才能（《北京的蝴蝶,東京的蜜蜂》, p.262）。書中提出了一個典型範例：領導者在熱鬧繁華的市中心，採取行動籌劃銀座養蜜蜂（《北京的蝴蝶,東京的蜜蜂》, p.262）。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;這個隱喻的核心在於領導者如何聯結「蜜蜂拍動的翅膀」和「都會養蜂潮流」（《北京的蝴蝶,東京的蜜蜂》, p.262）。故事的舞臺發生在德島的深山，然後轉移到東京銀座，象徵著從邊緣的偶然發現到中心市場的主流化過程（《北京的蝴蝶,東京的蜜蜂》, p.262）。這顯示出領導者的角色不僅是被動地觀察蝴蝶效應，而是主動地捕捉那些微小的振動（蜜蜂拍動翅膀），並透過策略性的行動，將其引導為可持續的社會或經濟潮流（都會養蜂）。&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;h3 style=&quot;text-align: left;&quot;&gt;&amp;nbsp;兩面刃：小改變的市場機會與名聲風險&lt;/h3&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;在錯綜複雜的系統與社交圈互動中，小改變所帶來的影響具有雙重性，既是市場開發的機遇，也是名聲毀滅的風險。《N世代衝撞》指出，行銷專家若將目標市場鎖定在上網成迷的年輕人，就必須了解蝴蝶效應的觀念，因為它告訴你：你可以只跟一小撮佔據良好地位的顧客發展關係就可能快速開發出產品市場來（《N世代衝撞》, p.312）。然而，這種波動性卻是很鋒利的「兩面刃」（《N世代衝撞》, p.312）。假如你在初期犯下一些錯誤，也可能像滾雪球一般傷害產品的名聲（《N世代衝撞》, p.312）。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;《WBSA商務企劃專員資格認證學習手冊》在討論媒體計畫時，也強調了這種效應的驚人程度。該書指出，媒體效應跟蝴蝶效應一樣驚人，且其傳播速度之快是難以想像的（《WBSA商務企劃專員資格認證學習手冊》, p.356）。這意味著，任何微小的資訊偏差或錯誤，在媒體的放大效應下，都可能迅速擴散並造成難以挽回的負面影響。《行銷3.0》則從領導者角度補充，一個能掌握這種小改變的企業領導者，將能贏得重要優勢（《行銷3.0》, p.102）。但這裡的「優勢」隱含著對風險的極高敏感度，因為能夠引發巨大變革的小改變，同樣能引發巨大的危機。&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;h3 style=&quot;text-align: left;&quot;&gt;&amp;nbsp;媒體與利害關係人：不可控的蝴蝶與可管理的媒體&lt;/h3&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;關於媒體與行銷資訊的可控性，不同書籍呈現了明顯的分歧觀點。一方面，《N世代衝撞》認為企業已無法嚴格管控行銷資訊。該書指出，企業界必須體認到：自己不再有能力嚴格管控行銷資訊，反而愈來愈需要看「利害關係人網站」（stakeholder webs）的臉色，它們是由一群又一群的個人所組織起來的網站，隨時都在監視企業的行為並設法想改變之（《N世代衝撞》, p.312）。這反映了在去中心化的社交網絡中，資訊流動的不可預測性與不可控性，媒體與公眾已成為主動的監督者與改變者。&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;這兩種觀點並非完全互斥，而是適用於不同的層面與情境。《N世代衝撞》描述的是宏觀的、長期的、基於社交網絡的資訊生態，其中企業確實難以完全控制敘事；而《WBSA》描述的是微觀的、短期的、基於特定活動的媒體操作，其中企業可以透過專業技巧影響報導內容。然而，在整體行銷策略中，企業必須承認宏觀層面的不可控性，同時在微觀層面盡力管理媒體互動，以減少負面風險並最大化正面效應。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&amp;nbsp;珍珠奶茶：蝴蝶效應「想來也不過如此」&lt;/h3&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;對於蝴蝶效應是否僅僅是偶然的神話，材料中呈現了另一組衝突。多本書如《北京的蝴蝶,東京的蜜蜂》與《行銷3.0》將蝴蝶效應描述為能引發驚人變革的偶然力量（《北京的蝴蝶,東京的蜜蜂》, p.262；《行銷3.0》, p.102）。然而，《當珍珠遇到茶》提供了不同的視角。該書指出，珍珠奶茶翻紅後，很多媒體喜歡拿來談論，甚至將其定位成「全球趨勢下一定要修的學分」（《當珍珠遇到茶》, p.217）。但作者認為，想不到一項創意飲料，居然引起這麼廣的迴響，蝴蝶效應想來也不過如此（《當珍珠遇到茶》, p.217）。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;《當珍珠遇到茶》強調，譽為茶學，引發思想體系，歸納成理論，讓人有所依循，看來簡單易懂，對我們來說，卻是上萬個日子行動一致的扎實付出（《當珍珠遇到茶》, p.217）。這表明，廣闊的社會迴響與成功背後，並非單純依賴偶然的蝴蝶效應，而是長期、持續且一致的行動與付出。蝴蝶效應或許解釋了為什麼某個時刻會突然爆發，但無法解釋為什麼只有某些產品或品牌能夠持續維持這種影響力。&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;h3 style=&quot;text-align: left;&quot;&gt;總結：從蝴蝶警覺到養蜂行動&lt;/h3&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;回顧本文，蝴蝶與蜜蜂的隱喻共同構成了理解複雜系統中變革的完整圖景。蝴蝶效應提醒我們，平常容易被略過的細微條件，可能在複雜系統中引發重大且難以預測的結果（《北京的蝴蝶,東京的蜜蜂》, p.262；《N世代衝撞》, p.312；《行銷3.0》, p.102）。這種不可預測性要求領導者具備高度警覺意識，正如《行銷3.0》所稱的「有警覺心的領導者」，他們眼觀四面、耳聽八方，根據少數的資訊即採取行動（《行銷3.0》, p.102）。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;然而，警覺只是起點。蜜蜂隱喻則提供了將偶然轉化為必然的路徑：領導者需要聯結「蜜蜂拍動的翅膀」與「都會養蜂潮流」，把偶然事件轉化為可行動的產業機會（《北京的蝴蝶,東京的蜜蜂》, p.262）。這過程充滿了「兩面刃」的風險，初期錯誤可能像滾雪球一般傷害名聲（《N世代衝撞》, p.312），且媒體效應驚人。同時，我們必須警惕將成功過度歸因於偶然，因為廣闊的迴響背後往往是上萬個日子行動一致的扎實付出（《當珍珠遇到茶》, p.217）。&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;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&amp;nbsp;參考來源&lt;/h3&gt;&lt;div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;北京的蝴蝶,東京的蜜蜂 | p.262 |&lt;/li&gt;&lt;li&gt;N世代衝撞 | p.312 |&lt;/li&gt;&lt;li&gt;WBSA商務企劃專員資格認證學習手冊 | p.356 |&lt;/li&gt;&lt;li&gt;行銷3.0 | p.102 |&lt;/li&gt;&lt;li&gt;當珍珠遇到茶 | p.217 |&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/3115622427303856468/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/3115622427303856468' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/3115622427303856468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/3115622427303856468'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2026/10/blog-post.html' title='蝴蝶製造偶然，蜜蜂把偶然養成潮流'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-1441418515016140776</id><published>2024-10-20T16:03:00.007+08:00</published><updated>2026-04-09T11:51:41.683+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ai"/><category scheme="http://www.blogger.com/atom/ns#" term="llm"/><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><category scheme="http://www.blogger.com/atom/ns#" term="os"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><title type='text'>Ollama 基本指令</title><content type='html'>&lt;h2&gt;基本指令&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;strong&gt;執行模型：&lt;/strong&gt;Ollama 運行於本地環境，使用以下指令來啟動模型：
    &lt;pre class=&quot;shellblock&quot;&gt;&lt;code&gt;ollama run &amp;lt;模型名稱&amp;gt;&lt;/code&gt;&lt;/pre&gt;
    例如，若要運行 Llama2 模型：
    &lt;pre class=&quot;shellblock&quot;&gt;&lt;code&gt;ollama run llama2&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;strong&gt;管理模型：&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;
        列出所有可用的模型：
        &lt;pre class=&quot;shellblock&quot;&gt;&lt;code&gt;ollama list&lt;/code&gt;&lt;/pre&gt;
      &lt;/li&gt;
      &lt;li&gt;
        從模型庫中拉取新的模型：
        &lt;pre class=&quot;shellblock&quot;&gt;&lt;code&gt;ollama pull &amp;lt;模型名稱&amp;gt;&lt;/code&gt;&lt;/pre&gt;
      &lt;/li&gt;
      &lt;li&gt;
        查看特定模型的詳細資訊：
        &lt;pre class=&quot;shellblock&quot;&gt;&lt;code&gt;ollama show &amp;lt;模型名稱&amp;gt;&lt;/code&gt;&lt;/pre&gt;
      &lt;/li&gt;
      &lt;li&gt;
        刪除特定模型：
        &lt;pre class=&quot;shellblock&quot;&gt;&lt;code&gt;ollama rm &amp;lt;模型名稱&amp;gt;&lt;/code&gt;&lt;/pre&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/1441418515016140776/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/1441418515016140776' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/1441418515016140776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/1441418515016140776'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2024/10/ollama.html' title='Ollama 基本指令'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-6231993522054691892</id><published>2024-10-13T01:35:00.005+08:00</published><updated>2024-10-14T00:58:59.337+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><category scheme="http://www.blogger.com/atom/ns#" term="ocr"/><title type='text'>Combining Scanned Images into a PDF with OCR on Mac OS X</title><content type='html'>&lt;h2&gt;Combining Scanned Images into a PDF with OCR on Mac OS X&lt;/h2&gt;

&lt;p&gt;This guide will walk you through the process of combining multiple scanned images of book pages into a single PDF file on Mac OS X and using OCR (Optical Character Recognition) to convert the text into searchable, selectable electronic text.&lt;/p&gt;

&lt;h3&gt;1. Installing Required Tools&lt;/h3&gt;
&lt;p&gt;First, we need to install a few tools to handle image and PDF processing, as well as perform OCR. The following tools are required:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;ImageMagick&lt;/strong&gt;: For image format conversion and processing.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;ocrmypdf&lt;/strong&gt;: For performing OCR on PDF files.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Tesseract&lt;/strong&gt;: OCR engine used for text recognition.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Poppler&lt;/strong&gt;: A PDF utilities suite, which includes tools like &lt;code&gt;pdfunite&lt;/code&gt; for merging PDFs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Install these tools using Homebrew:&lt;/p&gt;

&lt;pre class=&quot;shellblock&quot;&gt;&lt;code&gt;brew install imagemagick    # Install ImageMagick
brew install ocrmypdf       # Install OCRMyPDF
brew install tesseract-lang # Install Tesseract language packs
brew install poppler        # Install Poppler
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;2. Merging Images into a PDF&lt;/h3&gt;
&lt;p&gt;If your scanned output is in image format (e.g., JPG), you can use ImageMagick to combine multiple image files into a single PDF document. This ensures that the subsequent OCR process works on a single PDF file.&lt;/p&gt;

&lt;p&gt;To combine all &lt;code&gt;.jpg&lt;/code&gt; images in the current directory into a single &lt;code&gt;001.pdf&lt;/code&gt; file:&lt;/p&gt;

&lt;pre class=&quot;shellblock&quot;&gt;&lt;code&gt;magick *.jpg 001.pdf&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This command uses the &lt;code&gt;magick&lt;/code&gt; tool from ImageMagick to merge all &lt;code&gt;.jpg&lt;/code&gt; files in the directory into one PDF file named &lt;code&gt;001.pdf&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;3. Running OCR on the PDF&lt;/h3&gt;
&lt;p&gt;Next, we use the &lt;code&gt;ocrmypdf&lt;/code&gt; tool to perform OCR on the generated PDF file and save the output as a new file. In this step, we specify the OCR languages as English (&lt;code&gt;eng&lt;/code&gt;) and Traditional Chinese (&lt;code&gt;chi_tra&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Run the following command:&lt;/p&gt;

&lt;pre class=&quot;shellblock&quot;&gt;&lt;code&gt;ocrmypdf -l eng+chi_tra+chi_tra_vert 001.pdf 001a.pdf&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This command will apply OCR to the &lt;code&gt;001.pdf&lt;/code&gt; file and save the result as &lt;code&gt;001a.pdf&lt;/code&gt;. The &lt;code&gt;-l eng+chi_tra+chi_tra_vert&lt;/code&gt; option indicates that both English and Traditional Chinese will be used for text recognition.&lt;/p&gt;

&lt;h3&gt;4. Merging Multiple OCR Processed PDFs&lt;/h3&gt;
&lt;p&gt;If you have multiple PDF files that need to be combined into a single final PDF, the &lt;code&gt;pdfunite&lt;/code&gt; tool can do this easily. To merge the processed PDF files into a single output named &lt;code&gt;combined_pdf.pdf&lt;/code&gt;, use the following command:&lt;/p&gt;

&lt;pre class=&quot;shellblock&quot;&gt;&lt;code&gt;pdfunite 001a.pdf 002a.pdf 003a.pdf combined_pdf.pdf&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This command merges &lt;code&gt;001a.pdf&lt;/code&gt;, &lt;code&gt;002a.pdf&lt;/code&gt;, and &lt;code&gt;003a.pdf&lt;/code&gt; into a single &lt;code&gt;combined_pdf.pdf&lt;/code&gt; file.&lt;/p&gt;

&lt;h3&gt;Summary&lt;/h3&gt;
&lt;p&gt;By following these steps, you can:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Merge scanned images into a PDF file.&lt;/li&gt;
  &lt;li&gt;Use the Tesseract engine via &lt;code&gt;ocrmypdf&lt;/code&gt; to perform OCR text recognition.&lt;/li&gt;
  &lt;li&gt;Combine multiple PDF files into a final merged PDF.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This allows you to convert scanned images of book pages into a searchable, selectable, and copyable PDF document.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/6231993522054691892/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/6231993522054691892' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/6231993522054691892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/6231993522054691892'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2024/10/combining-scanned-images-into-pdf-with.html' title='Combining Scanned Images into a PDF with OCR on Mac OS X'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-8020912169828801114</id><published>2024-10-13T01:32:00.006+08:00</published><updated>2024-10-14T00:58:31.752+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><category scheme="http://www.blogger.com/atom/ns#" term="ocr"/><title type='text'>Mac OS X 環境下將圖片合併為PDF並進行OCR處理</title><content type='html'>&lt;h2&gt;將圖片合併為PDF並進行OCR處理&lt;/h2&gt;

&lt;p&gt;在這份說明文件中，我們將介紹如何在Mac OS X環境下，將多個掃描成圖片的書籍頁面合併為一個PDF檔案，並使用OCR（光學文字識別）將其中的文字轉換為可搜索和選取的電子文字。&lt;/p&gt;

&lt;h3&gt;1. 安裝必要的工具&lt;/h3&gt;
&lt;p&gt;首先，我們需要安裝一些工具來處理圖片和PDF，並進行OCR。以下是需要的工具：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;ImageMagick&lt;/strong&gt;：用於圖片格式轉換與處理。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;ocrmypdf&lt;/strong&gt;：用於將PDF檔案進行OCR處理。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Tesseract&lt;/strong&gt;：OCR引擎，用於實際進行文字識別。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Poppler&lt;/strong&gt;：PDF工具集，包含 &lt;code&gt;pdfunite&lt;/code&gt; 等工具，用於合併PDF。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;使用 Homebrew 安裝這些工具：&lt;/p&gt;

&lt;pre class=&quot;shellblock&quot;&gt;&lt;code&gt;brew install imagemagick    # 安裝 ImageMagick
brew install ocrmypdf       # 安裝 OCRMyPDF
brew install tesseract-lang # 安裝 Tesseract 語言包
brew install poppler        # 安裝 Poppler
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;2. 圖片合併為PDF&lt;/h3&gt;
&lt;p&gt;當掃描結果以圖片格式（如 JPG）儲存時，我們可以使用 ImageMagick 將多個圖片檔案合併為單一 PDF 文件。這樣做可以保證後續的 OCR 處理僅在一個 PDF 檔案上進行。&lt;/p&gt;

&lt;p&gt;將當前目錄下的所有 &lt;code&gt;.jpg&lt;/code&gt; 圖片檔合併為 &lt;code&gt;001.pdf&lt;/code&gt;：&lt;/p&gt;

&lt;pre class=&quot;shellblock&quot;&gt;&lt;code&gt;magick *.jpg 001.pdf&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;這條指令將使用 ImageMagick 中的 &lt;code&gt;magick&lt;/code&gt; 工具，將目錄中的所有 &lt;code&gt;.jpg&lt;/code&gt; 檔案依序合併成一個 PDF 文件 &lt;code&gt;001.pdf&lt;/code&gt;。&lt;/p&gt;

&lt;h3&gt;3. 執行 OCR 文字識別&lt;/h3&gt;
&lt;p&gt;接下來，我們使用 &lt;code&gt;ocrmypdf&lt;/code&gt; 工具來對生成的 PDF 檔案進行 OCR 處理，並將處理後的 PDF 儲存為新的文件。在此步驟中，我們指定使用英語（&lt;code&gt;eng&lt;/code&gt;）和繁體中文（&lt;code&gt;chi_tra&lt;/code&gt;）作為 OCR 的語言。&lt;/p&gt;

&lt;p&gt;執行指令：&lt;/p&gt;

&lt;pre class=&quot;shellblock&quot;&gt;&lt;code&gt;ocrmypdf -l eng+chi_tra+chi_tra_vert 001.pdf 001a.pdf&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;這條指令會對 &lt;code&gt;001.pdf&lt;/code&gt; 文件進行 OCR 文字識別，並將結果儲存為 &lt;code&gt;001a.pdf&lt;/code&gt;。其中，&lt;code&gt;-l eng+chi_tra+chi_tra_vert&lt;/code&gt; 表示同時使用英語和繁體中文進行文字識別。&lt;/p&gt;

&lt;h3&gt;4. 合併多個 OCR 處理後的 PDF 檔案&lt;/h3&gt;
&lt;p&gt;如果你有多個 PDF 檔案需要合併為一個最終的 PDF 檔案，&lt;code&gt;pdfunite&lt;/code&gt; 工具可以輕鬆做到這點。將處理過的 PDF 檔案合併為單一檔案 &lt;code&gt;combined_pdf.pdf&lt;/code&gt;：&lt;/p&gt;

&lt;pre class=&quot;shellblock&quot;&gt;&lt;code&gt;pdfunite 001a.pdf 002a.pdf 003a.pdf combined_pdf.pdf&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;這條指令將 &lt;code&gt;001a.pdf&lt;/code&gt;、&lt;code&gt;002a.pdf&lt;/code&gt; 和 &lt;code&gt;003a.pdf&lt;/code&gt; 三個檔案合併成一個 &lt;code&gt;combined_pdf.pdf&lt;/code&gt;。&lt;/p&gt;

&lt;h3&gt;總結&lt;/h3&gt;
&lt;p&gt;透過這些步驟，你可以：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;將掃描的圖片合併成 PDF 檔案。&lt;/li&gt;
  &lt;li&gt;使用 Tesseract 引擎透過 &lt;code&gt;ocrmypdf&lt;/code&gt; 進行 OCR 文字識別。&lt;/li&gt;
  &lt;li&gt;將多個 PDF 檔案合併成一個完整的 PDF。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;這樣，你就能將掃描成圖片的書籍內容轉換為可以搜索、選取和複製文字的 PDF 電子檔。&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/8020912169828801114/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/8020912169828801114' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/8020912169828801114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/8020912169828801114'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2024/10/mac-os-x-pdfocr.html' title='Mac OS X 環境下將圖片合併為PDF並進行OCR處理'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-8594294751297680222</id><published>2024-10-09T09:58:00.001+08:00</published><updated>2024-10-09T09:58:25.891+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ai"/><category scheme="http://www.blogger.com/atom/ns#" term="business"/><category scheme="http://www.blogger.com/atom/ns#" term="music"/><title type='text'>Business Model for AI Music Generation Services</title><content type='html'>&lt;p&gt;This document outlines a comprehensive business model for an AI music generation service. As the demand for personalized and unique music continues to rise, leveraging artificial intelligence to create music can provide a competitive edge in the music industry. This model will explore various revenue streams, target markets, and operational strategies to ensure the service&#39;s success.&lt;/p&gt;&lt;p&gt;&lt;/p&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/a/AVvXsEiHi1BOz7dLQXkJG3CqUyNcCwnLbMqkoAKTM3c6PFtjLZR5qyjHIa4yRyXie7CxDEaDH-URwHqAJP8qNifnFl4dKUmecmXbsZFMM1PR1o2nzjThNE6tFz0STLwwqvfAh6SmklNQpT9LpmraBC1K6IF9q096bJT_ja3UJzKtdXRU5s5lYgzB6mykjBPSflgq&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;1224&quot; data-original-width=&quot;1392&quot; height=&quot;444&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiHi1BOz7dLQXkJG3CqUyNcCwnLbMqkoAKTM3c6PFtjLZR5qyjHIa4yRyXie7CxDEaDH-URwHqAJP8qNifnFl4dKUmecmXbsZFMM1PR1o2nzjThNE6tFz0STLwwqvfAh6SmklNQpT9LpmraBC1K6IF9q096bJT_ja3UJzKtdXRU5s5lYgzB6mykjBPSflgq=w504-h444&quot; width=&quot;504&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;h1 data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; data-pm-slice=&quot;1 3 []&quot; dir=&quot;ltr&quot; id=&quot;bh-3JkO4kwMEcvTrNtgzJnxd&quot;&gt;Target Market&lt;/h1&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; id=&quot;bh-VFEqRB10QH-nkPwiuFKIT&quot;&gt;&lt;/p&gt;&lt;ol data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-Gq5H4Gbg6dAqFlFBTn-S0&quot;&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-5oDyzxsdc-78BqKS3EG__&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-jlTNXsD0XtjX3MiICtTLq&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Content Creators&lt;/strong&gt;: YouTubers, podcasters, and streamers looking for royalty-free music to enhance their content.&lt;/p&gt;&lt;/li&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-nXJt18lUO1I_twNvBJQiQ&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-XKGO6cltqW8dmfhaGuMQC&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Advertising Agencies&lt;/strong&gt;: Companies needing custom jingles or background music for advertisements.&lt;/p&gt;&lt;/li&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-ptJOm5g68rZh_BLLBMPTb&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-9Ji6zV9nDY67VBxrfQ2t6&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Game Developers&lt;/strong&gt;: Indie and large-scale game developers seeking unique soundtracks for their games.&lt;/p&gt;&lt;/li&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-7wsw1g4rJOfS59tDFMCda&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-6_Up72v1xu6RBQSvmbg9K&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Film and TV Production&lt;/strong&gt;: Producers looking for original scores or soundtracks for their projects.&lt;/p&gt;&lt;/li&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-mhjUzFnM2anLoi3iegEoV&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-ppaj5K42uIP0V4TgvF3WE&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Musicians and Bands&lt;/strong&gt;: Artists wanting to experiment with new sounds or collaborate with AI-generated music.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; id=&quot;bh-S4BqY20EJQnwPPlGaNj7N&quot;&gt;&lt;/p&gt;&lt;h1 data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-KmTNJFBbBLjHEH-FEqAaO&quot; style=&quot;text-align: left;&quot;&gt;Revenue Streams&lt;/h1&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; id=&quot;bh-bEG67icyvZeYOx3jQUQWL&quot;&gt;&lt;/p&gt;&lt;ol data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-18_h9TffOsKQbFo-OzLl3&quot;&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-bwR72j-ZOZli-3lyM-OdQ&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-Xt2ux2IBixBt-xI2Tdo41&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Subscription Model&lt;/strong&gt;: Offer tiered subscription plans that provide users with access to different levels of music generation capabilities, including varying numbers of tracks per month, quality of music, and customization options.&lt;/p&gt;&lt;/li&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-iCq7vnJb8yHr4lQDRGFqs&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-_uWmZXLjChsJMXqe53bcR&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Pay-Per-Track&lt;/strong&gt;: Allow users to purchase individual tracks or licenses for specific uses, catering to those who may not want a subscription.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; id=&quot;bh-PWfjbQBHN5SNO5DtexFPt&quot;&gt;&lt;/p&gt;&lt;ol data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-xD1w7Xj99xIC1367xBTO9&quot; start=&quot;3&quot;&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-5EAfUbxJ7j2fHdA-V5LiC&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-nZPXZ7vs6NoYCWAMYreWT&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Custom Commissions&lt;/strong&gt;: Provide a service where users can request custom music tailored to their specific needs, charging a premium for this personalized service.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; id=&quot;bh-gIKQ3t4iHrM3Tw3u7tXQo&quot;&gt;&lt;/p&gt;&lt;ol data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-WTZN1C-ZnHxgqsFNr3HZW&quot; start=&quot;4&quot;&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-pt-kqWN7ZkaT_aUBBERt5&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-QZkZXU2eK-VIeeTagG91j&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Partnerships and Collaborations&lt;/strong&gt;: Collaborate with platforms like YouTube, Twitch, and gaming companies to offer integrated music solutions, potentially sharing revenue from users who utilize the service.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; id=&quot;bh-6Rnc8HMP3myKx39y65TvU&quot;&gt;&lt;/p&gt;&lt;ol data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-a2n6TA8j37ix3WVYgS5yE&quot; start=&quot;5&quot;&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-ZnZEbqAXV8WF_y13f3nor&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-wuwZKzH84W3PjpCf4ejSt&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Merchandising&lt;/strong&gt;: Create and sell merchandise related to the AI-generated music, such as vinyl records, digital albums, or branded products.&lt;/p&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; id=&quot;bh-jzalYU3jvNbmflG3ZfVGI&quot;&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&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/a/AVvXsEicRJba1pblzkQ94Od8hz3KLa-1yIGtTewd-isJFaakRntQxqyk0kyy130sB1Eu9pC9u5shfiVk5y9GrprMVAzS3l9zyHbtp1V0K71f5oT40BYFVisn5twMtRVCtigQbYRUvJcY47mcMac2FZuS-lsJzXggqfPOS4FDxhbVH92OKDsdTYjbaOlCgSkAnjAO&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;1032&quot; data-original-width=&quot;1368&quot; height=&quot;421&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEicRJba1pblzkQ94Od8hz3KLa-1yIGtTewd-isJFaakRntQxqyk0kyy130sB1Eu9pC9u5shfiVk5y9GrprMVAzS3l9zyHbtp1V0K71f5oT40BYFVisn5twMtRVCtigQbYRUvJcY47mcMac2FZuS-lsJzXggqfPOS4FDxhbVH92OKDsdTYjbaOlCgSkAnjAO=w557-h421&quot; width=&quot;557&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;h1 data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; data-pm-slice=&quot;1 3 []&quot; dir=&quot;ltr&quot; id=&quot;bh-_j989VjldfOhniixw5fBo&quot;&gt;Operational Strategy&lt;/h1&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; id=&quot;bh-bQwsVo7bhJbDZwsseo5xx&quot;&gt;&lt;/p&gt;&lt;ol data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-gtpLigM9cAVvD1dX1inIU&quot;&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-3u_epIulMj_gNr3h3QxTs&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-MMG8gz_PRi0n9NIJIlmGi&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Technology Development&lt;/strong&gt;: Invest in developing a robust AI music generation algorithm that can create high-quality, diverse music across various genres.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; id=&quot;bh-tLQnAr7R6FOGvJOmxlMwx&quot;&gt;&lt;/p&gt;&lt;ol data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-V7lMcMitPQ3OKO3mM-Ywu&quot; start=&quot;2&quot;&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-PCa05JfogaoeBBxqpTaLt&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-7HydPpF_oAW2VeHfJxHx8&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;User-Friendly Interface&lt;/strong&gt;: Design an intuitive platform that allows users to easily generate and customize music tracks, ensuring a seamless user experience.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; id=&quot;bh-ximHoR0int4NPzkXi1N02&quot;&gt;&lt;/p&gt;&lt;ol data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-m-b8JnvajmYJTBojlovcW&quot; start=&quot;3&quot;&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-p14CRxPux2G4RpLoREZ3C&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-bQLORYpOFksTTFoGEsYPe&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Marketing and Outreach&lt;/strong&gt;: Utilize social media, influencer partnerships, and targeted advertising to reach potential users in the identified target markets.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; id=&quot;bh-SwTlik3sDtm63iZVFwRZM&quot;&gt;&lt;/p&gt;&lt;ol data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-cfc4IW7wynzlBNQnb3LDj&quot; start=&quot;4&quot;&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-h0Dv-qCBl63wG_F8VBwda&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-msiruS3IPlcvgud1DsvEr&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Community Building&lt;/strong&gt;: Foster a community of users who can share their experiences, provide feedback, and showcase how they use the generated music, enhancing user engagement and loyalty.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; id=&quot;bh-bxY9UngwuOZRWbUhmJ4P1&quot;&gt;&lt;/p&gt;&lt;ol data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-oqZflumsnwZLrGAle0yXw&quot; start=&quot;5&quot;&gt;&lt;li data-hook-type=&quot;blockHook&quot; id=&quot;bh-z4gi5QlMrukv4qBvecYfB&quot;&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-EUrNQzt0nz8-6703RxlHQ&quot; style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Legal Considerations&lt;/strong&gt;: Ensure compliance with copyright laws and provide clear licensing agreements to protect both the service and its users.&lt;/p&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; id=&quot;bh-VcxNZZjMx_awsYXj0c8KK&quot;&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&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/a/AVvXsEhIRmj2XEPVURtQ5kgptPosk8L8gBQ-S6MF7GOynLpmuqFF_MiBRuu5_5cj9OZRwqEJKggdlslJAE6sE0m71m5XtF_acdJhVpbL8rtshqUZUKkI888sXnM9LpLFfhM7rEXcaoS-2J-aAfgGAYGpWQq4Oth5YfSTVkHffcTvEVixkk3IASsPpIQ7Xn1qtHyh&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;652&quot; data-original-width=&quot;1708&quot; height=&quot;221&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhIRmj2XEPVURtQ5kgptPosk8L8gBQ-S6MF7GOynLpmuqFF_MiBRuu5_5cj9OZRwqEJKggdlslJAE6sE0m71m5XtF_acdJhVpbL8rtshqUZUKkI888sXnM9LpLFfhM7rEXcaoS-2J-aAfgGAYGpWQq4Oth5YfSTVkHffcTvEVixkk3IASsPpIQ7Xn1qtHyh=w580-h221&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;h1 data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; data-pm-slice=&quot;1 1 []&quot; dir=&quot;ltr&quot; id=&quot;bh-Z2J-XBtCJjRut1wetwBco&quot;&gt;Conclusion&lt;/h1&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; id=&quot;bh-_QUaVtIGj-4t74Zj0G449&quot;&gt;&lt;/p&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-14YTs9cSoGdYjJ3oSdPNj&quot;&gt;The AI music generation service presents a unique opportunity to tap into the growing demand for personalized music solutions. By targeting diverse markets, implementing multiple revenue streams, and focusing on technology and user experience, this business model can establish a strong foothold in the music industry. With the right strategies in place, the service can not only thrive but also innovate the way music is created and consumed.&lt;/p&gt;&lt;p data-bubble-menu=&quot;true&quot; data-hook-type=&quot;blockHook&quot; dir=&quot;ltr&quot; id=&quot;bh-14YTs9cSoGdYjJ3oSdPNj&quot;&gt;#&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/8594294751297680222/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/8594294751297680222' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/8594294751297680222'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/8594294751297680222'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2024/10/business-model-for-ai-music-generation.html' title='Business Model for AI Music Generation Services'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEiHi1BOz7dLQXkJG3CqUyNcCwnLbMqkoAKTM3c6PFtjLZR5qyjHIa4yRyXie7CxDEaDH-URwHqAJP8qNifnFl4dKUmecmXbsZFMM1PR1o2nzjThNE6tFz0STLwwqvfAh6SmklNQpT9LpmraBC1K6IF9q096bJT_ja3UJzKtdXRU5s5lYgzB6mykjBPSflgq=s72-w504-h444-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-7180914630448247052</id><published>2024-10-06T02:15:00.001+08:00</published><updated>2024-10-06T02:15:04.221+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="chinese"/><category scheme="http://www.blogger.com/atom/ns#" term="fonts"/><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><category scheme="http://www.blogger.com/atom/ns#" term="matplotlib"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Mac OS X 下 Python套件matplotlib繪製中文標題散點圖表(Scatter Plot)</title><content type='html'>
&lt;br/&gt;
&lt;li&gt;匯入了必要的套件：seaborn、matplotlib.pyplot 和 matplotlib.font_manager。
&lt;li&gt;設定了字體和字號：使用 FontProperties 類別來指定字體檔案路徑和字號大小。
&lt;li&gt;載入了 tips 數據集：使用 sns.load_dataset 函數來載入 seaborn 的 tips 數據集。
&lt;li&gt;設定了 seaborn 的樣式：使用 sns.set() 函數來設定 seaborn 的預設樣式。
&lt;li&gt;畫了散點圖：使用 sns.scatterplot 函數來畫散點圖。
&lt;li/&gt;設定了圖表標題：使用 plt.title 函數來設定圖表標題，並指定了中文字體和字號。
&lt;br/&gt;

&lt;pre class=&quot;shellblock&quot;&gt;import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm

# 設定字體和字號
font = fm.FontProperties(fname=&#39;/Users/YOURNAME/Library/Fonts/jf-openhuninn-2.0.ttf&#39;, size=12)

tips = sns.load_dataset(&quot;tips&quot;)
sns.set()
sns.scatterplot(x=&quot;total_bill&quot;, y=&quot;tip&quot;, data=tips)
plt.title(&#39;餐廳小費關係圖&#39;, fontproperties=font)
plt.show()
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/7180914630448247052/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/7180914630448247052' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/7180914630448247052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/7180914630448247052'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2024/10/mac-os-x-pythonmatplotlibscatter-plot.html' title='Mac OS X 下 Python套件matplotlib繪製中文標題散點圖表(Scatter Plot)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-864784369252828757</id><published>2021-02-11T02:50:00.003+08:00</published><updated>2021-02-11T02:50:50.061+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="apple"/><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Apple M1 Mac 安裝 python3 程式庫</title><content type='html'>
&lt;pre class=&quot;shellblock&quot;&gt;
python3 -m pip install --upgrade pip

arch -x86_64 $(which python3) -m pip install numpy scipy matplotlib dbr
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/864784369252828757/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/864784369252828757' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/864784369252828757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/864784369252828757'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2021/02/apple-m1-mac-python3.html' title='Apple M1 Mac 安裝 python3 程式庫'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-4712054422896411252</id><published>2019-11-10T14:46:00.000+08:00</published><updated>2019-11-10T14:46:21.734+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2019"/><category scheme="http://www.blogger.com/atom/ns#" term="bash"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="shell"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><category scheme="http://www.blogger.com/atom/ns#" term="程式"/><category scheme="http://www.blogger.com/atom/ns#" term="組合的力量"/><category scheme="http://www.blogger.com/atom/ns#" term="軟體"/><title type='text'>bash shell 批次更改圖片檔名範例</title><content type='html'>&lt;pre class=&quot;shellblock&quot;&gt;
#!/bin/bash

files=&quot;img-1*&quot;
start=1
rename=1
echo $count

for i in `ls $files`
do
  echo $i
  rename=$(($start * 2 - 1))
  #rename=$(($start * 2))
  start=$(($start + 1))
  echo $rename
  refilename=`printf &quot;%02u&quot; $rename`
  mv $i $refilename.tif

done
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/4712054422896411252/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/4712054422896411252' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/4712054422896411252'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/4712054422896411252'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2019/11/bash-shell.html' title='bash shell 批次更改圖片檔名範例'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-4179018936552855754</id><published>2019-11-10T04:47:00.001+08:00</published><updated>2019-11-10T04:49:46.276+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2019"/><category scheme="http://www.blogger.com/atom/ns#" term="elasticsearch"/><category scheme="http://www.blogger.com/atom/ns#" term="中文"/><category scheme="http://www.blogger.com/atom/ns#" term="設定"/><title type='text'>Ubuntu Elasticsearch 使用 IK Analysis Plugin</title><content type='html'>下載新版的 IK Analysis Plugin (這裡以 Ver 7.4.2為例)，並且下載擴充中文字典檔案
&lt;br/&gt;
&lt;pre class=&quot;shellblock&quot;&gt;
sudo mkdir /usr/share/elasticsearch/plugins/ik/
sudo cd /usr/share/elasticsearch/plugins/ik/
sudo wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.4.2/elasticsearch-analysis-ik-7.4.2.zip
sudo unzip elasticsearch-analysis-ik-7.4.2.zip
sudo \rm elasticsearch-analysis-ik-7.4.2.zip
sudo cd /usr/share/elasticsearch/plugins/ik/config
sudo wget https://github.com/samejack/sc-dictionary/raw/master/main.txt
sudo mv main.dic main.dic.old
sudo mv main.txt main.dic
&lt;/pre&gt;

&lt;br/&gt;
設定擴充字典，編輯 IKAnalyzer.cfg.xml 設定檔案
&lt;pre class=&quot;shellblock&quot;&gt;
cd /usr/share/elasticsearch/plugins/ik/config
sudo vi IKAnalyzer.cfg.xml
&lt;/pre&gt;
將 ext_dict 新增 main.dic
&lt;pre class=&quot;codeblock&quot;&gt;
 &amp;lt;entry key=&quot;ext_dict&quot;&amp;gt;main.dic&amp;lt;/entry&amp;gt;
&lt;/pre&gt;
重新啟動ElasticSearch
&lt;pre class=&quot;shellblock&quot;&gt;
sudo service elasticsearch restart
&lt;/pre&gt;
&lt;hr/&gt;
沒問題的話，就來測試一下 IK 吧...
&lt;pre class=&quot;shellblock&quot;&gt;
curl -XGET http://localhost:9200/_analyze -H &#39;Content-Type:application/json&#39; -d&#39;
{
  &quot;text&quot;:&quot;後悔莫及的人家&quot;,
  &quot;analyzer&quot;: &quot;ik_smart&quot;
}&#39;
&lt;/pre&gt;
應該會得到這樣的結果:
&lt;pre class=&quot;codeblock&quot;&gt;
{
  &quot;tokens&quot; : [
    {
      &quot;token&quot; : &quot;後悔莫及&quot;,
      &quot;start_offset&quot; : 0,
      &quot;end_offset&quot; : 4,
      &quot;type&quot; : &quot;CN_WORD&quot;,
      &quot;position&quot; : 0
    },
    {
      &quot;token&quot; : &quot;的&quot;,
      &quot;start_offset&quot; : 4,
      &quot;end_offset&quot; : 5,
      &quot;type&quot; : &quot;CN_CHAR&quot;,
      &quot;position&quot; : 1
    },
    {
      &quot;token&quot; : &quot;人家&quot;,
      &quot;start_offset&quot; : 5,
      &quot;end_offset&quot; : 7,
      &quot;type&quot; : &quot;CN_WORD&quot;,
      &quot;position&quot; : 2
    }
  ]
}
&lt;/pre&gt;
&lt;hr/&gt;
接著來建立一個新的 index 就叫做 test 吧，順便進行一下IK分詞測試看看...
&lt;pre class=&quot;shellblock&quot;&gt;
curl -XPUT http://localhost:9200/test

curl -XPOST http://localhost:9200/test/_mapping -H &#39;Content-Type:application/json&#39; -d&#39;
{
        &quot;properties&quot;: {
            &quot;content&quot;: {
                &quot;type&quot;: &quot;text&quot;,
                &quot;analyzer&quot;: &quot;ik_max_word&quot;,
                &quot;search_analyzer&quot;: &quot;ik_smart&quot;
            }
        }

}&#39;

curl -XPOST http://localhost:9200/test/_create/1 -H &#39;Content-Type:application/json&#39; -d&#39;
{&quot;content&quot;:&quot;曾經有一份真摯的感情放在我面前.我沒有珍惜.等到失去的時候才後悔莫及，塵世間最痛苦的事莫過於此.你的劍在我的咽喉上割下去吧!不要再猶豫了!如果上天能夠給我一個再來一次的機會，我一定會對那個女孩子說三個字\&quot;我愛你\&quot;,如果非要在這份愛上加一個期限的話，我希望是一萬年。&quot;}&#39;

curl -XPOST /test/_search -H &#39;Content-Type:application/json&#39; -d&#39;
{
  &quot;query&quot;: {&quot;match&quot;: {&quot;content&quot;: &quot;如果&quot;}},
  &quot;highlight&quot; : {
    &quot;pre_tags&quot; : [&quot;&lt;tag1&gt;&quot;, &quot;&lt;tag2&gt;&quot;],
    &quot;post_tags&quot; : [&quot;&lt;/tag1&gt;&quot;, &quot;&lt;/tag2&gt;&quot;],
    &quot;fields&quot; : {
      &quot;content&quot; : {}
    }
  }
}&#39;
&lt;/pre&gt;
結果應該會是如此 :
&lt;pre class=&quot;codeblock&quot;&gt;
{
  &quot;took&quot; : 292,
  &quot;timed_out&quot; : false,
  &quot;_shards&quot; : {
    &quot;total&quot; : 1,
    &quot;successful&quot; : 1,
    &quot;skipped&quot; : 0,
    &quot;failed&quot; : 0
  },
  &quot;hits&quot; : {
    &quot;total&quot; : {
      &quot;value&quot; : 1,
      &quot;relation&quot; : &quot;eq&quot;
    },
    &quot;max_score&quot; : 0.40037507,
    &quot;hits&quot; : [
      {
        &quot;_index&quot; : &quot;test&quot;,
        &quot;_type&quot; : &quot;_doc&quot;,
        &quot;_id&quot; : &quot;1&quot;,
        &quot;_score&quot; : 0.40037507,
        &quot;_source&quot; : {
          &quot;content&quot; : &quot;&quot;&quot;曾經有一份真摯的感情放在我面前.我沒有珍惜.等到失去的時候才後悔莫及，塵世間最痛苦的事莫過於此.你的劍在我的咽喉上割下去吧!不要再猶豫了!如果上天能夠給我一個再來一次的機會，我一定會對那個女孩子說三個字&quot;我愛你&quot;,如果非要在這份愛上加一個期限的話，我希望是一萬年。&quot;&quot;&quot;
        },
        &quot;highlight&quot; : {
          &quot;content&quot; : [
            &quot;&quot;&quot;&amp;lt;tag1&amp;gt;如果&amp;lt;/tag1&amp;gt;上天能夠給我一個再來一次的機會，我一定會對那個女孩子說三個字&quot;我愛你&quot;,&amp;lt;tag1&amp;gt;如果&amp;lt;/tag1&amp;gt;非要在這份愛上加一個期限的話，我希望是一萬年。&quot;&quot;&quot;
          ]
        }
      }
    ]
  }
}
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/4179018936552855754/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/4179018936552855754' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/4179018936552855754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/4179018936552855754'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2019/11/ubuntu-elasticsearch-ik-analysis-plugin.html' title='Ubuntu Elasticsearch 使用 IK Analysis Plugin'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-207343697959142792</id><published>2019-10-22T02:08:00.000+08:00</published><updated>2019-10-22T02:08:29.413+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2019"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="nginx"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><category scheme="http://www.blogger.com/atom/ns#" term="設定"/><category scheme="http://www.blogger.com/atom/ns#" term="軟體"/><title type='text'>Ubuntu 18.04 安裝 Nginx+MySQL+PHP</title><content type='html'>安裝 Nginx, MySQL：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;sudo apt-get update
sudo apt-get install nginx
sudo apt-get install mysql-server
&lt;/pre&gt;
&lt;br /&gt;
設定MySQL安全性設定：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;sudo mysql_secure_installation
&lt;/pre&gt;
&lt;br /&gt;
安裝PHP：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;sudo apt-get install php-fpm php-mysql php-json php-gd
&lt;/pre&gt;
&lt;br /&gt;
設定 php.ini，編輯 /etc/php/7.2/fpm/php.ini，將cgi.fix_pathinfo設為0
&lt;br /&gt;
&lt;pre class=&quot;codeblock&quot;&gt;;cgi.fix_pathinfo=1
cgi.fix_pathinfo=0
&lt;/pre&gt;
&lt;br /&gt;
重新啟動PHP服務：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;sudo service php7.2-fpm restart
&lt;/pre&gt;
&lt;hr /&gt;
設定一個新的nginx網站，以adia.cc為例。編輯 /etc/nginx/sites-available/adia.cc檔案：
&lt;br /&gt;
&lt;pre class=&quot;codeblock&quot;&gt;server {
        listen 8080;
        root /var/www/adia.cc/html;
        index index.php index.html index.htm;
        access_log /var/log/nginx/adia.cc.access.log;
        error_log /var/log/nginx/adia.cc.error.log;
        server_name adia.cc www.adia.cc;
 
        location / {
                try_files $uri $uri/ =404;
        }
 
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        }
 
        location ~ /\.ht {
                deny all;
        }
}
&lt;/pre&gt;
&lt;br /&gt;
建立adia.cc網站設定檔連結，並測試設定檔是否正確：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;sudo ln -s /etc/nginx/sites-available/adia.cc /etc/nginx/sites-enabled/
sudo nginx -t
&lt;/pre&gt;
&lt;br /&gt;
正確的話，應該會出現類似結果：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
&lt;/pre&gt;
&lt;br /&gt;
接著建立一個PHP測試網頁，編輯 /var/www/adia.cc/html/info.php：
&lt;br /&gt;
&lt;pre class=&quot;codeblock&quot;&gt;&amp;lt;?php
   phpinfo();
?&amp;gt;
&lt;/pre&gt;
重新啟動 Nginx 服務：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;sudo service nginx restart
&lt;/pre&gt;
&lt;br /&gt;
接下來利用瀏覽器測試 http://YOUR_IP/ 和 http://YOUR_IP:8080/info.php是否正常~
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEiZPAoXo0g0-tb7JtzYDbbtv3k-vDvXR6k1_JYDbHqgnd8HjhyEI1Rd9h1YyOm7258FlS4eJ8qD2fHIA1Hghqo4AqHSXSIHs99N5X6q_S8kvLOj5nsCNbzPt4kFeu6jufDatG06furtWT/s1600/php7.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1262&quot; data-original-width=&quot;1227&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEiZPAoXo0g0-tb7JtzYDbbtv3k-vDvXR6k1_JYDbHqgnd8HjhyEI1Rd9h1YyOm7258FlS4eJ8qD2fHIA1Hghqo4AqHSXSIHs99N5X6q_S8kvLOj5nsCNbzPt4kFeu6jufDatG06furtWT/s320/php7.JPG&quot; width=&quot;311&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;phpinfo() 執行結果&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;hr /&gt;
#</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/207343697959142792/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/207343697959142792' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/207343697959142792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/207343697959142792'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2019/10/ubuntu-1804-nginxmysqlphp.html' title='Ubuntu 18.04 安裝 Nginx+MySQL+PHP'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEiZPAoXo0g0-tb7JtzYDbbtv3k-vDvXR6k1_JYDbHqgnd8HjhyEI1Rd9h1YyOm7258FlS4eJ8qD2fHIA1Hghqo4AqHSXSIHs99N5X6q_S8kvLOj5nsCNbzPt4kFeu6jufDatG06furtWT/s72-c/php7.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-1724068456417644685</id><published>2019-10-22T00:23:00.002+08:00</published><updated>2019-10-22T00:23:28.119+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2019"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><category scheme="http://www.blogger.com/atom/ns#" term="安裝"/><category scheme="http://www.blogger.com/atom/ns#" term="設定"/><category scheme="http://www.blogger.com/atom/ns#" term="軟體"/><title type='text'>Ubuntu 18.04 安裝 SSH Server , 設定為文字開機模式 (disable GUI boot mode)</title><content type='html'>確定一下 Ubuntu 版本是否為 18.04：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;lsb_release -a
&lt;/pre&gt;
執行結果：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:        18.04
Codename:       bionic
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;安裝 SSH Server ：
&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;sudo apt-get install openssh-server
sudo update-rc.d ssh defaults
sudo service ssh start
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;關閉GUI開機模式，並且重開機生效：
&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;sudo systemctl set-default multi-user.target
sudo sync;sync;sync;reboot
&lt;/pre&gt;
&lt;br /&gt;
假若要再重新設定GUI開機模式：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;sudo systemctl set-default graphical.target
sudo sync;sync;sync;reboot
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;設定 NTP 時間同步主機為 clock.stdtime.gov.tw&lt;/b&gt;，編輯 /etc/systemd/timesyncd.conf 檔案
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;sudo vi /etc/systemd/timesyncd.conf
&lt;/pre&gt;
將內容 #NTP= 前面註解符號(#)刪除，順便設定同步主機後存檔：
&lt;br /&gt;
&lt;pre class=&quot;codeblock&quot;&gt;#NTP=
NTP=clock.stdtime.gov.tw
&lt;/pre&gt;
&lt;br /&gt;
重新啟動時間同步服務後，順便看一下執行狀態：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;sudo service systemd-timesyncd restart
sudo service systemd-timesyncd status
&lt;/pre&gt;
&lt;br /&gt;
執行結果已經顯示同步 time server 從原來的 ntp.ubuntu.com 改為 clock.stdtime.gov.tw：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;● systemd-timesyncd.service - Network Time Synchronization
 (...略...)
   Status: &quot;Synchronized to time server 211.22.103.158:123 (clock.stdtime.gov.tw).&quot;
 (...略...)
&lt;/pre&gt;
&lt;hr/&gt;
#
</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/1724068456417644685/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/1724068456417644685' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/1724068456417644685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/1724068456417644685'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2019/10/ubuntu-1804-ssh-server-disable-gui-boot.html' title='Ubuntu 18.04 安裝 SSH Server , 設定為文字開機模式 (disable GUI boot mode)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-693009705250074335</id><published>2019-10-14T03:45:00.002+08:00</published><updated>2019-10-14T03:57:28.931+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2019"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="爬蟲"/><category scheme="http://www.blogger.com/atom/ns#" term="程式"/><category scheme="http://www.blogger.com/atom/ns#" term="組合的力量"/><category scheme="http://www.blogger.com/atom/ns#" term="軟體"/><title type='text'>第11屆iT邦幫忙鐵人賽-參考 Python 程式交易 30 天新手入門系列範例</title><content type='html'>可能需要預先安裝下列 Python Packages：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;pip install js2py
pip install loguru
pip install pandas
pip install plotly
pip install pyquery
&lt;/pre&gt;
&lt;br /&gt;
參考「&lt;a href=&quot;https://ithelp.ithome.com.tw/users/20120536/ironman/2571&quot; target=&quot;_blank&quot;&gt;第11屆iT邦幫忙鐵人賽-參考 Python 程式交易 30 天新手入門系列&lt;/a&gt;」系列範例修改，並存成檔名 getTaxies.py：&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://ithelp.ithome.com.tw/articles/10217871&quot; target=&quot;_blank&quot;&gt;Day-05 資料蒐集：取得代理清單&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ithelp.ithome.com.tw/articles/10218413&quot; target=&quot;_blank&quot;&gt;Day-06 資料蒐集：如何避免頻繁存取被封鎖&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ithelp.ithome.com.tw/articles/10221050&quot; target=&quot;_blank&quot;&gt;Day-11 資料保存：取得 2019 年每日加權指數盤後資訊並繪製線圖&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ithelp.ithome.com.tw/articles/10221694&quot; target=&quot;_blank&quot;&gt;Day-12 程式運行：解析命令列參數&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;pre class=&quot;codeblock&quot;&gt;import csv
import datetime
import fractions
import json
import os
import random
import re
import time
import urllib.parse
import argparse

from random import randint
from time import sleep

import js2py
import loguru
import pandas
import plotly.graph_objects
import pyquery
import requests
import requests.exceptions

now = datetime.datetime.now()
proxies = []

proxy = None

class Taiex:
    def __init__(self, date, openPrice, highestPrice, lowestPrice, closePrice):
        # 日期
        self.Date = date
        # 開盤價
        self.OpenPrice = openPrice
        # 最高價
        self.HighestPrice = highestPrice
        # 最低價
        self.LowestPrice = lowestPrice
        # 收盤價
        self.ClosePrice = closePrice
    # 物件表達式
    def __repr__(self):
        return f&#39;class Taiex {{ Date={self.Date}, OpenPrice={self.OpenPrice}, HighestPrice={self.HighestPrice}, LowestPrice={self.LowestPrice}, ClosePrice={self.ClosePrice} }}&#39;

def getProxy():
    global proxies
    if len(proxies) == 0:
        getProxies()
    proxy = random.choice(proxies)
    loguru.logger.debug(f&#39;getProxy: {proxy}&#39;)
    proxies.remove(proxy)
    loguru.logger.debug(f&#39;getProxy: {len(proxies)} proxies is unused.&#39;)
    return proxy

def reqProxies(hour):
    global proxies
    proxies = proxies + getProxiesFromProxyNova()
    proxies = proxies + getProxiesFromGatherProxy()
    proxies = proxies + getProxiesFromFreeProxyList()
    proxies = list(dict.fromkeys(proxies))
    loguru.logger.debug(f&#39;reqProxies: {len(proxies)} proxies is found.&#39;)

def getProxies():
    global proxies
    hour = f&#39;{now:%Y%m%d%H}&#39;
    filename = f&#39;proxies-{hour}.csv&#39;
    filepath = f&#39;{filename}&#39;
    if os.path.isfile(filepath):
        loguru.logger.info(f&#39;getProxies: {filename} exists.&#39;)
        loguru.logger.warning(f&#39;getProxies: {filename} is loading...&#39;)
        with open(filepath, &#39;r&#39;, newline=&#39;&#39;, encoding=&#39;utf-8-sig&#39;) as f:
            reader = csv.DictReader(f)
            for row in reader:
                proxy = row[&#39;Proxy&#39;]
                proxies.append(proxy)
        loguru.logger.success(f&#39;getProxies: {filename} is loaded.&#39;)
    else:
        loguru.logger.info(f&#39;getProxies: {filename} does not exist.&#39;)
        reqProxies(hour)
        loguru.logger.warning(f&#39;getProxies: {filename} is saving...&#39;)
        with open(filepath, &#39;w&#39;, newline=&#39;&#39;, encoding=&#39;utf-8-sig&#39;) as f:
            writer = csv.writer(f)
            writer.writerow([
                &#39;Proxy&#39;
            ])
            for proxy in proxies:
                writer.writerow([
                    proxy
                ])
        loguru.logger.success(f&#39;getProxies: {filename} is saved.&#39;)

def getProxiesFromProxyNova():
    proxies = []
    countries = [
        &#39;tw&#39;,
        &#39;jp&#39;,
        &#39;kr&#39;,
        &#39;id&#39;,
        &#39;my&#39;,
        &#39;th&#39;,
        &#39;vn&#39;,
        &#39;ph&#39;,
        &#39;hk&#39;,
        &#39;uk&#39;,
        &#39;us&#39;
    ]
    for country in countries:
        url = f&#39;https://www.proxynova.com/proxy-server-list/country-{country}/&#39;
        loguru.logger.debug(f&#39;getProxiesFromProxyNova: {url}&#39;)
        loguru.logger.warning(f&#39;getProxiesFromProxyNova: downloading...&#39;)
        response = requests.get(url)
        if response.status_code != 200:
            loguru.logger.debug(f&#39;getProxiesFromProxyNova: status code is not 200&#39;)
            continue
        loguru.logger.success(f&#39;getProxiesFromProxyNova: downloaded.&#39;)
        d = pyquery.PyQuery(response.text)
        table = d(&#39;table#tbl_proxy_list&#39;)
        rows = list(table(&#39;tbody:first &amp;gt; tr&#39;).items())
        loguru.logger.warning(f&#39;getProxiesFromProxyNova: scanning...&#39;)
        for row in rows:
            tds = list(row(&#39;td&#39;).items())
            if len(tds) == 1:
                continue
            js = row(&#39;td:nth-child(1) &amp;gt; abbr&#39;).text()
            js = &#39;let x = %s; x&#39; % (js[15:-2])
            ip = js2py.eval_js(js).strip()
            port = row(&#39;td:nth-child(2)&#39;).text().strip()
            proxy = f&#39;{ip}:{port}&#39;
            proxies.append(proxy)
        loguru.logger.success(f&#39;getProxiesFromProxyNova: scanned.&#39;)
        loguru.logger.debug(f&#39;getProxiesFromProxyNova: {len(proxies)} proxies is found.&#39;)
        time.sleep(1)
    return proxies

def getProxiesFromGatherProxy():
    proxies = []
    countries = [
        &#39;Taiwan&#39;,
        &#39;Japan&#39;,
        &#39;United States&#39;,
        &#39;Thailand&#39;,
        &#39;Vietnam&#39;,
        &#39;Indonesia&#39;,
        &#39;Singapore&#39;,
        &#39;Philippines&#39;,
        &#39;Malaysia&#39;,
        &#39;Hong Kong&#39;
    ]
    for country in countries:
        url = f&#39;http://www.gatherproxy.com/proxylist/country/?c={urllib.parse.quote(country)}&#39;
        loguru.logger.debug(f&#39;getProxiesFromGatherProxy: {url}&#39;)
        loguru.logger.warning(f&#39;getProxiesFromGatherProxy: downloading...&#39;)
        response = requests.get(url)
        if response.status_code != 200:
            loguru.logger.debug(f&#39;getProxiesFromGatherProxy: status code is not 200&#39;)
            continue
        loguru.logger.success(f&#39;getProxiesFromGatherProxy: downloaded.&#39;)
        d = pyquery.PyQuery(response.text)
        scripts = list(d(&#39;table#tblproxy &amp;gt; script&#39;).items())
        loguru.logger.warning(f&#39;getProxiesFromGatherProxy: scanning...&#39;)
        for script in scripts:
            script = script.text().strip()
            script = re.sub(r&#39;^gp\.insertPrx\(&#39;, &#39;&#39;, script)
            script = re.sub(r&#39;\);$&#39;, &#39;&#39;, script)
            script = json.loads(script)
            ip = script[&#39;PROXY_IP&#39;].strip()
            port = int(script[&#39;PROXY_PORT&#39;].strip(), 16)
            proxy = f&#39;{ip}:{port}&#39;
            proxies.append(proxy)
        loguru.logger.success(f&#39;getProxiesFromGatherProxy: scanned.&#39;)
        loguru.logger.debug(f&#39;getProxiesFromGatherProxy: {len(proxies)} proxies is found.&#39;)
        time.sleep(1)
    return proxies

def getProxiesFromFreeProxyList():
    proxies = []
    url = &#39;https://free-proxy-list.net/&#39;
    loguru.logger.debug(f&#39;getProxiesFromFreeProxyList: {url}&#39;)
    loguru.logger.warning(f&#39;getProxiesFromFreeProxyList: downloading...&#39;)
    response = requests.get(url)
    if response.status_code != 200:
        loguru.logger.debug(f&#39;getProxiesFromFreeProxyList: status code is not 200&#39;)
        return
    loguru.logger.success(f&#39;getProxiesFromFreeProxyList: downloaded.&#39;)
    d = pyquery.PyQuery(response.text)
    trs = list(d(&#39;table#proxylisttable &amp;gt; tbody &amp;gt; tr&#39;).items())
    loguru.logger.warning(f&#39;getProxiesFromFreeProxyList: scanning...&#39;)
    for tr in trs:
        tds = list(tr(&#39;td&#39;).items())
        ip = tds[0].text().strip()
        port = tds[1].text().strip()
        proxy = f&#39;{ip}:{port}&#39;
        proxies.append(proxy)
    loguru.logger.success(f&#39;getProxiesFromFreeProxyList: scanned.&#39;)
    loguru.logger.debug(f&#39;getProxiesFromFreeProxyList: {len(proxies)} proxies is found.&#39;)
    return proxies

# 取得指定年月內每交易日的盤後資訊
def getTaiexs(year, month):
    global proxy
    taiexs = []
    while True:
        if proxy is None:
            proxy = getProxy()
        url = f&#39;https://www.twse.com.tw/indicesReport/MI_5MINS_HIST?response=json&amp;amp;date={year}{month:02}01&#39;
        loguru.logger.info(f&#39;getTaiexs: month {month} url is {url}&#39;)
        loguru.logger.warning(f&#39;getTaiexs: month {month} is downloading...&#39;)
        try:
            response = requests.get(
                url,
                proxies={
                    &#39;https&#39;: f&#39;https://{proxy}&#39;
                },
                timeout=3
            )
            if response.status_code != 200:
                loguru.logger.success(f&#39;getTaiexs: month {month} status code is not 200.&#39;)
                proxy = None
                break
            loguru.logger.success(f&#39;getTaiexs: month {month} is downloaded.&#39;)
            body = response.json()
            stat = body[&#39;stat&#39;]
            if stat != &#39;OK&#39;:
                loguru.logger.error(f&#39;getTaiexs: month {month} responses with error({stat}).&#39;)
                break
            records = body[&#39;data&#39;]
            if len(records) == 0:
                loguru.logger.success(f&#39;getTaiexs: month {month} has no data.&#39;)
                break
            for record in records:
                date = record[0].strip()
                parts = date.split(&#39;/&#39;)
                y = int(parts[0]) + 1911
                m = int(parts[1])
                d = int(parts[2])
                date = f&#39;{y}{m:02d}{d:02d}&#39;
                openPrice = record[1].replace(&#39;,&#39;, &#39;&#39;).strip()
                highestPrice = record[2].replace(&#39;,&#39;, &#39;&#39;).strip()
                lowestPrice = record[3].replace(&#39;,&#39;, &#39;&#39;).strip()
                closePrice = record[4].replace(&#39;,&#39;, &#39;&#39;).strip()
                taiex = Taiex(
                    date=date,
                    openPrice=openPrice,
                    highestPrice=highestPrice,
                    lowestPrice=lowestPrice,
                    closePrice=closePrice
                )
                taiexs.append(taiex)
        except requests.exceptions.ConnectionError:
            loguru.logger.error(f&#39;getTaiexs: proxy({proxy}) is not working (connection error).&#39;)
            proxy = None
            continue
        except requests.exceptions.ConnectTimeout:
            loguru.logger.error(f&#39;getTaiexs: proxy({proxy}) is not working (connect timeout).&#39;)
            proxy = None
            continue
        except requests.exceptions.ProxyError:
            loguru.logger.error(f&#39;getTaiexs: proxy({proxy}) is not working (proxy error).&#39;)
            proxy = None
            continue
        except requests.exceptions.SSLError:
            loguru.logger.error(f&#39;getTaiexs: proxy({proxy}) is not working (ssl error).&#39;)
            proxy = None
            continue
        except Exception as e:
            loguru.logger.error(f&#39;getTaiexs: proxy({proxy}) is not working.&#39;)
            loguru.logger.error(e)
            proxy = None
            continue
        break
    return taiexs

# 儲存傳入的盤後資訊
def saveTaiexs(filepath, taiexs):
    loguru.logger.info(f&#39;saveTaiexs: {len(taiexs)} taiexs.&#39;)
    loguru.logger.warning(f&#39;saveTaiexs: {filepath} is saving...&#39;)
    with open(filepath, mode=&#39;w&#39;, newline=&#39;&#39;, encoding=&#39;utf-8-sig&#39;) as f:
        writer = csv.writer(f)
        writer.writerow([
            &#39;Date&#39;,
            &#39;OpenPrice&#39;,
            &#39;HighestPrice&#39;,
            &#39;LowestPrice&#39;,
            &#39;ClosePrice&#39;
        ])
        for taiex in taiexs:
            writer.writerow([
                taiex.Date,
                taiex.OpenPrice,
                taiex.HighestPrice,
                taiex.LowestPrice,
                taiex.ClosePrice
            ])
    loguru.logger.success(f&#39;main: {filepath} is saved.&#39;)

def main(args):
    taiexs = []
    thisYear = 2019
    if args.year:
        loguru.logger.info(f&#39;[-y|--year] [value:{args.year}]&#39;)
        thisYear = int(args.year)
    else:
        loguru.logger.info(f&#39;[-y|--year] is not used, set year in &#39;+str(thisYear))
    # 取得從 2019.01 至 2019.12 的盤後資訊
    for month in range(1, 13):
        # 程式暫停 3~15 秒
        sleep(randint(3, 15))
        taiexs = taiexs + getTaiexs(thisYear, month)
    filepath = f&#39;taiexs-&#39;+str(thisYear)+&#39;.csv&#39;
    saveTaiexs(filepath, taiexs)

    # 使用 Pandas 讀取下載回來的紀錄檔
    df = pandas.read_csv(filepath)
    # 將 Date 欄位按照格式轉換為 datetime 資料
    df[&#39;Date&#39;] = pandas.to_datetime(df[&#39;Date&#39;], format=&#39;%Y%m%d&#39;)
    
    # 建立圖表
    figure = plotly.graph_objects.Figure(
        data=[
            # Line Chart
            # 收盤價
            plotly.graph_objects.Scatter(
                x=df[&#39;Date&#39;],
                y=df[&#39;ClosePrice&#39;],
                name=&#39;收盤價&#39;,
                mode=&#39;lines&#39;,
                line=plotly.graph_objects.scatter.Line(
                    color=&#39;#6B99E5&#39;
                )
            ),
            # Candlestick Chart
            # K 棒
            plotly.graph_objects.Candlestick(
                x=df[&#39;Date&#39;],
                open=df[&#39;OpenPrice&#39;],
                high=df[&#39;HighestPrice&#39;],
                low=df[&#39;LowestPrice&#39;],
                close=df[&#39;ClosePrice&#39;],
                name=&#39;盤後資訊&#39;,
            )
        ],
        # 設定 XY 顯示格式
        layout=plotly.graph_objects.Layout(
            xaxis=plotly.graph_objects.layout.XAxis(
                tickformat=&#39;%Y-%m&#39;
            ),
            yaxis=plotly.graph_objects.layout.YAxis(
                tickformat=&#39;.2f&#39;
            )
        )
    )
    figure.show()

if __name__ == &#39;__main__&#39;:
    parser = argparse.ArgumentParser()

    # -y [value:yyyy]
    # -- year [value:yyyy]
    parser.add_argument(
        &#39;-y&#39;,
        &#39;--year&#39;,
        help=&#39;set year in yyyy format&#39;,
        type=int
    )

    args = parser.parse_args()

    loguru.logger.add(
        f&#39;{datetime.date.today():%Y%m%d}.log&#39;,
        rotation=&#39;1 day&#39;,
        retention=&#39;7 days&#39;,
        level=&#39;DEBUG&#39;
    )
    main(args)
&lt;/pre&gt;
範例以2007年為例，執行下列：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;python getTaxies.py -y 2007
&lt;/pre&gt;
執行結果：
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;python getTaixes.py -y 2007
2019-10-14 03:34:40.292 | INFO     | __main__:main:300 - [-y|--year] [value:2007]
2019-10-14 03:34:44.294 | INFO     | __main__:getProxies:69 - getProxies: proxies-2019101403.csv exists.
2019-10-14 03:34:44.298 | WARNING  | __main__:getProxies:70 - getProxies: proxies-2019101403.csv is loading...
2019-10-14 03:34:44.308 | SUCCESS  | __main__:getProxies:76 - getProxies: proxies-2019101403.csv is loaded.
2019-10-14 03:34:44.313 | DEBUG    | __main__:getProxy:50 - getProxy: 180.250.216.242:3128
2019-10-14 03:34:44.317 | DEBUG    | __main__:getProxy:52 - getProxy: 724 proxies is unused.
2019-10-14 03:34:44.322 | INFO     | __main__:getTaiexs:206 - getTaiexs: month 1 url is https://www.twse.com.tw/indicesReport/MI_5MINS_HIST?response=json&amp;amp;date=20070101
...(略)...
2019-10-14 03:36:58.484 | INFO     | __main__:getTaiexs:206 - getTaiexs: month 12 url is https://www.twse.com.tw/indicesReport/MI_5MINS_HIST?response=json&amp;amp;date=20071201
2019-10-14 03:36:58.489 | WARNING  | __main__:getTaiexs:207 - getTaiexs: month 12 is downloading...
2019-10-14 03:36:58.846 | SUCCESS  | __main__:getTaiexs:220 - getTaiexs: month 12 is downloaded.
2019-10-14 03:36:58.850 | INFO     | __main__:saveTaiexs:275 - saveTaiexs: 247 taiexs.
2019-10-14 03:36:58.853 | WARNING  | __main__:saveTaiexs:276 - saveTaiexs: taiexs-2007.csv is saving...
2019-10-14 03:36:58.864 | SUCCESS  | __main__:saveTaiexs:294 - main: taiexs-2007.csv is saved.
&lt;/pre&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipjXAG-HMpZoKkJxCb3mwUK2NeO7GpF-mBDeFHfiK-vPSkSlQn3S7RmmS1TVx8EYEqrbSnakLgqE9BQFvRSJFeRwWa7ADMbqjX6RoIhmv5VoDaiujOh7i-rk7TwUWCH9Xp5qZ45UINiYM_/s1600/2007.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1210&quot; data-original-width=&quot;1600&quot; height=&quot;481&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipjXAG-HMpZoKkJxCb3mwUK2NeO7GpF-mBDeFHfiK-vPSkSlQn3S7RmmS1TVx8EYEqrbSnakLgqE9BQFvRSJFeRwWa7ADMbqjX6RoIhmv5VoDaiujOh7i-rk7TwUWCH9Xp5qZ45UINiYM_/s640/2007.JPG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;2007年大盤指數&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
#</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/693009705250074335/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/693009705250074335' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/693009705250074335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/693009705250074335'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2019/10/11it-python-30.html' title='第11屆iT邦幫忙鐵人賽-參考 Python 程式交易 30 天新手入門系列範例'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipjXAG-HMpZoKkJxCb3mwUK2NeO7GpF-mBDeFHfiK-vPSkSlQn3S7RmmS1TVx8EYEqrbSnakLgqE9BQFvRSJFeRwWa7ADMbqjX6RoIhmv5VoDaiujOh7i-rk7TwUWCH9Xp5qZ45UINiYM_/s72-c/2007.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-7954133686080656208</id><published>2019-07-27T00:49:00.000+08:00</published><updated>2019-07-27T00:49:24.681+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2019"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="中文"/><category scheme="http://www.blogger.com/atom/ns#" term="爬蟲"/><category scheme="http://www.blogger.com/atom/ns#" term="軟體"/><title type='text'>Python 3 + Google 新聞爬蟲 + 罔拍 MONPA 中文正體分詞</title><content type='html'>&lt;pre class=&quot;codeblock&quot;&gt;
import requests
from bs4 import BeautifulSoup
import monpa

res = requests.get(&quot;https://news.google.com.tw&quot;)
soup = BeautifulSoup(res.text)

count = 1
for item in soup.select(&quot;.MQsxIb&quot;):
    print(&#39;=====[&#39;,count,&#39;]=====&#39;)
    news_title = item.select(&quot;.ipQwMb&quot;)[0].text
    news_url = item.select(&quot;.ipQwMb&quot;)[0].find(&#39;a&#39;)[&#39;href&#39;]
    print(news_title)
    result = monpa.pseg(news_title)
    for t in result:
        print(t)
    count+=1
    #print(news_url)
&lt;/pre&gt;

執行結果：
&lt;pre class=&quot;shellblock&quot;&gt;
=====[ 1 ]=====
國安私菸案》檢調大搜索華航總部 歷時9小時公關室也沒放過
[&#39;國安&#39;, &#39;ORG&#39;]
[&#39;私菸案&#39;, &#39;Na&#39;]
[&#39;》&#39;, &#39;PARENTHESISCATEGORY&#39;]
[&#39;檢調&#39;, &#39;Na&#39;]
[&#39;大&#39;, &#39;VH&#39;]
[&#39;搜索&#39;, &#39;VC&#39;]
[&#39;華航&#39;, &#39;ORG&#39;]
[&#39;總部&#39;, &#39;Nc&#39;]
[&#39; &#39;, &#39;D&#39;]
[&#39;歷時&#39;, &#39;VJ&#39;]
[&#39;9&#39;, &#39;Neu&#39;]
[&#39;小時&#39;, &#39;Nf&#39;]
[&#39;公關室&#39;, &#39;Nc&#39;]
[&#39;也&#39;, &#39;D&#39;]
[&#39;沒&#39;, &#39;D&#39;]
[&#39;放過&#39;, &#39;VC&#39;]
=====[ 2 ]=====
快訊／國安局私菸事件華航首波懲處拔官名單出爐| 交通氣象
[&#39;快訊&#39;, &#39;Na&#39;]
[&#39;／&#39;, &#39;PERIODCATEGORY&#39;]
[&#39;國安局&#39;, &#39;ORG&#39;]
[&#39;私菸&#39;, &#39;VA&#39;]
[&#39;事件&#39;, &#39;Na&#39;]
[&#39;華航&#39;, &#39;ORG&#39;]
[&#39;首&#39;, &#39;Nes&#39;]
[&#39;波&#39;, &#39;Nf&#39;]
[&#39;懲處&#39;, &#39;Nv&#39;]
[&#39;拔官&#39;, &#39;Na&#39;]
[&#39;名單&#39;, &#39;Na&#39;]
[&#39;出爐&#39;, &#39;VH&#39;]
[&#39;|&#39;, &#39;FW&#39;]
[&#39; &#39;, &#39;VC&#39;]
[&#39;交通&#39;, &#39;Na&#39;]
[&#39;氣象&#39;, &#39;Na&#39;]
=====[ 3 ]=====
國安私菸案》吳宗憲傳致電黃川禎：我訂那麼多 華航高層知道嗎
[&#39;國安&#39;, &#39;Nb&#39;]
[&#39;私菸案&#39;, &#39;Na&#39;]
[&#39;》&#39;, &#39;PARENTHESISCATEGORY&#39;]
[&#39;吳宗憲&#39;, &#39;PER&#39;]
[&#39;傳&#39;, &#39;VD&#39;]
[&#39;致電&#39;, &#39;VC&#39;]
[&#39;黃川禎&#39;, &#39;PER&#39;]
[&#39;：&#39;, &#39;COLONCATEGORY&#39;]
[&#39;我&#39;, &#39;Nh&#39;]
[&#39;訂&#39;, &#39;VC&#39;]
[&#39;那麼多&#39;, &#39;Neqa&#39;]
[&#39; 華航&#39;, &#39;PER&#39;]
[&#39;高層&#39;, &#39;Na&#39;]
[&#39;知道&#39;, &#39;VK&#39;]
[&#39;嗎&#39;, &#39;T&#39;]
=====[ 4 ]=====
華航公布14次專機負責人！開鍘羅雅美、邱彰信
[&#39;華航&#39;, &#39;PER&#39;]
[&#39;公布&#39;, &#39;VE&#39;]
[&#39;14&#39;, &#39;Neu&#39;]
[&#39;次&#39;, &#39;Nf&#39;]
[&#39;專機&#39;, &#39;Na&#39;]
[&#39;負責人&#39;, &#39;Na&#39;]
[&#39;！&#39;, &#39;EXCLAMATIONCATEGORY&#39;]
[&#39;開&#39;, &#39;VC&#39;]
[&#39;鍘羅雅美&#39;, &#39;PER&#39;]
[&#39;、&#39;, &#39;PAUSECATEGORY&#39;]
[&#39;邱彰信&#39;, &#39;PER&#39;]
=====[ 5 ]=====
華航開鍘！公布14次專機負責人羅雅美邱彰信調非主管職| 政治
[&#39;華航&#39;, &#39;PER&#39;]
[&#39;開鍘&#39;, &#39;Na&#39;]
[&#39;！&#39;, &#39;EXCLAMATIONCATEGORY&#39;]
[&#39;公布&#39;, &#39;VE&#39;]
[&#39;14&#39;, &#39;Neu&#39;]
[&#39;次&#39;, &#39;Nf&#39;]
[&#39;專機&#39;, &#39;Na&#39;]
[&#39;負責人&#39;, &#39;Na&#39;]
[&#39;羅雅美&#39;, &#39;PER&#39;]
[&#39;邱彰信調&#39;, &#39;PER&#39;]
[&#39;非&#39;, &#39;VG&#39;]
[&#39;主管&#39;, &#39;Na&#39;]
[&#39;職&#39;, &#39;Na&#39;]
[&#39;|&#39;, &#39;FW&#39;]
[&#39; 政治&#39;, &#39;PER&#39;]
=====[ 6 ]=====
只是賣太多菸？他揭華航最大漏洞
[&#39;只是&#39;, &#39;D&#39;]
[&#39;賣&#39;, &#39;VD&#39;]
[&#39;太多&#39;, &#39;Neqa&#39;]
[&#39;菸&#39;, &#39;Na&#39;]
[&#39;？&#39;, &#39;QUESTIONCATEGORY&#39;]
[&#39;他&#39;, &#39;Nh&#39;]
[&#39;揭&#39;, &#39;VC&#39;]
[&#39;華航&#39;, &#39;ORG&#39;]
[&#39;最&#39;, &#39;Dfa&#39;]
[&#39;大&#39;, &#39;VH&#39;]
[&#39;漏洞&#39;, &#39;Na&#39;]
=====[ 7 ]=====
黃國昌揭私菸案 洪慈庸：綠支持者問「這樣好嗎？」
[&#39;黃國昌&#39;, &#39;PER&#39;]
[&#39;揭&#39;, &#39;VC&#39;]
[&#39;私菸案&#39;, &#39;Na&#39;]
[&#39; 洪慈庸&#39;, &#39;PER&#39;]
[&#39;：&#39;, &#39;COLONCATEGORY&#39;]
[&#39;綠&#39;, &#39;VH&#39;]
[&#39;支持&#39;, &#39;VC&#39;]
[&#39;者&#39;, &#39;Na&#39;]
[&#39;問&#39;, &#39;VE&#39;]
[&#39;「&#39;, &#39;PARENTHESISCATEGORY&#39;]
[&#39;這樣&#39;, &#39;VH&#39;]
[&#39;好&#39;, &#39;VH&#39;]
[&#39;嗎&#39;, &#39;T&#39;]
[&#39;？&#39;, &#39;QUESTIONCATEGORY&#39;]
[&#39;」&#39;, &#39;PARENTHESISCATEGORY&#39;]
=====[ 8 ]=====
時力分裂？黨內同志要約黃國昌見面 結果是......
[&#39;時力&#39;, &#39;Na&#39;]
[&#39;分裂&#39;, &#39;VHC&#39;]
[&#39;？&#39;, &#39;QUESTIONCATEGORY&#39;]
[&#39;黨內&#39;, &#39;Nc&#39;]
[&#39;同志&#39;, &#39;Na&#39;]
[&#39;要&#39;, &#39;D&#39;]
[&#39;約&#39;, &#39;VC&#39;]
[&#39;黃國昌&#39;, &#39;PER&#39;]
[&#39;見面 &#39;, &#39;Na&#39;]
[&#39;結果&#39;, &#39;Na&#39;]
[&#39;是&#39;, &#39;SHI&#39;]
[&#39;......&#39;, &#39;ETCCATEGORY&#39;]
=====[ 9 ]=====
內鬨？洪慈庸：綠基層焦慮黃國昌：追弊案不可看顏色
[&#39;內鬨&#39;, &#39;Na&#39;]
[&#39;？&#39;, &#39;QUESTIONCATEGORY&#39;]
[&#39;洪慈庸&#39;, &#39;PER&#39;]
[&#39;：&#39;, &#39;COLONCATEGORY&#39;]
[&#39;綠&#39;, &#39;VH&#39;]
[&#39;基層&#39;, &#39;A&#39;]
[&#39;焦慮&#39;, &#39;Nv&#39;]
[&#39;黃國昌&#39;, &#39;PER&#39;]
[&#39;：&#39;, &#39;COLONCATEGORY&#39;]
[&#39;追&#39;, &#39;VC&#39;]
[&#39;弊案&#39;, &#39;Na&#39;]
[&#39;不可&#39;, &#39;D&#39;]
[&#39;看&#39;, &#39;VC&#39;]
[&#39;顏色&#39;, &#39;Na&#39;]
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/7954133686080656208/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/7954133686080656208' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/7954133686080656208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/7954133686080656208'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2019/07/python-3-google-monpa.html' title='Python 3 + Google 新聞爬蟲 + 罔拍 MONPA 中文正體分詞'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-6957941199214466656</id><published>2019-04-30T01:58:00.000+08:00</published><updated>2019-04-30T01:58:19.257+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2019"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="爬蟲"/><category scheme="http://www.blogger.com/atom/ns#" term="程式"/><title type='text'>python 抓取上市及上櫃公司清單, 並寫入 MySQL 資料庫</title><content type='html'>不囉嗦，直接看程式碼：

&lt;pre class=&quot;codeblock&quot;&gt;
# 如何獲得上市上櫃股票清單
import requests
import time
import pandas as pd
from sqlalchemy import create_engine
from sqlalchemy.types import NVARCHAR, Date

def getTWSE(str_mode):
     # 設定爬蟲程式的 User_Agent
    headers = {&#39;user-agent&#39;: &#39;Mozilla/5.0 (Macintosh Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36&#39;}
    # 上市: http://isin.twse.com.tw/isin/C_public.jsp?strMode=2
    # 上櫃: http://isin.twse.com.tw/isin/C_public.jsp?strMode=4
    req_url = &quot;http://isin.twse.com.tw/isin/C_public.jsp?strMode=%s&quot; % (str_mode)
    res = requests.get(req_url, headers=headers)
    df = pd.read_html(res.text)[0]

    # 設定column名稱
    df.columns = df.iloc[0]
    # 刪除第一行
    df = df.iloc[1:]
    # 先移除row，再移除column，超過三個NaN則移除
    df = df.dropna(thresh=3, axis=0).dropna(thresh=3, axis=1)
    df[[&#39;有價證券代號&#39;,&#39;名稱&#39;]] = df[&#39;有價證券代號及名稱&#39;].str.split(n=1, expand=True)
    del df[&#39;有價證券代號及名稱&#39;]
    df = df.set_index(&#39;有價證券代號&#39;)
    return df

engine = create_engine(&quot;mysql+pymysql://stockuser:password@127.0.0.1:3306/stockdb&quot;)

dtypedict = {
    &#39;有價證券代號&#39;:NVARCHAR(length=32),
    &#39;上市日&#39;: Date()
}

# 抓取上市公司股票清單, 寫入MySQL &gt; stockdb &gt; listed_code (listed_code table存在時整個取代)
listed_companies = &quot;2&quot;  #上市公司
mydf1 = getTWSE(listed_companies)
mydf1.to_sql(name=&quot;listed_code&quot;, con=engine, if_exists = &#39;replace&#39;, index=True, dtype=dtypedict)

# 先睡個10秒鐘吧
time.sleep(10)

# 抓取上櫃公司股票清單, 寫入MySQL &gt; stockdb &gt; listed_code (append 到 listed_code table)
listed_companies = &quot;4&quot; #上櫃公司
mydf2 = getTWSE(listed_companies)
mydf2.to_sql(name=&quot;listed_code&quot;, con=engine, if_exists = &#39;append&#39;, index=True, dtype=dtypedict)

&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/6957941199214466656/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/6957941199214466656' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/6957941199214466656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/6957941199214466656'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2019/04/python-mysql_30.html' title='python 抓取上市及上櫃公司清單, 並寫入 MySQL 資料庫'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-4192189659411682162</id><published>2019-04-29T01:04:00.003+08:00</published><updated>2019-04-29T01:11:54.259+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2019"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="R"/><title type='text'>python 讀取 MySQL 資料</title><content type='html'>sqlalchemy連結MySQL時，必須先安裝另一模組 pymysql 
&lt;pre class=&quot;shellblock&quot;&gt;
pip install pymysql
&lt;/pre&gt;

接下來利用 python 來讀取先前我們用&lt;a href=&quot;http://tekibrain.blogspot.com/2019/04/r-tidyquant-mysql.html&quot;&gt;R寫入的股價資料庫&lt;/a&gt;吧
&lt;pre class=&quot;codeblock&quot;&gt;
%matplotlib inline

import pandas as pd
from sqlalchemy import create_engine

engine = create_engine(&quot;mysql+pymysql://stockuser:password@127.0.0.1:3306/stockdb&quot;)

sql =&quot;select * from tw1101;&quot;

df = pd.read_sql_query(sql, engine)

print(df)

df.close.plot()
&lt;/pre&gt;

執行結果：
&lt;pre&gt;
  row_names        date       open       high        low      close  \
0            1  2009-01-02  24.193001  24.193001  24.193001  24.193001   
1            2  2009-01-05  25.135599  25.225300  24.597000  24.821400   
2            3  2009-01-06  24.955999  25.135599  24.372499  24.641800   
3            4  2009-01-07  25.090700  25.449800  24.417400  25.225300   
4            5  2009-01-08  24.372499  24.731600  23.789000  24.417400   
5            6  2009-01-09  24.552099  25.090700  23.789000  23.789000   
...
          volume   adjusted  
0            0.0  14.254436  
1     22712510.0  14.624688  
2     20298561.0  14.518868  
3     26370751.0  14.862664  
4     23748492.0  14.386651
...
2536  30751985.0  41.000000  
2537  23165336.0  41.599998  
2538  16390191.0  41.549999  
2539  13459252.0  41.799999  
2540  11300709.0  41.750000  

[2541 rows x 8 columns]
&lt;matplotlib.axes._subplots.AxesSubplot at 0x213f30ae2e8&gt;
&lt;/pre&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/AVvXsEiQXFyTrASxSVpfGOdKcC97ydUr9onWUKsXkBRlVCIRTrvLDNo3N6ElLGWBO3gBmmubLBNVtHqsh6TJDFckt2aOD_NQ3MsrqD_KKrfOoRkbC_nrJXoEYqurRPPhulk69WPAhyphenhyphenBm4C1Wl_4c/s1600/1101closeplot.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; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQXFyTrASxSVpfGOdKcC97ydUr9onWUKsXkBRlVCIRTrvLDNo3N6ElLGWBO3gBmmubLBNVtHqsh6TJDFckt2aOD_NQ3MsrqD_KKrfOoRkbC_nrJXoEYqurRPPhulk69WPAhyphenhyphenBm4C1Wl_4c/s1600/1101closeplot.png&quot; data-original-width=&quot;372&quot; data-original-height=&quot;252&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/4192189659411682162/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/4192189659411682162' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/4192189659411682162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/4192189659411682162'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2019/04/python-mysql.html' title='python 讀取 MySQL 資料'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQXFyTrASxSVpfGOdKcC97ydUr9onWUKsXkBRlVCIRTrvLDNo3N6ElLGWBO3gBmmubLBNVtHqsh6TJDFckt2aOD_NQ3MsrqD_KKrfOoRkbC_nrJXoEYqurRPPhulk69WPAhyphenhyphenBm4C1Wl_4c/s72-c/1101closeplot.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-6827973419975339701</id><published>2019-04-28T23:53:00.000+08:00</published><updated>2019-04-28T23:57:15.499+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2019"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="爬蟲"/><category scheme="http://www.blogger.com/atom/ns#" term="軟體"/><title type='text'>R tidyquant 抓取股價資料寫入 MySQL 資料庫</title><content type='html'>MySQL上先建立一個新使用者 stockuser ：
&lt;pre class=&quot;shellblock&quot;&gt;mysql -u root -p&lt;/pre&gt;

出現 mysql &gt; 後，開始建立新用者資料並設定密碼：
&lt;pre class=&quot;shellblock&quot;&gt;
mysql &gt;
mysql &gt; GRANT ALL PRIVILEGES ON *.* TO &#39;stockuser&#39;@&#39;%&#39; IDENTIFIED BY &#39;password&#39;;
mysql &gt; FLUSH PRIVILEGES;
mysql &gt; quit;
&lt;/pre&gt;

若MySQL伺服器要開放遠端連結，記得防火牆允入3306埠，另外 MySQL的設定檔也要檢查：
&lt;pre class=&quot;shellblock&quot;&gt;
vi /etc/mysql/my.cnf
&lt;/pre&gt;
記得 bind-address = 127.0.0.1 這行要註解
&lt;pre class=&quot;codeblock&quot;&gt;
#bind-address           = 127.0.0.1
&lt;/pre&gt;
也記得 MySQL 要重新啟動
&lt;pre class=&quot;shellblock&quot;&gt;
service mysql restart
&lt;/pre&gt;

資料庫部分沒問題的話，就可以準備來使用R抓取股價資料~R 如果還沒有安裝過 RMySQL package, 也記得先安裝：
&lt;pre class=&quot;codeblock&quot;&gt;
install.packages(&quot;RMySQL&quot;)
&lt;/pre&gt;
確認安裝完成後，就開始吧...
&lt;pre class=&quot;codeblock&quot;&gt;
library(RMySQL)

library(DBI)
library(tidyquant)
library(dplyr)

cn &lt;- dbConnect(
 drv = RMySQL::MySQL(),
 username=&#39;stockuser&#39;,
 password=&#39;password&#39;,
 host=&#39;127.0.0.1&#39;,
 port = 3306,
 dbname = &quot;stockdb&quot;
 )

#  利用 tidyquant 取得 Yahoo 上的台灣五十股價資料, 寫入 MySQL stockdb &gt; tw{股票代碼}
tw50 &lt;- c(&quot;1101&quot;,&quot;1102&quot;,&quot;1216&quot;) #只有示範三檔股票
for (i in tw50) {
 stockid &lt;- paste(i,&quot;TW&quot;,sep=&quot;.&quot;)
 tblname &lt;- paste(&quot;tw&quot;,i,sep=&quot;&quot;)
 print(stockid)
 sdata &lt;- tq_get(stockid)
 dbWriteTable(cn, name=tblname, value=sdata, overwrite=TRUE)
 Sys.sleep(10) # 每次 Loop 先休息 10 秒
}

# 利用 tidyquant 取得 Yahoo 上的IBM股價資料, 寫入 MySQL stockdb &gt; ibm
ibm &lt;- tq_get(&quot;IBM&quot;)
dbWriteTable(cn, name=&quot;ibm&quot;, value=ibm, overwrite=TRUE)

dbDisconnect(cn) #記得斷開資料庫連線
&lt;/pre&gt;

資料都抓取完成後，MySQL資料庫裡面 stockdb &gt; 就會多個股 table ：
&lt;pre class=&quot;shellblock&quot;&gt;
mysql -u stockuser -p
輸入密碼，登入後...
mysql&gt; use stockdb;
Database changed
mysql&gt; show tables;
+-------------------+
| Tables_in_stockdb |
+-------------------+
| ibm               |
| tw1101            |
| tw1102            |
| tw1216            |
+-------------------+
4 rows in set (0.00 sec)
&lt;/pre&gt;

以後就可以直接從 MySQL 中讀取股價資料來運用：
&lt;pre class=&quot;codeblock&quot;&gt;
# 從 MySQL 取出 IBM 股價資料
cn &lt;- src_mysql(
 user=&#39;stockuser&#39;,
 password=&#39;password&#39;,
 host=&#39;127.0.0.1&#39;,
 port = 3306,
 dbname = &quot;stockdb&quot;
 )

ibm_table &lt;- tbl(cn, &quot;ibm&quot;)
ibm_table

dbDisconnect(cn)
&lt;/pre&gt;
延伸閱讀資料：&lt;br/&gt;
&lt;li/&gt;&lt;a href=&quot;https://blog.davisvaughan.com/2017/05/10/rds-and-r/&quot;&gt;Amazon RDS + R&lt;/a&gt; (其實我是租不起, 所以自建 MySQL...)&lt;br/&gt;
&lt;li/&gt;&lt;a href=&quot;https://waylan25.blogspot.com/2017/01/r-database.html&quot;&gt;R學習筆記 - 資料工程篇(四) Database&lt;/a&gt;&lt;br/&gt;
&lt;br/&gt;
&lt;hr/&gt;



</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/6827973419975339701/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/6827973419975339701' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/6827973419975339701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/6827973419975339701'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2019/04/r-tidyquant-mysql.html' title='R tidyquant 抓取股價資料寫入 MySQL 資料庫'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total><georss:featurename>台灣台北</georss:featurename><georss:point>25.0329694 121.56541770000001</georss:point><georss:box>24.5725269 120.91997070000001 25.493411899999998 122.21086470000002</georss:box></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-1140564680869997330</id><published>2018-11-14T10:26:00.000+08:00</published><updated>2018-11-14T10:26:26.772+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2018"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><category scheme="http://www.blogger.com/atom/ns#" term="組合的力量"/><category scheme="http://www.blogger.com/atom/ns#" term="軟體"/><title type='text'>ubuntu 7-zip 安裝與使用</title><content type='html'>安裝指令&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;sudo apt-get install p7zip-full
&lt;/pre&gt;
&lt;br /&gt;
執行壓縮:
7z a 壓縮檔案 目標來源
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;7z a demo.7z demo_path_or_file
&lt;/pre&gt;
&lt;br /&gt;
執行加密壓縮:
7z a 壓縮檔案 目標來源 -p加密密碼
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;7z a demo.7zp demo_path_or_file -pMYPASSWD
&lt;/pre&gt;
&lt;br /&gt;
執行密碼解壓縮:
7z x 壓縮檔案 -p加密密碼
&lt;br /&gt;
&lt;pre class=&quot;shellblock&quot;&gt;7z x demo.7zp -pMYPASSWD
&lt;/pre&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/1140564680869997330/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/1140564680869997330' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/1140564680869997330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/1140564680869997330'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2018/11/ubuntu-7-zip.html' title='ubuntu 7-zip 安裝與使用'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-7252353857051848086</id><published>2018-10-19T01:59:00.002+08:00</published><updated>2018-10-19T01:59:46.757+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="更新"/><category scheme="http://www.blogger.com/atom/ns#" term="軟體"/><title type='text'>一次更新所有 Python Packages</title><content type='html'>適用於 Linux、Mac OS X :&lt;br /&gt;
&lt;br /&gt;
指令 ： &lt;span style=&quot;background-color: yellow; color: blue;&quot;&gt;pip list | cut -d &quot; &quot; -f 1 | xargs -n1 sudo pip install -U&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
參考來源：&lt;a href=&quot;https://stackoverflow.com/questions/2720014/upgrading-all-packages-with-pip&quot; target=&quot;_blank&quot;&gt;stack overflow - Upgrading all packages with pip&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/7252353857051848086/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/7252353857051848086' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/7252353857051848086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/7252353857051848086'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2018/10/python-packages.html' title='一次更新所有 Python Packages'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-3078567401684281038</id><published>2018-04-01T04:38:00.000+08:00</published><updated>2018-04-01T04:59:40.719+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2018"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>把 IPython notebook貼上Blogger文章上分享</title><content type='html'>&lt;style type=&quot;text/css&quot;&gt;
.highlight{background: #f8f8f8; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .1em;padding:0em .5em;border-radius: 4px;}
.k{color: #338822; font-weight: bold;}
.kn{color: #338822; font-weight: bold;}
.mi{color: #000000;}
.o{color: #000000;}
.ow{color: #BA22FF;  font-weight: bold;}
.nb{color: #338822;}
.n{color: #000000;}
.s{color: #cc2222;}
.se{color: #cc2222; font-weight: bold;}
.si{color: #C06688; font-weight: bold;}
.nn{color: #4D00FF; font-weight: bold;}
&lt;/style&gt;

&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;
&lt;div class=&quot;input&quot;&gt;
&lt;div class=&quot;prompt input_prompt&quot;&gt;In&amp;nbsp;[1]:&lt;/div&gt;
&lt;div class=&quot;inner_cell&quot;&gt;
    &lt;div class=&quot;input_area&quot;&gt;
&lt;div class=&quot; highlight hl-ipython3&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;win32com.client&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;time&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;xlApp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;win32com&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Dispatch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;Excel.Application&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;xlApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Visible&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;workBook&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;xlApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Workbooks&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;C:\Users\kenne\Desktop\datelist.xlsx&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;workBook&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ActiveSheet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Cells&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;now&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;workBook&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ActiveSheet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Cells&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;now&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#SaveChanges = 1 : Save flle&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# SaveChanges = 0 : Nothing Saved&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;workBook&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SaveChanges&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;xlApp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Quit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

參考&lt;a href=&quot;http://prooffreaderplus.blogspot.tw/2014/11/how-to-quickly-turn-ipython-notebook.html&quot; target=&quot;new&quot;&gt;此篇(How to quickly turn an IPython notebook into a blog post)&quot;&lt;/a&gt;，將 .ipynb 轉成 HTML code
&lt;pre class=&quot;codeblock&quot;&gt;
!ipython nbconvert --to html --template basic filename.ipynb
&lt;/pre&gt;

接下來就把目錄底下的 filename.html 檔案內的HTML原碼貼上 blogger.com ，然後記得在HTML原碼前面加上底下的CSS碼，就可以囉~

&lt;pre class=&#39;language-css&#39;&gt;
&amp;lt;style type=&quot;text/css&quot;&amp;gt;
.highlight{background: #f8f8f8; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .1em;padding:0em .5em;border-radius: 4px;}
.k{color: #338822; font-weight: bold;}
.kn{color: #338822; font-weight: bold;}
.mi{color: #000000;}
.o{color: #000000;}
.ow{color: #BA22FF;  font-weight: bold;}
.nb{color: #338822;}
.n{color: #000000;}
.s{color: #cc2222;}
.se{color: #cc2222; font-weight: bold;}
.si{color: #C06688; font-weight: bold;}
.nn{color: #4D00FF; font-weight: bold;}
&amp;lt;/style&amp;gt;
&lt;/pre&gt;
&lt;hr/&gt;
同場加映補充資料：&lt;a href=&quot;https://www.opinionatedgeek.com/codecs/htmlencoder&quot; target=&quot;new&quot;&gt;HTML Encoder&lt;/a&gt;

</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/3078567401684281038/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/3078567401684281038' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/3078567401684281038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/3078567401684281038'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2018/04/ipython-notebookblogger.html' title='把 IPython notebook貼上Blogger文章上分享'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-3617684812004412913</id><published>2018-04-01T04:24:00.001+08:00</published><updated>2018-04-01T05:01:39.439+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2018"/><category scheme="http://www.blogger.com/atom/ns#" term="excel"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="開發"/><title type='text'>python +pywin32 操作 Excel</title><content type='html'>&lt;pre class=&quot;codeblock&quot;&gt;
import win32com.client
import time

xlApp = win32com.client.Dispatch(&quot;Excel.Application&quot;)
xlApp.Visible=1

workBook = xlApp.Workbooks.Open(r&quot;C:\Users\tekibrain\Desktop\datelist.xlsx&quot;)
print(str(workBook.ActiveSheet.Cells(1,1)))
now = time.time()
workBook.ActiveSheet.Cells(1, 2).Value = now
#SaveChanges = 1 : Save flle
# SaveChanges = 0 : Nothing Saved
workBook.Close(SaveChanges=1)
xlApp.Quit()
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/3617684812004412913/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/3617684812004412913' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/3617684812004412913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/3617684812004412913'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2018/04/python-win32com-excel.html' title='python +pywin32 操作 Excel'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-3868619678495512519</id><published>2017-12-12T16:15:00.002+08:00</published><updated>2017-12-12T16:31:30.357+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2017"/><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="esp8266"/><category scheme="http://www.blogger.com/atom/ns#" term="程式"/><category scheme="http://www.blogger.com/atom/ns#" term="設定"/><category scheme="http://www.blogger.com/atom/ns#" term="軟體"/><category scheme="http://www.blogger.com/atom/ns#" term="開發"/><title type='text'>Windows 10 64bits + Arduino IDE + ESP8266 (ESP-01)</title><content type='html'>&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;至 &lt;a href=&quot;https://www.arduino.cc/en/Main/Software&quot;&gt;Arduino.cc&lt;/a&gt; 下載最新版 Arduino IDE (以&lt;a href=&quot;https://www.arduino.cc/download_handler.php?f=/arduino-1.8.5-windows.zip&quot;&gt;1.8.5版&lt;/a&gt;為例)&lt;/li&gt;
&lt;li&gt;將&amp;nbsp;arduino-1.8.5-windows.zip 解壓縮至指定目錄下，安裝好 Arduino IDE&lt;/li&gt;
&lt;li&gt;啟動 Arduino IDE，開啟「檔案 &amp;gt; 偏好設定 (preferences)」&amp;nbsp;視窗&lt;/li&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiacbqT0sP4McExMq3UEZ-vFvO5pPPxuMB68TUkJiNm6Ym2xe2Hy1Y0r4Ec9UQ1M6oaD7Lc1KhWXx91pdamAjcoA97lri_jnT-0qVQ6GAPWAs5PohPzZ9NnAxR77e1iz7d5FrZNadY-51X/s1600/arduino_ide.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;443&quot; data-original-width=&quot;786&quot; height=&quot;180&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiacbqT0sP4McExMq3UEZ-vFvO5pPPxuMB68TUkJiNm6Ym2xe2Hy1Y0r4Ec9UQ1M6oaD7Lc1KhWXx91pdamAjcoA97lri_jnT-0qVQ6GAPWAs5PohPzZ9NnAxR77e1iz7d5FrZNadY-51X/s320/arduino_ide.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;偏好設定&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;li&gt;在「額外的開發版管理員網址」(Additional Board Manager) 輸入網址：&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://arduino.esp8266.com/stable/package_esp8266com_index.json&quot;&gt;http://arduino.esp8266.com/stable/package_esp8266com_index.json&lt;/a&gt;&lt;/li&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNED6hSl8ZRhF0od2ygE7q_koDWnLMdtVyPw8NWmZs2HBL3n9B90INzThIRXYHShb1tsacsQB_iLohttz94ONyxI9sZfRjej8kAUMa0lxCL1nar2rVCS3tarSGnPzFsr_GdFBxIgC21jho/s1600/arduino_ide_2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;443&quot; data-original-width=&quot;786&quot; height=&quot;180&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNED6hSl8ZRhF0od2ygE7q_koDWnLMdtVyPw8NWmZs2HBL3n9B90INzThIRXYHShb1tsacsQB_iLohttz94ONyxI9sZfRjej8kAUMa0lxCL1nar2rVCS3tarSGnPzFsr_GdFBxIgC21jho/s320/arduino_ide_2.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;新增 esp8266 套件網址&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/ul&gt;
&lt;li&gt;開啟「工具 (Tools) &amp;gt; 開發板 (Board) &amp;gt; 開發板管理員 (Boards Manager)」後，搜尋 &quot;esp&quot; 並且安裝 esp8266 套件&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZrV4P3QpHw7McYj6W9aSrexXbEaw-ElQmzPYEmszDOqJ1RMakdmFtgvA-Sfy2qty7qmtQkm5lwgezfcILqaANwsSgXcivVdyI4hJX47Lo-FhgQx65PsDmjcQstwZjNVcn-Jy5LrAUKdcp/s1600/arduino_ide_3.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;819&quot; data-original-width=&quot;862&quot; height=&quot;303&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZrV4P3QpHw7McYj6W9aSrexXbEaw-ElQmzPYEmszDOqJ1RMakdmFtgvA-Sfy2qty7qmtQkm5lwgezfcILqaANwsSgXcivVdyI4hJX47Lo-FhgQx65PsDmjcQstwZjNVcn-Jy5LrAUKdcp/s320/arduino_ide_3.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;安裝 esp8266 (可以看見其實有錯誤發生)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvPJ6NFN4ZfwLys7JXABCMXoxS4aB0TtxD5fATSQkbUO9poSgfX-u9Q4kv0n7o5TJgIWahIhVrOiV9HmgxJV6LgPGWqWJEyKKDw0sfRis0MEttufJfP2uqzJct2WHfe0bhwob45kh51Vo1/s1600/esp_download.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;443&quot; data-original-width=&quot;786&quot; height=&quot;180&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvPJ6NFN4ZfwLys7JXABCMXoxS4aB0TtxD5fATSQkbUO9poSgfX-u9Q4kv0n7o5TJgIWahIhVrOiV9HmgxJV6LgPGWqWJEyKKDw0sfRis0MEttufJfP2uqzJct2WHfe0bhwob45kh51Vo1/s320/esp_download.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;正常的套件下載安裝畫面&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/li&gt;
&lt;li&gt;安裝完成後，下次就能選擇 ESP8266 開發板，進行IDE程式開發與上傳功能&lt;/li&gt;
&lt;/ol&gt;
&lt;hr /&gt;
&lt;br /&gt;
後記：&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;如果下載時發生了&quot;&lt;span style=&quot;color: red;&quot;&gt;下載http://downloads.arduino.cc/packages/package_index.jsp時發生錯誤&lt;/span&gt;&quot;的訊息，可以在「檔案 &amp;gt; 偏好設定 &amp;gt; 網路」設定 proxy 來解決。&lt;/li&gt;
&lt;li&gt;網路上有些說法是設定 JAVA IPv4Stack=true 即可:&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt; setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;不過對我來說似乎沒有用，反而是最簡單的 proxy 解決了我的問題。&lt;/li&gt;
&lt;li&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXTMKWsArfqJqmbcf6JinlGnvjjD7IC_85lcKaZcbWqV5QwBvmlyU3iNSBeLx1aXE2GNJJpvoOiy1nifbbhJSVXdrq_Fd_JQ9e66ooRTdcw-N1C14m_91-Ipm3zF3GM0a4YnMuaiBxLeNP/s1600/arduino_ide_error.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;443&quot; data-original-width=&quot;786&quot; height=&quot;180&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXTMKWsArfqJqmbcf6JinlGnvjjD7IC_85lcKaZcbWqV5QwBvmlyU3iNSBeLx1aXE2GNJJpvoOiy1nifbbhJSVXdrq_Fd_JQ9e66ooRTdcw-N1C14m_91-Ipm3zF3GM0a4YnMuaiBxLeNP/s320/arduino_ide_error.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;下載套件時的錯誤訊息&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGdrVbCGKntUZReLedkF7-3AWszStbrkq1ipPObtfJ7LrjP3sTo0Rzxg4LoIWP45GuMSVGJTIhHGURWAfSLfdUKk7OQSFB-gBrY47UWtwO0Y9oe7S1FiKPy4PJ4U0LX4znHUFaZxWjC4SQ/s1600/arduino_ide_error_java_ipv4.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;512&quot; data-original-width=&quot;979&quot; height=&quot;167&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGdrVbCGKntUZReLedkF7-3AWszStbrkq1ipPObtfJ7LrjP3sTo0Rzxg4LoIWP45GuMSVGJTIhHGURWAfSLfdUKk7OQSFB-gBrY47UWtwO0Y9oe7S1FiKPy4PJ4U0LX4znHUFaZxWjC4SQ/s320/arduino_ide_error_java_ipv4.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;設定 Java IPv4Stack ，不過對我來說沒用處&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br/&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR_aEB9VI1BSD1wd8oZtmbWE7s0xIl0ri2eDpReagpi5t9Yjxz7geLWyzv6iM95KMqY7i0NqgYLFA95mDqm8ckr5DecabfHJKg7GqD_qx9KiF507SAhPcbV2cplyQf79L6AMs0hiNGWO-o/s1600/arduino_ide_4_proxy.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;607&quot; data-original-width=&quot;704&quot; height=&quot;275&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR_aEB9VI1BSD1wd8oZtmbWE7s0xIl0ri2eDpReagpi5t9Yjxz7geLWyzv6iM95KMqY7i0NqgYLFA95mDqm8ckr5DecabfHJKg7GqD_qx9KiF507SAhPcbV2cplyQf79L6AMs0hiNGWO-o/s320/arduino_ide_4_proxy.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;設定 proxy&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tekibrain.blogspot.com/feeds/3868619678495512519/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/3868619678495512519' title='5 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/3868619678495512519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/3868619678495512519'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2017/12/windows-10-64bits-arduino-ide-esp8266.html' title='Windows 10 64bits + Arduino IDE + ESP8266 (ESP-01)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiacbqT0sP4McExMq3UEZ-vFvO5pPPxuMB68TUkJiNm6Ym2xe2Hy1Y0r4Ec9UQ1M6oaD7Lc1KhWXx91pdamAjcoA97lri_jnT-0qVQ6GAPWAs5PohPzZ9NnAxR77e1iz7d5FrZNadY-51X/s72-c/arduino_ide.PNG" height="72" width="72"/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4636464703125334513.post-5277482578966903337</id><published>2017-09-19T16:14:00.002+08:00</published><updated>2017-09-19T16:14:28.706+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2017"/><category scheme="http://www.blogger.com/atom/ns#" term="apple"/><category scheme="http://www.blogger.com/atom/ns#" term="ios"/><category scheme="http://www.blogger.com/atom/ns#" term="iphone"/><title type='text'>新 iPhone 是否會熱銷?</title><content type='html'>&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG0jN0H5uBybgJDxEzH1o_T-O0VPnxaIXuJ1Znz9Ca8ZrTR4vhu_GJASrHFc1hr-qOfXVX17ZcXBlGPx6bJBfyhh3vFEYSTcQm4W5GzcBMmFBNYfq-oovq8Mbhc2-tPl4Ihn-fmSdzXHMZ/s1600/iphone_trends.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;756&quot; data-original-width=&quot;1454&quot; height=&quot;331&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG0jN0H5uBybgJDxEzH1o_T-O0VPnxaIXuJ1Znz9Ca8ZrTR4vhu_GJASrHFc1hr-qOfXVX17ZcXBlGPx6bJBfyhh3vFEYSTcQm4W5GzcBMmFBNYfq-oovq8Mbhc2-tPl4Ihn-fmSdzXHMZ/s640/iphone_trends.JPG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Google趨勢比較結果&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;div&gt;
市場是不少看衰此次 iPhone 8/iPhone X的消息與傳言，就連股市裏相關的蘋果概念股一時間股價也被看空。那到底銷售情況會如何呢？&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
沒有甚麼大數據分析能力，但&lt;a href=&quot;https://trends.google.com.tw/trends/explore?date=all&amp;amp;q=iphone,iphone%206,iphone%207,iphone%208,iphone%20X&quot; target=&quot;_blank&quot;&gt;Google Trends比較&lt;/a&gt;一下或許能告訴我們一些&lt;a href=&quot;https://trends.google.com.tw/trends/explore?date=all&amp;amp;q=iphone,iphone%206,iphone%207,iphone%208,iphone%20X&quot; target=&quot;_blank&quot;&gt;答案&lt;/a&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://tekibrain.blogspot.com/feeds/5277482578966903337/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4636464703125334513/5277482578966903337' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/5277482578966903337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4636464703125334513/posts/default/5277482578966903337'/><link rel='alternate' type='text/html' href='http://tekibrain.blogspot.com/2017/09/iphone.html' title='新 iPhone 是否會熱銷?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG0jN0H5uBybgJDxEzH1o_T-O0VPnxaIXuJ1Znz9Ca8ZrTR4vhu_GJASrHFc1hr-qOfXVX17ZcXBlGPx6bJBfyhh3vFEYSTcQm4W5GzcBMmFBNYfq-oovq8Mbhc2-tPl4Ihn-fmSdzXHMZ/s72-c/iphone_trends.JPG" height="72" width="72"/><thr:total>0</thr:total></entry></feed>