GithubHelp home page GithubHelp logo

note's Introduction

Note

Check Issues

note's People

Contributors

catertsai avatar

Watchers

 avatar  avatar

note's Issues

[JS]iOS Safari需要將img轉為blob會發生各種Error

【問題描述】

在需要使用canvas繪製或是分享圖片時,會遇到需要將image轉為blob的情況。
即便同網域,在iOS Safari上若是使用canvas搭配toBlob,會跳出Security error,原因是Tainted canvases
iOS Version:17.4.11

【解決過程】

  1. 在new image時加入crossorigin=anonymous→無效
  2. 在img tag本身加入crossorigin='anonymous'→無效,影片本身也無法顯示
  3. 改用fetch取得blob,但url帶整個網址→無效,會出現TypeError
  4. 用fetch取得blob,url使用相對目錄→正常

[C#]建立Socket Server時只能接受本地訊號的問題

【問題說明】

Socket Server在127.0.0.1的本地端可以正常運作,但是給予IP時就無法連線

【解法】

撰寫Server Side時,無論是使用Socket, TcpListener, UdpClient
初始化IPEndPoint時請都使用IPAddress.Any
部分教學有看到IPAddress.Loopback的,會導致只有使用127.0.0.1才能正常接收

[AWS]前端網站上CDN流程紀錄

1-Route 53

  1. 建立Domain託管區域
  2. 如果網域購買在其他網站(ex:Godaddy),透過Name Server轉移管理權

2-Certificate Manager

  1. 將區域切換至us-east-1
  2. 請求公有憑證
  3. 選擇DNS驗證,並建立www別名,完成選單
  4. 於網域部分選擇「在Route53建立紀錄」
  5. 等待驗證完成

3-S3

  1. 建立儲存體
  2. 保持預設即可,區域可選靠自己近的
  3. 上傳前端檔案

4-CloudFront

  1. 建立分佈
  2. 選擇Step 3建立的S3來源,根據指示複製政策並跳至S3,貼上至S3的「儲存貯體政策」中
  3. 快取行為、功能關聯、WAF等根據需求設定
  4. 「備用網域」選擇Step 1建立之網域,包含www。自訂SSL如果沒有列出Step 2可以後面再補
  5. 設定「預設根對象」,一般為index.html
  6. 完成設定後,如果有使用router功能,可增加錯誤頁面。錯誤碼:403,自訂行為200,回到根目錄

5-Route 53

  1. 確定CloudFront建立的分佈已經完成布署(如果沒有完成,下一步偶爾會看不到)
  2. 新增紀錄,選擇「別名」→「CloudFront的別名」,點選Step4建立的分佈
  3. www的也一併建立

[JS]下載CSV檔案中文亂碼的問題

問題說明

預設Excel的CSV會是ASNI編碼,而JS匯出的CSV為UTF-8

解決方案

在匯出的CSV加上BOM標頭

Example
let csvDataArray = []
let universalBOM = "\uFEFF";
let csvContent = "data:text/csv;charset=utf-8," + encodeURIComponent(universalBOM + csvDataArray.map(e => e.join(",")).join("\r\n"))
window.open(csvContent);

[ASP.net Core .net 6] 筆記-1

Nuget package for MSSQL

  • Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
  • Microsoft.EntityFrameworkCore
  • Microsoft.EntityFrameworkCore.Design
  • Microsoft.EntityFrameworkCore.SqlServer

EF Core 基本建立流程 (Code First)

  1. 建立資料Class於\Models,欄位格式與屬性設定在此
  2. 建立Context Class於\Models,並設定各資料Class
  3. 於Context Class設定OnModelCreating,初始值設定在此
  4. 於Program.cs設定DB連線builder.Services.AddDbContext<Context物件>(options => {})
  5. 於CMD執行指令 dotnet ef migrations add <名稱> --context <Context物件名稱>建立Migrations
  6. 於CMD執行指令dotnet ef database update --context <Context物件名稱>發佈至DB中

靜態資源(前端)的使用

  1. 於Program.cs中設定app.UseDefaultFiles();以及app.UseStaticFiles();
  2. 主目錄下設置wwwroot資料夾

手動發佈於IIS的設定

  • IIS需安裝 dotnet-hosting-x.x.x-win.exe
  • Net CLB設定為 "No Managed"

其他

  • 官方建議使用System.Text.Json套件
  • CORS可在Programs.cs中設定app.AddCors & app.UseCors去設定,並於個別Controller設定是否套用(EnableCors)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.