要學哪種資料庫語法? 常常聽到各種資料庫的名稱 SQLite、PostgreSQL、MySQL… 阿到底要學哪一種?語法都有一些些不同,真的是搞死人。 我們看一下最基本的功能 - 創建表 在不同的資料庫下有不同的語法 SQLite CREATE TABLE users ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, ...
SQLAlchemy Introduction(中文)
使用 Docker 安裝 PostgreSQL(中文)
PostgreSQL 是啥? PostgreSQL,通常簡稱為 Postgres,是一個自由和開放源碼的關係資料庫管理系統。它起源於加州大學柏克萊分校的 POSTGRES 專案。PostgreSQL 支持 SQL 標準,同時還擴展了許多先進的特性和功能,使其在處理複雜查詢和大規模資料管理方面表現出色。 關鍵是開源,free to use !!!除了免費,再提供一些優點介紹一下吧 Pos...
Github 上開發教學 Step by Step(3/3)(中文)
Gitlab 操作介紹? 也有不少人在使用 Gitlab,那 Gitlab 的操作介紹呢? 因為 GitLab 與 GitHub 類似,也是一個基於 Git 的網絡平台,所以上 code 的操作和邏輯都一模一樣。 因此重點在於了解 Git 的上 code 邏輯才是最關鍵的部分,這部分之後再講吧! Follow 上一篇的操作,你已經有 Github 帳號,有 Sourcetree 可以跟...
Step-by-Step Guide to Developing on GitHub(3/3)(English)
Introduction to GitLab Operations? Many people also use GitLab. So, what about an introduction to GitLab operations? Since GitLab is similar to GitHub, being a web-based platform built on Git, the...
Step-by-Step Guide to Developing on GitHub(1/3) (English)
Git vs Github vs Gitlab Let’s Start with a Brief Introduction: Git is a distributed version control system designed to handle everything from small to very large projects efficiently. Its main fe...
Android app 新手開發(中文)
Android app 新手開發 你是第一次開發 andriod app 嗎?如果是的話,應該會有很多疑問? 到底從何開始?網路上的資料也是零零散散的。 以下分享我們的開發歷程,目的是讓你們可以減少摸索的時間,而把時間花在開發上面,產生價值。 當初我們自己也摸索了好久,才終於成功上架 app,但其實真正花在 coding 的時間不多。 如果你也是想做 side project,沒那麼...
Beginner's Guide to Android App Development(English)
Beginner’s Guide to Android App Development Are you developing an Android app for the first time? If so, you might have a lot of questions. Where should you start? The information available online...
Github 上開發教學 Step by Step(1/3)(中文)
Git vs Github vs Gitlab 我們先來粗略介紹一下: Git 是一個分散式版本控制系統,旨在高效處理從小型到超大型項目的源代碼管理, 其主要特點包括: 分散式開發: 每個開發者都有完整的代碼庫歷史的本地副本。 分支和合併: Git 允許開發者創建分支以獨立工作在不同功能或修復上,完成後可以合併回主分支。 速度和性能: Git 針對性能進行了優化,可以高效...
Item 19 - 結構化綁定(structured bindings) (中文)
情境 當我們在寫 python 時,可以看到以下這種方便的寫法, 可以直接拿到 x,y ,而不用先寫個變數去接函數回傳,再分別取出 x, y # Multiple return values unpacking def get_coordinates(): return (10, 20) x, y = get_coordinates() print(f"x: {x}, y: {...
Item 19 - Structured bindings (English)
Scenario When writing Python, we can conveniently unpack values directly into variables without needing to first store the function’s return value in an intermediate variable and then extract x an...
Item 18 - if 語句中的初始化 (中文)
if 語句中的初始化 功能如同標題,這篇比較簡單,C++17 引入了一項新特性,即在 if 語句中進行初始化。 這使得我們可以在 if 語句中同時聲明並初始化變量,並將其限制在 if 語句的作用域內。 這樣可以使代碼更加簡潔,並避免了變量泄露到更大的作用域。 語法 C++17 中,if 語句的語法可以寫成如下形式: if (init_statement; condition) { ...
Item 18 - Initialization in if Statements (English)
Initialization in if Statements As the title suggests, this section is relatively simple. C++17 introduced a new feature that allows for initialization within an if statement. This means we can d...
Item 16 - 折疊表達式(fold expressions) (中文)
情境 先問個問題,如果今天要寫 function 處理 sum(1,2) ,或是 sum(1.0,2.0),我們可以寫以下 code 處理。 auto sum(int a, int b) { return a+b; } auto sum(double a, double b) { return a+b; } 但是,這樣太麻煩了,懂得人會知道要寫 template 處...
Item 16 - fold expressions (English)
Scenario Let’s start with a question: If we want to write a function to handle sum(1, 2) or sum(1.0, 2.0), we could write the following code to handle it. auto sum(int a, int b) { return a+b;...
Item 14 - 初始化捕獲(initializer capture)(中文)
初始化捕獲 上一篇講到 c++ 11 可以支援 Lambda 捕獲變量,看 code 回顧一下,而且改寫一下故意把變數名稱寫的很長。 #include <iostream> int main() { int x_thisIsAnExtremelyLongVariableName = 10; int y_thisIsAnExtremelyLongVariable...
Item 14 - initializer capture (English)
Initializer Capture In the previous article , we discussed that C++11 supports capturing variables in lambdas. Let’s review the code and rewrite it with deliberately long variable names. #include ...
Item 3 (2/2) - 移動語意(move semantics)(中文)
why std::move 全網最詳細介紹 std::move (自認啦) 當我們的 project 選擇使用 c++ 實作時,常常是因為 c++ 的執行效率很好,若在硬體資源較不足的情況下, ex: 嵌入式系統, 任何可以被優化的部分都要被優化。而 std::move 也是效率優化的一部分,特別是用在物件的拷貝上。 std::move 是 C++ 標準庫中的一個函數模板,定義在 <...
Item 3 (2/2) - move semantics (English)
why std::move The Most Detailed Introduction to std::move (self-proclaimed) When we choose C++ for our projects, it’s often because of its excellent execution efficiency. In scenarios where hardw...
Item 3 (1/2) - 移動語意(move semantics)(中文)
左值 & 右值 在講 std::move 之前,我們先來了解左值右值,不然根本不知道 std::move 在幹嘛。 在 C++ 中,左值(lvalue)和右值(rvalue)是兩個基本的值類型概念,它們對變量、表達式以及操作的語法和語義有著重要影響。 一句話講明: = 左邊的就是左值, = 右邊的就是右值 左值 左值(lvalue,指 “locator value”)是指那些...
Item 3 (1/2) - move semantics (English)
Lvalues & Rvalues Before discussing std::move, let’s first understand lvalues and rvalues; otherwise, we won’t know what std::move is doing. In C++, lvalues (left values) and rvalues (right va...
Item 5 - Lambda expression 匿名函數 (中文)
Lambda expression 匿名函數 你覺得幫 function 取名字很麻煩嗎 ? 我也是 ! 哈 有時候只是處理資料算平均,不寫 function 覺得醜,寫了function 還要想名字, 甚至 c++ 中還要在 header 中宣告 cpp 中實作,實在非常煩! 在 C++11 中,Lambda 表達式是一種匿名函數,通常用於需要臨時函數對象的情況。它們在處理 STL 算...
Item 5 - Lambda expression (English)
Lambda expression Do you find naming functions troublesome? So do I! Haha. Sometimes, just to calculate an average, not writing a function looks messy, but writing a function requires thinking of ...
Item 13 - 返回類型推斷(return type deduction) (中文)
返回類型推斷(return type deduction) 發展到 C++14 後,覺得 C++ 語言開始變聰明了,也開始 care 它的 user(You, programmer) 了。哈 它可以幫你推斷的時候,且沒有模稜兩可的情況時,它竟量幫你做到! 直接看 code function 可以這樣寫,return 直接寫 auto. auto add(int a, int b) {...
Item 13 - Return type deduction (English)
Return type deduction By the time we reached C++14, the C++ language started to get smarter and began to care about its users (you, the programmer). Haha. When it can infer the return type withou...
Item 12 - 泛型 lambda 表達式 (中文)
泛型 lambda 表達式 因 Lambda expression 帶來的諸多好處,大家開始寫諸多臨時小函數(可以不用命名!哈), 但有時候只是參數型別,不同其實邏輯大同小異,但卻要再寫一個 Lambda expression,看起來有點不夠乾淨。 ex : 看以下兩個例子吧, 只是兩數相加,差別只在於一個是 int, 另一個是 double 型別。 auto lambda = [](i...
Item 12 - Generic lambda expressions (English)
Generic lambda expressions Due to the numerous benefits brought by lambda expressions, people started writing many temporary small functions (no need to name them! Haha). However, sometimes only t...
Item 20 - constexpr if (中文)
constexpr if constexpr if 是 C++17 中引入的新語法,它允許在編譯時根據條件進行編譯時選擇,從而避免了在模板程式設計中經常需要使用的模板特化和 SFINAE 技術。 SFINAE 是 “Substitution Failure Is Not An Error” 的縮寫,它是 C++ 模板元程式設計中的一種技術。當進行模板實例化時,如果在推斷模板參數或進行模板...
Item 20 - constexpr if (English)
constexpr if constexpr if is a new syntax introduced in C++17, allowing compile-time selection based on conditions, thus avoiding the need for template specialization and SFINAE techniques often u...
Item 15 - 常數表達式函數(constexpr function)(中文)
常數表達式函數 在 C++11 中,constexpr 函數是被限制在僅允許使用非常有限的語法。在 C++14 中,對 constexpr 函數的支援進行了擴展,其中包括允許在函數中使用 if 語句和定義局部變量。 主要限制包括: 只允許使用單一 return 語句。直白說就是一個 function 只能有一個 return. 不允許在函數體內聲明局部變量。 不允許使用迴...
Item 15 - constexpr function (English)
Constant Expression Functions In C++11, constexpr functions were restricted to using very limited syntax. In C++14, support for constexpr functions has been expanded, including allowing the use of...