跳到主要內容

發表文章

解決Windows 10 taskbar 出現的, 詭異的DesktopWindowXamlSource icon 問題

 自從在2023 1月份 更新了Windows 之後, 總是會出現這個東西 如果我右鍵點擊並關閉它, 它會關閉我的 OneDrive. 無論怎麼做, 重新安裝OneDrive 也好, 都無法把這個icon給解決掉 最後找到了解決的辦法, 辦法如下: 到 Windows 的 Settings (可以直接在Windows search 搜尋 「多工作業 / Multitasking」.  直接跳過2 ~ 4 的步驟), 或者在桌面的空白區域按右鍵。 選擇「Display Settings / 顯示設定」。 在「尋找設定」方塊中輸入「Multitasking / 多工作業」。 選擇「Multitasking / 多工作業設定」。 在「Virtual Desktop / 虛擬桌面」,將「On the taskbar, show windows that are open on / 在工作列中顯示開啟的視窗」設定為「Only the desktop I'm using / 僅顯示我正在使用的桌面」。

解決 CentOS 8.x Module yaml error: Unexpected key in data: static_context [line 9 col 3] No match for argument: install 的問題

當使用 dnf 安裝的時候, 遇到如下的錯誤: Updating Subscription Management repositories. Unable to read consumer identity This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Last metadata expiration check: 0:17:10 ago on Tue 29 Nov 2022 10:45:57 AM +08. Module yaml error: Unexpected key in data: static_context [line 9 col 3] Module yaml error: Unexpected key in data: static_context [line 9 col 3] Module yaml error: Unexpected key in data: static_context [line 9 col 3] Module yaml error: Unexpected key in data: static_context [line 9 col 3] Module yaml error: Unexpected key in data: static_context [line 9 col 3] Module yaml error: Unexpected key in data: static_context [line 9 col 3] Module yaml error: Unexpected key in data: static_context [line 9 col 3] Module yaml error: Unexpected key in data: static_context [line 9 col 3] Package libmodulemd-2.9.4-2.el8.x86_64 is already installed. Dependencies resolved. Nothing to do. Complete! 這是由於 libmod...

解決CentOS 8 的 failed to set locale defaulting to c.utf-8 的問題

這原因是沒有安裝好支援的語言與字型, 特別是UTF8 並沒有被安裝到 因此使用以下指令確認 localedef -i en_US -f UTF-8 en_US.UTF-8 假如出現 "[error] character map file `UTF-8' not found: No such file or directory" 或者 [error] default character map file 'ANSI_X3.4-1968' not found : No such file or directory 那就安裝UTF8 吧 yum whatprovides "*/UTF-8.gz" 如果找到的話 "UTF-8.gz" 的話 yum install "*/UTF-8.gz" -y 再執行一次: localedef -i en_US -f UTF-8 en_US.UTF-8

解決CentOS 8 的conflicting requests – nothing provides module(perl:5.26) needed by module perl-DBD-SQLite 的問題

Problem 1: conflicting requests – nothing provides module(perl:5.26) needed by module perl-DBD-SQLite:1.58:8010020190322125518:073fa5fe-0.x86_64 Problem 2: conflicting requests – nothing provides module(perl:5.26) needed by module perl-DBI:1.641:8010020190322130042:16b3ab4d-0.x86_64 如果出現以上的錯誤訊息, 只要使用以下指令即可 yum module enable perl:5.26

動手解決CentOS 的問題 - error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery

想要在舊主機的PHP 5.4 安裝新的套件, 結果出現以下的問題 error: rpmdb: BDB0113 Thread/process 11283/139789426345792 failed: BDB1507 Thread died in Berkeley DB library error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db5 -  (-30973) error: cannot open Packages database in /var/lib/rpm 原因不外乎是RPM 資料庫掛掉了... 解決辦法如下: mkdir /var/lib/rpm/backup cp -a /var/lib/rpm/__db* /var/lib/rpm/backup/ rm -f /var/lib/rpm/__db.[0-9][0-9]* rpm --quiet -qa rpm --rebuilddb yum clean all

關於有些網站, 雖然擁有相同的SSL 設定, 可是有的 SSL 測試達到 A+ 有些則是 A 的原因

經過測試, 發現那是因為有些網站使用 wildcard (比如:  *.abc.com) 型的 SSL cert 那些能夠得到 A+ 的網站則是使用單一 (但是有 附屬的子域名 在同一張 SSL cert 裡) 型的 SSL cert  (比如:  sub.abc.com, alternative names :  sub.abc.com sub2.abc.com sub3.abc.com sub4.abc.com) 從網路上搜尋得知 "Wildcard certificates can impact security negatively if they're used by different teams and on unrelated sites, but for us it's not possible to determine if that's the case. For that reason, they're not impacting the score." 解決辦法:  暫時無解, 或者放棄使用wildcard 型的 SSL cert

關於網站支援 TLS 1.3 可是瀏覽器卻顯示 TLS 1.2 或者以下的解決辦法

這有兩個可能性: 使用者相較舊版本的瀏覽器.  如今最新版的瀏覽器已經支援 TLS 1.3 了, 因此不成問題.  可以參考以下的網址來解決 https://geekflare.com/enable-tls-1-3-in-browsers/ 電腦安裝了Kaspersky 解決辦法: a.  打開Kaspersky b.  Additional -> Network c.  在Encrypted connections scanning, 勾選 " Do not scan encrypted connections " 但是一旦勾選了 " Do not scan encrypted connections ", 意味著失去了一層的保護, 不再掃描所瀏覽的 HTTPS 網站, 也不會在瀏覽器使用 Kaspersky 自己的 SSL cert (其實這無所謂.  因為這其實是類似proxy, 通過 Kaspersky 的伺服器掃描與解析所瀏覽的HTTPS 網站) 一旦按照以上的步驟做了之後, 順利的話, 瀏覽器會顯示 TLS v1.3 Chrome FireFox

在NGINX 安裝與設定 TLS 1.3 以及所面對的無法運行 TLS 1.3 的問題解決辦法

這是因為我在每個virtualhost 都有設定SSL 相關設定 (根據每個virtualhost有不同的設定)... 因此這很重要, 所有的virtual hosts (包含 /etc/nginx/conf.d) 裡, 都必須設定  ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3 ; 只要有一個virtualhost 不是 TLS v1.3, 所有的virtualhost 都會受影響, 降級成只有運行 TLS v1.2 (假如你之前是設定 TLS v1.2) 我不曉得這是不是NGINX的問題, 但, 顯然的, 我將所有的virtualhost 增加 TLS v1.3 之後, 所有的問題都解決了.  為此, 我花費了好幾天的時間不斷編譯安裝與測試, 特此記錄下來. 測試是否有跑 TLS v1.3, 可以使用以下的指令: openssl s_client -tls1_3 test.localhost:443 成功運行 TLS v1.3 的話, 就會顯示類似以下的資訊: 想要使用 TLS 1.3, 必須安裝 OpenSSL v1.1.1 開始的版本, 以及最低 NGINX v1.13 安裝步驟如下: yum group install "Development Tools" -y yum install gcc gcc-c++ gcc++ cmake pcre-devel -y mkdir -p /usr/local/src/nginx/modules/ cd /usr/local/src/nginx/modules/ rm -rf * git clone https://github.com/openresty/headers-more-nginx-module.git git clone https://github.com/google/ngx_brotli.git #可以選擇不安裝 git clone https://github.com/simplresty/ngx_devel_kit.git git clone https://github.com/openresty/lua-nginx-module.git cd /...

解決無法在Windows 使用 composer / git 下載與安裝的問題

出現了幾個詭異的問題.  首先是從github clone 或者從composer 下載檔案時 : Permission denied (publickey) 解決辦法如下: 1.  ssh-keygen -t rsa -b 4096 -C "github email account" 2.  cd c:\users\你的WINDOWS_USER\.ssh 3.  clip < id_rsa.pub 登入到github 1.  到 Account -> Settings -> New SSH Key 2.  建立一個SSH key 3.  將之前複製的id_rsa.pub 內容貼上, 然後Save 4.  確認是否通過認證:  ssh -T git@github.com 然後是第二個問題, composer 無法下載檔案, 現實的錯誤如下: SSL certificate problem: self signed certificate in certificate chain 解決的辦法如下: 1. git config --global http.sslVerify false 2. 或者自己將這段放進 composer.bat 檔裡以避免偶爾會失效, 每次執行 php composer.phar 之前設定  git config --global http.sslVerify false 但是這辦法太麻煩了. 3. 直接在 .gitconfig 裡設定: 尋找 .gitconfig 在哪, 可以使用這個指令:   git config --list --show-origin 之後直接將 以下這段貼進 config 或者   .gitconfig (通常在 c:\users\你的WINDOWS_USER_NAME 裡.  有多少個config 就全部加入) 就行了: [http] sslVerify = false 4. 因為我有使用WinNMP, 因此每次切換不同的PHP 時, WinNM...

解決Linux kernel 4.13 時, VMWare Workstation Pro 12.5.7 造成的 Physical memory not enough 問題

即使電腦 / 伺服器的記憶體還有非常足夠的空間 (比如還剩下50G), 但是仍然顯示Physical memory not enough 的錯誤訊息, 造成VM Host 無法啟動 這原因是因為Workstation 的bugs, 與4.13 或以上的不太相容, 並且也無法與3.10 或者更低的相容, 因而造成不少的困擾. 解決的辦法如下: cd /usr/lib/vmware/modules/source/ tar xvf vmmon.tar cd vmmon-only/ cd linux rm -rf hostif.c wget https://raw.githubusercontent.com/mkubecek/vmware-host-modules/b50848c985f1a6c0a341187346d77f0119d0a835/vmmon-only/linux/hostif.c cd .. cd .. mv vmmon.tar vmmon.orig.tar tar cf vmmon.tar ./vmmon-only vmware-modconfig --console --install-all 然後再重新啟動Workstation Pro 以及Hosts 看看 來源參考: https://communities.vmware.com/thread/571740 https://github.com/mkubecek/vmware-host-modules/commit/b50848c985f1

解決 CentOS 7 出現的問題 ABRT has detected 1 problem(s). For more info run: abrt-cli list --since 1502979524

SSH 登入之後出現這個錯誤訊息  ABRT has detected 1 problem(s). For more info run: abrt-cli list --since 1502979524 查明原因之後發現是 __init__.py:50:info:RuntimeError: Policy not loaded 用附上的指令 ( /usr/bin/python -Es /usr/sbin/setroubleshootd -f '' ) , 出現以下問題: centos ValueError: Failed to read //etc/selinux/targeted/policy/policy.30 policy file 最直接的解決方法 : yum update selinux-policy-targeted -y 或者 yum upgrade -y

在CentOS 6.x 安裝Python 2.7 的方法

CentOS 6.x 是使用各種python 2.6 來運作, 比如yum 就是使用python 2.6, 倘若貿然升級到 2.7, 將會造成無法使用yum 的情況. 因為不可以覆蓋Python 2.6, 所以採用以下的方法: wget http://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz tar -zxvf Python-2.7.12.tgz cd Python-2.7.12 yum install openssl openssl-devel zlib-devel gcc -y ./configure --prefix=/usr/local --with-zlib make && make altinstall ln -s /usr/local/bin/python2.7 /usr/bin/python27 wget https://bootstrap.pypa.io/get-pip.py python get-pip.py ln -s /usr/local/bin/pip2.7 /usr/bin/pip27

解決atomic repo 的gpg key 太舊造成的問題 The GPG keys listed for the "CentOS / Red Hat Enterprise Linux 6 - atomicrocketturtle.com" repository are already installed but they are not correct for this package

wget https://www.atomicorp.com/RPM-GPG-KEY.atomicorp.txt mv RPM-GPG-KEY.atomicorp.txt /etc/pki/rpm-gpg/RPM-GPG-KEY.atomicorp.txt rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY.atomicorp.txt

PHP 7.1.5 require() vs include() vs spl_autoload() vs require_once() vs include_once() benchmark

做了數次的測試, include 相對穩定與快速一些.  很多時候 require 與 include 不相上下 spl_autoload 則令人失望, 速度非常不穩定而且比require(), include() 慢.  如果要使用spl_autoload, 建議在裡面搭配 require() / include() 比較好. spl_autoload 的唯一好處就是自動載入需要的檔案, 不需要再在include/require, 避免在不同的class / php 裡因為需要而要重新include/require, 從而減少浪費與增加載入速度.  不過, 若是在相同的條件下, include / require 全部一樣的檔案, spl_autoload 則失去優勢了.  如以下的測試. 另外, 有開啟opcache 確實會比較快, 建議還是打開的好, 畢竟opcache 是將之前compile好的php 放在memory, 下一次再用時就不需要再compile, 從而達到快速載入的時間 With opcache enabled (Require 1 files) Execution Time: 0.012760877609253 seconds. (Require 3 files) Execution Time: 0.0004780292511 seconds. (Require 5 files) Execution Time: 0.00022292137145996 seconds. (Require 50000 files) Execution Time: 7.2010669708252 seconds. (Require 50000 files) Execution Time: 1.4862420558929 seconds. (Require 100000 files) Execution Time: 8.5520980358124 seconds. (Require 100000 files) Execution Time: 2.9480040073395 seconds. (Include 1 files) Execution Time: 7.6055526733398E...