ju peter
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    1
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    [![hackmd-github-sync-badge](https://hackmd.io/XK305SlCQ46_J6wvPl5sUg/badge)](https://hackmd.io/XK305SlCQ46_J6wvPl5sUg) <style> .emp {color:red} .info {color:green} details.part {color:#2471A3} </style> # 01.開發環境建置 <!-- ## Python安裝與架構介紹 --> {%hackmd yP_O7PiHTROviRgmcVI2Ig %} <!-- ## VScode基礎介紹 --> {%hackmd GF4QsVrjTjmFLJELtjDLWg %} ## 源代碼管理(Source code management;SCM) 源代碼管理 SCM 是一種管理軟體程式碼的系統。它可讓您儲存、組織和追蹤程式碼,並與其他開發人員協作。SCM 可幫助您避免程式碼衝突、追蹤程式碼變更並還原先前的版本。 SCM 也是版本控制(Version Control)的同義詞。 ### 演進脈絡 ``` mermaid graph TD classDef start fill:#dc9,stroke:#333; classDef concept fill:#f9f,stroke:#333; SCM(SCM:Source Code Management):::start RCS[RCS:Revision Control System] VCS{{VCS:Version Control System}}:::concept CVCS{{CVCS:Centralized VCS}}:::concept DVCS{{DVCS:Distributed VCS}}:::concept CVS[CVS:Concurrent Versions System] SVN[SVN:Subversion] SCM --> RCS & VCS VCS --> CVCS & DVCS CVCS --> CVS --> SVN DVCS --> Git & mercurial ``` - Revision Control System (RCS): RCS 是運作在單機上的版本控制系統。它是早期的版本控制系統,用於跟踪和管理單個檔案的歷史版本。每個檔案都有自己的 RCS 版本控制,並且運作在單一的本地機器上。 - Centralized VCS (集中式版本控制系統): Centralized VCS 運作在中央伺服器和區域網路上。在這種系統中,程式碼儲存在中央伺服器上,每位開發者在工作時需連線到中央伺服器進行操作。典型的例子是 Concurrent Versions System (CVS) 或 Subversion (SVN)。儘管中央伺服器在區域網路內運作,但它並不限於區域網路,可以在 WAN 網路上進行操作,但仍需要與中央伺服器保持連線。 - Distributed VCS (分散式版本控制系統): Distributed VCS 可以運作在區域網路或網際網路上。這是相對於集中式版本控制系統的進階版本。在 DVCS 中,每位開發者都擁有完整的程式碼儲存庫副本,可以在本地工作而不需持續連線到中央伺服器。開發者可以離線進行工作並在完成後推送變更到遠端伺服器上。著名的 DVCS 實作是 Git 和 Mercurial。 ![](https://hackmd.io/_uploads/B17QYNIch.png) 目前最流行的分散式版本控制系統是 Git ,是 Linus Torvalds 在 2005 年為了管理 Linux 核心所創造。 <!-- ## Git 整體概念 --> {%hackmd LfLD8PHFRvWoTHy83Hvd9A %} <!-- ### Git for Windows --> {%hackmd wHAJnDOLSfWUXvVJv1zRkw %} <!-- ### GitHub Desktop --> {%hackmd vloW6LJHTN63uaV7gYzCUA %} <!-- ## Git 與 VScode 的整合 --> {%hackmd vxEAWN39Qo6AeRSxQ2ajEg %} :::success 更多的 Git 使用方式,請參考: - [Git 介紹與在 Windows 系統下安裝](https://progressbar.tw/posts/1) - [甚麼是 Git/Github?為什麼需要專案版本管理?](https://pythonviz.com/git/version-control-and-git-concepts/) ::: ## 如虎添翼 ### Windows 重要 Hotkey - Alt + Space > 快速搜尋 - Win + Space > 切換中文輸入法 - Win + P > 投影模式選擇 - Win + Print Screen > 截圖工具 - Shift + Win + 【left | right】 > 雙螢幕視窗切換 ### 第三方工具 - [Cmder](https://blog.miniasp.com/post/2015/09/27/Useful-tool-Cmder) > 具有 Linux 溫度的終端機程式,可取代內建的cmd 與 powershell,安裝 mini 版即可。若要與 VScode 結合請參考:[Seamless VS Code Integration](https://github.com/cmderdev/cmder/wiki/Seamless-VS-Code-Integration) - [WinMerge](https://winmerge.org/?lang=zh_tw) > 一套開放原始碼的視覺化文字比對與合併工具。當你需要在不同版本的文件之間快速地找出不同點,或是需要將被各自修改過的二份文件合併時使用。 - [grepWin](https://github.com/stefankueng/grepWin) > 可使用正規表示式進行檔案內容搜尋與取代的工具。 - [Ditto](https://ditto-cp.sourceforge.io/) > 補強 window 剪貼簿功能,使用者可以將複製的每個項目通通放在剪貼清單上,且隨時都可以作存取,而且不限於文字,圖片、HTML等其他格式。 - [Notepad++](https://notepad-plus-plus.org/downloads/) > 以C++所設計的純文字編輯軟體,開放原始碼、體積輕巧不佔系統記憶體,支援多分頁功能,完美取代微軟記事本!具有好用的中文搜尋取代、支援ANSI、UTF-8(支援檔首無BOM)、UCS-2...等格式的編譯及轉換。 - [PowerToys](https://learn.microsoft.com/zh-tw/windows/powertoys/) > Microsoft PowerToys是一組免費的系統工具軟體,由微軟為Windows作業系統上的系統管理員設計。這些程式為系統加入或變更了一些功能,並加入更多自訂選項以提高生產力。 - [WinSCP](https://winscp.net/) > WinSCP是在Windows中使用SSH的開放原始碼的圖形化SFTP用戶端。同時也支援SCP通訊協定。它主要的功能是安全的在電腦間傳輸檔案。 ### 線上工具 - [ChatGPT](https://chat.openai.com/) > OpenAI 的 AI 聊天機器人 - [Gemini](https://gemini.google.com/app) > Google 的 AI 聊天機器人 - [Claude](https://claude.ai/chats) > Anthropic 開發的聊天機器人(比ChatGPT強) - [Perplexity AI](https://www.perplexity.ai/) > AI 搜索引擎 - [CodePen](https://codepen.io/) > 線上前端編輯器(html/css/javascript) - [RegEx Testing](https://www.regextester.com/) > 線上測試正規表示式是否正確 - [URL Encoder, Decoder And JSON Formatter Tool](https://sites.google.com/view/url-encoder-decoder-extension/home) > 此為 Chrome 插件 可進行網址的 encoder/decorder 與 JSON 的美化與正規化 - [個資、姓名產生器](https://lab.sp88.com.tw/genall/) > 可提供最多 10000 個隨機產生個人資料,供測試之用 - [I Love IMG](https://www.iloveimg.com/zh-tw) > 批量線上處理影像檔,例如將任何格式轉為 jpg,或將 jpg 轉為任何格式 - [I Love PDF](https://www.ilovepdf.com/zh-tw) > 批量線上處理PDF檔 - [remove bg](https://www.remove.bg/zh-tw) > 線上去背 - [大陸台灣計算機術語對照表](https://zh.wikibooks.org/zh/%E5%A4%A7%E9%99%86%E5%8F%B0%E6%B9%BE%E8%AE%A1%E7%AE%97%E6%9C%BA%E6%9C%AF%E8%AF%AD%E5%AF%B9%E7%85%A7%E8%A1%A8) ## 回家作業 請於 10/6 24:00 以前完成以下二項版控作業,並將對應的 GitHub 專案網址上傳表單:https://forms.gle/a8UmgJks4kV6AzLKA <!-- https://forms.gle/QSj1449nBNqPHFbG6 --> ### 1. 版控實作 請使用命令提示字元在本機建立一個專案:BMIcalc,並以指令呼叫 VScode 開啟資料夾,新增 app.py 並輸入程式碼如下 ```python= height = int(input("Please input your height:")) weight = int(input("Please input your weight:")) bmi = weight / (height / 100) ** 2 print("your height:"+str(height)) ``` 執行上述程式碼無誤後,請完成 GitHub 的版控專案推送(使用 GitHub Desktop 進行),內容必須完整(包含專案的描述與 .gitignore/README.md... 等4個檔案),repo 的能見度須為 public。 完成上述版控後,再到 VScode 修改程式碼,增加以下 3 行(最後一行必須是空行) ```python=5 print("your weight:"+str(weight)) print("your bmi:"+str(round(bmi,2))) ``` 執行上述程式碼無誤後,再請增加工作區設定(.vscode\settings.json),可參考講義的 VScode 基礎介紹、環境設定一節的內容,然後進行第 2 次版控作業(使用 VScode 進行 git add/commit/push) 完成上述版控後,再修改 .gitignore 檔案,增加以下2行 ``` # 忽略 .vscode 目錄 .vscode ``` 但因為 .vscode 是在 .gitignore 排除之前就進入版控了,因此必須手動下達指令清除本機 Git 的快取,請在 VScode 中按下 【Ctrl + `】 <span class="highlight">(令終端機開啟於專案目錄)</span>,輸入以下指令 ```bash git rm --cached -r .vscode/. ``` 完成上述動作後,請進行第 3 次版控作業(使用 VScode 進行 git add/commit/push) 最後將 GitHub 專案網址記錄下來。 ### 2. 收歸己用 請使用 GitHub Desktop 將專案 https://github.com/peterju/guessNum Clone 到自己的電腦,並進行以下動作 1. 刪除 .git 目錄(記得開啟隱藏檔的檢視權) 2. 調整程式碼,最後一行必須是空行 3. 執行程式碼,看看程式執行是否正常 4. 再請增加工作區設定(.vscode\settings.json) 5. 以 GitHub Desktop 增加專案的描述與 .gitignore/README.md... 等4個檔案,進行第一次版控並 publish 至 Github 6. 以 VScode 修改 .gitignore 排除 .vscode 目錄 7. 在 VScode 以指令排除版控追蹤 `git rm --cached -r .vscode/.` 8. 在 VScode 進行第2次的版控作業(進行 git add/commit/push) 上傳到自己的 GitHub,專案的能見度請設為 public,再將專案網址記錄下來。 老師會看你的專案是否有 About 描述、說明等4個檔案,commit 的次數與說明是否正確。 ps: - 來源專案未依照 github 建議設定該有的項目。 - 程式碼最後一行必須是空行是 PEP 8 建議的規範。 :::info .gitignore 只能忽略尚未被追蹤的檔案 (Untracked Files),也就是那些從來沒有被 Git 記錄過的檔案(從未經版控 add 及 commit 過的檔案)所以如果開發到一半才新增 .gitignore 或在 .gitignore 排除檔案與目錄以前,就已被加入 Git 版控的檔案會無法被排除。 要解決這個問題,除了版控開始前就設定好 .gitignore 的內容,像這種已經開始版控後才想到要排除的檔案與目錄,就必先清除 Git 對排除項目的快取(取消追蹤),再重新 git add 與 git commit 才能解決。 ::: ## 學習參考 - [官網教學文件](https://docs.python.org/zh-tw/3/tutorial/index.html) - [Python 入門教學課程](https://www.youtube.com/playlist?list=PL-g0fdC5RMboYEyt6QS2iLb_1m7QcgfHk) - [Python 專案開發入門的十堂課](https://www.youtube.com/watch?v=7Gqkq4R8DPE&list=PL9OF2bYpo7BPmgkStwEPKt2KQvNQV_uzs) - [Python - 100天從新手到大師(繁體中文)]( https://github.com/ateliershen/Python-100-Days-zh_TW) - [Git 和 GitHub 零基礎快速上手,輕鬆掌握版本控制的要訣!](https://www.youtube.com/watch?v=FKXRiAiQFiY) - [Git 版本管控](https://bwtit.gitbook.io/phpdev/ban-ben-guan-kong) - [Git忽略提交规则 - .gitignore配置运维总结](https://www.cnblogs.com/kevingrace/p/5690241.html) - [git取消文件跟踪](http://www.cnblogs.com/zhuchenglin/p/7128383.html) - [GitHub Flow 工作流程與實際演練](https://awdr74100.github.io/2020-05-11-git-githubflow/)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully