Home
JE Sharing
Cancel
Preview Image

Item 4 (1/2) - array of std (English)

c++ New Container Type: array Think C++’s array is too cumbersome? Like int[5], it doesn’t offer many member functions to assist coders. No worries, you can use std::array. When you need a fixed-...

Preview Image

Item 2 - range-based for loop (English)

range-based for loop In C++11, the range-based for loop was introduced, making it more convenient and intuitive to iterate over elements in a container. Let’s dive straight into the code #includ...

Preview Image

Item 1 - auto (English)

Auto In C++11, automatic type inference (using the auto keyword) allows the compiler to deduce the type of a variable based on the type of the initialization expression. This makes the code more c...

Preview Image

Item 2 - range-based for loop (中文)

range-based for loop C++11中引入了範圍for循環(range-based for loop),使得遍歷容器中的元素更加方便和直觀。 直接看 code #include <iostream> #include <vector> int main() { // 創建一個整數向量 std::vector<int>...

Preview Image

Item 1 - auto (中文)

Auto 在C++11中,自動類型推斷(auto關鍵字)允許編譯器根據初始化表達式的類型推斷變量的類型,這使得程式碼更加簡潔且容易理解 ,反正就compiler 已經知道是什麼型別了,你就可以不用去寫,符合人性(惰性);其實現在的 IDE 已經很強大了,滑鼠移過去就可以看到型別了。一直寫型別反而有礙閱讀。 直接看 code #include <iostream> #incl...

Preview Image

部屬 Django App 在 Docker 容器中(中文)

部屬 Django App 在 Docker 容器中 當我們在寫 Django 的時候,會使用以下 command 去做開發, python manage.py runserver Django 支援的內建 server 可以讓我們即時看到更改後的內容及錯誤,在開發階段十分重要。 但當我們完成開發後,需要部屬時至主機時,我們該如何設定 ? Django 官方特別註明不可使用內建 ...

Preview Image

Django 教學 (1) -- create project & app(中文)

如同之前docker+vscode的教學一般,現在我們要建立一個 Django 的環境。 step by step 需要 requirement.txt (DockerFile 內容可直接複製上面那篇教學即可,都大同小異) 環境建立後,使用 pip list 去看相關模組是否有被正確安裝 create project 之前的資料夾狀態 使用...

Preview Image

Django 教學 (0) -- 介紹 Django(中文)

Django Django: The web framework for perfectionists with deadlines 在時間壓力下(死線下),完美主義者使用的 web 框架。 Django 是一個用於構建 Web 應用程式的開發框架,它基於 Python 程式語言。 先解釋一下什麼是框架吧,在軟體開發中,一個框架(Framework)是一套預先定義的程式碼和工具的集合,...

Preview Image

網頁上播放音檔(中文)

文字轉音檔 ttsmaker 是一個免費的文字轉音檔的網站, 介面簡單明瞭且功能強大,可選擇轉換多種語言。 製作完音檔,與網頁放在一起 簡單的 html + javascript 即可完成 <div class="container"> <audio id="audioPlayer" controls> <source id...

Preview Image

Playing Audio Files on Web Pages(English)

Text-to-Speech Conversion ttsmaker s a free website for converting text to audio files. It features a simple and user-friendly interface, and supports multiple languages. Integrating Audio Fi...

Preview Image

Git 最清楚、最簡單教學(中文)

什麼人需要學版控 任何人!只要你的檔案需要修改、沒辦法一次就完成的,就需要使用 版控。應用範圍:論文(特別是遇到機車的教授)、code、大型報告…etc,若你的檔案還是需要多人 一起協同完成的,那你一定要用版控,人生寶貴,不要浪費時間在去管理版本。 Git 是一種分散式版本控制系統,它是一個用於跟蹤和管理代碼變更的工具。Git 的主要功能是記錄文件的歷史記錄,使多個開發者能夠協同工作,同時...

Preview Image

The Clearest and Simplest Git Tutorial(English)

Who Needs to Learn Version Control? Anyone! If your files need to be modified and can’t be completed in one go, you need version control. Applications include: theses (especially when dealing with...

Preview Image

透過指令把 FastAPI 程式放到 Cloud Run(2/2)(中文)

輸入指令 透過CMD指令進入eddie-fastapi-test資料夾 輸入指令 gcloud run deploy my-fastapi-app –source . 選 y 再來要選擇地區,選 1 再來Docker跟IMAGE都選 y 等執行結束就完成了 前往 Cloud Run 就可以看到 部屬好的服務 ...

Preview Image

透過指令把 FastAPI 程式放到 Cloud Run(1/2)(中文)

事前準備 建立資料夾例如 : eddie-fastapi-test,然後新增3個檔案,Dockerfile、requirements.txt、main.py Dockerfile FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9 # 將專案複製到容器中 COPY . /app # 安裝必要的套件 RUN pip insta...

Preview Image

Docker 使用 Jekyll 在 MAC 或 Windows(中文)

撰寫文章 --- 1.開啟 Terminal -> CD 到專案路徑 2-1.MAC : $ docker run --rm -v $PWD:/srv/jekyll jekyll/jekyll jekyll build 2-2.Windows : $ docker run --rm -v %CD%:/srv/jekyll jekyll/jekyll jekyll build ...

Preview Image

gcloud-CLI安裝(中文)

gcloud-CLI安裝 Windows 11 透過搜尋 PowerShell,接者點擊 Windows PowerShell 然後貼上 (New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "...

Preview Image

FastAPI (4) Validation Conditions(English)

Why We Need Validation Conditions As mentioned before, Type Hint can help prevent parameter type errors when calling an API. If there is a type error, the API will indicate which parameter has the...

Preview Image

FastAPI (4) Validation Conditions(中文)

為什麼需要 Validation Conditions 之前提到 Type Hint 可以幫助 我們 call API 時,防止參數 type 錯誤,一旦 type 錯誤 API 會回復哪個參數 type 錯誤。 這樣不是就很好了,幹嘛還要 Validation Conditions ? 有寫過 Unit Test 的人都知道,有時候 Function 出錯是因為傳入 type 正確但不合...

Preview Image

FastAPI (3) REST Architecture(English)

REST Architecture REST stands for Representational State Transfer, not rest architectureㄡ Its purpose is to facilitate the exchange of information between different software/programs over the net...

Preview Image

FastAPI (3) REST 架構(中文)

REST 架構 REST 是個縮寫,不是休息架構的意思,而是 Representational State Transfer,較多的翻譯為 “表現層狀態轉換” 目的是方便不同軟體/程式在網路上互相傳遞資訊。 好處 好處很多,這邊列出最具代表的好處。 簡單性:REST 架構風格採用了簡單的原則和約束,使其易於理解和實施。它使用 HTTP 協議中的標準方法(GET、POST、PUT、DE...

Preview Image

Andorid & iOS 網頁變成 app 的開啟方式(中文)

為什麼要將網頁變成 app 的開啟方式 網路上有許多有趣且重要的資訊,但是網頁的網址又臭又長,根本沒人會去記,大部分的人,光是記自己的帳號密碼都很吃力了,包含我自己,哈哈。 人的大腦記住圖片總是比記文字更快更準確,而大家在手機上已經習慣的 app 的開啟方式,將網頁變成 app 的開啟方式,可以事半功倍。 android 手機上 chrome 實測 點擊右上角的按鈕 ...

Preview Image

Opening Web Pages as Apps on Android & iOS(English)

Why turn web pages into app launch methods? There’s a lot of interesting and important information online, but web page URLs are often long and unwieldy, making them difficult to remember. Most pe...

Preview Image

FastAPI (2) Type Hint(English)

Type Hint Why are Type Hints important? Because Python is a dynamically typed language, meaning you don’t need to specify the type of parameters when writing a function. The type of the parameters...

Preview Image

FastAPI (2) Type Hint(中文)

Type Hint Type Hint 有什麼重要的 ? 因為 Python 是個動態類型語言(dynamically typed language),也就是你在寫 Function 時, 不需要指定參數是什麼型別,而是在執行階段動態被決定該參數是什麼型別,特點是動態類型檢查 (Dynamic Type Checking)、 遲綁定(Late Binding),有更大的靈活性,但是缺點是若...

Preview Image

FastAPI 介紹(1)(中文)

FastAPI 介紹 FastAPI 是一個現代的 Python 網絡應用程式框架,設計用於建立高性能的 Web API。開發超級快速而且自動產生文件(Yes ! 以後都不用再寫文件了),到底有多快,下面 5 行就有一個簡單的 Web API。 file name: test.py from fastapi import FastAPI app = FastAPI() @app.get(...

Preview Image

Introduction to FastAPI(1)(English)

Introduction to FastAPI FastAPI is a modern Python web framework designed for building high-performance web APIs. Development is super fast and it automatically generates documentation (Yes! No mo...

Preview Image

將網頁內容轉成 PDF(中文)

使用 xhtml2pdf 將內容轉成 PDF xhtml2pdf 是一個 Python 庫,用於將 HTML 文檔轉換為 PDF 文件。它使用 HTML 和 CSS 來創建高度自定義的 PDF文檔,這對於生成報告、文件、合同等內容豐富的PDF文件非常有用,根本就是神器! 為什麼要將網頁轉成 PDF 以下是一些閱讀紙本書的優點: 觸感和香氣(真的,我就很喜歡舊書的味道 XD)、無散射光、...

Preview Image

Converting Web Content to PDF(English)

Using xhtml2pdf to convert content to PDF xhtml2pdf s a Python library used to convert HTML documents to PDF files. It utilizes HTML and CSS to create highly customized PDF documents, making it ex...

Preview Image

Prettier vue + ts and python

安裝 VS Code , extension 調整 VS Code 設定 找到 Prettier extension 把 code 弄亂 save output console 但 vue 上沒有用 !!! 安裝 Prettier 支援 Vue 的插件 為了讓 Prettier 正確處理 .vue 文件,你需要安裝額外的插件。需要安裝 prettier-plugin...

Preview Image

Tailwind CSS

PostCSS 與 Tailwind 的關係 什麼是 PostCSS? PostCSS 是一個工具,用來處理 CSS 文件,透過插件的方式對 CSS 進行轉換。它本身並不是一個框架,而是一個強大的工具鏈,可以: 增強 CSS 語法(如自動加前綴)。 支援未來的 CSS 特性(如嵌套規則)。 透過插件實現高度客製化。 什麼是 Tailwind CSS? Tailwind CSS...