Thứ Ba, 11 tháng 10, 2022

Cách cài đặt Chocolatey cho Windows

Chocolatey là gì?

Chocolatey là gì
Chocolatey là gì?

Chocolatey là một trình cài đặt dựa trên nền một gói quản lý ứng dụng (package manager) mang tên NuGet. Không giống như việc cài đặt thủ công, Chocolatey dùng câu lệnh (command line) để thực hiện cài thêm, cập nhật, và gỡ bỏ ứng dụng giống với cách hoạt động của các package manager đã rất quen thuộc trên Linux như apt-get, pacman…

Các bước cài đặt Chocolatey cho Windows:

Bước 1: Mở powershell với quyền admin

Mở powershell với quyền admin
Mở powershell với quyền admin

Bước 2: Kiểm tra quyền truy cập Get-ExecutionPolicy bằng câu lệnh: Get-ExecutionPolicy
Nếu trả Restricted thì các bạn gõ thêm câu lệnh: Set-ExecutionPolicy Bypass -Scope Process để gỡ restricted.

Bước 3: Chạy câu lệnh sau để cài Chocolatey cho Windows
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Bước 4: Kiểm tra xem đã cài Chocolatey cho Windows thành công chưa bằng câu lệnh: choco hoặc choco -?

Chúc các bạn thành công!




Thứ Hai, 26 tháng 9, 2022

Thứ Sáu, 15 tháng 4, 2022

Lý do tại sao undefined == null trong Javascript

Javascript là 1 cái gì đó rất magic mà khi làm việc với nó nhiều khi bạn phải thốt lên rằng "what the f**k" sao nó có thể như thế được nhỉ, sao trông nó lại như thế này. Và câu trả lời là: "thế đấy, hiểu thì hiểu mà không hiểu thì cũng phải hiểu"

Lý do tại sao undefined == null trong Javascript
Lý do tại sao undefined == null trong Javascript

Cụ thể ở bài viết này mình xin nói về trường hợp khi sử dụng so sánh với "==" mà undefined == null trả ra kết quả true.

Trong Javascript thì cả undefined và null đều thuộc kiểu dữ liệu nguyên thủy (primitive type) nghĩa là ngay từ kiểu dữ liệu đã khác nhau rồi nhưng khi so sánh bằng "==" thì vẫn cho ra kết quả true bởi vì khi sử dụng "==" để so sánh thì Javascript sẽ cố gắng ép về cùng 1 kiểu dữ liệu để so sánh (đây cũng là điểm khác biệt khi so sánh bằng "==" và "==="). Cụ thể thì ở đây thì cả undefined và null đều được parse về kiểu dữ liệu boolean và đều trả ra là false. Vì vậy undefined == null trong Javascript.

Cụ thể hơn các bạn có thể tham khảo thêm ở đây: https://262.ecma-international.org/5.1/#sec-11.9.3

Thứ Năm, 14 tháng 4, 2022

Thứ Ba, 12 tháng 4, 2022

1 số khái niệm chỉ số cơ bản trong chứng khoán
1 số khái niệm chỉ số cơ bản trong chứng khoán
1 số khái niệm chỉ số cơ bản trong chứng khoán

1. EPS (Earning Per Share) lợi nhuận trên mỗi cổ phiếu:

EPS = (Thu nhập ròng - Cổ tức dành cho cổ phiếu ưu đãi)/số lượng cổ phiếu đang lưu thông

Số lượng cổ phiếu có thể là:

  • Số lượng bình quân cố phiếu đang lưu thông (cho kết quả EPS chính xác hơn)
  • Số lượng cố phiếu đang lưu hành vào thời điểm cuối kỳ (thuận tiện cho việc tính toán)
2. P/Ehệ số giữa giá của cổ phiếu/lợi nhuận mỗi cổ phiếu, phản ánh mối quan hệ giữa giá trị trường của cổ phiếu và lợi nhuận trên mỗi cổ phiếu (EPS). Nói cách dễ hiểu hơn thì để có được 1 đồng lợi nhuận của cty bạn phải bỏ ra x đồng thì x ở đây chính là P/E

Thứ Tư, 30 tháng 3, 2022

How to fix error FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory NuxtJS

How to fix error FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory NuxtJS
How to fix error FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory NuxtJS

For everyone who faces this problem. Try to bump the memory limit with max-old-space-size the node optimization flag, but use it correctly. As example:

"scripts": {
  "dev": "node --max-old-space-size=4096 node_modules/nuxt/bin/nuxt.js",
  "build": "node --max-old-space-size=4096 node_modules/nuxt/bin/nuxt.js build",
  "start": "node --max-old-space-size=4096 node_modules/nuxt/bin/nuxt.js start"
}

An example for TS guys:

"scripts": {
  "dev": "node --max-old-space-size=4096 node_modules/@nuxt/typescript-runtime/bin/nuxt-ts.js",
  "build": "node --max-old-space-size=4096 node_modules/@nuxt/typescript-runtime/bin/nuxt-ts.js build",
  "start": "node --max-old-space-size=4096 node_modules/@nuxt/typescript-runtime/bin/nuxt-ts.js start"
}

If you still get errors, allocate some more memory--max-old-space-size=8192, etc.
If you don't have enough memory on the node, try to add a flag --optimize_for_size, this will allow less memory to be allocated but may affect performance and give some errors in theory.


Source: https://github.com/nuxt/nuxt.js/issues/5396#issuecomment-671779648

Chủ Nhật, 19 tháng 9, 2021

Cách Phân Biệt 5 Chuẩn Token ERC-20, TRC-20, OMNI, BEP2, BEP20 (BSC)

5 CHUẨN TOKEN PHỔ BIẾN HIỆN NAY

➖ Chuẩn token OMNI: Đây là một chuẩn token được phát hành bởi mạng lưới Bitcoin. Do đó, địa chỉ ví của các dụ án tiền điện tử được phát hành trên mạng lưới này là địa chỉ ví Bitcoin. Đương nhiên, hoạt động rút/nạp đều diễn ra trên mạng lưới này. Địa chỉ ví bắt đầu ký hiệu bằng số 1 hoặc 3… Trả phí giao dịch bằng BTC ➖ Chuẩn token ERC20: Là chuẩn token của mạng lưới Ethereum. Địa chí ví của nó sử dụng chuẩn chung của Ethereum. Hoạt động nạp/rút sẽ diễn ra trên mạng Ethereum. Địa chỉ ví bắt đầu ký hiệu bằng 0x Trả phí giao dịch bằng ETH ➖ Chuẩn TRC20: Chuẩn token mạng lưới Tron. Mọi giao dịch giữa các chuẩn này đều được thực hiện trên mạng lưới Tron. Địa chỉ ví bắt đầu ký hiệu bằng T… Trả phí giao dịch bằng TRX Chuẩn BEP2 (Binance Chain): Chuẩn token xây dựng trên nền tảng hợp đồng thông minh của mạng Binance Chain. Địa chỉ ví bắt đầu ký hiệu bằng bnb… Trả phí giao dịch bằng bnb loại BEP2 ➖ Chuẩn BEP20 (Binance Smart Chain): Ký hiệu BSC. BEP20 đại diện cho tiêu chuẩn token trên Binance Smart Chain (BSC). Địa chỉ ví bắt đầu ký hiệu bằng 0x... giống hệt địa chỉ của mạng ETH Trả phí bằng BNB (loại BEP20 còn gọi là BSC hoặc Smart Chain)

Thứ Bảy, 10 tháng 4, 2021

How to fix error "Got permission denied while trying to connect to the Docker daemon"

How to fix error "Got permission denied while trying to connect to the Docker daemon"

If you want to run docker as non-root user then you need to add it to the docker group.

  1. Create the docker group if it does not exist
$ sudo groupadd docker
  1. Add your user to the docker group.
$ sudo usermod -aG docker $USER
  1. Run the following command or Logout and login again and run (that doesn't work you may need to reboot your machine first)
$ newgrp docker

  1. Check if docker can be run without root
$ docker run hello-world

Reboot if still got error

$ reboot

Taken from the docker official documentation: manage-docker-as-a-non-root-user




Source from: https://stackoverflow.com/questions/48957195/how-to-fix-docker-got-permission-denied-issue


Chủ Nhật, 8 tháng 11, 2020

How to install Anki for Linux mint 19.2 Cinnamon

 Step 1: sudo apt-get update -y

Step 2: sudo apt-get install -y anki

After that you can see at start menu like that

How to install Anki for Linux mint 19.2 Cinnamon

If you can run it and catch this error when run Anki with termianl like that:
Error can't open Anki for linux

You must to install package python3-distutils by: sudo apt-get install python3-distutils



Thứ Ba, 4 tháng 8, 2020

How to push notification in NuxtJS with Firebase Cloud Messaging
How to push notification in NuxtJS with Firebase Cloud Messaging
How to push notification in NuxtJS with Firebase Cloud Messaging

In this post, I'll talk about how to push notification in NuxtJS with Firebase Cloud Messaging.

You need to do those steps to push notification with Firebase Cloud Messaging.
  1. Create a Firebase app at https://console.firebase.google.com/ then you create a new web app project to receive info about your firebase web app project.
  2. Add firebase package to your project use: yarn add firebase (npm i firebase if you use npm).
  3. Add file firebase-messaging-sw.js to the static folder.
  4. Add file firebase.js to the plugins folder.
  5. Register firebase plugins at plugins block in nuxt.config.js file.
After config firebase cloud messaging for your NuxtJS project. You need to register it in your project and request permission to push notification and send this token for server. In my project, I put it to pages/index.vue like that.

Then request permission success, you can receive data from the server through 2 ways.
  1. When project running on an active tab (chrome/safari/firefox...) you use method messaging.onMessage() of firebase/messaging to handle data received. You can update your pages/index.vue like that.
  2. When your project offline or running on a nonactive tab browser, you'll receive notification of the browser.
Now, you can test feature push notification with Firebase Cloud Messaging. I hope that I can help you with this post and enjoy it.

Thank you for reading. I so sorry, because I don't good at English.