2025年11月14日 星期五

[git]git 推到別站

 # 假設你已經從 A 站 clone 下來,這時 origin 指向 A 站

git remote rename origin upstream

# 新增 B 站的遠端儲存庫

git remote add origin [B 站的 Repository URL]

# 之後你就可以 push 到 B 站了

git push -u origin main

# 如果需要,也可以從 A 站拉取更新

git pull upstream main

2025年9月23日 星期二

[windows]設定 IP

 這幾年,出門去測機,每每要改別人 windows 電腦的 IP,都找不到熟悉的介面改。

一個改 IP 的介面是越藏越深,越來越難找。

乾脆,用命令列來改反而一行解決。當然,首先,要開啟的是系統管理員權限的命令列

改成固定 IP 的命令如下:

netsh interface ipv4 set address name="eth0" static 192.168.1.5 255.255.255.0

改成 DHCP 的命令如下:

netsh interface ipv4 set address name="eth0" source=dhcp

---
1. 那個 name 的值用 ipconfig 查
2. 為何不從 左下角窗戶>齒輪>網路與網際網路>乙太網路 改呢?因為改了沒生效。
3. 從 左下角窗戶>齒輪>網路與網際網路>進階網路設定 這裡有介面卡的名字,也可以改成方便記憶或下指令的名字
4. 舊的 IP 設定介面,從 左下角窗戶>齒輪>網路與網際網路>進階網路設定 點你要的介面卡,資訊會撐開,按下「編輯」按鈕。會打開舊版的設定畫面,在這裡設定 IPv4 的值,會直接生效。

2024年11月11日 星期一

[csharp]發生 Managed Debugging Assistant 'NonComVisibleBaseClass' 錯誤

 我不知道原因,但只知道解法。從解法來看,是 VS IDE 管太多卡到舊DLL了。


In Visual Studio 2019: 

Debug Menu, Windows --> Exception settings, opens the Exception settings window. 

There expand "Managed Debugging Assistants" and finally uncheck NonComVisibleBaseClass


參考:

https://stackoverflow.com/questions/1049742/noncomvisiblebaseclass-was-detected-how-do-i-fix-this

2024年8月27日 星期二

[golang]http.HandleFunc 新的 routing pattern

 在 Go1.22 的時候,讓 http.HandleFunc 新的 routing pattern 可以用變數的形式拿到 URL 路徑裡的值


要使用這個功能,要讓 go build 使用新的編譯方法,不然它總是用舊方法編譯,這是為了相容性。


最簡單就是在 go.mod 裡加上一行 go 1.22 或是 go 1.23





https://stackoverflow.com/questions/28745161/with-gos-webserver-where-does-the-root-of-the-website-map-onto-the-filesystem


https://tip.golang.org/doc/godebug


https://programmingpercy.tech/blog/exciting-go-update-v-1-22/


https://github.com/babafemi99/up-I-go/blob/main/main.go


https://gowithore.hashnode.dev/go-up-or-go-down


https://stackoverflow.com/questions/24116147/how-to-download-file-in-browser-from-go-server


https://mileslin.github.io/2020/03/Golang/%E5%BB%BA%E7%AB%8B%E4%B8%8B%E8%BC%89%E6%AA%94%E6%A1%88%E7%9A%84-Http-Response/

2024年3月18日 星期一

[secs]HSMS timeout

 T6: Active 端

    select.req <-T6-> select.rsp

T7: Passive 端

    open -> not_select <-T7-> select

T5: Active 端

    connect_fail <-T5-> connecting

T8: msg:{B <-T8-> B...}

2024年3月7日 星期四

[csharp]C# 如何得知某個 class 有實作某個介面

 ## 方法

1. objectType.GetInterfaces().Contains(interfaceType)


2. interfaceType.IsAssignableFrom(objectType)


3. objectType.IsAssignableTo(interfaceType)


4. objectType.GetInterface(nameof(interface)) != null


## 參考來源

https://www.facebook.com/groups/1706638306295947/?multi_permalinks=3338835626409532

2024年1月7日 星期日

[vmware]突然出現 misc.rsba_no 不存在的問題

 是否出現 misc.rsba_no 不存在的問題?其實解答不是表面上可以看到的。


我最近突然遇到很多個 suspend 的 vm 開起來就出現這個問題,導致許多暫存的東西皆無法回復。


回頭去查發現這情況都發生在主機的 hyper-v 功能打開之後,來回測試一番,覺得應該是 CPU 特性有改變,讓 vmware 無法回復狀態。


很重要的資料在 vm 裡沒存的話,還是改回去做處理。