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...
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.
Recently, I found that almost every time I creates a new .NET app, I need cache service. While Microsoft officially provides the IMemoryCache, I found that it is pretty complicated for you to use it. For it requires a lot of code. So I wrapped it to a more common one. Before star...
Recently I was trying to build a server management tool. That I need to connect to my server (Ubuntu) programmatically. I usually access my server via SSH, as a normal human. So I wanna do it with the same approach. First, create a new .NET Core project with: dotnet new console A...
Target. Display code coverage information on your own .NET Core project. First, create a build pipeline in your Azure DevOps. If you are using the classic designer, you need to add new .NET Core command line step. Make sure you publish the test result. As for the Arguments input,...
In the official document, there is only an example of the ASP.NET Core integration test using xunit. https://docs.microsoft.com/en us/aspnet/core/test/integration tests But what if you don't like xunit? Can we replace that with MSTest? Yes. We can. Brief steps Uninstall xunit. In...
The source code this blog mentioned is here: https://github.com/Anduin2017/SuperRandom The traditional methods for obtaining \ n\ non repeating random numbers are: The random number is generated by the linear congruence method, and each random number is generated and compared in ...
Now with .NET Core 3, Microsoft released a new .NET Core HTTP client. Reference: https://docs.microsoft.com/en us/aspnet/core/fundamentals/http requests?view=aspnetcore 3.1 With the new client, to call a WEB API is much easier. For example, to make an HTTP GET request: var client...
Kahla.SDK ========= Kahla.SDK is a library for writting bots and extends for Kahla. Tutorial How to create a bot with Kahla.SDK This will introduce how to write a bot for Kahla. Before starting, make sure you have .NET Core SDK installed. Download .NET Core SDK here. 1\. Create a...
This article documents the practical process of integrating Tencent Cloud live streaming push functionality in a C# environment. Since Tencent Cloud officially provides code examples only in Java and PHP, and the push URL must be generated on the client side, the author successfully reverse-engineered the Java examples to decipher the generation logic of the critical parameter `txTime`, confirming it to be a Unix timestamp counting from January 1, 1970. Subsequently, the author implemented the complete signing algorithm in C#, including calculating the MD5 value, string concatenation, and conversion to hexadecimal format, ultimately generating valid push and playback addresses. The article details the complete code implementation from timestamp conversion and MD5 encryption to final URL construction, resolving the difficulty C# developers face in understanding the signing mechanism due to the lack of official documentation support. It provides a reusable technical solution and code reference for integrating live streaming features in similar scenarios.