[C#] 利用 .NET core 3.x 存取 Windows Registry
2020年9月11日 星期五
前幾天用 Jetbrains Rider 寫了一支 C# 的小程式,裡面需要對 Windows Registry 做讀取、刪除的動作,一開始建新專案時選擇 .NET Core 的 framework,結果編譯不成功。
後來改成用 .Net Framework 4.8之後,程式未修改,編譯就 pass 了,後來發現有些 API ,在 .NET Core 預設是不支援的,得自己手動增加才行,用 nuget 這個工具可以做這個動作。
下列的項目是只有 Windows 才有的 API :
- Code Pages
- CodeDom
- Configuration
- Directory Services
- Drawing
- ODBC
- Permissions
- Ports
- Windows Access Control Lists (ACL)
- Windows Communication Foundation (WCF)
- Windows Cryptography
- Windows EventLog
- Windows Management Instrumentation (WMI)
- Windows Performance Counters
- Windows Registry
- Windows Runtime Caching
- Windows Services
微軟出一個相容性的整合包(Windows Compatibility Pack),可以一次支援上列的項目,不過,我個人是覺得整合包用在開發環境上比較理想,正式環境的話,我比較傾向用到的項目才安裝。
Ubuntu Server 18.04 更新到 20.04.1 後,Xshell4 無法連線(no matching key exchange)
2020年8月29日 星期六
前兩天把 Ubuntu Server 18.04 升級成 20.04.1,結果,發生用 Xshell 4 無法連線,出現「no matching key exchange 」,用 putty 連線也一樣。
查了 putty 的版本,是0.6x 的版本,重新下載新版 (0.74)後,putty 就可以正常連線了。不過, 我用另一台電腦上的 Xshell 6 其實也可以連線,所以,但是因為某個原因,我並不想把 Xshell4 升級,所以又努力查原因…
看了一下 log 檔:
no matching key exchange method found. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
看來應該是某個(些)運算法不支援了,若要強制支援的話,得另外在 「/etc/ssh/sshd_config」加上參數:
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org
把 sshd 重新啟動後,Bingo!!! 連線正常。
Ref: xshell4連接ubuntu,報錯No matching outgoing encryption
[程式] 點一下圖片,黑白瞬間變彩色
2020年8月24日 星期一
夥伴傳來一個連結,打開後,裡面的多張黑白(灰階)圖片,按一下圖片後,就會慢慢轉成彩色,所以覺得很療癒。
不過,我想了一下,想試著把它的動作還原,整理以下思路:
- 一開始把頁面中的圖片都設成灰階
- 設定每個圖片監聽 click 事件
- 圖片被點擊後,取消灰階
- (opt)取消灰階後,用 fadeIn 讓圖片浮現
試了一下,果然可行,其中的關鍵字:
- css
- filter
- grayscale
以下是我簡單做的範例程式,提供參考囉!
標籤:
CSS,
JS,
Programming
[校園網路]校園無線網路無法連網 除錯步驟
2020年7月22日 星期三
早上低年級老師到校備課,打電話回報教室內電腦可以上網,但是手機連無線網路有問題。
首先,❶先請她走到附近的教室,再連一次無線看看是否正常;❷拿手機到辦公室測試手機是否正常(辦公室無線OK)。
結果,❶仍是無法上網,但是❷可以上網;嗯!看起來有點像是設備有點狀況,所以我就❸連上 Siraya 平台(nms.ntpc.edu.tw)檢查,點開 網路設備/基地台設備 後,發現所有教室內的 Cisco 無線 AP 都處理離線狀態,鑒於對第一大廠而言,發生大規模故障的機率實在微乎其微,其中還有一台是 AP Controller,❹就拿起電話打給駐點工程師,工程師做了簡單的測試確認有點問題後,留下我的聯絡電話,並說明待會兒會有人與我聯絡。
沒多久,另一位工程師打電話聯絡,請我到機房看看 AP Controller 目前的燈號情況,我拿著手機到機房後,發現機櫃上的 Cisco AP Controller 未過電,走到機櫃後一看,電源延長線壞了,先臨時接到另一個正常的插孔上後,通電,正常!
再打電話到教室給報修的老師,手機上網也正常了,結案!!
喔…忘了說,掛電話之後,就趕緊上網購買多孔插座回來更換,多孔插座也是有壽命的!!
下面這篇文章有介紹多孔插座,我覺得蠻詳細的,很有用!我買了蓋世特,不過不是該文中所列的機架式款式。
[網管] 用指令設定 IP、啟用檔案共用
2020年7月13日 星期一
- 防火牆 啟用 遠端桌面
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes - 修改註冊機碼啟用 遠端桌面
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f - 防火牆 啟用 檔案及印表機共用
netsh advfirewall firewall set rule group="File and Printer Sharing" new profile=private
netsh advfirewall firewall set rule name="檔案及印表機共用 (SMB-In)" dir=in profile=private new enable=Yes - To see a list of interfaces
netsh interface show interface - To set/change an address:
netsh interface ip set address "Ethernet" static 10.0.0.100 255.255.0.0 10.0.0.1 1 - To see a list of NICs with their configured network settings
netsh interface ip show config - To set a static IP
netsh interface ip set address "Local Area Connection 3" static 10.0.0.100 255.255.0.0 10.0.0.1 1 - If you are setting a static IP for the first time, you will also need to configure a DNS server:
netsh interface ipv4 add dnsserver "Local Area Connection 3" address=8.8.8.8 index=1 - To change the connection back to DHCP
netsh interface ip set address "Local Area Connection 3" dhcp
[PHP]虛擬資料產生器
暑假研習,剛好需好一些資料來測試,有些沒有權限下載自己學校的學生資料,只好動手刻個虛擬資料產生器…,不得不說,巨人的肩膀夠硬啊!直接引用套件(專案)節省很多時間。
- 中文姓名
- 出生年月日
- 學號
- 住址
- 郵遞區號
- 身分證字號(這有點敏感,就不列出來了)
標籤:
Development,
php,
Programming
訂閱:
文章 (Atom)


