2025年12月4日 星期四

筆記 使用Babel開發測試React

僅測試時使用
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>使用babel測試開發React</title>
    <!-- React 和 ReactDOM(開發版本) -->
    <script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
    <!-- Babel Standalone:讓瀏覽器即時編譯 JSX -->
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
    <!-- axios -->
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <!-- bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
</head>
<body>
    <div id="root"></div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"
        integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI"
        crossorigin="anonymous"></script>
    <script type="text/babel">
        const App = () => {
            const { useState } = React;
            const [count, setCount] = useState(0);
            const handleClick = () => {
                setCount(count + 1);
            }
            return (
                <>
                    <h5>{count}</h5>
                    <button className="btn btn-primary" onClick={handleClick}>+1</button>
                </>
            )
        }
        ReactDOM.createRoot(document.querySelector('#root')).render(<App />);
    </script>
</body>
</html>

2025年11月4日 星期二

筆記 前端開發簡易使用https方法 VS Code + mkcert + Vite

情境如果已經拿到一個網站是"資料夾類型"例如剛切好html + css + javascript,測試時想使用https開啟瀏覽器,Live Server雖然也可以,但是比較麻煩複雜,以下方式AI提供測試改良,蠻簡單的。
PS.已經是vite專案的話1>5>6即可
1.下載mkcert,一般windows選mkcert-v1.4.4-windows-amd64.exe,下載後重新命名"mkcert.exe",放於C:\Windows或C:\Windows\System32底下
2.新增vite.config.js package.json .gitignore到專案底下,內容如下
vite.config.js

import { defineConfig } from 'vite';
import fs from 'fs';

export default defineConfig({
  server: {
    https: {
      key: fs.readFileSync('./localhost-key.pem'),
      cert: fs.readFileSync('./localhost.pem')
    },
    port: 3000,
    open: true
  }
});
package.json

{
  "name": "yourname",
  "version": "1.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "serve": "vite preview"
  },
  "devDependencies": {
    "vite": "^7.1.12"
  }
}
.gitignore

node_modules/
dist/
.vite/
npm-debug.log*
.yarn-debug.log*
.yarn-error.log*
.pnpm-debug.log*
.vscode/
.DS_Store
Thumbs.db

# mkcert local certificates
localhost.pem
localhost-key.pem
3.改package.json裡的name變成你的專案名稱
4.vs code > 終端機(termainal) > npm install -y
5.vs code > 終端機(termainal) > mkcert localhost(產生憑證)
6.vs code > 終端機(termainal) > npm run dev

2025年9月29日 星期一

未分類 威力導演365無法匯出

直接點選.pds副檔名開啟專案後,點選匯出都沒反應,網路找了解決方式
1.檔案 > 開新專案
2.將要使用的影音檔都拉進媒體櫃如下圖
3.如果出現下列錯誤的話,整個軟體關掉或電腦重開,從1開始重作,如果沒錯就直接跳4
4.檔案 > 開啟專案 > 選擇您的.pds
參考網址:
Cyberlink PowerDirector 2025 不讓你匯出影片

2025年7月9日 星期三

Git make sure you configure your 'user.name' and 'user.email' in git

VS Code Commit時出現的錯誤
make sure you configure your 'user.name' and 'user.email' in git
開啟終端機輸入以下指令
git config --global user.name "你git上面的名稱"
git config --global user.email 你git註冊的mail

2025年5月26日 星期一

未分類 Nas 對接電腦傳輸速度變慢

使用網路芳鄰時跑的速度很慢
1.檢查網路線是否接好
2.網路線品質cat?
3.先檢查Nas跟PC或筆電的網路速度
4.透過 Windows (SMB / CIFS) 傳輸檔案時速度緩慢,該如何解決?[網路芳鄰 (SMB)] 如何解決Windows 11無法使用SMB功能的問題?
5.通常會需要關閉SMB簽名要求,用管理員開啟Power Shell
Set-SmbClientConfiguration -RequireSecuritySignature $false
參考資料
透過 Windows (SMB / CIFS) 傳輸檔案時速度緩慢,該如何解決?
[網路芳鄰 (SMB)] 如何解決Windows 11無法使用SMB功能的問題?

2025年5月9日 星期五

Windows chkdsk

最近常遇到磁碟無法讀取或是USB隨身硬碟讀LAG很久
微軟有個命令chkdsk嘗試後不錯用記錄一下
chkdsk /f /r /x d:
/f	修正磁碟上的錯誤。 磁碟必須鎖定。 如果 chkdsk 無法鎖定磁碟機,則會出現一則訊息,詢問您是否要在下次重新啟動電腦時檢查磁碟機。
/r	找出損毀的磁區並復原可讀取的資訊。 磁碟必須鎖定。 /r 包含 /f 的功能,以及實體磁碟錯誤的額外分析。
/x	如有必要,強制磁碟區先卸除。 磁碟機的所有開啟控點都會失效。 /x 也包含 /f 的功能。
試過之後USB隨身硬碟問題解決了 參考資料
chkdsk

2025年4月14日 星期一

IIS At least one other site is using the same HTTPS binding and the binding is configured

一台Server IIS使用多網站憑證問題
At least one other site is using the same HTTPS binding and the binding is configured
解決方式
勾選Require Server Name Indication
中文版請參考下方參考資料
參考資料
IIS 多站台使用 HTTPS 憑證的設定方式

2025年4月1日 星期二

Git npm : 因為這個系統上已停用指令碼執行,所以無法載入

1.開啟PowerShell
2.執行
get-executionpolicy
3.如為Restricted執行
set-executionpolicy remotesigned
4.如有例外改執行
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
參考資料
VSCode 執行 npm install 失敗

2025年3月21日 星期五

SQL Server 無法修改強制執行密碼原則

新增SQL使用者時,強制密碼原則未勾選時錯誤
"The CHECK_POLICY and CHECK_EXPIRATION options cannot be turned OFF when MUST_CHANGE is ON"
USE Master
GO
ALTER LOGIN UserName WITH PASSWORD = 'password'
GO
ALTER LOGIN UserName WITH
      CHECK_POLICY = OFF,
      CHECK_EXPIRATION = OFF;
參考資料
Can't Alter Login

2025年3月3日 星期一

SQL Server provider: Named Pipes Provider, error: 40

這問題新手時常遇到所以大概解法
1.開啟 Sql Server Configuation Manager,啟用具名管道
2.防火牆設定輸入規則1433 port
通常這樣就解決了,但我問題還是沒解決
後來詢問主機廠商才知道1433 port常被駭,所以主機商先鎖了,所以需要在Server上使用另一個Port
以下為解決方法
1.開啟 Sql Server Configuation Manager,修改TCP/IP > 改port > 重啟服務
2.防火牆設定輸入規則"自訂的"port
最後專案或程式碼修改連線字串
連線字串比較特別,例如自訂的port為9527,原"192.168.1.100",要改成"192.168.1.100,9527"