2021年10月26日 星期二

Docker Desktop Upgrade Failed

 

Docker Desktop Upgrade Failed



Here is a new update version could install

Click Install & Restart but not working.


Or select "Download update" to upgrade Docker Desktop


It starts to downloading, but always failed or no response.


Says installation failed.



The problem might be the service won't stop, let us stop it manually.


Go to Windows Services, find out Docker Desktop Service, then stop it.



Then it's stoping.


Download install file from official website: 
Docker Desktop


Execute the install package, start to install.


If you see it's unpacking, sound good.



It might occur some warning, ignore it.



Finally, the installation succeeded.



Chck out the About dialog, it's updated.


2021年8月7日 星期六

How to remove OneDrive 如何移除

Terminated process first.
(首先停止正在執行的OneDrive程序)

 taskkill /f /im OneDrive.exe

According to your OS type:
(根據OS版本)

open cmd with administrator permission
(以系統管理員身份執行)

32bit
%SystemRoot%\System32\OneDriveSetup.exe /uninstall

64bit
%SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall

2021年5月4日 星期二

Webstorm can't resolve module with vue-cli, setup webpack config for alias. 解決Webstorm無法解析路徑的問題

WebStorm can't resolve alias if project created by vue-cli.

Because vue-cli didn't set up via webpack, the alias can't resolved without webpack config.

To fix this problem, we can specify a webpack config for WebStorm to recognize alias.

[Setting] > [Language & Frameworks] > [JavaScript] > [Webpack]



Here are my references.

[1] https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000556284/comments/360000093780

[2] https://juejin.cn/post/6844903802185891848

[3] https://cli.vuejs.org/guide/webpack.html#inspecting-the-project-s-webpack-config


Updated

In unknown problem, all above action can't fix the resolution issue. But I found some trick: Go to any *.vue file, move to import block, right click on any component then install it. And it will solved. Unbeleible. Amazing.


Updated-2

No need to set webpack config because it always says: 
Can't analyse webpack.config.js: coding assistance will ignore module resolution rules in this file.
The rest current setting: node_module was excluded. src was rescouce root.
Rewritre vue.config.js, let it re-index, then it can resolved correctly.
I rewrite 

config.resolve.alias
.set('@img', path.resolve(__dirname, 'src/asset/images'))
.set('@common', path.resolve(__dirname, 'src/components/common'))
.set('Source', path.resolve(__dirname, 'src'));
to
config.resolve.alias
.
set('_img', path.resolve(__dirname, 'src/asset/images'))
.
set('_common', path.resolve(__dirname, 'src/components/common'))
.
set('Source', path.resolve(__dirname, 'src')); then re-write back
config.resolve.alias
.set('@img', path.resolve(__dirname, 'src/asset/images'))
.set('@common', path.resolve(__dirname, 'src/components/common'))
.set('Source', path.resolve(__dirname, 'src'));

Updated-3

[Setting] > [Language & Frameworks] > [JavaScript] > [Webpack]
=> Set as Automatic.


Select node_module folder, right click to popup menu, click "Optimize Imports"
=> it's work!

Or, select "src" root, do "Optimize Imports".
=> it's work!

Or, select any single *.vue, do "Optimize Imports".


[1] https://youtrack.jetbrains.com/issue/WEB-27933



2021年4月1日 星期四

解決執行Bat檔案,第一行是亂碼。不是內部或外部命令、可執行的程式或批次檔。


 如上圖,每次執行BAT檔第一行一定會出現亂碼報錯。

這有可能是該BAT檔的文件編碼選到UTF-8。

要正確顯示BAT檔,需改成ANSI格式。

可利用Notepad++或以記事本開啟BAT檔後另存新檔時將編碼改選為ANSI

以上

2021年1月22日 星期五

Turn on HPET

How to TURN ON HPET

[Credit] NavJack27 

 to enable HPET - bcdedit /set useplatformclock true

to disable HPET - bcdedit /deletevalue useplatformclock

2021年1月12日 星期二

AWS S3 SDK 下載物件時強迫設定 Content-Disposition 為 attachment

 串AWS S3 SDK時

要下載一個項目,使用 Signature的下載方式

const getS3SignedDocumentURL = (docName) => {
  const url = s3.getSignedUrl('getObject', {
    Bucket: <aws-s3-bucket-name>,
    Key: <aws-s3-object-key>,
    Expires: <url-expiry-time>,
  });

  return url;
};
但會因為檔案預設的 Content-Type 被 Browser 處理(例如txt就直接打開)
所以需要指定一個 Content-Disposition
兩個方法
1.在網址後加上
String url = serverURL+'/'+bucketName+'/'+codedFilename+'?response-content-disposition='+EncodingUtil.urlEncode('attachment; filename=abc.doc','UTF-8')+'&AWSAccessKeyId='+awskey+'&Expires='+Lexpires+'&Signature='+codedsigned;

然後含這串signed的文字給後端去算signed

2.直接在Header裡加上ResponseContentDisposition: 原因是若後端已經拿算好的URI去計算Signed的話,只能靠在呼叫AWS s3 sdk 時加上ResponseContentDisposition
const getS3SignedDocumentURL = (docName) => {
  const url = s3.getSignedUrl('getObject', {
    Bucket: <aws-s3-bucket-name>,
    Key: <aws-s3-object-key>,
    Expires: <url-expiry-time>,
    ResponseContentDisposition: `attachment; filename="${docName}"`
  });

  return url;
};


參考資料https://stackoverflow.com/questions/59684182/s3-presigned-url-multiple-content-disposition-headers
https://stackoverflow.com/questions/19046718/aws-s3-force-file-download-using-response-content-disposition

2020年11月6日 星期五

SSD Format 4K using command

進入command模式
shift+F10

或直接windows cmd
cmd

打開diskpart
diskpart

列出硬碟清單,找出要操作的編號
list disk

選擇硬碟
select disk 0

清除硬碟
clean

初始化磁區
create partition primary align=1024

列出磁區,找出要操作的編號
list partition

選擇磁區
select partition 1

啟用磁區
active

格式化
format fs=ntfs unit=4096 quick

2020年11月4日 星期三

「調校」 透過關閉一些服務解決 Windows 10 CPU 使用率高的問題

https://zi.media/@yidianzixun/post/pbnXDf

簡單來說關閉以下服務
1. Connected User Experiences and Telemetry
2. Diagnostic Policy Service
3. Diagnostic Service Host
4. Diagnostic System Host

關閉P2P的windows update
1. 在找到最佳化傳遞並關掉它

關閉

[工作排程器]-[Microsoft]-[Windows]-[Application Experience]刪除或停用[Microsoft Compatibility Telemetry]排程



還有一些優化
關閉Windows Search
關閉superfetch(現叫sysmain)
關閉虛擬記憶體
https://kknews.cc/zh-tw/news/e4v5ejy.html


提高指定程式的優先權
https://superuser.com/questions/620724/changing-windows-process-priority-via-command-line

wmic process where name="node.exe" CALL setpriority "above normal"
wmic process where name="webstorm64.exe" CALL setpriority "above normal"

之類的

2020年8月27日 星期四

bash 的載入順序

打開bash後,要編寫變數可以寫在 ~/.bash_profile 或 ~/.bashrc。

也許還聽過 /etc/profile

位置不同但效果相同,有想過這些順序和情境到底怎麼使用嗎?

  • /etc/profile
  • ~/.bash_profile
  • ~/.bashrc
  • ~/.bash_login
  • ~/.profile
  • ~/.bash_logout
// 一般順序
execute /etc/profile
IF ~/.bash_profile exists THEN
    execute ~/.bash_profile
ELSE
    IF ~/.bash_login exist THEN
        execute ~/.bash_login
    ELSE
        IF ~/.profile exist THEN
            execute ~/.profile
        END IF
    END IF
END IF
// 互動登出
IF ~/.bash_logout exists THEN
    execute ~/.bash_logout
END IF
//互動式非登入
IF ~/.bashrc exists THEN
    execute ~/.bashrc
END IF


參考文章在此

Execution sequence for .bash_profile, .bashrc, .bash_login, .profile and .bash_logout

 https://www.thegeekstuff.com/2008/10/execution-sequence-for-bash_profile-bashrc-bash_login-profile-and-bash_logout/

2020年6月30日 星期二

Enable shutdown button on windows logon screen

For Windows 7 & 10 Regedit \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System shutdownwithoutlogon 1: Enable 0: Disable