Anduin Xue

let today = new Beginning();

All Posts


时评:国家对于子女教育方面的政策还需要多方面配套

之前看到中央办公厅 国务院办公室印发了减轻学生作业和校外培训负担的意见。(中共中央办公厅 国务院办公厅印发《关于进一步减轻义务教育阶段学生作业负担和校外培训负担的意见》_中央有关文件_中国政府网 (www.gov.cn)) 从意见中看得出,其主要目的之一,仍然是为了降低现在家长的育儿压力。而目前的现状仍然更倾向于是:家长没有那么多精力来管教孩子的业余生活,而课外生活往往又内卷于做题和研究解题技巧这些意义不大的事情上。通过标准教育流程的学生,往往精于解题技巧,却对社会本身的运行原理理解并不深入,生存能力也并不高,反而在业余时间找不到舒适又能够被所有人许可的娱乐方式。 而在6月8日,人民时评一篇报道:以制度效能守护健康上网(人民时评)--理论-中国共产党新闻网 (people.com.cn),其主要方向仍然围绕在避免未成年人的过度网络游戏、消费行为上。要求增加更多对未成年人在网络游戏上的制度建 …

China Politics Education


Build a common cache service for your C# app.

Recently, I found that almost every time I creates a new .NET app, I gonna 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 starting, make sure the project references Microsoft.Extensions.Caching.Memory and Microsoft.Extensions.Logging.  …

ASP.NET Core C# .NET Core Performance Caching .NET Cache MemoryCache


Tips about rules setup for Outlook enterprise users

How to set rules for an employee in a large company that uses outlook? As I work at Microsoft, I receive thousands of emails every day. Usually including: Advertisement and news. Daily updates. Topics about the project I'm working on. My crew working discussion Robots notification (like GitHub notification) Incident alerts. Oncall requests from other teams. Updates from my organization. Questions  …


软件工程领域中的逆全球化趋势

在过去的二十年间,我们目睹了中美关系的长足发展带来了在技术领域非常多元的交流。其中典型的代表,就是微软和苹果在中国的市场发展。李永乐老师的视频中曾经指出:两个国家在贸易的过程中,一定是对国家双方都有利益的。 在这样的思想的指导下,我们始终认为构建的应用,也应该是越来越“全球化”的。所谓全球化,指的也正是在应用能够全球布局,全球服务。而面向这种全球布局的应用,我们完全可以在已有的基础设施、服务和运维经验的基础上,来大幅度的降低我们的维护成本。因为我们始终只需要一份专业的运维团队来维持全球的数据和服务。 我们曾经在思考一个问题的时候,也随着技术的背景发展,我们思考“分布式”的方式也逐渐改变。其中,最典型的代表就是在思考CAP定理时,我们更多的考虑的是实现分区容忍性和可用性,而弱化最终一致性。这类使用场景,在例如Email、微信等通信App的构建上时非常典型。也就是说,我们可以考虑中美两个大型数 …

Multi-tenant China Software Development AirGap

Build a package that can be used in browser and node with TypeScript

Sometimes I may need to share some of my logic\algorithm with other developers. In this case I might need to build a library. That library might be used in the customer's browser, or might be referenced by other front-end projects, may be based on Angular or React. So how can we build a package with TypeScript that benefits from strong type while can be installed\reference\used by others? After  …

Web npm TypeScript node webpack JavaScript Front-end

Use Azure Key Vault to store connection strings for App Service.

Sometimes, we need to provide key-values as environment variables for Azure app service, like database connection strings. In some cases, we might need someone to collaborate managing the app service. However, with app service environment variables access, he will also be able to connect to the database manually and do custom database operations, like drop database. That is not what we expected.  …

Azure App Service Azure Security Key vault

Programmatically connect to the remote server via SSH and execute remote command.

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 After creating the new project, install the latest SSH.NET library. Reference: NuGet Gallery | SSH.NET 2020.0.1 And  …

C# .NET Core bash Linux SSH

Use JetBrains code quality analyzer to prevent checking-in bad C# code

When we are using Azure DevOps to review PR, it's simple and easy to use. Usually, we only run tests and build tasks, like this: In my previous blog, I mentioned how to run test and generate code coverage for CI pipelines: Display code coverage information for .NET Core project using Azure DevOps. - Anduin Xue (aiursoft.com) -------------- JetBrains ReSharper and Rider are impressive C# grammar  …

C# Azure DevOps JetBrains Resharper Code Quality Pipelines

FFmpeg 用法概览

背景 最近买了个4K,144Hz的 HDR 显示器。新的显示器很不错,于是我想先进行测试一下。 于是我下载了非常多 4K 视频,准备观赏观赏。但是很快发现,怎么得到最优质的播放体验还是一个深坑。而衡量视频质量,除了看分辨率,还要看编码格式,码率,色彩,HDR等信息。 显然,现在折腾视频,最方便的工具就是 ffmpeg 了。FFmpeg 是一个开放源代码的自由软件,可以执行音频和视频多种格式的录影、转换、串流功能,非常适合快速、批量的修改视频。 开始之前 安装ffmpeg ffmpeg 的最新版下载地址始终都是: https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-full.7z 直接将其下载,解压,放到一个地方,将 exe 文件所在路径加入环境变量 PATH 即可。 了解视频的编码格式 开始之前,需要先了解平时经常使用的编码格式和平台支持情况,以及什 …

bash FFmpeg

C# run tasks in a threads pool with fixed size

Imagine I have 100 tasks to run. But my machine has only 16 core. So I expect that every core will run one task in parallel. And once a core is idle, assign a new task to it. That will be very easy for C# with Task. But before starting, we gonna create a thread-safe queue for saving our tasks. public class SafeQueue<T> { private readonly Queue<T> queue = new Queue&  …

C# Async Task Multi-Threading