In this blog, I will briefly introduce how to use C to manage InfluxDB data. InfluxDB is a time series database designed to handle high write and query loads. It is an integral component of the TICK stack. InfluxDB is meant to be used as a backing store for any use case involving...
To start a process and get the output, it might be simple. (Do NOT COPY!!! Wrong code!!!) csharp var process = new Process { StartInfo = new ProcessStartInfo { FileName = bin, Arguments = arg, CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden, WorkingDirectory = path...
This article provides an in-depth analysis of the critical role of PPI (Pixels Per Inch) in application development and monitor selection. Since the vast majority of desktop applications are designed based on the 96 PPI standard, using Fractional Scaling when a monitor's PPI is not an integer multiple of 96 can result in blurry images or jaggies. The article points out that when selecting a monitor, one should calculate its PPI to ensure it is close to an integer multiple of 96 (such as 96, 192, or 288), thereby achieving clear and appropriately sized text display through 100%, 200%, or 300% integer scaling. For macOS users, the 72 PPI standard should be referenced, ensuring the PPI is an integer multiple of 72. The article demonstrates how to calculate the optimal scaling ratio based on resolution and size using examples such as LG OLED, Surface Studio, and the Apple Studio Display, and provides C# code to assist in the calculation. Finally, it emphasizes that while PPI and scaling ratios are core parameters for ensuring text clarity and appropriate size, other performance metrics such as color accuracy, refresh rate, and HDR support must also be considered when purchasing a monitor. This article aims to help resolve issues of text being too large or too small and scaling blur, rather than providing a sole standard for selection.
As individuals, it's important to have a way for others to easily verify our identity. One of the best ways to do this is by using a digital certificate for signing. Digital certificates can do many things, such as signing code. Certificates are split into two parts, public and p...
Before starting, you need to make sure you have your own GitLab instance or have registered GitLab.com. Check in your .NET project. Make sure there is the .sln file in the root of the repository: Add the following packages to all your unit test projects: coverlet.collector JunitX...
Sometimes, we need to check if the input is valid. Usually, we may do this: // Bad example: // Requires a lot of duplicate code. Bad architecture. if (string.IsNullOrWhiteSpace(InputArgument.TargetMachine)) { throw new ArgumentException($"Invalid input argument! Target Machine: '...
A extension class for string to add GZip features. Copy the following code to your project first. using System; using System.IO; using System.IO.Compression; using System.Text; public static class GZipExtensions { private static byte[] Zip(string str) { var bytes = Encoding.UTF8....
Background Reference: c Why should Console.WriteLine be avoided in library code? Stack Overflow Do not use the Console class to display output in unattended applications, such as server applications. Calls to methods such as Console.Write and Console.WriteLine have no effect in G...
Just built a simple retry engine in C . csharp /// <summary /// Retry engine. /// </summary public class RetryEngine { private static Random rnd = new Random(); private readonly ILogger<RetryEngine logger; /// <summary /// Creates new retry engine. /// </summary /// <param name="...
This article introduces KustoBuffer, a high-performance non-blocking data buffering component designed to optimize bulk write performance to Kusto databases. The design draws on the implementation approach of ArrayDb, with its core mechanism employing a double-buffering strategy that leverages concurrent queues to decouple data writing from persistence. The system controls the write flow through engine tasks and incorporates a cooling engine mechanism, which dynamically calculates sleep time based on the amount of data in the buffer, thereby balancing write frequency against data fragmentation issues. The article provides detailed code implementations, including thread-safe buffer exchange logic, a logarithmic-function-based sleep time algorithm, and synchronization methods that ensure eventual data consistency. This solution effectively avoids lock contention in high-concurrency scenarios, improves system throughput, and prevents resource waste through fine-grained state management, offering a robust and efficient solution for large-scale data write scenarios.