<?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 貓奴前端工程師的筆記庫 on Medium]]></title>
        <description><![CDATA[Stories by 貓奴前端工程師的筆記庫 on Medium]]></description>
        <link>https://medium.com/@fu3810299?source=rss-6803fdf5ff66------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*0Zg9-7ynvR69Rt_F.jpg</url>
            <title>Stories by 貓奴前端工程師的筆記庫 on Medium</title>
            <link>https://medium.com/@fu3810299?source=rss-6803fdf5ff66------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 00:20:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fu3810299/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[AWS CI/CD： 架構與實作心得]]></title>
            <link>https://medium.com/@fu3810299/aws-ci-cd-%E6%9E%B6%E6%A7%8B%E8%88%87%E5%AF%A6%E4%BD%9C%E5%BF%83%E5%BE%97-c785645b2614?source=rss-6803fdf5ff66------2</link>
            <guid isPermaLink="false">https://medium.com/p/c785645b2614</guid>
            <category><![CDATA[aws-codedeploy]]></category>
            <category><![CDATA[aws-codepipeline]]></category>
            <category><![CDATA[aws-codebuild]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[cicd]]></category>
            <dc:creator><![CDATA[貓奴前端工程師的筆記庫]]></dc:creator>
            <pubDate>Wed, 11 Feb 2026 02:11:00 GMT</pubDate>
            <atom:updated>2026-02-11T02:11:00.899Z</atom:updated>
            <content:encoded><![CDATA[<p>在我們這個小型團隊，部署都是直接 SSH 連到 AWS EC2 手動操作。每次都得小心步驟與參數，一不小心就可能出錯，編譯期間網站還會短暫掛掉。</p><p>為了讓部署更穩定、可預期，我開始導入 CI/CD。因為服務都在 AWS EC2 上，如果用 GitHub Actions 還要額外處理權限問題，所以最終選擇 AWS 原生服務來構建整套流程。</p><h4>架構概覽</h4><p>CI/CD 流程以 GitHub 作為版本控制中心，當程式碼提交到指定分支（main 或 develop）時，AWS CodePipeline 就會自動觸發建置與部署。</p><p>這套流程自動化、可追蹤，也能即時掌握部署狀態，讓每次上線更放心。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VOjXzWL6oVwnTfXV778NPQ.png" /><figcaption>架構流程圖</figcaption></figure><h4>CodePipeline：流程的管理者</h4><ul><li>監聽 GitHub 提交事件，依序觸發建置、測試、部署等階段。</li><li>流程順序由開發者設定，也可選擇特定 commit 執行後續流程。</li></ul><h4>CodeBuild：建置與測試</h4><ul><li>抓取 GitHub 程式碼，執行編譯、打包與測試，生成可部署成果並上傳 S3。</li><li>可自訂建置環境 RAM 與 vCPU，即使編譯需要較大資源，也不用在 EC2 開高規格，降低成本並減少錯誤。</li></ul><h4>Amazon S3：存放建置成果與環境設定</h4><ul><li>儲存建置成果，也可放置環境變數或設定檔。</li><li>CodeDeploy 從 S3 取得檔案與設定進行部署，方便不同環境（開發、測試、正式）使用不同設定，保持流程穩定。</li></ul><h4>CodeDeploy：將建置成果部署到 EC2</h4><ul><li>負責將 S3 上的建置成果部署到 EC2，確保應用程式運行順利。</li><li>可透過部署群組（Deployment Group）設定不同環境，CodeDeploy 會依群組將應用程式部署到對應的 EC2。</li></ul><h4><strong>SNS + Lambda：即時通知</strong></h4><ul><li>部署完成後，CodeDeploy 會透過 SNS 發送通知，Lambda 整理訊息後推送到 Slack。</li><li>不用一直登入 AWS 後台，也能即時知道部署成功或失敗，提高反應速度。</li></ul><h4>心得</h4><p>這套 CI/CD 流程解決了編譯期間網站短暫掛掉的問題，也省下不少資源成本。<br>就算新同事或設計師只想調整樣式，也不用理解複雜的部署流程；多專案、多 Node 版本，只要靠既有設定，就能穩定上線，讓我能更專注在開發與產品迭代上。</p><p>回想過去，在前公司我用過 Jenkins，覺得 CI/CD 非常方便。但來到這個只有我一人的前端團隊時，部署又麻煩，每次還是靠 SSH 手動操作。<br>以前從沒做過完整 CI/CD 流程，這次是第一次嘗試，也踩了不少坑 — — 像是權限設定、環境變數管理、建置資源配置等等。<br>一直想建立自己的自動化流程，直到前年終於搭好，雖然拖到現在才寫下這段心路歷程。😅<br>建立自動化流程，不只是讓部署更穩定，也讓開發時心裡更踏實 — — 少了擔心掛掉、少了繁瑣操作，就能專心做更有價值的事情。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c785645b2614" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Side Project 紀錄：實作列表頁返回時保留位置]]></title>
            <link>https://medium.com/@fu3810299/side-project-%E7%B4%80%E9%8C%84-%E5%AF%A6%E4%BD%9C%E5%88%97%E8%A1%A8%E9%A0%81%E8%BF%94%E5%9B%9E%E6%99%82%E4%BF%9D%E7%95%99%E4%BD%8D%E7%BD%AE-20ce03d89456?source=rss-6803fdf5ff66------2</link>
            <guid isPermaLink="false">https://medium.com/p/20ce03d89456</guid>
            <category><![CDATA[scroll]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[keepalived]]></category>
            <category><![CDATA[side-project]]></category>
            <dc:creator><![CDATA[貓奴前端工程師的筆記庫]]></dc:creator>
            <pubDate>Fri, 06 Feb 2026 03:13:27 GMT</pubDate>
            <atom:updated>2026-02-06T03:13:27.877Z</atom:updated>
            <content:encoded><![CDATA[<p>作為一個長期使用 Vue 框架的前端工程師，我經常好奇：如果換成 React，要怎麼實現同樣的功能？🤔</p><p>以 Keep Alive 為例 — — 在商品列表中，從列表進入詳細頁，再返回列表時，希望能<strong>回到原本的位置繼續瀏覽</strong>，而不是從頭開始。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0jckCFgzXRrEG6NdnKmj_Q.gif" /><figcaption>demo</figcaption></figure><h4>過程</h4><p>一開始的想法很直覺：既然 Vue 有 KeepAlive，那 React 也應該可以做類似的事情。</p><p>我找到 React Keep Alive 套件，嘗試實作出「返回列表頁時保留原本位置」的效果。</p><p><strong>第一版 GitHub Repo</strong>：<a href="https://github.com/weichi1021/next-keep-alive/releases/tag/v1.0">v1.0</a></p><p>在實作過程中，我查了資料，也和 ChatGPT 討論後，發現 <strong>不建議在前台使用 React Keep Alive</strong>：保留整個 component tree 容易消耗大量記憶體，也可能影響 Next.js 的 routing 與 SEO。</p><p>於是，我找到另一個方向：<strong>React Query 快取 + scroll restore</strong>，這對前台網站更合適。</p><p>第二版的實作方向完全放棄 React Keep Alive，列表資料透過 React Query 保留快取，返回列表時再恢復 scroll 位置，即使 component 被卸載也能保持使用者體驗。</p><p><strong>第二版 GitHub Repo</strong>：<a href="https://github.com/weichi1021/next-keep-alive/releases/tag/v2.0">v2.0</a></p><h4>最後</h4><p>從這個過程中，我學到一件事：<strong>不是只要能運作就好，而是要思考可能存在的問題，對解答保持一點懷疑與好奇</strong>。這篇文章，也記錄了我探索這個 side project 的心路歷程。</p><h4>相關文件</h4><ul><li><a href="https://cn.vuejs.org/guide/built-ins/keep-alive">Vue.js</a></li><li><a href="https://github.com/StructureBuilder/react-keep-alive/blob/master/README.zh-CN.md">react-keep-alive/README.zh-CN.md at master · StructureBuilder/react-keep-alive</a></li></ul><p>這篇文章，就是其中一個 side project 的心路歷程。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20ce03d89456" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CMS：用 Firebase 打造文章編輯鎖（Edit Lock）機制]]></title>
            <link>https://medium.com/@fu3810299/cms-%E7%94%A8-firebase-%E6%89%93%E9%80%A0%E6%96%87%E7%AB%A0%E7%B7%A8%E8%BC%AF%E9%8E%96-edit-lock-%E6%A9%9F%E5%88%B6-d5cb8e203867?source=rss-6803fdf5ff66------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5cb8e203867</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[cms]]></category>
            <dc:creator><![CDATA[貓奴前端工程師的筆記庫]]></dc:creator>
            <pubDate>Mon, 02 Feb 2026 02:21:01 GMT</pubDate>
            <atom:updated>2026-02-02T02:21:01.456Z</atom:updated>
            <content:encoded><![CDATA[<p>當文章管理後台兩個人同時編輯同一篇文章時，最後存檔的人可能會覆蓋前一位的變更，造成內容不同步或資料遺失。</p><p>為了解決這個問題，我們加入 <strong>編輯鎖（Edit Lock）</strong>，確保：</p><ul><li>同一時間只允許一人編輯</li><li>即時顯示目前編輯者</li><li>分頁關閉或斷線時自動釋放鎖定</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ir3eUgveVatNv_v8xbMQrw.png" /><figcaption>編輯鎖功能 AI 生成示意圖</figcaption></figure><h4>概述</h4><p>這篇文章分享如何使用 <strong>Firebase Realtime Database</strong> 實作文章編輯鎖。</p><p>目前鎖定針對 <strong>不同使用者</strong>，用來防止同一篇文章被多人同時編輯；同一作者開多分頁仍可同時儲存，每個分頁視為獨立 client。這個設計出發點來自公司的開發規格，大家可依需求調整策略。</p><p>整套機制不需額外後端排程，即時同步編輯狀態，前端即可完成穩定可靠的協作鎖。</p><h4>實作流程圖</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*_PwzbXg01IDeyeWBhHF0gQ.png" /></figure><h4>資料結構設計（Schema）</h4><p>在 Firebase Realtime Database 中，我們把文章鎖定資料集中管理，每篇文章底下可以存放多個 client，方便即時追蹤誰在編輯。</p><p><strong>🔹 範例 JSON</strong></p><pre>{<br>  &quot;locked_post&quot;: {<br>    &quot;post_id_123&quot;: {<br>      &quot;author_id&quot;: 2001,<br>      &quot;post_id&quot;: 123,<br>      &quot;created_at&quot;: &quot;2025-07-28 10:00:00&quot;,<br>      &quot;client&quot;: {<br>        &quot;client_id_abc123&quot;: {<br>          &quot;device&quot;: &quot;Mac Chrome&quot;,<br>          &quot;heartbeat&quot;: 1722139200000<br>        },<br>        &quot;client_id_def456&quot;: {<br>          &quot;device&quot;: &quot;Win Edge&quot;,<br>          &quot;heartbeat&quot;: 1722139210000<br>        }<br>      }<br>    }<br>  }<br>}</pre><p><strong>🔹 欄位說明</strong></p><p><strong>文章鎖定層級</strong> locked_post/post_id_{文章ID}</p><ul><li>author_id：作者使用者 ID</li><li>post_id：文章 ID</li><li>created_at：鎖定建立時間</li><li>client：客戶端列表，記錄所有正在編輯該文章的分頁或裝置</li></ul><p><strong>客戶端層級</strong> locked_post/post_id_{文章ID}/client/client_id_{客戶端ID}</p><ul><li>device：裝置或瀏覽器資訊（如 Mac Chrome、iPhone Safari）</li><li>heartbeat：最後一次心跳時間戳（毫秒），用於判斷 client 是否在線</li></ul><h4>關鍵技術細節</h4><p>在文章編輯鎖系統中，有三個核心技術支撐鎖定的可靠性與即時性：</p><p>🔹 <strong>心跳機制（heartbeat）</strong><br>心跳用來判斷每個 client 是否仍在線。<br>每個編輯分頁會定期更新一個時間戳，告訴系統「我還在這裡」。</p><p>🔹 <strong>客戶端唯一識別（clientId）<br></strong>每個瀏覽器分頁或裝置都會生成一個唯一 clientId。<br>這樣可以區分不同分頁，即使同一使用者開啟多個分頁，也能分別追蹤每個 client 的狀態，避免鎖定衝突。</p><p>🔹 <strong>onDisconnect</strong><br>Firebase 提供 onDisconnect 功能，當 client 因網路斷線或關閉分頁而離開時，自動釋放鎖定。</p><h4>onDisconnect 注意事項</h4><p>Firebase 的 onDisconnect 可以在 client 斷線或關閉瀏覽器時自動執行操作，例如釋放鎖定。</p><p>不過它 <strong>不保證百分百觸發</strong>，因此一般會搭配排程或定期清理。</p><p>在這套規劃中，我們只靠前端，所以改用 <strong>heartbeat + 前端清理</strong> 做雙重保險，確保鎖定狀態可靠。<br>實作上，前端會在 <strong>進入文章編輯頁時先清理過期 client</strong>，再設定 heartbeat，避免殘留鎖影響新進入的編輯者。</p><h4><strong>相關文件</strong></h4><p><a href="https://firebase.google.com/docs/reference/node/firebase.database.OnDisconnect">OnDisconnect | JavaScript SDK | Node.js (client) API reference | Firebase</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5cb8e203867" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JS：用 IntersectionObserver 優雅監聽元素是否進入畫面，告別 scroll event]]></title>
            <link>https://medium.com/@fu3810299/js-%E7%94%A8-intersectionobserver-%E5%84%AA%E9%9B%85%E7%9B%A3%E8%81%BD%E5%85%83%E7%B4%A0%E6%98%AF%E5%90%A6%E9%80%B2%E5%85%A5%E7%95%AB%E9%9D%A2-%E5%91%8A%E5%88%A5-scroll-event-4f476ebac309?source=rss-6803fdf5ff66------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f476ebac309</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[scroll]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[intersection-observer]]></category>
            <dc:creator><![CDATA[貓奴前端工程師的筆記庫]]></dc:creator>
            <pubDate>Thu, 29 Jan 2026 02:51:01 GMT</pubDate>
            <atom:updated>2026-01-29T02:51:01.533Z</atom:updated>
            <content:encoded><![CDATA[<p>在前端開發中，常常要解決以下問題：圖片什麼時候該 lazy load？動畫什麼時候開始播放？使用者是否滑到頁面底部 Infinite scroll？</p><p>過去最常見的寫法是，監聽 scroll 事件再自行計算元素位置。</p><pre>window.addEventListener(&#39;scroll&#39;, ...)</pre><h4>什麼是 IntersectionObserver？</h4><p>IntersectionObserver 是一個瀏覽器原生 API，用來觀察某個元素是否進入指定容器（通常是 viewport）。</p><h4>基本用法</h4><pre>// 建立 observer<br>const observer = new IntersectionObserver((entries) =&gt; {<br>  entries.forEach(entry =&gt; {<br>    console.log(entry);<br>  });<br>});<br><br>// 開始觀察元素<br>const target = document.querySelector(&#39;.box&#39;);<br>observer.observe(target);</pre><p>只要 .box 進入或離開畫面，就會觸發 callback。</p><h4>entry 參數說明</h4><p>callback 內的 entries 是一個陣列，每一個 entry 都包含目前元素的交集狀態。</p><p>🔹 isIntersecting: 是否進入畫面；true 進入畫面，false 離開畫面<br>🔹 intersectionRatio: 進入畫面的比例 (0~1)；0.5 一半進入 ，1 完全進入<br>🔹 boundingClientRect: 元素本身的位置資訊<br>🔹 intersectionRect: 實際可見區域</p><h4>options 設定</h4><p>建立 observer 時可以帶第二個參數：</p><pre>const observer = new IntersectionObserver(callback, options)</pre><p>🔹 root: 指定觀察容器（預設是 viewport）<br>🔹 rootMargin: 類似 CSS margin，可提前或延後觸發<br>🔹 threshold: 進入多少比例才算觸發</p><h4>常見坑</h4><p>❗️ 初次 observe 會立即觸發一次：這是正常行為。<br>❗️ 記得 unobserve：否則元素即使完成任務仍會被監聽。</p><h4>相關文件</h4><p><a href="https://developer.mozilla.org/zh-CN/docs/Web/API/IntersectionObserver">IntersectionObserver - Web API | MDN</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f476ebac309" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS：scrollbar-gutter 滾動條空間控制]]></title>
            <link>https://medium.com/@fu3810299/css-scrollbar-gutter-%E6%BB%BE%E5%8B%95%E6%A2%9D%E7%A9%BA%E9%96%93%E6%8E%A7%E5%88%B6-842cf50ed73a?source=rss-6803fdf5ff66------2</link>
            <guid isPermaLink="false">https://medium.com/p/842cf50ed73a</guid>
            <category><![CDATA[scrollbar]]></category>
            <category><![CDATA[gutters]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[貓奴前端工程師的筆記庫]]></dc:creator>
            <pubDate>Tue, 27 Jan 2026 02:01:12 GMT</pubDate>
            <atom:updated>2026-01-27T02:01:12.401Z</atom:updated>
            <content:encoded><![CDATA[<p>當內容超出容器並出現滾動條時，往往會引起<strong> layout shift（版面跳動</strong>）。這時候，CSS 的 <strong>scrollbar-gutter</strong> 就能派上用場。</p><p>🔶 <strong>Windows</strong>：通常滾動條常駐，即使沒有操作也會顯示。<br>🔶 <strong>macOS</strong>：滾動條預設隱藏，只有在滑鼠或觸控板操作時才顯示，可能導致版面閃動。若希望 macOS 也固定顯示滾動條，可在系統偏好設定中修改為「總是顯示滾動條」。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kQlf9tZSCo1Nk6EySJ9dFw.png" /></figure><h4>什麼是 scrollbar-gutter？</h4><p>scrollbar-gutter 用來 <strong>保留或控制滾動條的空間</strong>，避免滾動條出現或消失時造成內容閃動。它可以應用於任何有滾動行為的元素（如 overflow: auto 或 overflow: scroll）。</p><h4>參數</h4><p>auto預設值，滾動條出現時才佔位，不出現時不佔位。<br>stable無論滾動條是否出現，都保留空間，避免 layout shift。<br>both-edges在左右兩側都保留滾動條的空間，主要用於水平滾動條。</p><h4>範例圖</h4><p>當 scrollbar-gutter: auto 時，滾動條出現會讓文字換行，導致「至關」兩字出現在不同的行上。<br>當 scrollbar-gutter: stable 時，滾動條空間被預留，文字保持原位，不會因為滾動條出現而換行。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*wEEiTYiXpoRInYCuUuI9dQ.png" /><figcaption>stable / auto 示意圖</figcaption></figure><h4>題外：如何避免 scroll / hidden 造成的版面跳動</h4><p>當使用 overflow: hidden 時，滾動條不會出現且 scrollbar-gutter 會完全失效，這樣的情形也會造成 <strong>layout shift</strong>。</p><p>🔹<strong>解法一：改用 auto + stable</strong><br>讓瀏覽器自己管理滾動條空間，是最乾淨的解法。</p><pre>.container {<br>  overflow: auto;<br>  scrollbar-gutter: stable;<br>}</pre><p>🔹<strong>解法二：手動預留 scrollbar 空間（hidden 專用）</strong></p><p>當必須使用 hidden（例如鎖住 body scroll），就只能手動補空間：</p><pre>body.lock {<br>  overflow: hidden;<br>  padding-right: 17px; /* scrollbar 寬度 */<br>}</pre><p>這個 17px 是常見 Windows scrollbar 寬度，也可搭配 scrollbar-width 控制寬度。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*X_DOmnRIiDkQXX6hJwCnOQ.png" /><figcaption>手動預留 scrollbar 空間 示意圖</figcaption></figure><h4>相關文件</h4><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/scrollbar-gutter">scrollbar-gutter - CSS | MDN</a></li><li><a href="https://caniuse.com/?search=scrollbar-gutter">&quot;scrollbar-gutter&quot; | Can I use... Support tables for HTML5, CSS3, etc</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=842cf50ed73a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Side Project 紀錄：自動化車牌選牌監控]]></title>
            <link>https://medium.com/@fu3810299/side-project-%E8%87%AA%E5%8B%95%E5%8C%96%E8%BB%8A%E7%89%8C%E7%9B%A3%E6%8E%A7-56d15e19d616?source=rss-6803fdf5ff66------2</link>
            <guid isPermaLink="false">https://medium.com/p/56d15e19d616</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[puppeteer]]></category>
            <category><![CDATA[cats]]></category>
            <category><![CDATA[car-number-plates]]></category>
            <category><![CDATA[side-project]]></category>
            <dc:creator><![CDATA[貓奴前端工程師的筆記庫]]></dc:creator>
            <pubDate>Mon, 26 Jan 2026 02:02:02 GMT</pubDate>
            <atom:updated>2026-02-12T07:21:29.097Z</atom:updated>
            <content:encoded><![CDATA[<p>最近完成了一個 Side Project <strong>自動化車牌選牌監控系統與查詢系統</strong>。整個專案使用 <strong>TypeScript + Puppeteer</strong> 實作，支援 LINE 推播、CAPTCHA 辨識、批次查詢與差異分析。趁著整理專案，把心得與開發經驗記錄下來 📝</p><h4>為什麼做這個 Side Project？</h4><p>前陣子有買 🚘 的計畫，發現台北市基隆監理站開放了 CAT 車牌的競標，但卻在競標結束後一天才知道這件事，心裡非常懊惱😭</p><p>後來聽說過一段時間還會有選號機會，而我對某些數字特別喜愛，非常希望能順利拿到想要的「🐱貓牌」。<br>因此，決定自己寫一個 <strong>自動化車牌監控系統</strong>，幫助自己快速掌握車牌資訊、提高成功機會。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1apBjzpdE-xEGxA39SYXLg.png" /><figcaption>AI 生成示意圖</figcaption></figure><h4>專案功能與特色</h4><ol><li>自動產生車牌清單<br>▪️可自動生成候選車牌、去除不要的數字（例如「4」）</li><li>批次查詢監理站資料<br>️️️▪️查詢尚未開放或尚未競標的車牌</li><li>定期抓取最新車牌並比對差異<br>▪️定時任務抓取最新資料<br>▪️計算前後差距，快速掌握新增或異動車牌</li><li>LINE 推播通知<br>▪️定時或異動時主動發送訊息<br>▪️隨時掌握最新進度</li><li>CAPTCHA 辨識<br>▪️支援人工輸入與自動辨識 (需要API) 兩種方式<br>▪️OCR 辨識僅能處理簡單文字，驗證碼基本上需要額外 API</li></ol><h4>開發過程踩過的坑</h4><ol><li>OCR 辨識<br>原本以為 OCR 可以自動辨識驗證碼，但 OCR 只能處理簡單文字<br>最後是透過大神幫忙製作的 API 才順利解決</li><li><strong>長期運行記憶體累積<br></strong>一開始忘了關閉瀏覽器，導致記憶體越跑越多😅<br>後來加上關閉瀏覽器與分批處理後才穩定</li></ol><h4>GitHub Repo</h4><p><a href="https://github.com/weichi1021/car-number">GitHub - weichi1021/car-number</a></p><h4>小知識</h4><p>在台灣車牌中，常見的是 <strong>不使用 4、0、O、I、Q</strong>，主要是因為：</p><ul><li><strong>4</strong> → 諧音「死」，不吉利</li><li><strong>0 / O / I / Q</strong> → 容易與數字混淆</li></ul><p>因此不會看到「DOG-XXXX」🐶 牌，因為 O 被排除在外。</p><p>最後，當然有順利選到我喜愛的貓牌 + 數字 👏</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56d15e19d616" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Image：LQIP（低品質圖片佔位）教學]]></title>
            <link>https://medium.com/@fu3810299/image-lqip-%E4%BD%8E%E5%93%81%E8%B3%AA%E5%9C%96%E7%89%87%E4%BD%94%E4%BD%8D-%E5%AE%8C%E6%95%B4%E6%95%99%E5%AD%B8-6583c47bff4f?source=rss-6803fdf5ff66------2</link>
            <guid isPermaLink="false">https://medium.com/p/6583c47bff4f</guid>
            <category><![CDATA[lqip]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[image]]></category>
            <dc:creator><![CDATA[貓奴前端工程師的筆記庫]]></dc:creator>
            <pubDate>Thu, 22 Jan 2026 07:13:40 GMT</pubDate>
            <atom:updated>2026-01-22T07:59:59.776Z</atom:updated>
            <content:encoded><![CDATA[<p>LQIP（Low Quality Image Placeholder，低品質圖片佔位）是一種圖片載入優化技術，在高清圖片完全加載前，先顯示一個模糊的低品量圖片佔位符，提升用戶體驗。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*B2G0txbJbO3qdYyLPs03Yw.png" /><figcaption>低品質/高清圖範例圖</figcaption></figure><h4>工作原理</h4><ol><li><strong>先載入一張低品質的小尺寸圖片</strong><br>尺寸約為 10×10 或 20×20，檔案體積極小，能在極短時間內完成載入。</li><li><strong>動態產生低品質圖片的 URL</strong><br>建議透過 AWS Lambda、圖片處理服務（如 CloudFront + Lambda@Edge、Cloudinary 等），利用 Query String 傳入寬度或品質參數，即時產生對應尺寸的低品質圖片，而非手動維護多張圖檔。</li><li><strong>放大並套用模糊效果作為佔位圖</strong><br>將小圖放大顯示，並透過 CSS（如 filter: blur()）營造模糊效果，使其作為高清圖片載入前的視覺佔位。</li><li><strong>高清圖片載入完成後進行替換</strong><br>當原始解析度圖片載入完成後，以淡入（fade-in）或移除模糊的方式平滑切換，避免突兀跳轉，提升整體感知效能與使用者體驗。</li></ol><h4>範例 Vue3（雙圖疊加）</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/27a337e68ffe5ae2c1240689f67c3284/href">https://medium.com/media/27a337e68ffe5ae2c1240689f67c3284/href</a></iframe><h4>相關閱讀</h4><ul><li><a href="https://medium.com/@fu3810299/aws-lambda-%E7%B8%AE%E5%9C%96-%E8%AE%8A%E6%9B%B4%E5%B0%BA%E5%AF%B8-a4942b676d7d">AWS Lambda：縮圖、變更尺寸</a></li><li><a href="https://medium.com/@fu3810299/css-%E5%9B%BA%E5%AE%9A%E5%9C%96%E7%89%87%E6%AF%94%E4%BE%8B-8900ccf383ca">CSS：固定圖片比例</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6583c47bff4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter：安裝並建立專案]]></title>
            <link>https://medium.com/@fu3810299/flutter-%E5%AE%89%E8%A3%9D%E4%B8%A6%E5%BB%BA%E7%AB%8B%E5%B0%88%E6%A1%88-5a051b66dd92?source=rss-6803fdf5ff66------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a051b66dd92</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[貓奴前端工程師的筆記庫]]></dc:creator>
            <pubDate>Fri, 19 Jul 2024 06:29:04 GMT</pubDate>
            <atom:updated>2024-07-19T06:29:04.623Z</atom:updated>
            <content:encoded><![CDATA[<p>在 Flutter 的官方教學中，有兩種安裝方式，第一種是使用 VS Code 安裝，第二種下載壓縮檔安裝。</p><p>以 Mac 下載壓縮檔的安裝為範例：</p><ol><li>先到官方安裝教學裡面下載壓縮檔</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ak9a51grNNsqs9wq6g6Lrg.png" /></figure><p>2. 將下載檔案解壓縮，用 VS Code打開</p><p>3. 在解完壓縮的資料夾下，執行 flutter doctor -v ，出現以下內容表示成功</p><pre>[✓] Flutter (Channel stable, 3.22.3, on macOS 13.5 22G74 darwin-x64, locale zh-Hant-TW)<br>    • Flutter version 3.22.3 on channel stable at /Users/vicky.wen/workspace-test/flutter<br>    • Upstream repository https://github.com/flutter/flutter.git<br>    • Framework revision b0850beeb2 (2 days ago), 2024-07-16 21:43:41 -0700<br>    • Engine revision 235db911ba<br>    • Dart version 3.4.4<br>    • DevTools version 2.34.3<br><br>[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)<br>    • Android SDK at /Users/vicky.wen/Library/Android/sdk<br>    ✗ cmdline-tools component is missing<br>      Run `path/to/sdkmanager --install &quot;cmdline-tools;latest&quot;`<br>      See https://developer.android.com/studio/command-line for more details.<br>    ✗ Android license status unknown.<br>      Run `flutter doctor --android-licenses` to accept the SDK licenses.<br>      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.<br><br>[✓] Xcode - develop for iOS and macOS (Xcode 15.2)<br>    • Xcode at /Applications/Xcode.app/Contents/Developer<br>    • Build 15C500b<br>    • CocoaPods version 1.15.2<br><br>[✓] Chrome - develop for the web<br>    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome<br><br>[✓] Android Studio (version 2023.3)<br>    • Android Studio at /Applications/Android Studio.app/Contents<br>    • Flutter plugin can be installed from:<br>      🔨 https://plugins.jetbrains.com/plugin/9212-flutter<br>    • Dart plugin can be installed from:<br>      🔨 https://plugins.jetbrains.com/plugin/6351-dart<br>    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)<br><br>[✓] VS Code (version 1.91.1)<br>    • VS Code at /Applications/Visual Studio Code.app/Contents<br>    • Flutter extension version 3.92.0<br><br>[✓] Connected device (3 available)            <br>    • iPhone 15 Pro (mobile) • 2032A7EC-0D77-4DC2-8DBE-65E27878389A • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator)<br>    • macOS (desktop)        • macos                                • darwin-x64     • macOS 13.5 22G74 darwin-x64<br>    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 126.0.6478.183<br><br>[✓] Network resources<br>    • All expected network resources are available.<br><br>! Doctor found issues in 1 category.</pre><p>4. 開啟模擬器</p><p>5. 找到根目錄 cd ./examples/hello_word，執行 flutter run</p><p>6. 看到這個畫面即表示成功 🎉<br>順帶一提，初始畫面的路徑在 ./examples/hell_word/lib/main.dart</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FQ9V8P5nV9raZ_-rX2GhiQ.jpeg" /></figure><h4>問題集</h4><ol><li>執行 flutter doctor -v出現了以下錯誤</li></ol><pre>/Users/xxx/flutter/bin/internal/shared.sh: line 260: <br>/Users/xxx/flutter/bin/cache/dart-sdk/bin/dart: Bad CPU type in executable</pre><p>解法：刪除 /Users/xxx/flutter/bin/cache 資料夾，再重新執行一次 flutter doctor -v</p><p>2. 執行 flutter doctor -v出現了以下錯誤</p><pre>shell-init: error retrieving current directory: getcwd: cannot access parent directories: Operation not permitted</pre><p>解法：終端機重新進入資料夾，cd ../ ，在重新 cd ./flutter/ 進入。</p><p>3. 執行 flutter run出現了以下錯誤</p><pre>Error: No pubspec.yaml file found.<br>This command should be run from the root of your Flutter project.</pre><p>解法：找到根目錄 cd ./examples/hello_word，確認 hello_word 資料夾裡面有 pubspec.yaml，在 hello_word 資料夾執行 flutter run</p><h4>相關文件</h4><p><a href="https://docs.flutter.dev/get-started/install/macos/mobile-ios#configure-your-target-ios-device">Start building Flutter iOS apps on macOS</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a051b66dd92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[網頁效能優化：以 NUXT 為例 (二)]]></title>
            <link>https://medium.com/@fu3810299/%E7%B6%B2%E9%A0%81%E6%95%88%E8%83%BD%E5%84%AA%E5%8C%96-%E4%BB%A5-nuxt-%E7%82%BA%E4%BE%8B-%E4%BA%8C-397e30723a3b?source=rss-6803fdf5ff66------2</link>
            <guid isPermaLink="false">https://medium.com/p/397e30723a3b</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nuxt]]></category>
            <dc:creator><![CDATA[貓奴前端工程師的筆記庫]]></dc:creator>
            <pubDate>Mon, 15 Jul 2024 10:05:17 GMT</pubDate>
            <atom:updated>2024-07-16T07:24:04.548Z</atom:updated>
            <content:encoded><![CDATA[<p>過了很久終於來到了第二篇😅 <br>來分享幾點可入手的方向：</p><h4>1. 改變 import 的方式</h4><p>有些套件很大卻不得不使用，這時候可以改變 import 的方式，來準確載入需要的功能。</p><p>以 lodash 為例：</p><pre>// 不好的載入<br>// 實際上會載入完整的 lodash，導致打包的檔案過於肥大<br>import { sortby } from &#39;lodash&#39;<br><br>// 好的載入<br>// 這方法只載入一個檔案，再從檔案中拿出所需要的 sortby<br>import sortby from &#39;lodash/sortby&#39;<br><br>// 現在 lodash 也可以安裝單一 function 了<br>// npm install lodash.sortby --save<br>import _sortby from &#39;lodash.sortby&#39;</pre><h4><strong>2. 優化套件 (Optimize Dependencies)</strong></h4><p>檢查並移除未使用的套件，減少打包的大小。<br>可以使用工具如 webpack-bundle-analyzer ，也就是上一篇提到分析程式碼的部分，針對過大的套件，來做相對應的調整。</p><h4>3. 使用 CDN (Content Delivery Network)</h4><p>對於大型第三方庫，可以透過 CDN 的快取加載，達到加快載入的速度。</p><h4>4. 使用 Gzip 或 Brotli 壓縮</h4><p>使用 Gzip 或 Brotli 壓縮，減少傳輸到客戶端(Client Side)的檔案大小。</p><p>首先，安裝nuxt-precompress</p><pre>npm i nuxt-precompress<br>// or<br>yarn add nuxt-precompress</pre><p>然後在，nuxt.config.js中加上，以下內容</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f626283d8a436355c166557a72e44038/href">https://medium.com/media/f626283d8a436355c166557a72e44038/href</a></iframe><p>npm run build後，在 .nuxt &gt; dist &gt; client 的資料架，確認是否有 .br 或者 .gz 结尾的檔案，即為成功。</p><h4><em>5. 壓縮圖片大小</em></h4><p>上網搜尋壓縮圖片，有提供許多方式來處理，也可以用 AWS Lambda 來達到同樣的效果，可參考之前的文章。</p><p><a href="https://medium.com/@fu3810299/aws-lambda-%E7%B8%AE%E5%9C%96-%E8%AE%8A%E6%9B%B4%E5%B0%BA%E5%AF%B8-a4942b676d7d">AWS Lambda：縮圖、變更尺寸</a></p><h4>相關文件</h4><p><a href="https://nuxt.com/modules/precompress">Precompress · Nuxt Modules</a></p><h4>相關閱讀</h4><p><a href="https://medium.com/@fu3810299/%E7%B6%B2%E9%A0%81%E6%95%88%E8%83%BD%E5%84%AA%E5%8C%96-%E4%BB%A5-nuxt-%E7%82%BA%E4%BE%8B-%E4%B8%80-5c4cbfc17004">網頁效能優化：以 NUXT 為例 (一)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=397e30723a3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PM2：問題處理 “Spawning PM2 daemon with …”]]></title>
            <link>https://medium.com/@fu3810299/pm2-%E5%95%8F%E9%A1%8C%E8%99%95%E7%90%86-spawning-pm2-daemon-with-bcd9dc21801c?source=rss-6803fdf5ff66------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcd9dc21801c</guid>
            <dc:creator><![CDATA[貓奴前端工程師的筆記庫]]></dc:creator>
            <pubDate>Tue, 06 Feb 2024 03:11:39 GMT</pubDate>
            <atom:updated>2024-02-06T03:11:39.951Z</atom:updated>
            <content:encoded><![CDATA[<h3>PM2：問題處理 “Spawning PM2 daemon with …”</h3><p>因為某些不知名原因 Server 一直呈現 502 Error，用 ssh 連線進 Server 查看，發現 pm2 的任何指令都無法執行，一直呈現</p><pre>$ pm2 list<br>[PM2] Spawning PM2 daemon with pm2_home=/home/ec2-user/.pm2</pre><p>後來去查詢 pm2 log</p><pre>$ vim /home/ec2-user/.pm2/pm2.log<br><br>2024-02-02T21:24:19: PM2 error: Error: ENOSPC: no space left on device, write<br>2024-02-02T21:24:19: PM2 error: Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed<br>2024-02-02T21:24:34: PM2 error: Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed<br>2024-02-02T21:24:34: PM2 error: Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed</pre><p>發現是 Server 的磁碟空間被佔滿，因此 log 無法寫入</p><h4>查看 Server 的磁碟空間可用量</h4><pre>$ df -hl<br><br>Filesystem      Size  Used Avail Use% Mounted on<br>devtmpfs         16G     0   16G   0% /dev<br>tmpfs            16G     0   16G   0% /dev/shm<br>tmpfs            16G   41M   16G   1% /run<br>tmpfs            16G     0   16G   0% /sys/fs/cgroup<br>/dev/nvme0n1p2  100G  100G    0G 100% /<br>tmpfs           3.1G     0  3.1G   0% /run/user/1000</pre><h4>解法一：找出比較大的檔案並刪除</h4><p>找尋較大的檔案指令</p><pre>du -sh /home/*<br><br>12G     /home/ec2-user<br>550M    /home/event_XxxxX<br>178M    /home/forum_XxxxX<br>268M    /home/_wXxxxX_slim_bak<br>517M    /home/wXxxxX_admin<br>1.6G    /home/wXxxxX_api<br>81G     /home/wXxxxX_vue</pre><p>刪除檔案指令，若要刪除檔案 myfile</p><pre>rm -rf myfile</pre><h4>解法二：加大磁碟空間容量</h4><p><a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html">Extend a Linux file system after resizing a volume</a></p><h4>相關文件</h4><p><a href="https://pm2.keymetrics.io/docs/usage/quick-start/">PM2 - Quick Start</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcd9dc21801c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>