Moonglade

Modern Markdown blogging with AI-powered localization and search.

Tag: .NET




Choosing the Right Monitor Size

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.

Views 769
.NET C# Display Display Resolution Monitor Resolution




C# Play with GZip.

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....

Views 280
.NET Base64 C# Compress GZip string extension



Query a Kusto database with C# and get the result as a List<T>.

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.

Views 3,410
.NET .NET Core Azure Azure Data Explorer C# KQL Kusto