SQLite:建立資料庫

  1. 在當前目錄下建立資料庫:
    C:\SQLite\sqlite3 test.db
  2. 查看已建立的資料庫:
    sqlite> .database

發表於 SQLite | 發表迴響

SQLite:Windows 安裝

由 SQLite 官網下載安裝程式:https://www.sqlite.org/download.html
Precompiled Binaries for Windows:

  1. 依 Windows 系統位元 (32-bit/64-bit) 下載對應版本:sqlite-dll-win64-x64-3310100.zip
  2. 接著下載 Tool:sqlite-tools-win32-x86-3310100.zip
  3. 於 C 槽建立「SQLite」資料夾,並解壓縮上述檔案到該資料夾
  4. 加入系統環境變數:
    快捷鍵 (Win+S) 開啟 windows 搜尋,輸入「進階系統設定」
    開啟「檢視進階系統設定」:「環境變數」 -> 「系統變數」 -> 選擇變數「Path」 -> 「編輯」->「新增」
    C:\SQLite
  5. 驗證安裝:
    「Win + R」執行 cmd,於命令列輸入 sqlite3
    若看到版本資訊與 sqlite>提示字元,即代表安裝成功
  6. 查看說明
    sqlite>.help
  7. 退出
    sqlite>.quit
發表於 SQLite | 發表迴響

Python:help()與dir()的使用

  1. help():用於查看函式或模組用途的詳細說明
    查看安裝的模組清單
    >>>help(‘modules’)
    使用 help() 用於查看「dir」 的用途
    >>>help(‘dir’)
    dir():用於查詢物件的全部屬性
  2. 例如使用 dir() 函數用於查看物件「sys」 的全部屬性
    >>>import sys
    >>>dir(sys)
發表於 Python | 發表迴響

6.打包 Python 程式碼

Windows平台:可以將 .py 改成 .pyw 直接執行。

安裝 PyInstaller
  1. 快捷鍵 (Win + R) 執行 cmd,於命令列輸入 pip install pyinstaller
  2. 開始打包 Python 程式碼:pyinstaller -F HelloWorld.py
  3. 參數說明
    -h:
    help
    -F:將程式打包成單一執行檔
    -D:打包多個文件,包含 exe 檔及依賴的東西會一起放置在 dist 資料夾內
    -w:使用視窗,no console
    -c:使用 console,無視窗
  4. 完成打包後,所在路徑下產生的資料
    a. HelloWorld.spec:打包時,相關的設定
    b. build 資料夾: Log紀錄檔與相關檔案
    c. dist 資料夾:執行檔 exe
  • 「from …import …」與「import」都是 Python 使用 Module 的方式
  • 引入套件時,「from」會將整個包都打包進去
    所以引入盡可能使用「from …import …」
  • Module:是 Python 內的檔案,有自己的宣告和實作
  • 使用「import」會保留獨立的 Symbol Table,不用擔心 Function Name 衝突的問題,但必須清楚告訴 Python 直譯器是使用哪一個 Function
  • 打包後的 exe 執行檔,只能與打包時相同的作業系統下執行
發表於 Python | 發表迴響

SQL Server:Microsoft SQL Server Management Studio 編輯前 N 個資料列

Microsoft SQL Server Management Studio
工具 > 選項 > SQL Server 物件總管 > 命令:
找到 [編輯前 <n> 個資料列]命令的值
預設值:200,若為0則為:編輯所有資料列

發表於 MSSQL | 發表迴響

Python:註解

  • 單行註解:使用#開頭
    #這是一個單行註解
  • 多行註解:為連續三個單引號
    "‘
    這
    是
    多
    行
    註
    解
    "‘
發表於 Python | 發表迴響

VS Code:常用模組

  1. Chinese (Traditional) Language Pack for Visual Studio Code:Language pack extension for Chinese (Traditional)
  2. PHP Extension Pack:Everything you need for PHP development
  3. PHP IntelliSense:Advanced Autocompletion and Refactoring support for PHP
  4. Smarty:
  5. ESLint:Integrates ESLint JavaScript into VS Code.
  6. HTML CSS Support
  7. Python
  8. Python for VSCode
  9. Qt for Python
  10. Jupyter
  11. Vim





發表於 VS Code [Visual Studio Code] | 發表迴響

VS Code:變更介面語系

  1. 按下「Ctrl + Shift + P」後,輸入 lang,選擇 「Configure Display Language」。
  2. 選擇 「Install additional languages」
  3. 接著在左側EXTENSIONS:市集中,選擇安裝「Chinese (Traditional) Language Pack for Visual Studio Code 中文(繁體)」。
發表於 VS Code [Visual Studio Code] | 發表迴響

5.將.ui檔轉換為.py檔

將 Qt Designer 產生的 .ui 檔轉換為 .py 檔

  1. 使用 pyuic5 指令:
    • PyQt5 安裝成功後,可透過 pyuic5 指令將.ui檔轉換為.py檔
    • 快捷鍵 (Win + R) 執行 cmd
      於命令列輸入:
      D:\Python\Project\pyuic5 -o mainUI.py mainUI.ui
  2. 使用 Python 腳本(下載 ui2py.py):
    • 將 ui2py.py 放在需要轉換介面檔 (.ui) 的目錄下
    • 點兩下執行 ui2py.py
      或
      執行 D:\Python\Project>python ui2py.py
發表於 Python | 發表迴響

4.安裝 Qt Designer

安裝 Qt Designer (可以用一種所見既所得的方式,產生 QT 程式 GUI 介面的程式碼)

  1. 快捷鍵 (Win + R) 執行 cmd,於命令列輸入
    pip install PyQt5-tools
    或
    pip install PyQt5Designer

    因為安裝 pyqt5-tools 是為了使用 PyQt5Designer 方便介面設計,所以也可以直接安裝 PyQt5Designer

  2. 建立桌面捷徑:
    C:\Users\YourAccount\AppData\Local\Programs\Python\Python39\Lib\site-packages\qt5_applications\Qt\bin\designer.exeC:\Users\YourAccount\AppData\Local\Programs\Python\Python38\Lib\site-packages\pyqt5_tools\Qt\bin\designer.exe
    或
    D:\Python38\Lib\site-packages\pyqt5_tools\Qt\bin\designer.exe

發表於 Python | 發表迴響