sharechiwai
sharechiwai
ShareChiWai Share everything
262 posts
Don't wanna be here? Send us removal request.
sharechiwai · 6 years ago
Text
ESLint couldn't find the plugin (when install dependencies using yarn)
ESLint couldn’t find the plugin (when install dependencies using yarn)
今日嘗試用 command line (CLI) 執行 ESLint 時出現了以下的錯誤信息
# eslint command eslint ./src Error: Cannot find module 'eslint-config-airbnb'
仔細看他其實是在找npm install 的 module 的 folder “c:\user\chi\AppData\Roaming\npm\node_modules” 但我是用 yarn install的所以 是使用錯了folder 解決方法十分簡單 我們只要使用 yarn 執行便可
yarn eslint ./src
Hope you find it useful
View On WordPress
0 notes
sharechiwai · 6 years ago
Text
Clear node-modules
我們可以使用以下指令到 clear Yarn / NPM 的 cache
# yarn yarn cache clean # npm npm cache clean # remove node_modules folder rm -rf node_modules/
Hope you find it useful
View On WordPress
0 notes
sharechiwai · 6 years ago
Text
Git Error Unlink of File failed. Should I try again?
Git Error Unlink of File failed. Should I try again?
久不久我使用的 Git 便會出現以下問題 “Unlink of file. ‘ file path and name’ failed. Should I try again? (y/n)“
很多時候按了 “Y” 也是說 file locked … Should I try again?
解釋方法: 我們只需要執行 git gc command 便可
git gc
Hope you find it useful
View On WordPress
0 notes
sharechiwai · 6 years ago
Text
Update Wordpress Inside Docker Container Required FTP Access
Update WordPress Inside Docker Container Required FTP Access
今日Update WordPress 既時候出現了 輸入FTP資料的畫面
To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.
原因是因為有些wordpress 的資料夾沒有 權限去access 解決方法 我們只需要把這個資料夾的ownership 設定和這個container一樣便可 e.g.
sudo chown -R www-data:www-data wordpress
Hope you find it useful
View On WordPress
0 notes
sharechiwai · 6 years ago
Photo
Tumblr media
VSCode config trim trailing space when saving file 如果有用開source control, 做code view 或 compare files 時 whitespace / Tab 會造成一些不必要既麻煩很多IDE 都有一些設定或 plugin 可以在你儲存檔案時除去尾隨空格 52 more words
0 notes
sharechiwai · 6 years ago
Text
Linux updated folder and subfolder's ownership
Linux updated folder and subfolder’s ownership
只要把這個folder的ownership 轉為 www-data 便可 我們可以使用 sudo chown user:usergroup folder/*
今日發現自從把wordpress 轉了用docker host 之後便不能 upload file 原因是我把之wordpress site 的檔案從 FTP upload 到新server 的 uploads folder 的ownership 是我FTP 的user名 而不是 run wordpress 的www-data
解決放法
sudo chown www-data:www-data uploads/*
Hope you find it useful
View On WordPress
0 notes
sharechiwai · 6 years ago
Text
Linux look for the process bound to a certain port
Linux look for the process bound to a certain port
今日嘗試執行 Docker-Compose 去啟動Nginx Container 時出現以下的錯誤信息
Cannot start service nginx: driverfailed programming external connectivity on endpoint nginx erland proxy: listen tcp 0.0.0.0:80: bind: address already in use
原因是因為 port 80 已經在使用中.. 怎樣知道那些process 正在使用 port 80呢? 我們可以使用以下command
sudo lsof -i -P -n | grep ":80 (LISTEN)"
Linux command check which process use specific port
知道那些process…
View On WordPress
0 notes
sharechiwai · 6 years ago
Text
C# Distinct List of Object
C# Distinct List of Object
今日在Code Review 同事的Code 時候發現了一個有趣的寫法 他想做的是 Return 一個Distinct 左既 List Of Object 好直接既想法是使用 Distinct
List.Distinct();
之後發現Distinct 是不能 Distinct Object的 同事的寫法是用了 List 加 GroupBy 和Select First()
List.GrounBy(x=> x.key).Select(x => x.First())
之後發現.. 原來我們可以使用 GroupBy 加 First 來做到 Distinct Object的效果 以下是我的 Code Sample
void Main() { var list = new List(); list.Add(new Example() {Id=1,…
View On WordPress
0 notes
sharechiwai · 6 years ago
Text
Git Check which branch contain specific commit
Git Check which branch contain specific commit
今日公司個Production project 有一個 Bug 但係在 Staging 和 UAT environment 都 replicate 唔到呢個問題.. 之後便用Git Blame 去檢查一下有什麼 code change 再看看是那一個 commit 做了code change 找到commit 之後 便要嘗試去看看這個commit merge 了去那些 branch 解決方法 我們可以使用以下 git command
git branch --contains $COMMIT_ID e.g. git branch --contains 7df12c5
Hope you find it useful
View On WordPress
0 notes
sharechiwai · 6 years ago
Text
EF Core with MySQL Specified key was too long; max key length is 3072 bytes
EF Core with MySQL Specified key was too long; max key length is 3072 bytes
今日嘗試使用 EF Core with MySQL 時出現了以下的錯誤信息:
MySql.Data.MySqlClient.MySqlException HResult=0x80004005 Message=Specified key was too long; max key length is 3072 bytes Source=MySql.Data StackTrace: at MySql.Data.MySqlClient.MySqlStream.ReadPacket() at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId) at MySql.Data.MySqlClient.Driver.NextResult(Int32…
View On WordPress
0 notes
sharechiwai · 6 years ago
Text
Visual Studio CodeLens show no Reference
Visual Studio CodeLens show no Reference
最近 我的Visual Studio 的 CodeLens 沒有再顯示 Class/ Method 有多 reference .. 只係顯示了 “–“… 十分不方便
做了一會research 之後發現解決方法十分簡單 我們只要洗除電腦的 Temporary files
之後重新開啟 Visual Studio 便可以了
Hope you find it useful
View On WordPress
0 notes
sharechiwai · 6 years ago
Text
Git Include Ignored files
How to include Ignored files back to git (source control)
今日嘗試在git 上加入之前 用 .gitignore Ignore 左既 個project folder入面的 .vscode資料夾 剛剛更新了project 入面的 workspace setting 而在VS Code 的 workspace setting 是儲存在 .vscode/settings.json 上 要把這個檔案加回 source control 我們首先要在 .gitignore 檔案上 移除這個資料夾 之後使用以下 指令 再強制把這個檔案加回source control
git add -f .vscode/settings.json
完成後便可以 commit 這個檔案了 Hope you find it useful
View On WordPress
0 notes
sharechiwai · 6 years ago
Text
Note:
今日需要Share 一個比較大既File 給國內的朋友 之前國內是可以連接 Microsoft One Drive的 最近唔知點解又有connection 問題 嘗試使用 WeChat share 檔案 可以過了File Size 上限 最後想到用使用自己的VPS 用Docker 起一個簡單的 web server 用來serve 這個檔案 解釋方法: 安裝 docker 後 執行以下Docker command 之後便會起了一個Web server 是 port: 8083 的 在以下的path: /home/username/web/storage
docker run --name storage -v /home/username/web/storage:/usr/share/nginx/html:ro -p 8083:80 -d nginx
E.g. docker run…
View On WordPress
0 notes
sharechiwai · 6 years ago
Text
Code-Playground
發覺返到香港越來越難集中去做自己既project 連blog 都少寫了 今日終於逼自己係GitHub 度開個repository 去寫下code 希望每星期都會commit到D code 同有blog post share 個project 叫做 Code-Playground 主要是用來share自己想寫既project 但係因為自己個根基比較弱.. 上網跟住D Tutorial blog post 有時可能version / setup 問題 或是我想做的feature 比較複雜 所以都係做唔到Expected result 希望藉著呢個repository 可以和大家分享這些code和解決方法 和學習一下怎樣organise projects Source code: https://github.com/sharechiwai/code-playground Happy Coding
View On WordPress
0 notes
sharechiwai · 7 years ago
Text
WPScan Docker Sample - WPScan Docker 示範
WPScan Docker Sample – WPScan Docker 示範
如果不想在電腦上安裝 WPScan 的話可以考慮使用Docker 使用方法十分簡單 首先要 pull wpscan 既 docker image https://hub.docker.com/r/wpscanteam/wpscan/
docker pull wpscanteam/wpscan
之後便可以使用這個Docker image 來執行 wpscan 的指令 e.g.
docker run --rm wpscanteam/wpscan -u https://blog.sharechiwai.com
如果想直接進入這個wpscan 的docker image 上執行wpscan 可以使用以下指令
docker run -it --entrypoint /bin/sh wpscanteam/wpscan
想了解更多的wpscan 的用法可以參考他們的網站 https://git…
View On WordPress
0 notes
sharechiwai · 7 years ago
Photo
Tumblr media
#夕陽無限好 #青衣東北公園 遠望 #汀九橋 方向既 #晚霞 景色好靚 #漸變色 #colourful #Beautiful shot of #clearskys #sunset at #tsingyinortheastpark You can also see the #reflection of the sky colour #hkig #sonyphotography #sunset #hx90v #nightshot #nightview #natural
0 notes
sharechiwai · 7 years ago
Text
Screen Recording via PowerPoint (Free Feature) - 使用 PowerPoint進行 屏幕錄製
Screen Recording via PowerPoint (Free Feature) – 使用 PowerPoint進行 屏幕錄製
很多朋友問..如何在Windows 上進行屏幕錄製, 之前以為一定要用其他軟件.. 例如:  Camtasia.. 誰不知..原來可以使用 PowerPoint  錄製 的 詳情可以參考這個 教學
hope you find it useful
View On WordPress
0 notes