<?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 Denise Chen on Medium]]></title>
        <description><![CDATA[Stories by Denise Chen on Medium]]></description>
        <link>https://medium.com/@denisechendd?source=rss-ded151d987b4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*grNAc2vSnWClNmbZAq545A.jpeg</url>
            <title>Stories by Denise Chen on Medium</title>
            <link>https://medium.com/@denisechendd?source=rss-ded151d987b4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 07:49:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@denisechendd/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[Make your own Python package]]></title>
            <link>https://medium.com/@denisechendd/make-your-own-python-package-02a085e84071?source=rss-ded151d987b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/02a085e84071</guid>
            <dc:creator><![CDATA[Denise Chen]]></dc:creator>
            <pubDate>Thu, 04 Dec 2025 09:48:19 GMT</pubDate>
            <atom:updated>2025-12-04T09:48:19.313Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*nANNZdz7zVB4XxBIVL_spw.png" /></figure><p>the content table follows by the structure</p><ul><li>Setup</li><li>setup.py</li><li>write package</li><li>upload to PyPI</li><li>Make automations with Github Action</li><li>References</li></ul><h4>1. Setup</h4><p>Must install some basic packages from requirement.txt</p><p>For instance, Train a RandomForestClassifier on the Iris dataset.</p><ul><li>Make predictions on new data after training.</li><li>Save and load trained models.</li><li>opoen .toml file</li><li>install wheel, setuptools</li></ul><pre>[build-system]<br>requires = [&quot;setuptools&gt;=42&quot;, &quot;wheel&quot;]<br>build-backend = &quot;setuptools.build_meta&quot;<br><br>[project]<br>name = &quot;mlpredictor&quot;<br>version = &quot;0.1.0&quot;<br>description = &quot;A simple machine learning package using scikit-learn&quot;<br>authors = [<br>    {name = &quot;Ebrahim&quot;, email = &quot;xxxv0501@gmail.com&quot;}<br>]<br>license = {text = &quot;MIT&quot;}<br>readme = &quot;README.md&quot;<br>requires-python = &quot;&gt;=3.6&quot;<br>dependencies = [<br>    &quot;scikit-learn&gt;=1.0&quot;,<br>]<br><br>[project.urls]<br>&quot;Homepage&quot; = &quot;https://github.com/ccc/mlpredictor&quot;</pre><p>Make sure to use <em>twine</em> to upload to PyPI. setuptools are writing the setup.py required 3-rd package tools.</p><h4>2. setup.py <a href="https://blog.siriuskoan.one/posts/python-third-party-package/#setuppy">#</a></h4><p>首先，必須先撰寫 setup.py，其中包含整個套件所需的資訊。以下為一個簡單範例。</p><p>雖然有許多欄位，但並非全部皆為必填，僅是若未填寫則在建置後可能會出現 UNKNOWN 等預設名稱，因此一般而言仍建議完整填寫。</p><p>基本上，name、version、packages 為較為重要的欄位，其餘欄位則可視需求選擇性填寫，以下分項說明。</p><ul><li>name 指的是此套件的名稱，亦即他人安裝套件時所需輸入的名稱。</li><li>version 顧名思義即為版本號，可參考 <a href="https://www.python.org/dev/peps/pep-0440/">PEP 440 – Version Identification and Dependency Specification</a> 的規範，此處直接以 x.x 命名。</li><li>packages 為此套件中所包含的 package，在上述範例中使用 setuptools 提供的 find_packages 以自動尋找，亦可加入 exclude 選項以排除不應納入的 package，例如 tests、docs 等，或直接指定，如 packages=[&quot;mypackage&quot;]。</li><li>description 為此套件的簡短描述，將於 PyPI 顯示；而 long_description 則會出現在 PyPI 網站的 Project description 部分，通常可直接引用 GitHub 上的 README.md。由於直接引用，需記得設定 long_description_content_type，否則將以純文字顯示。</li><li>author 與 author_email 為作者資訊，url 為專案網址，此處選擇放置 GitHub repo，亦因如此 PyPI 會顯示 GitHub statistics。license 可依個人偏好選擇。上述幾項皆會於 PyPI 網站顯示。</li><li>install_requires 包含此套件所需的其他第三方套件，如 requests、numpy 等。如需指定版本，請使用 extras_require，可參考 <a href="https://github.com/eternnoir/pyTelegramBotAPI/blob/master/setup.py">GitHub pyTelegramBotAPI/setup.py</a>。若對 python 版本有需求，則可使用 python_requires。</li><li>classifiers 為一系列資訊，官方稱之為 “A list of strings describing the categories for the package”，亦會顯示於 PyPI 頁面。此處放置了一些 python 版本相關資訊。</li></ul><p>若需更詳細的說明或瞭解更多欄位用途，可參考官方文件 <a href="https://setuptools.readthedocs.io/en/latest/references/keywords.html">Keywords</a>。此外，這些資料除了可直接撰寫於 setup.py，亦可寫於 setup.cfg，但本文不再贅述此方式，有需求者可參考 <a href="https://setuptools.readthedocs.io/en/latest/userguide/quickstart.html">setuptools: Quickstart</a> 進行轉換。</p><h4>3. 寫套件</h4><p>完成 setup.py 後，即可開始撰寫套件內容。</p><p>首先，需建立一個與套件名稱相同的目錄，此處以 mypackage 為例。接著於該目錄中建立 __init__.py，以標示其為一個 package。隨後即可開始撰寫套件內容，需注意在建立 class 或 function 後，應將其全部 import 至 __init__.py。</p><p>撰寫完成後，即可開始使用此套件。可嘗試執行 pip install .，理論上會顯示安裝成功的訊息，並完成 mypackage 套件的安裝。此時開啟 python interpreter，嘗試 import mypackage，應可順利載入，並開始使用自製套件。</p><h4>4. 上傳至 PyPI</h4><p>在自行測試無誤後，即可將套件發佈至 PyPI，供全球使用者下載，此時便需使用先前安裝的 twine 工具。</p><p>但在上傳之前，必須先產生套件的壓縮檔，需透過 python 進行相關處理。</p><p>在上傳之前，還需擁有一個 PyPI 帳號，可透過 twine 建立，亦可選擇於官方網站註冊。基本上並無特殊要求，但建議 Username 與 setup.py 中的 author 保持一致，以避免後續可能產生的問題。註冊完成後，即可進行最後步驟。</p><p>執行上述指令後，系統會要求登入，隨後開始上傳。完成後即可回到註冊頁面，理論上可見套件已成功發佈於 PyPI，供所有人下載。</p><p>日後若需更新套件，只需重複上述三個指令即可，但可能會遇到 HTTPError: 400 Client Error: File already exists.，此為 PyPI 不允許重複檔名所致，通常是因為未更新版本號。若已更新版本號仍無法解決，可嘗試先刪除 dist 目錄後再重新執行指令。</p><p>此外，PyPI 亦提供多種 badge 可嵌入於 README 中，以下為常見範例，建議善加利用以提升 README 的豐富度。</p><h4>5. 使用 GitHub Actions 自動化</h4><p>前述步驟為手動將套件上傳至 PyPI，本章則介紹如何透過 GitHub Actions 自動化此流程。首先需前往 repo 下方的 Actions 頁面，應可見如下圖所示介面。</p><p>選擇第一個 Publish Python Package，隨後進入編輯設定檔頁面，檔名不限，系統會自動偵測。基本上，此設定檔即指示 GitHub Actions 將套件上傳至 PyPI，但仍可進行部分微調。在開始之前，先簡要說明其組成元件。</p><ul><li>workflow 為流程，基本上目前編輯的設定檔即為一個 workflow。</li><li>job 為主要步驟，由多個 step 組成，若需處理相依性（如必須先通過測試才能部署），需於此層設定，否則系統將自動平行執行。</li><li>step 為執行步驟，由 job 依序執行。</li><li>action 為 GitHub Actions 中最小單位，一個 step 可包含多個 action。</li></ul><p>此外，最上方尚有 name 與 on，前者用於命名 workflow，後者則指定觸發時機，此處選擇於每次 push 時觸發，如此每次 push 系統即會自動更新 PyPI 上的套件。更改完成後，設定檔內容應類似 <a href="https://github.com/SiriusKoan/RandomUsers/blob/main/.github/workflows/python-publish.yml">RandomUsers GitHub Actions</a>。</p><p>最後，需於 repo 的設定中 secrets 加入 PYPI_API_TOKEN，如此 GitHub Actions 方能通過身份驗證。此 API token 可於 PyPI 的 Account Setting 產生。</p><p>完成上述步驟後，即可將新版本 push 至 GitHub，並確認是否成功觸發 GitHub Actions 並更新至 PyPI。過程中可能會遇到語法錯誤，畢竟各 CI/CD 工具的設定檔皆有其專屬語法。</p><h3>References</h3><ul><li><a href="https://zwindr.blogspot.com/2018/03/python-package.html">Python — 如何打包成 Package</a></li><li><a href="https://docs.python.org/3/distutils/setupscript.html">Writing the Setup Script</a></li><li><a href="https://setuptools.readthedocs.io/en/latest/index.html">setuptools Documentation</a></li><li><a href="https://marthall.github.io/blog/how-to-package-a-python-app/">How to package a python application to make it pip-installable</a></li><li><a href="https://betterscientificsoftware.github.io/python-for-hpc/tutorials/python-pypi-packaging/">Python: Creating a pip installable package</a></li><li><a href="https://towardsdatascience.com/how-to-package-your-python-code-df5a7739ab2e">How to Package Your Python Code</a></li><li><a href="https://stackoverflow.com/questions/52016336/how-to-upload-new-versions-of-project-to-pypi-with-twine">How to upload new versions of project to PyPI with twine?</a></li><li><a href="https://github.com/eternnoir/pyTelegramBotAPI/blob/master/setup.py">GitHub pyTelegramBotAPI/setup.py</a></li><li><a href="https://github.com/hsuan1117/CodeforcesAPI">GitHub CodeforcesAPI</a></li><li><a href="https://medium.com/starbugs/%E5%AF%A6%E4%BD%9C%E9%96%8B%E6%BA%90%E5%B0%8F%E5%B7%A5%E5%85%B7-%E8%88%87-github-actions-%E7%9A%84%E7%AC%AC%E4%B8%80%E6%AC%A1%E7%9B%B8%E9%81%87-3dd2d70eeb">實作開源小工具，與 Github Actions 的第一次相遇！</a></li><li><a href="https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/">Publishing package distribution releases using GitHub Actions CI/CD workflows</a></li><li><a href="https://docs.github.com/en/actions/learn-github-actions/introduction-to-github-actions">Introduction to GitHub Actions</a></li><li><a href="https://docs.github.com/en/actions/guides/building-and-testing-python">Building and testing Python</a></li></ul><p>Reference:</p><p><a href="https://blog.siriuskoan.one/posts/python-third-party-package/">https://blog.siriuskoan.one/posts/python-third-party-package/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02a085e84071" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Write better SQL than CHATGPT]]></title>
            <link>https://medium.com/@denisechendd/write-better-sql-than-chatgpt-6098a9f860a9?source=rss-ded151d987b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/6098a9f860a9</guid>
            <dc:creator><![CDATA[Denise Chen]]></dc:creator>
            <pubDate>Mon, 24 Nov 2025 01:47:03 GMT</pubDate>
            <atom:updated>2025-11-24T01:47:03.411Z</atom:updated>
            <content:encoded><![CDATA[<p>SQL is the backbone of data engineering. Here are 7<strong>queries</strong> you must master.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-gMEMtd4TTqSABCifIBHbQ.jpeg" /><figcaption>Data Engineer Path</figcaption></figure><h4>1. Find duplicate records</h4><pre>SELECT <br>       id, date, sysdate, COUNT(*)<br>FROM<br>       users<br>GROUP BY<br>       id<br>HAVING<br>       COUNT(*)&gt;1 ;</pre><h4>2. Retrieve latest record per user</h4><pre>DECLARE<br>    @MAXDATE DATETIME;<br><br>SELECT @MAXDATE=MAX(created_at) FROM orders WHERE user_id=&#39;MARYC&#39;;<br><br>SELECT<br>       *<br>FROM<br>     orders o<br>WHERE<br>     created_date=@MAXDATE;</pre><p>DEBUG 技巧:</p><ul><li><strong>先跑第一段</strong>：確認 @MAXDATE 有值 → SELECT @MAXDATE;</li><li><strong>再跑第二段</strong>：確認能抓到正確的那一筆</li></ul><pre>SELECT <br>       *<br>FROM <br>      orders o<br>WHERE <br>      o.user_id = &#39;MARYC&#39;<br>AND rownumber&lt;5 <br>ORDER BY <br>     o.created_at DESC;</pre><p>另外找尋每個群組第一筆資料可用這方法</p><pre>SELECT<br>      * <br>FROM <br>    (select <br>      ROW_NUMBER() OVER (PARTITION BY address ORDER BY id ASC) as ROW_ID ,* <br>     from <br>         Customers)as KKK <br>     where KKK.ROW_ID =1 </pre><p>想在CUSTOMERS 資料表輸入資料以利後續查詢</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/0*Se6KviEnvw1kUHE3.png" /></figure><p>更新已存在資料庫中的資料</p><pre>UPDATE  <br>       Customers<br>SET     <br>       address = N&#39;Japan&#39;, name = N&#39;fujifilm&#39;<br>WHERE   <br>       id = 8</pre><h4>3. Identify and replace latest record per user</h4><pre>SELECT *<br>FROM orders<br>WHERE orderID IS NULL;</pre><pre><br>with test_data as<br>(<br>    SELECT <br>          1 as prog_id, 1 as prog_cost, to_date(&#39;10-12-2015&#39;, &#39;MM-dd-yyyy&#39;) as start_date, sysdate as end_date <br>    FROM<br>          dual<br>    union all<br>    SELECT<br>          2, null, to_date(&#39;10-12-2015&#39;, &#39;MM-dd-yyyy&#39;), sysdate <br>    FROM <br>          dual<br>    union all<br>    SELECT <br>          3, 1, to_date(&#39;10-12-2015&#39;, &#39;MM-dd-yyyy&#39;), null <br>    FROM<br>          dual<br>    union all<br>    SELECT <br>          4, null, to_date(&#39;10-12-2015&#39;, &#39;MM-dd-yyyy&#39;), null <br>    FROM<br>          dual<br>)<br>SELECT<br>      nvl(add_months(end_date, 1), sysdate)<br>FROM <br>      test_data;</pre><h4>4. Top 10 customers</h4><pre>SELECT <br>      customer_id, SUM(amount) AS total<br>FROM <br>      payments<br>WHERE<br>      rownumber&lt;=10<br>GROUP BY <br>      customer_id<br>ORDER BY total DESC</pre><h4>5. Window function: running total</h4><pre>SELECT <br>    created_date,<br>    salesperson,<br>    SUM(sales) OVER (ORDER BY created_date) AS running_total<br>FROM revenue;</pre><h4>6. Detect churn signals</h4><pre>SELECT <br>      user_id<br>FROM <br>      logins<br>GROUP BY user_id<br>HAVING MAX(login_date) &lt; sysdate - INTERVAL &#39;30 days&#39;;</pre><h4>7. Pivot-style revenue by month</h4><pre>SELECT <br>    user_id,<br>    SUM(CASE WHEN EXTRACT(MONTH FROM date)=1 THEN amount END) AS jan,<br>    SUM(CASE WHEN EXTRACT(MONTH FROM date)=2 THEN amount END) AS feb<br>FROM <br>    payments<br>GROUP BY user_id;</pre><p>SQL Ref:</p><pre>SELECT *<br>FROM<br>    all_sources<br>WHERE<br>    NAME=UPPER(&#39;ONEDISTINCTVIEW&#39;);  --FIND AN TABLE SOURCE<br><br>SELECT *<br>FROM<br>     all_objects<br>WHERE<br>     object_name=UPPER(&#39;ONEDISTINCTVIEW&#39;); --find an aobject source<br><br>SELECT *<br>FROM<br>     all_views<br>WHERE<br>    view_name=UPPER(&#39;ONEDISTINCTVIEW&#39;);  --find a great view</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6098a9f860a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Oracle SQL DB 常用語法]]></title>
            <link>https://medium.com/@denisechendd/oracle-sql-db-%E5%B8%B8%E7%94%A8%E8%AA%9E%E6%B3%95-527d251d4b91?source=rss-ded151d987b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/527d251d4b91</guid>
            <dc:creator><![CDATA[Denise Chen]]></dc:creator>
            <pubDate>Sun, 08 Jun 2025 01:02:11 GMT</pubDate>
            <atom:updated>2025-06-08T01:02:11.538Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/167/0*fcMCUeSAMis0AvFH.jpg" /></figure><h3>%Type</h3><p>%TYPE 是 Procedure 定義變數的一種方法，%TYPE 是一種屬性（Attribute） ，用來宣告一個變數，其資料型態會與指定的資料表欄位或另一個變數完全一致。</p><h3>🔍 好處：</h3><ol><li>自動同步資料型態 ：當表格欄位的資料型態改變時（如 VARCHAR2(20) → VARCHAR2(30)），PL/SQL 程式碼中使用 %TYPE 宣告的變數也會自動跟著改變。</li><li>提高可讀性與維護性 ：讓程式設計師清楚知道這個變數是為了配合哪個欄位而存在。</li></ol><h4>先建立一個簡單的表格</h4><blockquote>CREATE TABLE students <br>(<br> id NUMBER PRIMARY KEY,<br> name VARCHAR2 (50),<br> email VARCHAR2(100)<br>);</blockquote><blockquote>寫一個 Procedure 使用 %TYPE</blockquote><blockquote>CREATE OR REPLACE PROCEDURE get_student_info (<br> p_id IN students.id%TYPE<br>)<br>IS<br> — 宣告變數，使用 %TYPE 讓變數與欄位類型一致<br> v_name students.name%TYPE;<br> v_email students.email%TYPE;<br>BEGIN<br> — 從 students 表中取出對應資料<br> SELECT name, email<br> INTO v_name, v_email<br> FROM students<br> WHERE id = p_id;</blockquote><blockquote>— 輸出結果<br> DBMS_OUTPUT.PUT_LINE(‘Student ID: ‘ || p_id);<br> DBMS_OUTPUT.PUT_LINE(‘Name: ‘ || v_name);<br> DBMS_OUTPUT.PUT_LINE(‘Email: ‘ || v_email);</blockquote><blockquote>EXCEPTION<br> WHEN NO_DATA_FOUND THEN<br> DBMS_OUTPUT.PUT_LINE(‘找不到學生ID: ‘ || p_id);<br>END;<br>/</blockquote><blockquote>— 插入測試資料<br>INSERT INTO students (id, name, email)<br> VALUES (1, ‘Alice’, ‘<a href="/service/mailto:alice@example.com">alice@example.com</a>’);<br>COMMIT;</blockquote><blockquote>— 執行 procedure<br>BEGIN<br> get_student_info(p_id =&gt; 1);<br>END;<br>/</blockquote><h4>變數也可以參考其他變數的 %TYPE</h4><blockquote>DECLARE<br> v_a NUMBER := 100;<br> v_b v_a%TYPE; — v_b 的型別與 v_a 相同（NUMBER）<br>BEGIN<br> v_b := 200;<br> DBMS_OUTPUT.PUT_LINE(‘v_b = ‘ || v_b);<br>END;<br>/</blockquote><p>常見操作方式:</p><p>如何在 ORDERS 和 ORDER_ITEMS 表之間建立索引，並使用這些索引來進行高效的 MERGE 操作</p><h4>1. 理解需求</h4><ul><li>目標 ：在 ORDERS 和 ORDER_ITEMS 表之間建立索引，以提高 MERGE 操作的效率。</li><li>表結構 ：</li><li>ORDERS 表包含訂單資訊，主鍵為 order_id。</li><li>ORDER_ITEMS 表包含訂單項目的詳細資訊，外鍵為 order_id，用於與 ORDERS 表關聯</li><li>索引: 提高查詢和更新操作的性能，特別是在大數據量的情況下。對於 MERGE 操作 (尤其是達成<br> 🔍加速 ON 子句中的條件匹配（如 d.order_id = s.order_id）。<br> 🔍提高插入、更新和刪除操作的效率</li></ul><h4>(a) 建立索引</h4><blockquote>— 在 ORDERS 表的 order_id 上建立索引<br>CREATE INDEX idx_orders_order_id ON ORDERS(order_id);</blockquote><blockquote>— 在 ORDER_ITEMS 表的 order_id 上建立索引<br>CREATE INDEX idx_order_items_order_id ON ORDER_ITEMS(order_id);</blockquote><blockquote>— 在 ORDER_ITEMS 表的 line_item_id 上建立索引<br>CREATE INDEX idx_order_items_line_item_id ON ORDER_ITEMS(line_item_id);</blockquote><p>執行merge</p><blockquote>MERGE INTO ORDER_ITEMS d<br>USING (<br> SELECT <br> o.order_id, oi.line_item_id, oi.product_id, oi.unit_price, oi.quantity, oi.shipment_id<br> <br>FROM ORDERS o<br> <br>JOIN ORDER_ITEMS oi ON o.order_id = oi.order_id<br>) s<br>ON (d.order_id = s.order_id AND d.line_item_id = s.line_item_id)<br>WHEN MATCHED THEN<br> UPDATE SET<br> d.product_id = s.product_id,<br> d.unit_price = s.unit_price,<br> d.quantity = s.quantity,<br> d.shipment_id = s.shipment_id<br>WHEN NOT MATCHED THEN<br> INSERT (order_id, line_item_id, product_id, unit_price, quantity, shipment_id)<br> VALUES (s.order_id, s.line_item_id, s.product_id, s.unit_price, s.quantity, s.shipment_id);</blockquote><p>完成以下事情:<br>步驟</p><ol><li>分析主鍵和外鍵</li><li>建立索引</li><li>使用 MERGE 操作</li><li>維護索引</li></ol><p>常見操作方式 2:</p><h3>📝 背景分析</h3><p>你有兩個需求：</p><ol><li>如何查看 Oracle SQL 程序的執行階段 ：這涉及到使用 Oracle 的性能調優工具，如 EXPLAIN PLAN 或 AUTOTRACE。</li><li>查詢客戶在一個月內的訂單下單次數、客戶和訂單詳細資料，並標示是否有重複訂單 ：這需要結合日期條件、聚合函數（如 COUNT）以及連接多個表來實現。</li></ol><h4>1. 如何查看 Oracle SQL 程序的執行階段</h4><h4>這涉及到使用 Oracle 的性能調優工具，如 EXPLAIN PLAN 或 AUTOTRACE</h4><blockquote>(a) 使用execute plan<br>EXPLAIN PLAN FOR<br>SELECT * FROM ORDERS WHERE order_datetime BETWEEN SYSDATE — 30 AND SYSDATE;</blockquote><p>(b) 查看執行計畫</p><blockquote>SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);</blockquote><p>SELECT * FROM ORDERS WHERE order_datetime BETWEEN SYSDATE — 30 AND SYSDATE;</p><ol><li>CTE (monthly_orders) ：</li></ol><ul><li>過濾出過去 30 天內的訂單，並包含相關的訂單項目詳細資訊。</li><li>使用 TRUNC(SYSDATE) - 30 確保只考慮完整的一個月。</li></ul><ol><li>主查詢 ：</li></ol><ul><li>連接 CUSTOMERS 表和 monthly_orders CTE。</li><li>使用窗口函數 COUNT(mo.order_id) OVER (PARTITION BY mo.customer_id) 計算每個客戶的訂單總數。</li><li>使用窗口函數 COUNT(mo.order_id) OVER (PARTITION BY mo.customer_id, mo.product_id) 檢查是否有重複訂單。</li></ul><ol><li>結果欄位 ：</li></ol><ul><li>total_orders_in_month：每個客戶在過去一個月內的訂單總數。</li><li>has_duplicate_orders：標示是否有重複訂單（基於產品 ID）。</li></ul><p>語法調用</p><pre>WITH monthly_orders AS (<br>    -- 過去一個月內的訂單<br>    SELECT <br>        o.order_id,<br>        o.customer_id,<br>        o.order_datetime,<br>        oi.line_item_id,<br>        oi.product_id,<br>        oi.unit_price,<br>        oi.quantity,<br>        oi.shipment_id<br>    FROM ORDERS o<br>    JOIN ORDER_ITEMS oi ON o.order_id = oi.order_id<br>    WHERE o.order_datetime &gt;= TRUNC(SYSDATE) - 30<br>)<br>SELECT <br>    c.customer_id,<br>    c.full_name,<br>    mo.order_id,<br>    mo.order_datetime,<br>    mo.line_item_id,<br>    mo.product_id,<br>    mo.unit_price,<br>    mo.quantity,<br>    mo.shipment_id,<br>    -- 計算每個客戶的訂單總數<br>    COUNT(mo.order_id) OVER (PARTITION BY mo.customer_id) AS total_orders_in_month,<br>    -- 檢查是否有重複訂單<br>    CASE <br>        WHEN COUNT(mo.order_id) OVER (PARTITION BY mo.customer_id, mo.product_id) &gt; 1 THEN &#39;Yes&#39;<br>        ELSE &#39;No&#39;<br>    END AS has_duplicate_orders<br>FROM CUSTOMERS c<br>JOIN monthly_orders mo ON c.customer_id = mo.customer_id<br>ORDER BY c.customer_id, mo.order_datetime;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*Oy0vWL0O7xcsPk7KhwHaqw.png" /><figcaption>CO 表格關聯性</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=527d251d4b91" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[使用行銷漏斗精準掌控目標客群]]></title>
            <link>https://medium.com/@denisechendd/%E4%BD%BF%E7%94%A8%E8%A1%8C%E9%8A%B7%E6%BC%8F%E6%96%97%E7%B2%BE%E6%BA%96%E6%8E%8C%E6%8E%A7%E7%9B%AE%E6%A8%99%E5%AE%A2%E7%BE%A4-dd4764b2174c?source=rss-ded151d987b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd4764b2174c</guid>
            <dc:creator><![CDATA[Denise Chen]]></dc:creator>
            <pubDate>Thu, 16 Jan 2025 03:32:01 GMT</pubDate>
            <atom:updated>2025-01-16T03:32:01.155Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VbjQ2sKxP7nM3wrM.png" /></figure><p>行銷科技日新月異，有效應用進階工具讓廣告效益翻倍，廣告投放入門容易，但策略規劃、數據分析才是行銷的成功要件</p><h4>行銷漏斗是什麼?</h4><p>從客戶消費模式到下訂單流程之間的不同階段，而行銷人員須制定行銷策略為達到訂單數量(KPI)，你必須準確預設他們在此過程當中，所考慮的因素以及問題，從而製作出相應的網絡行銷或內容行銷策略</p><p>Digital Marketing 泛指:</p><p><strong>Content Marketing: </strong>利用不同的內容，部落格，解決客戶問題，建立長期關係<br><strong>KOL行銷: </strong>利用Influencer拉近品牌和用戶的距離，以提高轉換率<br><strong>E-commerce: </strong>對一些網上商店而言，他們提供服務，一些<strong>CRM (Customer Relationship Management)</strong> 方面，<strong>EDM 電郵推送</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-5JMeOvnsN_kKEiH.png" /></figure><h4>行銷漏斗 Marketing Funnel 的結構 一圖看透你的消費模式</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4rRCDPdBGW4F6rlJ.png" /></figure><p><strong>掌握 8+ Martech 和 AI 工具: Google Analytics4, MOZ, Google ADs, Facebook ADs, mailerlite, Landingi, Shopify, zapier, Canva</strong></p><p>可以透過實際建Martech 模型並取得成果</p><ol><li>設計製作高轉換的到達頁面</li><li>制定行銷漏斗策略</li><li>Learn the optimized usuage of AI Marketing</li><li>Chatgpt AI 數位行銷實戰應用</li></ol><p>實例:</p><p>Facebook廣告漏斗是一種轉換漏斗營銷策略，你可以在Facebook營銷中利用它，通過用戶旅程中的幾個<a href="https://www.conductor.com/blog/2019/01/what-is-a-touchpoint-marketing-touchpoints-on-a-buyers-journey-in-2019/">營銷接觸點</a>將Facebook用戶轉換為你的客戶。這個漏斗足夠強大將一個完全陌生的用戶轉換為你的忠實客戶!</p><p>從TF（在那里把你的廣告顯示給最廣泛的受眾），一些感興趣的受眾將步入到下一階段，這是MF（這是再次鎖定興趣受眾的時候），最後的接近轉換的受眾將步入到BF，並在最終被轉換。漏斗的形狀意味著從TF一直到BF的受眾數量逐漸減少。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/196/0*0HU58Bs4appJmcDD.png" /></figure><p>臉書頁面:<br>為了應用Facebook廣告中的Facebook廣告漏斗，你必須有一個廣告賬戶，而要獲得廣告賬戶，你需要有一個Facebook頁面。如果你還沒有的話，下面就為大家介紹一下如何為你的企業品牌<a href="https://blog.hubspot.com/marketing/how-to-create-facebook-business-page-ht">創建一個Facebook頁面</a>。</p><p>在獲得Facebook頁面後，花一些時間來<a href="https://www.facebook.com/business/help/104002523024878">優化你的Facebook頁面</a>，以增加頁面瀏覽量和Facebook頁面的信任度。</p><p>所以，現在，我假設你已經創建了一個Facebook頁面，並將其優化到最好。接下來，強烈建議你在進入Facebook廣告之前，先獲得頁面讚（以增加你的頁面信任度，以便讓用戶信任你，放心購買），以提高你的廣告效果</p><p>獲得臉書頁面按讚數:<br>- 使用邀請按鈕來邀請人們為你的頁面點讚。</p><p>- 創建一個吸引人的貼文</p><ul><li>使用<a href="https://www.facebook.com/business/help/104002523024878">Facebook廣告活動</a></li></ul><p>為了創建Facebook廣告，你需要有一個Facebook廣告賬戶。強烈建議你為你的Facebook頁面創建一個Business Manager，以便在你的業務增長時，方便未來的處理。以下是如何創建<a href="https://sproutsocial.com/insights/facebook-best-practices/">Business Manager</a>和<a href="https://www.facebook.com/business/help/1710077379203657?id=180505742745347">Facebook廣告賬戶</a>。</p><p>接下來: 創建Facebook廣告</p><p>第一步：進入 “Business Manager”，選擇菜單圖標，進入 “Ads Manager”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/0*2Q8YCs76QsAFXa34.png" /></figure><p>第二步：點擊創建廣告</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U9eYLQUfct518JJA.png" /></figure><p>第三步：選擇廣告活動，進入廣告創建設置。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/0*9zGUThSbwLZC3Zet.png" /></figure><p>-冷受眾： 對你的品牌一無所知的Facebook用戶</p><p>- 溫受眾：對你的品牌有一定基礎了解，並對你提供的產品或服務相當感興趣的用戶。</p><ul><li>熱受眾：對你的品牌有非常了解，包括你提供的產品或服務，並且非常接近轉換的用戶。</li></ul><p>用於吸引<strong>漏斗頂部（TF）</strong>受眾好的方法就是用一種融入日常生活的方式讓受眾意識到你品牌的存在。創建Facebook廣告漏斗，你要從TF開始。TF的目的是將你的品牌介紹給最廣泛的Facebook用戶，記住，受眾去Facebook是為了社交，而不是為了買東西，所以如果你以一種非常融入日常生活的方式介紹你的品牌，那麽他們很可能會停下來看看，從而實現你的第一個接觸點</p><p>T<strong>F推薦的Facebook廣告系列</strong></p><p>1. 觀看影片(強烈建議)</p><p>- 這是介紹品牌的最佳方式，查看移動的物體是人類的本能，所以視頻是能夠吸引人類眼球的。</p><p>2. 流量</p><ul><li>這是一個很好的方式，引導受眾進入你的網頁，並由<a href="https://www.facebook.com/business/help/910137316041095?id=420299598837059">Facebook Pixel</a>來追蹤活動，並有數據供未來定制受眾使用。</li><li>輪播格式廣告: 輪播格式廣告非常適合展示多張關於品牌的圖片</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/0*ekMpmElPYiuzXjhE.png" /></figure><p>3. 觸及</p><p>簡單的單圖廣告，強調品牌的logo，第一眼就能抓住受眾的注意力，是一個完美的品牌宣傳廣告</p><p>在廣告Ad Set選擇受眾，選擇最廣泛的受眾，在其中你可以使用。</p><p>- 讚了你的頁面的<a href="https://blog.hootsuite.com/how-to-use-facebook-custom-audiences/">自訂受眾</a></p><p>- 你創建的自訂受眾的<a href="https://www.facebook.com/business/help/952192354843755?id=1205376682832142">相似受眾</a></p><p>- 廣泛的目標定位，不用詳細的目標定位</p><p>記住，在創建Facebook廣告之前，讓安裝你的Facebook pixel，以追蹤你的廣告和網站上的受眾的活動。</p><p>4. 品牌認知</p><p>總結: 抓取漏斗頂部受眾戶</p><p>- 安裝Facebook pixel</p><p>- 投放推薦的廣告目標</p><p>- 在廣告設置層面使用廣泛的受眾</p><p>- 使用推薦的廣告文案</p><p>- 同時，做A/B拆分測試。</p><ul><li>創建自訂受眾並進入MF</li></ul><p><strong>漏斗中部(MF)</strong></p><p>在這個層面上，溫受眾已經對你的品牌有了一些基本的了解，你可以開始向他們介紹你的一些產品，但是，請不要在這個階段做硬性銷售，因為他們需要先對你的產品有更多的了解。這個MF的目的是作為冷受眾到熱受眾的過渡，繼續給受眾提供品牌的接觸點</p><p>步入MF時，我們已經收集了不少的潛在顧客資料，也許是從TF收集的參數，頁面讚的受眾，網站流量和參與Facebook貼文互動的受眾，所以我們可以繼續創建自訂受眾和相似受眾。進入MF階段用廣告把受眾戶轉成能衡量的指標，會運用到: 1. 流量、2. 互動、3. 轉換</p><p>在MF中，值得對不同來源的受眾進行A/B測試，找出哪一批是高機會轉換的受眾。記得設置廣告頻率，防止目標受眾因看到廣告過於頻繁而產生廣告疲勞。名單型廣告通常非常昂貴，比較便宜的方法是利用流量廣告將他們引導到你的連結頁面，並讓Facebook pixel追蹤他們的活動，通過連結頁面獲取他們的信息。</p><p><strong>漏斗底部(BF)</strong></p><p>很可能只需要一點觸點和驅動力來促使他們進行購買，所以這個BF的目的是增加最後幾個觸點，促使熱受眾購買你的產品或服務。</p><p><strong>BF推薦的Facebook廣告目標</strong></p><p>1. 轉換</p><p>2. 目錄銷售</p><p>3. 來店客流量</p><p>在這個階段，你要促使他們向你購買產品。非常有用的方式是製造緊迫感，例如，限時折扣，促使他們向你購買產品。</p><p>總結: BF 受眾戶為已經追蹤許久的受眾戶，要有效轉換成購買力，需要達到以下目標<br> — 創建自訂和相似的受眾</p><p>- 創建推薦廣告目標</p><p>- 選擇合適的呼籲按鈕</p><p>- 製造緊迫感</p><ul><li>創造專有性</li></ul><p>以下行銷方法都有助於達成受眾戶轉成目標KPI</p><h3>EDM 電郵行銷</h3><p>EDM並非傳統的「Email Direct Marketing」，而是「Personalized EDM」，即個人化的郵件行銷。相較過去粗糙的大量電郵宣傳方式，當下已有眾多編輯系統，可以令每一封電郵也能夠個人化，從而加強對商戶（B2B）或對客戶（B2C）的信息及行銷力度。</p><h4>SEM 關鍵字行銷</h4><p>SEM與SEO只有一字之差，但其手段卻大不相同。</p><p>SEM 則是針對相應關鍵字所得出的付費廣告，相比針對客戶自然搜尋而得出的SEO，更需要有較強而明確的信息，去命中客戶所需。</p><p>不同的關鍵字所代表搜尋意圖及銷售階段亦有差別，統計的數據與分析亦有別於SEO。如SEM 必須要留意「PPC」（Pay per click／每點擊付費），去計算出廣告的點擊成本及相應的轉換率成本。</p><h4>AARRR 行銷漏斗</h4><p>「AARRR」是五個單詞的統稱，正式名稱為「Acquisition」（獲取用戶）、「Activation」（活躍度）、「Retention」（留存度）、「Refer」（轉介）、「Revenue」（利潤）。</p><p>此五個階段是所有商戶行為的總結，由客戶開始進入網站頁面，到決定下單，再決定將服務轉介予其他人，然後再次獲取新的用戶。對於成長行銷而言，統計客戶於此五階段的各項數據，是所有行銷決策的最基本。</p><p>行銷漏斗亦只是概括了消費者的行為模式，以及能夠對應的行銷手法，但實際的行銷內容，如何說服於「衡量」階段的顧客？如何增強消費者的「意向」？根據各自的產品內容及商業性質，必須制定適合的行銷策略及分配行銷的資源。這樣才能有效命中消費者，將行銷回報最大化。</p><h3>介紹SEO 工具</h3><h4>1.SEO 檢測工具</h4><ul><li>Google 結構化測試工具</li><li><a href="https://welly.tw/serp-rank-optimization/what-is-rwd-and-how-to-use"><strong>行動裝置相容性</strong></a>測試工具、行動裝置載入速度測試</li><li>Check My Links</li><li>Safe Browsing Test</li><li>Web. Dev</li><li>Authorityspy</li><li>Redirect Path</li></ul><h4>2.SEO 網站健檢工具</h4><ul><li>Chrome Lighthouse</li><li><a href="https://welly.tw/serp-rank-optimization/how-to-improve-site-speed"><strong>Google Page Speed Insights</strong></a>（PSI）</li><li>Moz Bar</li><li>GTmetrix</li><li><a href="https://welly.tw/serp-rank-optimization/screaming-frog-introduction-and-user-guide"><strong>Screaming Frog</strong></a></li></ul><h4>3.關鍵字工具</h4><ul><li><a href="https://welly.tw/serp-rank-optimization/ahrefs-introduction-and-user-guide"><strong>Ahrefs</strong></a></li><li><a href="https://welly.tw/serp-rank-optimization/ubersuggest"><strong>Ubersuggest</strong></a></li><li>Keyword Tool</li><li>WordStream</li></ul><h4>4.Google 關鍵字規劃工具</h4><ul><li><a href="https://welly.tw/serp-rank-optimization/google-keyword-planner"><strong>Google Ads</strong></a></li><li><a href="https://welly.tw/digital-marketing/google-trends"><strong>Google Trends</strong></a></li></ul><h4>5.關鍵字排名軟體</h4><ul><li>Rankware</li><li>Moz Keyword Explorer</li><li><a href="https://welly.tw/serp-rank-optimization/similarweb-introduction-and-user-guide"><strong>SimilarWeb</strong></a></li></ul><h4>6.SEO 排名工具</h4><ul><li><a href="https://welly.tw/digital-marketing/google-analytics-4"><strong>Google Analytics</strong></a></li><li><a href="https://welly.tw/serp-rank-optimization/how-to-use-google-search-console"><strong>Google Search Console</strong></a></li><li>Microsoft Clarity</li><li>Hotjar</li><li>SEOquake</li><li>SEMrush</li><li>Lipperhey</li><li>SimilarWeb</li></ul><h3>深入學習廣告投放</h3><p>實際工作人員:</p><p>行銷專員: 有 1–2 年廣告投放經驗，學習過基礎 FB 廣告或 Google 廣告操作</p><p>行銷主管: 對廣告投放有概念，想深入瞭解策略、優化與數據解讀的資深行銷人員或主管</p><p>學習曲線概括:</p><p><strong>Google 廣告基礎知識課程</strong></p><ul><li>廣告基礎知識入門</li><li>前期策劃-關鍵字廣告</li><li>廣告設定-關鍵字廣告</li><li>廣告設定-關鍵字廣告</li><li>廣告設定-YouTube 廣告</li><li>報告欄位的解釋</li></ul><p>Reference: GMA成長行銷訓練營</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd4764b2174c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python 必學之路 (資料結構)]]></title>
            <link>https://medium.com/@denisechendd/python-%E5%BF%85%E5%AD%B8%E4%B9%8B%E8%B7%AF-%E8%B3%87%E6%96%99%E7%B5%90%E6%A7%8B-b336c4505cc1?source=rss-ded151d987b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/b336c4505cc1</guid>
            <dc:creator><![CDATA[Denise Chen]]></dc:creator>
            <pubDate>Fri, 10 Jan 2025 13:01:56 GMT</pubDate>
            <atom:updated>2025-01-10T13:01:56.521Z</atom:updated>
            <content:encoded><![CDATA[<p>Python 程式會是接觸資料探勘和資料分析的基礎編成語言，倘若資料結構Stack 、Queue、Binary sorting、氣泡排序法、樹狀結構、資料庫調用還部會，這個文章將會帶你理解資料結構Python 基礎</p><p>寫一個刪除表中重複元素函數，去重後元素相對位置不變</p><pre>def dedup(items):<br>    no_dup_items = []<br>    seen = set()<br>    for item in items:<br>        if item not in seen:<br>            no_dup_items.append(item)<br>            seen.add(item)<br>    return no_dup_items</pre><p>Lambda函數是什麼，舉例說明它的應用場景</p><p>Lambda函數其實最主要的用途是把一個函數傳入另一个高階函數（如Python内置的filter、map等）中來為函數做解</p><pre>items = [12, 5, 7, 10, 8, 19]<br>items = list(map(lambda x: x ** 2, filter(lambda x: x % 2, items)))<br>print(items)    # [25, 49, 361]</pre><pre>items = [12, 5, 7, 10, 8, 19]<br>items = [x ** 2 for x in items if x % 2]<br>print(items)    # [25, 49, 361]</pre><p>正則表達式的match方法和search方法有什麼區別？</p><p>正則表達式是字符串處理的重要工具，所以也是面試中經常考察的知試點。在Python中，使用正則表達式有兩種方式，一種是直接調用re模塊中的函數，傳入正則表達式和需要處理的字符串；一種是先通过re模塊的compile函数創建正則表達式對象，然后再通過對象調用方法並傳入需要處理的字符串。如果一個正則表達式被频繁的使用，我们推薦用re.compile函數創建正則表達式對象，會减少頻繁編譯同一個正則表達式所造成的開銷。</p><p>match方法是从字符串的起始位置进行正则表达式匹配，返回Match对象或None。search方法会扫描整个字符串来找寻匹配的模式，同样也是返回Match对象或None。</p><p>用Python代碼實現Python内置函數max</p><p>因為Python内置的max函數既可以傳入可迭代對象找出最大，又可以傳入兩個或多個參數找出最大；最為關鍵的是還可以通過命名關键字参數key来指定一個用於元素比較的函數，還可以通過default命名關键字参數来指定當可迭代對象為空時返回的默認值。</p><pre>def my_max(*args, key=None, default=None):<br><br>if len(args) == 1 and len(args[0]) == 0:<br>        if default:<br>            return default<br>        else:<br>            raise ValueError(&#39;max() arg is an empty sequence&#39;)<br>    items = args[0] if len(args) == 1 else args<br>    max_elem, max_value = items[0], items[0]<br>    if key:<br>        max_value = key(max_value)<br>    for item in items:<br>        value = item<br>        if key:<br>            value = key(item)<br>        if value &gt; max_value:<br>            max_elem, max_value = item, value<br>    return max_elem</pre><p>輸入年月日，判斷这個日期是這一年的第幾天。</p><pre>def is_leap_year(year):<br>    &quot;&quot;&quot;判断指定的年份是不是闰年，平年返回False，闰年返回True&quot;&quot;&quot;<br>    return year % 4 == 0 and year % 100 != 0 or year % 400 == 0<br><br>def which_day(year, month, date):<br>    &quot;&quot;&quot;计算传入的日期是这一年的第几天&quot;&quot;&quot;<br>    # 用嵌套的列表保存平年和闰年每个月的天数<br>    days_of_month = [<br>        [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],<br>        [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]<br>    ]<br>    days = days_of_month[is_leap_year(year)][:month - 1]<br>    return sum(days) + date</pre><p>使用Python代碼實現遍歷一個文件夹的操作</p><pre>import os<br><br>g = os.walk(&#39;/Users/Hao/Downloads/&#39;)<br>for path, dir_list, file_list in g:<br>    for dir_name in dir_list:<br>        print(os.path.join(path, dir_name))<br>    for file_name in file_list:<br>        print(os.path.join(path, file_name))</pre><p>如果使用line_profiler三方工具，可以直接剖析is_prime函数每行代码的性能，需要给is_prime函数添加一个profiler装饰器，代码如下所示。</p><p>安装line_profiler ，使用line_profiler。</p><pre>pip install line_profiler<br>kernprof -lv example.py</pre><pre>@profiler<br>def is_prime(num):<br>    for factor in range(2, int(num ** 0.5) + 1):<br>        if num % factor == 0:<br>            return False<br>    return True</pre><h4>如何剖析Python代碼的執行性能？</h4><p>剖析代碼性能可以使用Python標準庫中的cProfile和pstats模塊，cProfile的run函數可以執行代碼並收集統計信息，創建出Stats打印簡單的剖析報告。Stats是pstats模塊中的類，它是一個统計對象。當然，也可以使用三方工具line_profiler和memory_profiler来剖析每一行代碼耗費的時間和内存，这兩個三方工具都會用非常友好的方式輸出剖析结構。如果使用PyCharm，可以利用“Run”菜單的“Profile”菜單項對代碼進行性能分析，PyCharm中可以用表格或者調用圖（Call Graph）的方式来顯示性能剖析的结果。</p><pre>&#39;&#39;&#39;example.py&#39;&#39;&#39;<br>import cProfile<br><br><br>def is_prime(num):<br>    for factor in range(2, int(num ** 0.5) + 1):<br>        if num % factor == 0:<br>            return False<br>    return True<br><br><br>class PrimeIter:<br><br>    def __init__(self, total):<br>        self.counter = 0<br>        self.current = 1<br>        self.total = total<br><br>    def __iter__(self):<br>        return self<br><br>    def __next__(self):<br>        if self.counter &lt; self.total:<br>            self.current += 1<br>            while not is_prime(self.current):<br>                self.current += 1<br>            self.counter += 1<br>            return self.current<br>        raise StopIteration()<br><br><br>cProfile.run(&#39;list(PrimeIter(10000))&#39;)</pre><p>Python 字符串表達式</p><pre>x = f&#39;名称: {name}; 分数: {n}&#39;<br>x = &#39;%s, %s!&#39; % (imperative, expletive)<br>x = &#39;{}, {}&#39;.format(first, second)<br>x = &#39;名称: %s; 分数: %d&#39; % (name, n)<br>x = &#39;名称: %(name)s; 分数: %(score)d&#39; % {&#39;name&#39;:name, &#39;score&#39;:n}<br>x = &#39;名称: {}; 分数: {}&#39;.format(name, n)<br>x = a + b</pre><p>模塊名: module_name; 包名: package_name; 類名: ClassName; 方法名: method_name; 異常名: ExceptionName; 函數名: function_name, query_proper_noun_for_thing, send_acronym_via_https; 全局常量名: GLOBAL_CONSTANT_NAME ; 全局遍量名: global_var_name; 實例名: instance_var_name; 函數参數名: function_parameter_name; 局部變量名: local_var_name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*63IOaZYTIkcRKxibaXQFOg.png" /></figure><p>一个<a href="https://baike.baidu.com/item/%E8%A1%A8%E8%BE%BE%E5%BC%8F/7655228?fromModule=lemma_inlink">表達式</a>E的後缀形式可以如下定義：</p><p>（1）如果E是一个变量或常量，则E的<a href="https://baike.baidu.com/item/%E5%90%8E%E7%BC%80%E5%BC%8F/3198638?fromModule=lemma_inlink">后缀式</a>是E本身。</p><p>（2）如果E是E1 op E2形式的表達式，这里op是任何二元<a href="https://baike.baidu.com/item/%E6%93%8D%E4%BD%9C%E7%AC%A6/8978896?fromModule=lemma_inlink">操作符</a>，则E的后缀式为E1&#39;E2&#39; op，这里E1&#39;和E2&#39;分别为E1和E2的後缀式。</p><p>（3）如果E是（E1）形式的表達式，则E1的後缀式就是E的後缀式。</p><p>如：我們平时寫a+b，这是<a href="https://baike.baidu.com/item/%E4%B8%AD%E7%BC%80%E8%A1%A8%E8%BE%BE%E5%BC%8F/2725244?fromModule=lemma_inlink">中缀表达式</a>，寫成后缀表達式就是：ab+</p><p>(a+b)*c-(a+b)/e的後缀表達式為：</p><p>(a+b)*c-(a+b)/e</p><p>→((a+b)*c)((a+b)/e)-</p><p>→((a+b)c*)((a+b)e/)-</p><p>→(ab+c*)(ab+e/)-</p><p>→ab+c*ab+e/-</p><p>資料結構參考資料: <a href="https://baike.baidu.com/item/%E9%80%86%E6%B3%A2%E5%85%B0%E5%BC%8F/128437">逆波兰式_百度百科</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b336c4505cc1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[產品經理能力地圖 + 技能評估]]></title>
            <link>https://medium.com/@denisechendd/%E7%94%A2%E5%93%81%E7%B6%93%E7%90%86%E8%83%BD%E5%8A%9B%E5%9C%B0%E5%9C%96-%E6%8A%80%E8%83%BD%E8%A9%95%E4%BC%B0-9bb31f40a212?source=rss-ded151d987b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bb31f40a212</guid>
            <dc:creator><![CDATA[Denise Chen]]></dc:creator>
            <pubDate>Tue, 31 Dec 2024 01:32:04 GMT</pubDate>
            <atom:updated>2024-12-31T01:32:04.358Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*4QihkClT1E6YUvznY-sZng.png" /></figure><p>舉凡個人網頁經營、知識管理平台、電子商務網站以及公司形象網站，放在 Google 搜尋引擎中進行優化，目的是提升產品觸及率與品牌曝光度。同時，為了讓使用者能在網站上輕鬆操作，並透過網頁的曝光帶動會員經營與行銷活動，電子行銷與網頁設計的規劃便顯得至關重要。而這一切背後的核心，便是產品經理。產品經理負責規劃產品的開發流程，並協調執行各項工作。他們不僅需具備設計流暢工作流程的能力，還需清楚列出具體的待辦事項，並結合專案開發流程，打造一套高效的專業工作流。本文將詳細介紹產品經理應具備的核心能力，並解析一個專案成功所需的技能組合，讓讀者能更深入理解產品經理在整體開發與執行過程中的角色與價值。</p><p>策略：策略是一組相互配合並相互增強的整合選擇。它涉及到下注，並允許你在你選擇的競技場上獲勝。重要的是，它應該解釋為什麼（“獲勝的願景”），並且難以複製（“不能/不會”測試）。（我最近發現我的“產品策略畫布”在谷歌上排名第一。）</p><p>商業模式：商業模式可以被視為公司運營的藍圖。它關乎你在銷售什麼、你的成本，以及你計劃如何賺錢。它應該嵌入在你的戰略選擇中，比如市場和價值主張。但它並不相同。</p><p>1. 產品管理核心技能</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jcK5Yt_fDlauTXwP.png" /></figure><ol><li>1 商業和策略</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/0*Qk5-lDgL2YXP30pd.png" /><figcaption>來源出於:<a href="https://www.productcompass.pm/">The Product Compass</a></figcaption></figure><p>策略是一組幫助你在選定市場中獲勝的選擇。它定義了願景、市場、價值主張、權衡和增長模型等。它應該讓競爭對手難以模仿。需要了解以下四點</p><p>1 什麼是策略，什麼不是。<br>2 像SWOT、PESTLE和波特五力模型這樣的模型。<br>3 市場規模指標，如TAM、SAM和SOM。<br>4 如何制定商業模型以概述您的公司將如何賺錢。這通常是通過商業模型畫布或精益模型畫布來完成的。</p><h4>1.2 執行是策略轉化為行動的階段</h4><p>當轉換成執行步驟須了解以下三點</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/0*Ch-Fq81MhiG4Zbl4.png" /><figcaption>來源出於:<a href="https://www.productcompass.pm/">The Product Compass</a></figcaption></figure><p>1 設定目標和衡量結果的目標與關鍵結果（OKRs）。<br>2 優先排序、做決策和管理風險的技術。<br>3 像敏捷、精益和DevOps這樣的方法。</p><p>學習如何制定強大的產品願景和策略。(根據以下項目，可以列出產品經理需要經營的細項) 例如:獲取 #1 產品策略畫布（Google）和專用的 Notion 模板。以戰略背景引導您的授權產品團隊。在實踐中應用目標和關鍵結果（OKRs）。</p><h4>1.3 人力資源</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/0*tX0b3_NUJmU8pHo5.png" /></figure><p>領導力涉及在沒有權威的情況下激勵、影響和指導他人。作為一名領導者，您應該了解如何：</p><p>1 以願景激勵。<br>2 以戰略背景引導，讓團隊成員理解工作的重要性及其與戰略的對齊。<br>3 這使他們能夠做出更好的自主決策。<br>4 建立基於信任和心理安全的文化。獲得支持並解決衝突。</p><h4>1.4 數據分析</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/0*mtcQQ1RC9ofcrbz_.png" /></figure><p>數據分析是數據驅動產品管理的基石。你應該知道：<br>1 像北極星框架和關鍵指標這樣的框架，以便你可以專注於少數幾個關鍵指標。<br>2 其他技術如客戶細分、漏斗分析、熱圖和會話錄製，以獲取有關用戶行為的額外見解。<br>3 如何閱讀數據並提取關鍵見解。數據分析是一個比產品分析更廣泛的概念，包括分析來自其他來源的數據（例如，CRM、交易數據）。</p><h4>1.5 產品探索</h4><p>‘Product Discovery’ 是一個產品管理過程中的重要階段，旨在確定用戶需求和市場機會。這個過程通常包括用戶研究、原型設計和測試，以確保所開發的產品能夠滿足目標用戶的需求</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/0*2-qmka1NlncT_TqY.png" /></figure><p>1 探索問題空間以理解和定義機會（問題、需求、渴望），<br>2 探索解決方案空間以腦力激盪可能的解決方案，制定可測試的假設，並計劃實驗以證明或駁斥這些假設。<br>3 識別有關價值、可用性、可行性、可持續性和倫理的高風險假設，以便在實施之前解決它們。<br>4 與新產品和現有產品一起工作。</p><h4>1.6 實驗</h4><p>‘Experimentation’ 指的是進行實驗的過程，通常用於科學研究或產品開發中，以測試假設、驗證理論或探索新概念。在產品管理的背景下，’實驗’可能涉及測試不同的產品功能、用戶體驗或市場策略，以收集數據並做出基於證據的決策。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/0*Blhp74cv0fjTscSW.png" /></figure><p>實驗用於驗證假設可跟著以下觀點:<br>1 不同類型的 MVP 原型（或稱「Pretotypes」）幫助您在早期階段驗證產品想法，特別是市場參與假設。<br>2 用戶原型及其在實驗中的使用方法，如首次點擊測試、卡片分類、5 秒測試等，以評估特定功能的價值和可用性。<br>3 其他方法如 A/B 測試和多變量測試，以獲取有關變更如何影響您的指標的統計數據。</p><h4>1.7 產品行銷</h4><p>‘Product Marketing’ 是指針對特定產品的市場推廣活動，旨在提高產品的知名度、吸引目標客戶並促進銷售。這一領域通常涉及市場研究、產品定位、定價策略、推廣活動及銷售支持等多個方面</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/0*4ak6xpypee6NlPog.png" /></figure><p>「產品經理專注於產品方面，而產品行銷人員則專注於市場方面，包括進入市場策略。」 — — Martina Lauchengco</p><p>為了達成產品行銷的目標，跟著以下方式並執行可行的行銷策略</p><p>1 如何傳達您產品的價值。<br>2 如何準備和執行市場推廣策略。<br>3 如何使銷售和合作夥伴能夠傳播消息。</p><h4>1.8 產品增長</h4><p>產品的增長或發展，通常指銷售、用戶數量或市場佔有率的提升。‘Product Growth’ 是一個商業術語，通常用於描述一個產品在市場上的表現和增長潛力。這包括了產品的銷售增長、用戶基礎的擴大以及市場佔有率的提升。產品成長的策略可能涉及市場推廣、用戶體驗的改善、功能的增強等</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/0*sVx6BY4-HioBpfOW.png" /></figure><h4>2 價值主張</h4><p>對於每個市場細分（角色和待完成的任務），定義： 之前：現有的問題狀態（例如，在 Excel 中維護任務） 如何：改變情況的特徵和能力（例如，看板） 之後：好處和結果（例如，組織良好的任務，具有明確的截止日期，生產力提高） 替代方案：您的獨特價值、獨特屬性，以及可選的相對定價與競爭對手和替代品（通常表示為價值曲線）。</p><h4>如何達成產品市場契合？</h4><p>市場研究是收集和綜合有關市場和競爭環境的信息，市場研究技術的分類，傳統上，市場研究技術分為兩個主要類別: <br>1 初級市場研究技術 — 您自己收集的數據。這可以被視為您的數據<br>2 次級市場研究技術 — 基於他人收集的數據。它可以被視為他人數據（ODP）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/0*8H6k0ujH2ojKou0Z.png" /><figcaption>market research skill</figcaption></figure><p>我們可以根據市場研究技術的目標來進行分類:</p><p>探索問題 — 收集和彙總有關行業、競爭對手和客戶的信息的技術。</p><p>驗證想法 — 驗證與價值主張、定位、定價或產品功能的價值和可用性相關的想法的技術（即實驗）。</p><p>在驗證你的想法時，你必須使用原始市場研究（YODA），並需要用數字表達的假設和具體的衡量指標，因此需要定量數據。態度數據不足，還需要行為數據。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zJ6TWRrOEl5Wqw-X.png" /></figure><h4>3 商業模型</h4><h4>成本結構</h4><p>你的成本將會是什麼？ 考慮租金、硬體、許可證、技術、行銷、訂閱和薪水等項目。 其中哪些是經常性成本？隨著你的業務增長，它們將如何擴展？ 收入來源</p><p>你希望從每個渠道獲得多少錢？ 你打算如何定價你的產品？你是追求滲透定價、基於價值的定價、競爭定價還是基於使用的定價？你考慮過SaaS嗎？ 你的收入模型是否可擴展？最大的不確定性和風險是什麼？</p><p>ppt 參考檔案: <a href="https://www.productcompass.pm/p/product-strategy-canvas">https://www.productcompass.pm/p/product-strategy-canvas</a></p><p>AI 產品經理簡介: <a href="https://www.productcompass.pm/p/introduction-to-ai-product-management">https://www.productcompass.pm/p/introduction-to-ai-product-management</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bb31f40a212" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Newbie C++ 運算符號]]></title>
            <link>https://medium.com/@denisechendd/newbie-c-%E9%81%8B%E7%AE%97%E7%AC%A6%E8%99%9F-fd0f95acbf9a?source=rss-ded151d987b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd0f95acbf9a</guid>
            <dc:creator><![CDATA[Denise Chen]]></dc:creator>
            <pubDate>Wed, 11 Dec 2024 01:02:15 GMT</pubDate>
            <atom:updated>2024-12-11T01:02:15.502Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fepLBxBh8Wg03RNTPCPl9w.png" /></figure><h3>The Ternary Conditional Operator:三元運算符號</h3><p>三元條件運算式子是Ｃ＋＋中強大運算工具，他提供編寫條件簡答表達式運算方法</p><h3>What is the conditional operator?</h3><p>條件運算子是ｃ＋＋中唯一運算符，這表示他需要３個運算元，他通常被稱為＂３元運算子＂或＂條件運算子＂，此運算子評估條件是並根據條件是ｔｒｕｅ或ｆａｌｓｅ傳回兩個值之一，三元條件運算子語法是：</p><pre>condition ? expression1 : expression2;</pre><ul><li>condition: 計算表達式</li><li>expression1: 條件為ｔｒｕｅ傳回的值.</li><li>expression2: 條件為ｆａｌｓｅ傳回的值</li></ul><h4>Basic Usage</h4><p>三元運算子可用來簡化條件賦值和回傳值，以下為基本範例</p><pre>#include &lt;iostream&gt;<br>#include &lt;string&gt;<br><br>int main(){<br>    int score = 85;<br>    std::string result = (score &gt;= 50) ? &quot;Pass&quot; : &quot;Fail&quot;;<br><br>    std::cout &lt;&lt; &quot;Result: &quot; &lt;&lt; result &lt;&lt; std::endl;<br><br>    return 0;<br>}</pre><p>在經常需要快速、簡潔表達方式下，三元運算子特別有用，</p><p>範例１：確定玩家狀態<br>讓我們考慮這樣１種情況，您想要根據玩家的生命值確定玩家是 “活著”還是 “死亡”</p><pre>#include &lt;iostream&gt;<br>#include &lt;string&gt;<br><br>int main(){<br>    int health = 0;<br>    std::string status = (health &gt; 0) ? &quot;Alive&quot; : &quot;Dead&quot;;<br><br>    std::cout &lt;&lt; &quot;Player is &quot; &lt;&lt; status &lt;&lt; std::endl;<br><br>    return 0;<br>}</pre><p>在此範例中，三元運算子評估玩家的值，並根據 status的值將「Alive」或「Dead」指派給字串</p><p>範例2：設定遊戲難度級別<br>假設您想根據玩家的選擇設定難度等級：</p><pre>#include &lt;iostream&gt;<br>#include &lt;string&gt;<br><br>int main(){<br>    int choice = 2; // 1 for easy, 2 for medium, 3 for hard<br>    std::string difficulty = (choice == 1) ? &quot;Easy&quot; : (choice == 2) ? &quot;Medium&quot; : &quot;Hard&quot;;<br><br>    std::cout &lt;&lt; &quot;Difficulty Level: &quot; &lt;&lt; difficulty &lt;&lt; std::endl;<br><br>    return 0;<br>}</pre><p>在這裡，三元運算子用於根據玩家的選擇選擇三個可能的難度等級之一。</p><p>範例 3：顯示排行榜位置<br>考慮一個場景，您想要使用正確的序數後綴顯示玩家在排行榜上的位置：</p><pre>#include &lt;iostream&gt;<br>#include &lt;string&gt;<br><br>int main(){<br>    int position = 1;<br>    std::string suffix = (position == 1) ? &quot;st&quot; : (position == 2) ? &quot;nd&quot; : (position == 3) ? &quot;rd&quot; : &quot;th&quot;;<br><br>    std::cout &lt;&lt; &quot;Position: &quot; &lt;&lt; position &lt;&lt; suffix &lt;&lt; std::endl;<br><br>    return 0;<br>}</pre><p>需要考慮的最佳實踐方法：<br><strong>１用於簡單的表達</strong></p><p>避免在複雜的情況下或當它使程式碼難以理解時使用它。</p><pre>// Good use of the ternary operator<br>int score = 85;<br>std::string grade = (score &gt;= 90) ? &quot;A&quot; : &quot;B&quot;;<br><br>// Complex use that might reduce readability<br>std::string result = (a &gt; b) ? (b &gt; c ? &quot;B is in the middle&quot; : &quot;C is in the middle&quot;) : &quot;A is greater&quot;;</pre><p><strong>２為了清楚起見，使用括號<br></strong>添加括號可以幫助闡明邏輯的意圖，尤其是在涉及多個運算符的複雜表達式中</p><pre>#include &lt;iostream&gt;<br>#include &lt;string&gt;<br><br>int main(){<br>    int score = 75;<br>    int bonus = 10;<br>    std::string result = (score &gt; 80) ? &quot;Excellent&quot; : (score &gt; 60) ? (score + bonus &gt; 70 ? &quot;Good&quot; : &quot;Average&quot;) : &quot;Poor&quot;;<br><br>    std::cout &lt;&lt; &quot;Performance: &quot; &lt;&lt; result &lt;&lt; std::endl;<br> <br>    return 0;<br>}</pre><p>在此範例中，在 (score + bonus &gt; 70 ? &quot;Good&quot; : &quot;Average&quot;可提高可讀性，從而更容易理解嵌套的條件邏輯。雖然由於運算符優先順序而沒有括號，程式碼的功能相同，但添加它們可以澄清程式設計師的意圖，減少其他人誤解的機會。</p><h4>總結</h4><p>三元條件運算子是 C++ 中的通用且強大的功能，可讓您編寫簡潔的條件表達式。透過了解其語法和用例，您可以將其合併到您的專案中，以簡化程式碼並提高可讀性。</p><p>有關三元運算符的更多詳細信息，請訪問<a href="https://en.cppreference.com/w/cpp/language/operator_other#Conditional_operator">cppreference.com 關於條件運算符的頁面</a></p><h4>完</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd0f95acbf9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Newbie to C++ Programming]]></title>
            <link>https://medium.com/@denisechendd/newbie-to-c-programming-07da5c43fb74?source=rss-ded151d987b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/07da5c43fb74</guid>
            <dc:creator><![CDATA[Denise Chen]]></dc:creator>
            <pubDate>Tue, 10 Dec 2024 07:31:38 GMT</pubDate>
            <atom:updated>2024-12-10T07:31:38.415Z</atom:updated>
            <content:encoded><![CDATA[<h4>what pointers are, how they work, and how to use them with variables and objects</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*rLFJMnZlDiWROZDHOeD7AQ.png" /><figcaption>Picture from <a href="https://www.fiverr.com/">https://www.fiverr.com/</a></figcaption></figure><h4><strong>Understanding the Memory Model</strong></h4><p>C++ gives you direct control over memory, which is both a strength and a responsibility. To understand why pointers are important, you need to grasp the basic memory model of a C++ program, which consists of two main areas: the stack and the heap.</p><h3>The stack</h3><p>The stack is a region of memory that stores automatic variables, function parameters, and return addresses. It’s organized in a last-in, first-out (LIFO) manner, meaning that the last item added to the stack is the first one removed. The stack is fast and efficient but limited in size.<br>When you declare a variable inside a function, it is typically allocated on the stack. These variables are automatically managed, meaning they are created when the function is called and destroyed when the function exits.</p><h3>The heap</h3><p>The heap is a larger, more flexible region of memory used for dynamic memory allocation. Unlike the stack, memory on the heap is manually managed. You allocate memory on the heap using the new operator and deallocate it using delete.</p><p><strong>Cons: flexibility Managing heap memory requires careful attention to avoid memory leaks and dangling pointers.</strong></p><h3>Scope and Automatic Variables</h3><p>Scope refers to the region of a program where a variable is accessible. In C++, a variable’s scope is typically defined by the block in which it is declared, such as a function, loop, or conditional statement</p><pre>#include &lt;iostream&gt;<br><br>void createMonster() {<br>    int health = 100; // Health is an automatic variable<br>    std::cout &lt;&lt; &quot;Monster&#39;s health: &quot; &lt;&lt; health &lt;&lt; std::endl;<br>} // Health is destroyed here<br><br>int main(){<br>    createMonster();<br>    // Attempting to access health here would result in an error<br>    return 0;<br>}</pre><p>the health variable is created when createMonster is called and destroyed when the function exits. If you need the health variable to persist after createMonster returns, you would need to allocate it dynamically on the heap.</p><h3>Example: Creating persistent objects</h3><pre>#include &lt;iostream&gt;<br><br>struct Character {<br>    int health;<br>    int strength;<br>};<br><br>Character* createCharacter(int health, int strength) {<br>    Character* newCharacter = new Character; // Allocate on the heap<br>    newCharacter-&gt;health = health;<br>    newCharacter-&gt;strength = strength;<br>    return newCharacter; // Return pointer to heap-allocated object<br>}<br><br>int main(){<br>    Character* hero = createCharacter(100, 50);<br>    std::cout &lt;&lt; &quot;Hero&#39;s health: &quot; &lt;&lt; hero-&gt;health &lt;&lt; std::endl;<br>    std::cout &lt;&lt; &quot;Hero&#39;s strength: &quot; &lt;&lt; hero-&gt;strength &lt;&lt; std::endl;<br>    delete hero; // Free the allocated memory<br>    return 0;<br>}</pre><p>the createCharacter function dynamically allocates a Character on the heap and returns a pointer to it. The hero object persists beyond the function&#39;s scope, allowing you to access and modify it in main</p><h3>Conclusion</h3><p>Pointers are necessary because they allow you to:</p><ol><li><strong>Access Dynamic Memory</strong>: Pointers are the only way to access memory allocated on the heap. This is important for creating data structures and objects that need to persist beyond the lifetime of a function.</li><li><strong>Implement Complex Data Structures</strong>: Many data structures, such as linked lists, trees, and graphs, rely on dynamically allocated data and pointers to link nodes together.</li><li><strong>Share and Modify Data</strong>: Pointers allow functions to share and modify data across different parts of a program, enabling more modular and flexible code.</li></ol><h3>End</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=07da5c43fb74" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[如何用Python爬取資料]]></title>
            <link>https://medium.com/@denisechendd/%E5%A6%82%E4%BD%95%E7%94%A8python%E7%88%AC%E5%8F%96%E8%B3%87%E6%96%99-bf39a7e95bb2?source=rss-ded151d987b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf39a7e95bb2</guid>
            <dc:creator><![CDATA[Denise Chen]]></dc:creator>
            <pubDate>Fri, 21 Jun 2024 10:01:19 GMT</pubDate>
            <atom:updated>2024-07-03T02:54:07.991Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/940/0*cNNc7NnYvpOXFB8Q.png" /><figcaption>出自於:<a href="https://cdn-images-1.medium.com/max/1000/0*cNNc7NnYvpOXFB8Q.png">https://cdn-images-1.medium.com/max/1000/0*cNNc7NnYvpOXFB8Q.png</a></figcaption></figure><p>網路爬蟲分成靜態網頁爬取和動態網頁爬取，爬蟲的基本觀念</p><blockquote><strong>請求 (Requests)</strong>：向網站發送HTTP請求，獲取網頁數據。</blockquote><blockquote><strong>解析 (Parsing)</strong>：解析網頁內容，通常是HTML或JSON格式。</blockquote><blockquote><strong>數據提取 (Data Extraction)</strong>：從解析後的數據中提取有用資訊。</blockquote><blockquote><strong>數據儲存 (Data Storage)</strong>：將提取的數據保存在檔案或數據庫中。</blockquote><p>網路爬蟲是一種廣泛應用於數據收集的工具，在著手編寫爬蟲程式之前，首先需要對目標網站的架構進行詳細分析，對網站的基本知識，特別是HTML結構與HTTP通訊協定的理解</p><h4>靜態網頁</h4><p>常用Python爬蟲工具有Requests(用於發送HTTP請求)、Beautiful Soup(用於解析HTML和XML文件的庫，適合網頁爬取)、Selenium(自動化網頁操作工具、適合處理Javascript交互網頁)<br>1.使用者(Client Side)發出請求，稱為Reuqest<br>2. 伺服器(Server Side)收到請求，根據請求的回應。稱為Response<br>3. 產生的回應是純資料，屬於API的一種，若是網頁的話，會回傳一個包含HTML標籤的網頁格式<br>4. 瀏覽器會接收包含HTML標籤的網頁格式，呈現網頁給使用者<br>網路爬蟲，是模擬使用者的行為，把資料做一個攔截動作<br>[模擬 Request] [攔截 Response] [從Response整理資料] [done]</p><h3>網頁組成</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*l6s52PLTOZ-AoT76.png" /><figcaption>出自於:<a href="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRTL0LA3TFC1RXlCc-OsmHKBSyD8wn7ztvTQS_23VdB3FXDVWik">https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRTL0LA3TFC1RXlCc-OsmHKBSyD8wn7ztvTQS_23VdB3FXDVWik</a></figcaption></figure><p>網站的HTML（超文本標記語言）是用於建立和設計網頁的標準標記語言。它使用各種標籤來定義網頁的結構和內容。</p><ol><li>&lt;!DOCTYPE html&gt;：聲明文檔類型，告訴瀏覽器這是一個HTML5文檔。</li><li>&lt;html&gt;：這個標籤包圍了整個HTML文檔的所有內容。</li><li>&lt;head&gt;：包含了文檔的元數據，如標題、鏈接到樣式表和腳本的引用。</li><li>&lt;title&gt;：定義了網頁的標題，這個標題會顯示在瀏覽器的標籤欄中。</li><li>&lt;body&gt;：包含了網頁的主要可見內容，如文本、圖片、連結、列表等。</li><li>&lt;h1&gt; 到 &lt;h6&gt;：這些是標題標籤，用於定義文檔中的標題。&lt;h1&gt; 是最高級別的標題。</li><li>&lt;p&gt;：段落標籤，用於定義文本的段落。</li><li>&lt;a&gt;：錨點標籤，用於創建超鏈接。</li><li>&lt;img&gt;：圖片標籤，用於在網頁上嵌入圖片。</li><li>&lt;ul&gt;、&lt;ol&gt;、&lt;li&gt;：分別用於創建無序列表、有序列表和列表項目。</li></ol><p>一個基礎的HTML網頁範例包含了標準的結構元素，如下所示：</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>    &lt;title&gt;我的網頁標題&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;h1&gt;我的第一個標題&lt;/h1&gt;<br>    &lt;p&gt;我的第一段文字。&lt;/p&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><h4>Python Selenium 靜態網頁抓取</h4><p>1.id定位：find_element_by_id(self, id_)<br>2.name定位：find_element_by_name(self, name)<br>3.class定位：find_element_by_class_name(self, name)<br>4.tag定位：find_element_by_tag_name(self, name)<br>5.link定位：find_element_by_link_text(self, link_text)<br>6.partial_link定位find_element_by_partial_link_text(self, link_text)<br>7.xpath定位：find_element_by_xpath(self, xpath)<br>8.css定位：find_element_by_css_selector(self, css_selector）</p><p>動態網頁爬取有專爬社群網頁、電商網頁和報社媒體的網頁等， Ajax網頁就是動態網頁之一，例如爬取國外網頁需要用到VPN去連線才能瀏覽網頁，</p><blockquote>例如到https://www.sunglasshut.com/網頁，游標開啟網頁inspector並放到Network/XHR/，要查看 ＵＲＬ網址回傳有包含字串符號<br><em>if (“v1/search/assets?” in response.url)，愈是找json 的資料可以用一些爬蟲的應用程式爬取例如Insomnia和</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*NAgZjiyUu0ZiLiO_.png" /><figcaption>Zillow網頁爬蟲</figcaption></figure><p>動態爬蟲還可以用webdriver自動登入</p><h3>參考資料：</h3><ol><li>一般靜態網頁爬蟲可以參考：<a href="https://www.zenrows.com/blog/mastering-web-scraping-in-python-from-zero-to-hero#conclusion">https://www.zenrows.com/blog/mastering-web-scraping-in-python-from-zero-to-hero#conclusion</a></li><li>Python 爬蟲:Requests模組: <a href="https://techmasters.tw/python-crawler/">https://techmasters.tw/python-crawler/</a></li><li>自動化產生爬蟲測試報告: <a href="https://hackmd.io/@FortesHuang/S1V6jrvet#%E5%AE%8C%E6%95%B4CODE%E7%AF%84%E4%BE%8B">https://hackmd.io/@FortesHuang/S1V6jrvet#%E5%AE%8C%E6%95%B4CODE%E7%AF%84%E4%BE%8B</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf39a7e95bb2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[英國留學生分享 — — Nina]]></title>
            <link>https://medium.com/@denisechendd/%E8%8B%B1%E5%9C%8B%E7%95%99%E5%AD%B8%E7%94%9F%E5%88%86%E4%BA%AB-nina-a4033b05c460?source=rss-ded151d987b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4033b05c460</guid>
            <category><![CDATA[marketing]]></category>
            <dc:creator><![CDATA[Denise Chen]]></dc:creator>
            <pubDate>Wed, 04 Oct 2023 09:41:03 GMT</pubDate>
            <atom:updated>2023-10-04T09:41:03.975Z</atom:updated>
            <content:encoded><![CDATA[<h3>英國留學生分享 — — Nina</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/0*w2LMRks-kRthRTNJ.png" /></figure><p>在中央大學讀英美語文學系的學姊nina Liu，從大學時期就喜歡國外電影、性別議題和國外研究等，逐漸接觸西洋文化和歌手，對於國際議題的研究可以培養個人思考能力和職涯規劃，有在大學時期做過實習並得到正向經驗，並很幸運得錄取廣告人、行銷人心目中的第一志願 — 奧美 Ogilvy Taiwan，他介紹了奧美集團「in-house」以及「agency」兩種不同形式的部門編制，在廣告代理商實習時可以接觸到不同產業的專案，面對高強度的工作環境並快速累積自己的產業經驗，之後因為個人規劃和在實習時遇到機會使她決定到國外念研究所，於是大四開始準備科系研究、校友聯繫、 IELTS 、 留學文件等，預計用兩年的時間申請到理想的校系並出國唸書。</p><p>針對Nina學姊分享：公關會負責內容編排、活動籌備、媒體聯繫，經由實習經驗她分享了廣告代理產業的行銷人員會常接觸品牌專案，也在廣告商品牌裡累積與人交流能力，國家部分從台灣學生排名一、二名的留學地點 — 美國以及英國中做出決定，英國普遍一年制的學程相較來說會比較符合當前的職涯規劃以及預算，所以我所申請的都是位於英國的學程，之後她到倫敦帝國學院學習策略行銷碩士。</p><p>學姊也分享了重要的留學職涯規劃，到國外工作都需要用到工作簽證，有分一年或兩年期，利用學生時期申請上的同時在 Coach 擔任 Part-Time Sales 賺取房租、生活費，另一方面在微軟新創加速器底下的 Startup — <a href="https://www.linkedin.com/company/wooju/about/">Wooju</a> 實習增加當地的工作經驗，過程中也發現自己的角色定位可能更適合於大型企業發展，因為個人規劃她放棄了國外的工作，回到台灣後她重新規劃，「舞台」跟「職能內容」對我來說會是兩個重點考量的因素。在產業部分如果目標是追求國際舞台，擁有跨國規模、總部設立在台灣的產業還是集中在科技業 ( Technology ) ，而職務內容則希望可以將碩士期間進修品牌策略 ( Brand Strategy ) 、 數位行銷 ( Digital Marketing ) 的優勢有所應用．之後他選擇到華碩 ( ASUS ) 作為職涯再出發的起點， Global Branding Campaign Cordinator 的任務分配也讓我可以充分的發揮自己的長才，在外商公司上班將它自身行銷技能應用在內部會議討論、在地化行銷 ( localized marketing ) 、追蹤成效、優化流程，並且完整經歷一個產品線的行銷週期</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*imTTcDsLz12rnVEWzA6O2Q.jpeg" /><figcaption>中央大學已畢業學姊Nina Liu</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4033b05c460" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>