<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Louis on Medium]]></title>
        <description><![CDATA[Stories by Louis on Medium]]></description>
        <link>https://medium.com/@pohsiu0709?source=rss-6c287f26282d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*-krdsLelT-APU_J0WQdCyg.png</url>
            <title>Stories by Louis on Medium</title>
            <link>https://medium.com/@pohsiu0709?source=rss-6c287f26282d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 12:36:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pohsiu0709/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[100 件你該知道的事關於人類的事 (譯) — 3/100]]></title>
            <link>https://pohsiu0709.medium.com/100-%E4%BB%B6%E4%BD%A0%E8%A9%B2%E7%9F%A5%E9%81%93%E7%9A%84%E4%BA%8B%E9%97%9C%E6%96%BC%E4%BA%BA%E9%A1%9E%E7%9A%84%E4%BA%8B-%E8%AD%AF-3-100-536ac2ff235?source=rss-6c287f26282d------2</link>
            <guid isPermaLink="false">https://medium.com/p/536ac2ff235</guid>
            <category><![CDATA[100-things]]></category>
            <dc:creator><![CDATA[Louis]]></dc:creator>
            <pubDate>Mon, 15 Mar 2021 14:45:09 GMT</pubDate>
            <atom:updated>2021-03-15T14:45:09.623Z</atom:updated>
            <content:encoded><![CDATA[<h3>100 件你該知道的事關於人類的事 (譯) — 3/100</h3><p>人類是透過圖型識別來區別物體的</p><p>圖型識別幫助很快地理解每分每秒透過感官所接觸的事物。你的眼睛與大腦會想要建立模式，即使根本沒有也一樣。如圖3.1，你可能可以看到4組兩個兩個的點而不是八個獨立的點。你把白色空白或是缺一個點當作是一個模式了。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*tqbwvkWGOtVnnjRxeu6m4w.png" /><figcaption>圖3.1</figcaption></figure><h3>單一細胞只會對特定的形狀做出反應</h3><p>在1959年，David Hubel 與 Torsten Wiesel 呈現了在視覺皮質層的某些細胞只會對水平線做出反應，有些是垂直線，其他是只有邊緣，或是只有某些角度。</p><h4>物體識別的幾何理論</h4><p>早期有個理論是大腦有記憶體儲存了數百萬的物體，當你看到物體時，大腦會比對所有在記憶體的物體，直到找到相應的物體。但現今研究指出，在你認出你正看著物體的基本形狀時，大腦會透過基本形狀（或稱幾何圖形）去識別物體。Irving Biderman 在1985年 提出了幾何的點子（如圖3.2)，在我們認出左側有24個基本圖形後，這些幾何圖形變成了所有我們看見與識別物體的建築模塊基本要素。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*XiQky60vvgs8eDDfIelBFA.png" /><figcaption>圖 3.2</figcaption></figure><h3>視覺皮質在你想像的時候會更活躍</h3><p>視覺皮質層在你想像某事物時，會比你真正看見還活躍。(Solso 2005年)</p><p>在視覺皮質層的作用域是一樣的，但想像的時候會比較活躍些。</p><p>這理論是視覺皮質層會作用的更活躍因為物體的刺激並不真的呈現在眼前。</p><blockquote>Takeaways</blockquote><blockquote>盡可能使用模式，因為人們會本能的去尋找模式。</blockquote><blockquote>利用一些集合或留白來建立模式</blockquote><blockquote>如果你希望人們識別出這個物體(例如某個圖標)，那就用簡單的幾何圖形去畫。這會讓它更容易仰賴幾何去識別，並令這個物體更容易被認出。</blockquote><blockquote>偏好2D大於3D，眼睛會與大腦溝通他們所看到的2D物件， 在螢幕上3D的呈現會降低識別與理解程度。</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=536ac2ff235" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[到新加坡了，然後呢]]></title>
            <link>https://pohsiu0709.medium.com/%E5%88%B0%E6%96%B0%E5%8A%A0%E5%9D%A1%E4%BA%86-%E7%84%B6%E5%BE%8C%E5%91%A2-ad2c62d50d12?source=rss-6c287f26282d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad2c62d50d12</guid>
            <category><![CDATA[singapore]]></category>
            <category><![CDATA[overseas]]></category>
            <dc:creator><![CDATA[Louis]]></dc:creator>
            <pubDate>Wed, 03 Mar 2021 13:23:06 GMT</pubDate>
            <atom:updated>2021-03-13T14:29:52.234Z</atom:updated>
            <content:encoded><![CDATA[<p>這邊紀錄一下自己遇到的狀況跟得出的最佳解，希望不會有人跟我一樣好傻好天真</p><h4>開戶</h4><p>我在台灣的時候，本想著可以使用 <a href="https://www.dbs.com.sg/personal/deposits/bank-earn/multiplier">DBS multiplier</a> 直接線上開戶，畢竟在到職前都領不到 EP，但會先拿到 IPA，本想著有 IPA 就先開戶，然後設定約定轉帳，就不用換太多新幣，還怕不夠用。</p><p>開戶會需要你的，手機 、VISA (IPA/EP)、護照、住址(不能用公司的)、居住證明</p><p>我很天真的傳房東的帳單過去，想當然爾因為名字不一樣被退件了。</p><blockquote>但實際上還好，只要有一張可以跨海刷的信用卡，基本上應該還能撐蠻久</blockquote><p>那理想解應該是什麼呢？ 嗯。到新加坡之後再辦</p><p>到了租屋處，你可以線上申請 <a href="https://gomo.sg/faq">GOMO</a> / <a href="https://www.giga.com.sg/">Giga</a>，它會寄到你家，這時候你就會有一張有你名字的住址單據了~</p><p>而申請這個用 IPA 就可以了。</p><p>(補充) 後來實際經驗，只有 IPA 是不行的，還是建議買 SIM卡，等發了 EP，再去電信業者申請轉月費或轉GOMO/Giga，再申請帳單，再半開戶….</p><h4>日常</h4><p>因應疫情，新加坡目前進入任一處建築、小店或是公園，都會需要有一個名為 TraceTogether 的 App 進行 QRCode 掃描，不然會被保全擋下來，而這個 App 需要綁手機，如果你下飛機沒手機也沒關係，就只是需要忍耐一下每次進出就站 5 分鐘讓保全手動 key in 你的 FIN / Passport (絕對瘋掉)。</p><p>我是當天就買了 SIM 卡註冊</p><blockquote>那時候不知道 GOMO 這麼牛逼，直接快遞過來</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad2c62d50d12" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[前端面試心得文 — 2020(應該也算)]]></title>
            <link>https://pohsiu0709.medium.com/%E5%89%8D%E7%AB%AF%E9%9D%A2%E8%A9%A6%E5%BF%83%E5%BE%97%E6%96%87-2020-%E6%87%89%E8%A9%B2%E4%B9%9F%E7%AE%97-3d893746969e?source=rss-6c287f26282d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d893746969e</guid>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[interview]]></category>
            <dc:creator><![CDATA[Louis]]></dc:creator>
            <pubDate>Wed, 20 Jan 2021 09:33:45 GMT</pubDate>
            <atom:updated>2021-03-15T14:56:38.948Z</atom:updated>
            <content:encoded><![CDATA[<h3>前端面試心得文 — 2020</h3><h3>前言</h3><p>基於最近有幸獲得海外職位，分享一下面試心路歷程，可能沒什麼參考性(? <br>把到處撞牆的路程分享給大家，被拒絕跟無聲卡的族繁不及記載，這邊只列出比較有印象跟有收穫的</p><h3>背景</h3><p>待過兩家新創公司，人數少於 20人，職務內容專注大多在於 Web 前端開發，有觸及少量後端。</p><h3>Binance — LinkedIn 投遞</h3><p><strong>流程</strong>：只走到二面</p><p>一二面都是技術考題，會請你 Live Coding，會問很多大量 React 相關的問題，像是 memo vs useMemo，其中有一題是想問 createPortal，但我沒用過，這過程有點小鬼打牆，我想確認他的實際需求來去解決，就問說什麼情況會有這種需要，然後考官就說他是要問 createPortal，就跳過了 XD。然後問說能不能 implement 一個簡單的 React.lazy，沒寫出來，只大概提一下概念。</p><p>二面考了一個演算法，也是花了一段時間確認需求，只寫出暴力解，但考官希望時間複雜度要更好，最後無聲卡，也就是從這裡開始我自己又回去複習一些演算法的基礎知識 XD。</p><p>比如說像是 DFS, DFS 這種入門演算法應用</p><ul><li><a href="https://alrightchiu.github.io/SecondRound/graph-breadth-first-searchbfsguang-du-you-xian-sou-xun.html">Graph: Breadth-First Search(BFS，廣度優先搜尋)</a></li><li><a href="https://reactjs.org/docs/react-dom.html#createportal">ReactDOM - React</a></li><li><a href="https://github.com/jamiebuilds/react-loadable">jamiebuilds/react-loadable</a></li></ul><h3>Positive Grid — (朋友內推)</h3><p><strong>流程</strong>：一面遠端技術考試，二面主管面試，三面CEO</p><p><strong>第一階段- </strong>實作白板題，二選一</p><p>一個跟 Promise 有關，一個是考 DOM 相關的事件操作。</p><p>我選了 Promise 那個，整體來說就是要符合題目需求並滿足寫好的 test 就算過關，解題過程中我習慣先解釋說我要怎麼做，預期達到什麼結果，然後開始實作，但想當然爾，莫非定律，沒有一次通過這種好事，結果一寫完就壞掉 XD，我當下就說了一下我要怎麼去 Debug，然後一步步完成，結果好像解得不算慢，還有時間，考官問我要不要寫另外一題，不寫也沒關係，我想說題目頗有趣，不然寫看看。</p><p>結果一度卡住 XD，不過過程是開放 google 的，所以我都會說我現在哪裏卡住，我要去 MDN 找什麼需要的資訊，幫助我接下來的實作這樣，最後時間關係這個沒寫完（但解得差不多）。</p><p><strong>第二階段- 考實作CSS</strong></p><p>考官會給你一個模板，還有需求，請你在只能改 css 的情況去滿足需求，也不是太難，就是常見的一些對齊置中等等的東西，應該只是想知道你對這些基本的用法熟不熟悉。</p><p>寫完之後，考官會問你你寫得東西會達到什麼效果，為什麼選擇這個，改別的會發生什麼事情，這邊可以解讀成，你知不知道你宣告的語法代表什麼意義，還是你只是隨便複製貼上。</p><p><strong>最後第三階段</strong> - 技術觀念問答</p><p>這邊考了很多 JS, React 以及一些 web fundamental 的知識，有興趣可以把 google 的文章肝起來。</p><p><a href="https://developers.google.com/web/fundamentals">Web Fundamentals | Google Developers</a></p><p><strong>二面</strong>的時候是各部門主管面試，會有 Marketing 跟 Manager 面試，簡介一下自己後會問一些過往經歷，還有工作上的意見交流，這部分主要就是做各種角度的評估適不適合一起工作，像是遇到問題通常是怎麼解決的。</p><p><strong>三面CEO</strong>，主要是聊天， 簡單自介後，CEO 會針對個人背景問一些問題，然後接著換我提問，這邊印象很深刻的部分是 CEO 特別針對新創常常遇到的一些狀況做一些分享，比如說大部分的小公司在初始階段常常會遇到需求的不確定性，這種時候公司員工對於 Navigate 的能力會比 Execute 能力還來的更為重要，把事情依照 Spec 一五一十的達成已經不是最重要的事情，同時還要不斷反思是不是有朝著預期的方向去靠近，這部分給了我很大的反思。</p><p><strong>結果</strong>: Offer Get</p><h3>ByteDance 新加坡— LinkedIn 收到邀請</h3><p><strong>流程： 三關技術面談，最後HR面談</strong></p><p>前兩關著重在 Live Coding，會考一些簡單的演算法，並同時根據經歷回答問題，演算法一直不算是我的強項，平常很少像網路上的大神一樣刷爆 Leet Code，這部分考的時候我是有點一度卡住，但我通常就是跟考官解釋我對於題目的理解，我現在有什麼想法，要做些什麼事情，然後慢慢寫這樣，我覺得就是不斷的溝通。</p><p>除了演算法之外會問很多大量跟經歷有關的問題，為什麼這麼做，你怎麼做決定的，這樣做有什麼理由，你預期達到什麼事情，你知道背後的行為是什麼嗎，不外乎就是 Why, How, What 。</p><p>第三關是主管面試，到這裡就沒有考 Live Coding了，這部分則是問了大量 Lazy Loading 相關的問題。</p><p><a href="https://developers.google.com/web/updates/2018/08/web-performance-made-easy?hl=en">Web Performance Made Easy: Google I/O 2018 edition | Google Developers</a></p><p>最後 HR 面談的時候會問一些 General Questions，主要是了解你這個人，並問一下你有沒有薪資期待，順便了解一下你英文的程度。</p><p>只有這關是幾乎全英文溝通，前三關考官都是用中文溝通。</p><p><strong>結果</strong>: Offer Get</p><h3>必要的結尾 (淦話)</h3><p>自己跟網上很多大神還差得很遠，但不斷碰壁的過程中，我是一直不斷調整心態，開始去花很多時間了解 Open Source 的內容，並補充複習一些曾經學過但幾乎不記得的東西，盡量去減少黑盒子的狀況，一方面也能從別人的 Code 長長知識。</p><p>還記得一個可敬的前輩曾經叮囑我：</p><blockquote>『你就是需要再追根究底一點，不然怎麼彰顯你的價值』</blockquote><p>正如我思故我在嘛，沒有思考的 Code，怎麼會有靈魂呢</p><p>希望弱弱的心得能夠帶來幫助 &lt;(_ _)&gt;</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d893746969e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[100 件你該知道的事關於人類的事 (譯) — 2/100]]></title>
            <link>https://pohsiu0709.medium.com/100-%E4%BB%B6%E4%BD%A0%E8%A9%B2%E7%9F%A5%E9%81%93%E7%9A%84%E4%BA%8B%E9%97%9C%E6%96%BC%E4%BA%BA%E9%A1%9E%E7%9A%84%E4%BA%8B-%E8%AD%AF-2-100-199786cf5573?source=rss-6c287f26282d------2</link>
            <guid isPermaLink="false">https://medium.com/p/199786cf5573</guid>
            <category><![CDATA[100-things]]></category>
            <dc:creator><![CDATA[Louis]]></dc:creator>
            <pubDate>Fri, 04 Dec 2020 06:39:56 GMT</pubDate>
            <atom:updated>2020-12-04T06:39:56.781Z</atom:updated>
            <content:encoded><![CDATA[<h3>100 件你該知道的事關於人類的事 (譯) — 2/100</h3><h3>在快速的一瞥你看到什麼的時候，周邊視覺比中央視覺用的更多</h3><p>你有兩種型態的視覺：中央視覺與周邊視覺。中央視覺是你直視著你看著的東西去得到關於物件的細節。而周邊視覺包含餘下所有的視覺區域－那些剩下你看得到，但不是直接看過去的部分。可以用眼睛看到除了物件中心以外的部分當然是一定有用的。但從 Kansas State University 新的研究指出，在幫助我們了解我們周遭的事物上，周邊視覺遠超出我們想像的重要。看起來像是我們是藉由周邊視覺去得到我們正看著什麼類型的場景等等的資訊。</p><h4>為什麼螢幕閃爍這麼惹人厭?</h4><p>人類的周邊視覺會情不自禁的注意到這些事情。例如，你正在閱讀電腦螢幕上的文字，並且旁邊有些動畫或是什麼正在閃爍的東西，你會忍不住去看一下。</p><p>Adam Larson 和 Lestor Loschky 在 2009 年的時候，做了一個實驗，他們拿了一些常見的場景照片秀給實驗者看(像是廚房或是客廳)。不過有些照片外圍是模糊的，有些照片中間是模糊的。並且照片的曝光時間很短，照片還帶有灰色圖層，所以人們很難一眼就看懂（如圖2.1, 2.2），之後再問實驗者能不能認出他們所看到的照片是什麼場景。</p><p>Adam Larson 和 Lestor Loschky 發現即使照片中央的圖不見了，實驗者還是能辨認出這是什麼場景。但當周圍的圖像不見的時候，實驗者反而不能認出這是廚房還是客廳。他們嘗試了各種不同組合的照片。最後得出結論，中央視覺最主要的目的是特定物品的識別，而周邊視覺則是用來獲取場景的資訊。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*UKsZIzTt4XfflvUnYXvJRA.png" /></figure><h4>周邊視覺讓我們的祖先在草原上存活</h4><p>這個理論是建立於演化的利基點，早期人類在削尖石頭時或是抬頭觀察烏雲時，還是能藉由周邊視覺注意到獅子正在接近，進而存活，而這個能力藉由基因傳承了下來。</p><p>即是演化史天擇說的利基，那些周邊視覺不佳的人類沒能把基因傳承下來。</p><p>近來研究也證實了這個假說，Dimitri Bayle 在 2009 年時放了一個可怕的照片在受測者的周邊視覺區與中央視覺區。他測量受測者多久需要多久時間才會反應過來。當可怕的照片擺在中央視覺區時，受測者需要140–190 毫秒來反應，但當擺在周邊視覺區時，受測者只需要 80 毫秒就反應過來了。</p><h4>思考</h4><blockquote>人們在看電腦螢幕時也會用到周邊視覺，通常是用來很快的一瞥這個頁面是關於什麼的等等。</blockquote><blockquote>雖然螢幕的正中間對中央視覺很重要，但也別忽略了使用者周邊視覺能看到的區域，確保網站在與使用者互動時，周邊視覺區也能帶來必要的資訊來源。</blockquote><blockquote>如果你想要使用者專注在螢幕的某個部份，那就不要放任何動畫或閃爍的元素在周邊視覺的地方。</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=199786cf5573" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[100 件你該知道的事關於人類的事 (譯) — 1/100]]></title>
            <link>https://pohsiu0709.medium.com/100-%E4%BB%B6%E4%BD%A0%E8%A9%B2%E7%9F%A5%E9%81%93%E7%9A%84%E4%BA%8B%E9%97%9C%E6%96%BC%E4%BA%BA%E9%A1%9E%E7%9A%84%E4%BA%8B-%E8%AD%AF-1-100-9f29320882a4?source=rss-6c287f26282d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f29320882a4</guid>
            <category><![CDATA[about-people]]></category>
            <category><![CDATA[100-things]]></category>
            <dc:creator><![CDATA[Louis]]></dc:creator>
            <pubDate>Thu, 26 Nov 2020 03:04:32 GMT</pubDate>
            <atom:updated>2020-11-26T03:04:32.261Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>100 件你該知道的事關於人類的事 (譯) — 1/100</strong></h3><ol><li>你所看見的，並不是你大腦所接收到的</li></ol><p>想像一下，你走在路上，你眼睛所看到資訊不斷的傳送給你的大腦，經由大腦處理過後，你才得到了你所認知到的『What’s out there』。</p><p>但事實上，大腦所產生的東西並不完全就是你看到的。你的大腦會不斷的解譯任何你所看到的東西，舉個例子來說（如圖1.1)。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*p3VUuNJ0B31my6NDDY-7Zw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*P7MCobyoW6YE8s2B0rRUeQ.png" /></figure><p>你看見什麼了？你第一眼可能看到一個帶有黑色邊緣的三角形，還有一個倒過來的三角形。不過，實際上你看到的只是線條與部分的圓而已，是你的大腦在空白處產生了這兩個三角形。這個特別的錯覺被稱做『Kanizsa 三角』又稱錯覺輪廓。是由一位義大利心理學家 Gaetano Kanizsa 在1995 年所提出的。現在再看一下圖1.2，它也產生了有著正方形的類似錯覺。</p><p>大腦所建立的捷徑</p><p>這是由你的大腦所建立的各種捷徑，以便於你可以快速的理解那些圍繞在你身邊的事物。你的大腦每秒會接收成千上萬的資訊，並試圖讓每個資訊變得令你能夠理解。</p><p>原理是根據經驗法則來去猜測你所看到東西是什麼。大多時候都是正確的，但有時候會造成錯誤。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L13ms39ePqKpVsgD49HPVQ.png" /></figure><p>你可以利用形狀或是顏色去影響人們以為他們所看到的事物。如圖1.3，展示了如何用顏色去詮釋兩個截然不同的訊息。</p><ul><li>如果你需要在黑暗中能清楚的看見，那就不要直接向前看</li></ul><p>眼睛有700 萬個對強光感到敏感的視錐細胞，還有1億2500萬個對弱光敏感的視桿細胞。錐細胞主要集中於正中央，桿細胞則比較分散些。 所以，如果你在光線較差的地方，如果你不直接看著你想看的地方，你會看的更清楚。（想不到吧～）</p><ul><li>視覺錯覺 (Optical illusion) 讓我們以為是真的</li></ul><p>視覺錯覺是大腦錯誤解譯我們所看到的東西的例子。舉例來說，圖1.4 左邊的線看起來比右邊的還要長，但實際上兩個一樣長。這是最古老的視覺錯覺之一，由Franz Müller-Lyer 在1889 年提出的。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*9XMb2YThNY0WNxfipMuQgQ.png" /></figure><ul><li>我們其實是看到2D的，不是3D</li></ul><p>光線藉由眼角膜跟水晶體進入我們的眼睛，水晶體會著重在視網膜上的圖像。在視網膜上都是由2D所呈現的，即使它是3D的物品。這個圖像會被送到腦中負責辨別圖案的視覺皮質，例如，“噢，我認得這個門”。接著視覺皮質會將2D的圖變成3D的樣子呈現出來。</p><ul><li>視覺皮質將所有的資訊放在一起</li></ul><p>根據John Medina 2009年所提出，視網膜會從我們所看到的東西接收電子圖案並從這些圖案產生數個軌跡。有些會帶有陰影或是動作等等的資訊。多達12個資訊軌跡時，會被送至大腦的視覺皮質。並在那由各個負責的區塊來處理與解繹。舉例來說，某個區塊只回應了40度角的線，其他區塊只回應顏色，其他區塊回應動作，其他則是只有邊緣。最後，這些所有資訊結合成剩下兩個軌跡，一個是動作（這個東西有在動嗎？)，另一個是定位（這個東西跟我有什麼關係？）</p><p>補充思考</p><ul><li>你認為人類在你的網頁上會看到什麼他們認為是真的但其實是錯覺的東西呢？</li></ul><p>這會根據你的背景、知識還有你熟不熟悉他們正在看與期望看見的東西而有所不同</p><ul><li>你或許會根據他們陳述的內容去說服其他人用特別的方式去看</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f29320882a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why ORM ? What is ORM ?]]></title>
            <link>https://pohsiu0709.medium.com/why-orm-what-is-orm-4f2cc7d49a22?source=rss-6c287f26282d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f2cc7d49a22</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[orm]]></category>
            <dc:creator><![CDATA[Louis]]></dc:creator>
            <pubDate>Fri, 17 Jul 2020 07:59:30 GMT</pubDate>
            <atom:updated>2020-07-17T07:59:30.468Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why ORM ? What is ORM ?</h3><p><strong>Object Relational Mapping</strong>，簡稱<strong>ORM</strong></p><h4>What the fuck is ORM ?</h4><p>Object-relational mapping (ORM) is a programming technique in which a metadata descriptor is used to connect object code to a relational database.</p><h4>What does it do ?</h4><p>ORM converts data between type systems that are unable to coexist within relational databases and OOP languages.</p><h3>Pros</h3><ul><li>Simplified development because it automates object-to-table and table-to-object conversion, resulting in lower development and maintenance costs</li><li>Less code compared to embedded SQL and handwritten stored procedures</li><li>Transparent object caching in the application tier, improving system performance</li><li>An optimized solution making an application faster and easier to maintain</li></ul><blockquote><a href="https://rajivrnair.dev/why-orm">WHY</a> — 作為一個物件導向的程式開發者，我們都傾向用物件來思考。</blockquote><h3>As object-oriented programmers, we tend to think in terms of objects.</h3><ul><li>An ORM tool keeps your object model separate from your persistence model, i.e., your java code need not know about your database tables. You write your data modification code in a programming language of your choice and the ORM tool will map that to the database for you.</li><li>In most cases, you don’t have to write much SQL and you really don’t end up writing SQL that caters to a specific database vendor (in the highly unlikely case that you decide to switch databases after writing an application).</li><li>ORMs also take away the repetitive, mind-numbing job of writing code that maps object properties to columns and vice-versa.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f2cc7d49a22" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding redux-thunk]]></title>
            <link>https://pohsiu0709.medium.com/understanding-redux-thunk-a85d5b121fdd?source=rss-6c287f26282d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a85d5b121fdd</guid>
            <category><![CDATA[redux-thunk]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[redux-middleware]]></category>
            <dc:creator><![CDATA[Louis]]></dc:creator>
            <pubDate>Wed, 11 Mar 2020 12:59:56 GMT</pubDate>
            <atom:updated>2020-09-08T01:35:02.953Z</atom:updated>
            <content:encoded><![CDATA[<p>Redux-thunk 原始碼</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5olq7uoVtDvzz82Q5zzZNg.png" /></figure><blockquote>短短14行到底做了什麼呢XD?</blockquote><p>開始之前我們先看一下 redux 的 applyMiddleware 做了什麼，這樣回過頭來看redux-thunk的原始碼才更清楚。</p><p><a href="https://redux.js.org/api/applymiddleware#applymiddlewaremiddleware">Redux API: applyMiddleware() api</a></p><blockquote>Each middleware receives <a href="https://redux.js.org/api/store">Store</a>&#39;s <a href="https://redux.js.org/api/store#dispatchaction">dispatch</a> and <a href="https://redux.js.org/api/store#getState">getState</a> functions as named arguments, and returns a function. The last middleware in the chain will receive the real store’s <a href="https://redux.js.org/api/store#dispatchaction">dispatch</a> method as the next parameter, thus ending the chain. So, the middleware signature is ({ getState, dispatch }) =&gt; next =&gt; action</blockquote><p>每個 middleware 會接收 <a href="https://chentsulin.github.io/redux/docs/api/Store.html">Store</a> 的 <a href="https://chentsulin.github.io/redux/docs/api/Store.html#dispatch">dispatch</a> 和 <a href="https://chentsulin.github.io/redux/docs/api/Store.html#getState">getState</a> functions 作為具名參數，並回傳一個 function。最後的 middleware 會接收到 store 的 dispatch 作為 next 傳入，最後結束。</p><p>這樣回頭看 redux-thunk 就相當簡單了，thunk 把宣告成 function 的 action 攔截下來在包了一層，可以想成是 closure 的應用，繼續往下傳遞，由最後我們所宣告的 function action 來執行內容，那正常的 action (我相信應該會是 object)，就會由 next 直接執行 (即 dispatch )。</p><blockquote>如果有人還是覺得一定要看一下 source code呢 …</blockquote><p>那我們就來看Ｒ，我截去ts的部分，這樣比較乾淨一點</p><pre>function applyMiddleware(...middlewares) {</pre><pre>  return (createStore) =&gt; (reducer, ...args) =&gt; {    <br>    const store = createStore(reducer, ...args);<br>    let dispatch = () =&gt; {<br>      throw new Error(&#39;Apply Middleware Error&#39;);<br>    }     <br>    const middlewareAPI = {<br>      getState: store.getState,<br>      dispatch: (action, ...args) =&gt; dispatch(action, ...args)<br>    }<br>    const chain = middlewares.map(<br>      middleware =&gt; middleware(middlewareAPI));<br>    dispatch = compose(...chain)(store.dispatch);<br>    return {<br>      ...store,<br>     dispatch<br>    }<br>  }</pre><pre>}</pre><h4>一個個來看看</h4><pre><br>let dispatch = () =&gt; {<br>  throw new Error(&#39;Apply Middleware Error&#39;);<br>}</pre><p>先設置如果後面dispatch 在 compose middlewares 只傳回自己時，throw error，就是 chain 為空的意思。</p><pre>middlewareAPI</pre><p>很 Ez，就是前面<em>({ getState, dispatch })，</em>要收到所準備的參數。</p><pre>const chain = middlewares.map(<br>  middleware =&gt; middleware(middlewareAPI));</pre><p>每個middleware 都包裝 getState, dispatch 進入產生 middleware 陣列。</p><pre>dispatch = compose(...chain)(store.dispatch);</pre><p>compose 是個啥呢</p><pre>function compose(...funcs) {</pre><pre>  return funcs.reduce((a, b) =&gt; (...args) =&gt; a(b(...args)))</pre><pre>}</pre><p>假設有三個 middleware 好了</p><pre>m1 = ({ getState, dispatch }) =&gt; (next) =&gt; (action) =&gt; {</pre><pre>  console.log(&#39;m1&#39;);</pre><pre>  return next(action);<br>}</pre><pre>m2 = ({ getState, dispatch }) =&gt; (next) =&gt; (action) =&gt; {</pre><pre>  console.log(&#39;m2&#39;);</pre><pre>  return next(action);<br>}</pre><pre>m3 = ({ getState, dispatch }) =&gt; (next) =&gt; (action) =&gt; {</pre><pre> console.log(&#39;m3&#39;);</pre><pre> return next(action);<br>}</pre><pre>還記得剛剛包裝過 getState, dispatch了嗎？</pre><pre>m1Middleware = m1(middlewareAPI);</pre><pre>m1Middleware = (next) =&gt; (action) =&gt; {</pre><pre>  console.log(&#39;m1&#39;);</pre><pre>  ...,</pre><pre>  return next;<br>}</pre><pre>m2Middleware = (next) =&gt; (action) =&gt; {</pre><pre>  console.log(&#39;m2&#39;);</pre><pre>  ...,</pre><pre>  return next;<br>}</pre><pre>m3Middleware = (next) =&gt; (action) =&gt; {</pre><pre>  console.log(&#39;m3&#39;);<br>   <br>  ...,</pre><pre>  return next;<br>}</pre><p>就會變成 m1Middleware(m2Middleware(m3Middleware(store.dispatch)))</p><pre>log<br>m3 -&gt; m2 -&gt; m1</pre><pre>const m1 = (next) =&gt; (action) =&gt; {</pre><pre>console.log(&quot;m1&quot;);</pre><pre>return next(action);</pre><pre>}</pre><pre>const m2 = (next) =&gt; (action) =&gt; {</pre><pre>console.log(&quot;m2&quot;);</pre><pre>return next(action);</pre><pre>}</pre><pre>const fakeDispatch = (action) =&gt; {</pre><pre>console.log(&quot;Final Dispatch this action&quot;, action);</pre><pre>}</pre><pre>const fakeActionYouInput = {</pre><pre>type: &quot;fakeType&quot;</pre><pre>}</pre><pre>m1(m2(fakeDispatch))(fakeActionYouInput);</pre><pre>m1<br>m2<br>Final Dispatch this action { type: &#39;fakeType&#39; }</pre><p>本來以為可以更簡短，結果越寫越多，希望日後回來看不會一頭霧水。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a85d5b121fdd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Transition? Animation? What’s difference?]]></title>
            <link>https://pohsiu0709.medium.com/transition-animation-whats-difference-1b52349a7289?source=rss-6c287f26282d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b52349a7289</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[transitions]]></category>
            <dc:creator><![CDATA[Louis]]></dc:creator>
            <pubDate>Sun, 26 Jan 2020 09:02:35 GMT</pubDate>
            <atom:updated>2020-01-26T12:48:28.943Z</atom:updated>
            <content:encoded><![CDATA[<h3>Transition? Animation? What’s the difference?</h3><p>When I faced animation issue, it occurs to my mind, what is that?</p><h3><strong>Transition</strong></h3><p><a href="https://developer.mozilla.org/zh-TW/docs/Web/CSS/transition">transition - CSS | MDN</a></p><pre>transition: &#39;[property_name] [duration_time] [timing_function] [delay_time]&#39;</pre><p>Sample code with css-in-js:</p><pre>sampleClass: {<br>    backgroundColor: &#39;blue&#39;,<br>    transition: &#39;backgroundColor .5s ease-in&#39;,<br>    &#39;&amp;:hover&#39;: {<br>       backgroundColor: &#39;red&#39;,<br>    }<br>}</pre><p>So, what will happen in upon code ?</p><p>We declare a transition effect it applied in backgroundColor attr. (if this property change that will transit by the function we just defined in ‘ease-in’ through ‘.6s’). So when we hover the element, that will transit the backgroundColor with effect of east-in. Pretty simple !</p><h3>Animation</h3><p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Animations/Using_CSS_animations">Using CSS animations - CSS: Cascading Style Sheets | MDN</a></p><pre>animation: &#39;[animationKeyFrameProperty] [duration_time] [process_function]&#39;</pre><p>Animation Sample Code (css-in-js):</p><pre>&quot;@keyframes opacityAnimation&quot;: {</pre><pre>  &quot;0%&quot;: {</pre><pre>    opacity: 0,</pre><pre>  },</pre><pre>  &quot;100%&quot;: {</pre><pre>    opacity: 1,</pre><pre>  },</pre><pre>},<br>sampleClass: {<br>  animation: &#39;$opacityAnimation .6s ease-in&#39;,<br>  backgroundColor: &#39;yellow&#39;,<br>},</pre><p>Done! Now when the sampleClass element render that would animated from opacity 0 to 1 in progress with no javascript and flash support.</p><h3>Which should I use?</h3><p>Usually, when we try to perform complicated effect, we tend to use animation instead of transition. Cause animation can declare more detail of element state in percentage.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b52349a7289" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Note — hooks lifecycle]]></title>
            <link>https://pohsiu0709.medium.com/react-note-hooks-lifecycle-f9d0b8d473b1?source=rss-6c287f26282d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9d0b8d473b1</guid>
            <category><![CDATA[hooks]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Louis]]></dc:creator>
            <pubDate>Tue, 27 Aug 2019 01:06:37 GMT</pubDate>
            <atom:updated>2019-08-27T01:18:10.514Z</atom:updated>
            <content:encoded><![CDATA[<h3>React Note — hooks lifecycle</h3><h4>利用 hooks 操作 react lifecycle 的方法: useEffect</h4><blockquote>useEffect 把 componentDidMount, componentDidUpdate, componentWillUnmount 三個階段整合在一起</blockquote><pre>import React, { useState, useEffect } from &#39;react&#39;;<br><br>function Example() {<br>  const [count, setCount] = useState(0);<br><br>  useEffect(() =&gt; {<br>    // Update the document title using the browser API<br>    // componentDidMount &amp;&amp; componentDidUpdate<br>  <br>    return () =&gt; { // 若不調用 WillUnmount 可省略<br>      // componentWillUnmount<br>    }<br>  });</pre><pre>// 預設不傳值， 每次變動都會重新呼叫 useEffect</pre><pre>// [] 代表只會觸發這個 useEffect 一次<br>// [props.id] 代表僅在 props.id 變動時，才觸發 useEffect<br>// [count] 代表訂閱 state 的 count，意即 setCount 被調用後觸發改變的 count    //  會進而也觸發 useEffect。</pre><pre>  return (<br>    &lt;div&gt;<br>      &lt;p&gt;You clicked {count} times&lt;/p&gt;<br>      &lt;button onClick={() =&gt; setCount(count + 1)}&gt;<br>        Click me<br>      &lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><h4>useCallback ?</h4><p>可以想成是一個 memoization 的 func 產生器，可帶入想訂閱什麼變數，變數改變時，也會重新產生帶入新參數的 func</p><pre>useCallback(func(), [])</pre><pre>// func() -&gt; 要帶有 memoize 效果的function</pre><pre>// [] -&gt; 要訂閱什麼變數</pre><h4>實際用起來</h4><p>把需要記憶的 function 在 useEffect 中調用。</p><pre>import React, { useState, useEffect, useCallback } from &#39;react&#39;;<br><br>function Example() {<br>  const [a, setA] = useState(0);<br>  const [b, setB] = useState(0);<br>  const doSomething = (a, b) =&gt; console.log(a, b);</pre><pre>  const memoizedCallback = useCallback(<br>    () =&gt; {<br>      doSomething(a, b); // 利用會變動的 a, b 做一些奇怪的事情<br>    },<br>    [a, b],<br>  );</pre><pre>  useEffect(() =&gt; {<br>    memoizedCallback();<br>  }, [a, b]);<br>  <br>  return (<br>    &lt;div&gt;Sample&lt;/div&gt;<br>  );<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9d0b8d473b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WebRTC 的靈魂 — STUN/TURN server]]></title>
            <link>https://pohsiu0709.medium.com/webrtc-%E7%9A%84%E9%9D%88%E9%AD%82-stun-turn-server-c652ce76725c?source=rss-6c287f26282d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c652ce76725c</guid>
            <category><![CDATA[stun]]></category>
            <category><![CDATA[nat]]></category>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[ice]]></category>
            <category><![CDATA[turn]]></category>
            <dc:creator><![CDATA[Louis]]></dc:creator>
            <pubDate>Tue, 20 Aug 2019 07:31:39 GMT</pubDate>
            <atom:updated>2019-08-20T07:32:56.310Z</atom:updated>
            <content:encoded><![CDATA[<h3>WebRTC 的靈魂 — STUN/TURN server</h3><h4>還是從 P2P 開始，傳統上 webRTC 連線是透過一個 signal server 來交換 IP 的，那實際背後的過程是什麼，最近稍微有點心得，紀錄一下。</h4><h3>目的：Client A 欲與 Client B 連線</h3><p>那實際上是這樣，雙方都不知道自己的 public IP /port for transportation 是什麼。這時候就需要一個叫做 STUN server 的東西，用來告知我，我的 public IP 跟 port 是什麼。</p><h4>解釋一 下 NAT …</h4><blockquote>假設你連線的 LAN 有 5 台電腦對外連線<br>各自有一個對內的 private IP (01, 02, 03, 04, 05 是你)<br>對外是 222.222.222.222 (port 99, 98, 97, 96, 95)</blockquote><blockquote>所以假如有人對 222.222.222.222:95 發送 request， NAT 就會對應到 05 轉送給你</blockquote><p>過程像是這樣</p><h4>Before Pending Request Process for Connection (補圖)</h4><ol><li>Client A propose a request to STUN server</li><li>STUN get client A ‘s public IP / port and respond to Client A</li><li>Client A told webRTC signal server that he wanted to connect Client B</li><li>Signal server informed Client B the connection request from Client A (public IP / port included)</li><li>Client B repeat step 1–2 get its own IP address information</li><li>Signal server respond information to Client A</li></ol><p>Now they both use its own IP address information to connect each other, no signal server business included.</p><p>上述是一個連線的完成。看似無害也很易懂。（大概啦）</p><p>多數情況下，據某個網站指出 STUN 有 86% 的成功率，但現在published的網站掛了，我 REF 也沒用了，所以直接省略，反正這裡我們要知道的就是還是有機會掛點無法連線，但這是為什麼呢？</p><blockquote>都是因為 NAT～～</blockquote><p>在某些特定的 <a href="https://zh.wikipedia.org/wiki/%E7%BD%91%E7%BB%9C%E5%9C%B0%E5%9D%80%E8%BD%AC%E6%8D%A2">NAT type</a> 底下，STUN server的運作會沒有意義，為什麼？</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*7NjlBpc1YuBzQindythTMw.png" /><figcaption>對稱式NAT (取自 <a href="https://zh.wikipedia.org/wiki/%E7%BD%91%E7%BB%9C%E5%9C%B0%E5%9D%80%E8%BD%AC%E6%8D%A2">維基百科</a>)</figcaption></figure><h4><strong>Distinctive</strong> IP address/ port for each connection between clients.</h4><p>我們在重新審視一下剛剛透過 STUN server 交換IP information的過程，很容易可以發現，STUN server 回應給我的 IP 資訊，在Symmetric NAT的限制下只限於我與server 間的連線，若有其他Client透過這組 IP 資訊與我連線，會在 NAT 被擋下，無法順利建立連線。</p><blockquote>That’s why we need TURN server</blockquote><p><a href="https://www.html5rocks.com/en/tutorials/webrtc/infrastructure/">以下轉自 WebRTC in the real world: STUN, TURN and signaling</a></p><h4><a href="https://en.wikipedia.org/wiki/Session_Traversal_Utilities_for_NAT">Session Traversal Utilities for NAT</a></h4><p>(STUN) is a standardized protocol for such address discovery including NAT classification. <a href="https://en.wikipedia.org/wiki/Traversal_Using_Relays_around_NAT">Traversal Using Relays around NAT</a> (TURN) places a third-party server to relay messages between two clients when direct media traffic between peers is not allowed by a firewall.</p><h4>TURN server</h4><p>TURN servers have public addresses, so they can be contacted by peers even if the peers are behind firewalls or proxies. TURN servers have a conceptually simple task — to relay a stream — but, unlike STUN servers, they inherently consume a lot of bandwidth. In other words, TURN servers need to be beefier</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c652ce76725c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>