Tối ưu hiệu suất .NET Core In-Process và Out-of-Process

Trong quá trình phát triển phần mềm, việc tối ưu hiệu suất luôn là vấn đề được quan tâm khi triển khai, đặc biệt trong .Net Core. Việc bạn lựa chọn các hosting model nào để chạy sẽ ảnh hưởng quan trọng đến hiệu suất của ứng dụng. Trong .Net có 2 phương pháp để hosting là In Process và Out Of Process. Với từng model sẽ có những ưu và nhược điểm riêng để phù hợp cho nhiều trường hợp khác nhau. Nhưng trước hết, ta hãy thử nghiên cứu về các khái niệm liên quan đến hosting model nhé. ...

10/11/2024

Lazy giúp khởi tạo trong multithread

Ở bài viết Singleton Pattern, tôi có trình bày về một cách đơn giản để tạo Singleton Pattern trong môi trường thread-safe bằng cách sử dụng Lazy. Trong .Net, đây là một class được dùng để khởi tạo an toàn trong môi trường đa luồng. Lazy là gì? Lazy<T> là một lớp giúp bạn trì hoãn việc tạo đối tượng cho đến khi sử dụng đối tượng đó lần đầu tiên, chúng ta có thể gọi là Lazy Initialization hay là khởi tạo chậm đều được. ...

11/08/2024

Save data less in database using theory of bit in C#

Using bit fields in C/C++ might be familiar to you. In C/C++, bit fields allow you to create multiple variables within a single byte, within the limits of the bit representation. Today, I’m sharing a similar technique for C#. It’s important to note that this method doesn’t exactly mirror C/C++ bit fields. Instead of optimizing variable size at runtime, it focuses on optimizing data storage. This post will guide you through this technique and compare it with C/C++. ...

06/08/2024

Hiểu về từ khoá this trong Javascript

Với các bạn từng học các ngôn ngữ hướng đối tượng khác ví dụ như C#, Java,.. thì chắc hẳn bạn đã rất quen với khái niệm this . Và khi mình tìm hiểu một chút về từ khoá này thì mỗi ngôn ngữ sẽ có cách sử dụng khá khác nhau. Nhưng nhìn chung, mọi ngôn ngữ đều chung một mục đích hay sử dụng là phân biệt parameter của function và properties của class, ngoài ra còn một số cách sử dụng khác. Tuy nhiên, trong bài viết này, tôi sẽ trình bày với các bạn từ khoá this trong Javascript. ...

29/04/2024

Changing default Grub boot options

Many people install dual boot both Windows and Linux. Some of them prefer set up Linux as a primary Operating System while some want to set Windows as their primary OS. After you install dual boot and start your computer, the Grub boot options will appear for you to choose, OS which you want to enter. If you prefer to have Windows as primary OS, this is inconvenient. The good news is that you can customize the priority OS in Grub boot. ...

23/03/2024

Bit Fields in C++ devide many variable with one byte

Structs are essential in C/C++ for creating new data types that simplify variable management. However, a lesser-known feature of C/C++ structs is Bit Fields, which allow you to allocate a specific number of bits for a variable, optimizing memory usage. Introduction Bit Fields allocate adjacent memory positions to hold a series of bits. For example, instead of using 8 bytes to store 8 flags (which would waste 54 bits), you can store them in a single byte by dividing the byte into different bit regions. ...

12/04/2021