William Basics

Keep learning, never ending.

Using NSIS to make a setup

Using NSIS to make a setup 引言 NSIS是一款制作Windows应用安装包的软件。由于其插件繁多以及不错的可扩展性,所以到今天依旧是一个不错的选择。 准备 文中

[WPF] How to avoid calling initial methods in the view model’s constructor

Introduction When developing a WFP application in the MVVM way, we often need to initialize such as loading data, logging, and other kinds of stuff when the view model is created. The no-brain way is to call the “initialization” method directly in the view model’s constructor while hoping the calling method never fails and finishes instantly. public class AwsomeViewModel { public AwsomeViewModel () { LoadDataFromDatabase(); } } However, To call a method that is likely to fail or costs a long time is a bad practice in any way.

Publish and install the Nuget package with Gitlab Server

Introduction When we do the .NET development, there are four ways to share the code. One is sharing the code directly, which is not a good idea. The second way is adding the projects as references. However, we don’t have the projects to add in many cases. The third way is adding the lib binary. It is working, but the dependency problems are pretty annoying and take lots of effort to figure out.

[PostgreSQL] - Simple and Quick Start a PostgreSQL Server with Docker

Introduction There are already some guides to introduce ways to start a PostgreSQL Server with Docker. But none of them helps me to work it out. That’s why I wrote my version to note the problems I encountered and their solutions. The environment My working computer is Windows 10, and the version of the docker desktop is 4.3.2. The Steps 1. Get the PostgreSQL docker image You can find the docker image at https://hub.

[Math] - FFT By Using Math.NET Numberics

引言 快速傅里叶变换是信号处理的常用工具。当我们想要对时间域里的连续信号进行成分分析时,我们就需要通过傅里叶变换来将时间域的连续信号转化为频率

[UnitTest] -How to test a private method in C#?

引言 对于是否要测试私有方法的争论由来已久。很多人对于这个问题总是不从正面回答,反而掉过头来尝试说服提问者放弃这个想法。是的,我们虽然有很多理

[WPF] - Data Binding

Introduction 在应用了MVVM设计模式的情况下,Data Binding特别常见。因为我们需要通过它来将前后端分离,让UI的归UI,业务归业务。 所谓Dat

[Algorithm] - C# - Join the xml nodes name by using backtracking

背景与问题介绍 XML文件,大家都很熟悉了。其中的各个节点组成了一颗“树”。 比如 <A> <B> <C/> </B> <D> <E/> </D> <F> <G/> </F> </A> “客户”要求希望开发一个程序,来通过节点

[Better code] - C# - Using Indexer

什么是Indexer? Indexer 可以帮助我们如同用索引来访问数组中的元素一样来访问自定义对象中的元素。它不仅可以帮助我们写出更流畅的代码,更提高了代

[UnitTest] - 用FluentAssertions让单元测试代码更优美

Introduction 早在2005年,Martin Fowler就提出了“fluent interface“这种编码风格(link)。我们比较熟悉的LINQ就是这”