William Basics
Keep learning, never ending.
Home
All Posts
About
Tags
Categories
Posts
01
Apr 2022
[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 …
22
Jan 2022
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 …
05
Jan 2022
[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 …
04
Dec 2021
SEMI Standards Summary
Name A.K.A Keyword Description E4 SECS-I [RS-232] The SECS-I standard defines a low level communication protocol for interfacing a …
28
Nov 2021
[Math] - FFT By Using Math.NET Numberics
引言 快速傅里叶变换是信号处理的常用工具。当我们想要对时间域里的连续信号进行成分分析时,我们就需要通过傅里叶变换来将时间域的连续信号转化为频率域的离散形式。这样我们就能知道这信号的频率成分以及相对的增益大小。 Math.NET Numberics Math.NET …
20
Nov 2021
[UnitTest] -How to test a private method in C#?
引言 对于是否要测试私有方法的争论由来已久。很多人对于这个问题总是不从正面回答,反而掉过头来尝试说服提问者放弃这个想法。是的,我们虽然有很多理由证明去测试一个私有方法不仅会遭人唾弃,而且纵欲过度还会引火烧身。 但是我们在开发中总是会遇到一些意外情况让我们不得不去测试它们。比如一个 …
14
Nov 2021
[WPF] - Data Binding
Introduction 在应用了MVVM设计模式的情况下,Data Binding特别常见。因为我们需要通过它来将前后端分离,让UI的归UI,业务归业务。 所谓Data Binding,就是将数据源中的某些信息赋给目标对象的某个属性。目标对象的这个属性必须是dependency …
03
Nov 2021
[Algorithm] - C# - Join the xml nodes name by using backtracking
背景与问题介绍 XML文件,大家都很熟悉了。其中的各个节点组成了一颗“树”。 比如
“客户”要求希望开发一个程序,来通过节点之间的树形关系得到以下结果 A A\B A\B\C A\D A\D\E A\F A\F\G 解决方案 .NET 中XML文件的解析,我 …
31
Oct 2021
[Better code] - C# - Using Indexer
什么是Indexer? Indexer 可以帮助我们如同用索引来访问数组中的元素一样来访问自定义对象中的元素。它不仅可以帮助我们写出更流畅的代码,更提高了代码的可读性。下面我将用一个示例来一起看看Indexer 是如何帮助到我们的。 使用Indexer 背景示例 假设 …
17
Oct 2021
[UnitTest] - 用FluentAssertions让单元测试代码更优美
Introduction 早在2005年,Martin Fowler就提出了“fluent interface“这种编码风格(link)。我们比较熟悉的LINQ就是这”fluent“风格的。 这种编码风格,使得代码表达十分流畅,更容易阅读和理 …
10
Oct 2021
WPF - Realtime charting by using DevExpress WPF toolkit
Realtime charting by using DevExpress WPF toolkit Realtime chart的用途十分广泛,特别是在测量领域尤为常见。 这个代码样例实现了一个realtime chart的原型,借助了DevExpress WPF …
03
Jun 2021
WPF - Localization on-the-fly
WPF的本地化或者说对多国语言的支持,微软官方给出的方案是借助Uid加上WPF Samples中的小工具locBaml来实现。这种方案的一个缺点就是界面语言的切换需要重新打开Window甚至重启程序。文章最后编辑日期是在2017年,都2021年了,WPF竟然还没有给出一个优雅的方 …
02
Jun 2021
WPF - Locbaml : Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly
这个error信息十分隐晦,解决方案是将LocBaml.exe拷贝到project的build目录下(xxxproject\bin\Debug)。 运行成功,对应的csv文件产生了。 千万不要用Windows环境变量PATH里设定的LocBaml,也不要在其他路径 …
27
May 2021
WPF - Creating Control Template Assembly
WPF - Creating Control Template Assembly 1. 新建一个WPF User Control Library project 删除 User Control1.xaml 2. Add New Item - Resource …
29
Apr 2021
Go Concurrency
Concurrency in Go Go提供了两个独特创新的方式来实现并发,他们就是goroutine和channel。 goroutine是Go程序中可执行的最小单元。channel可以使goroutine间的通信变得高效。 在Go中,所有可执行的代码都是通 …
27
Apr 2021
Go的函数
Go的函数 Go函数的定义以 func 关键词开头。 匿名函数 Go支持匿名函数,常常用于函数式编程中。匿名函数又被称为 闭包(closure) 多个返回值的函数定义 func aFunction() (int, int, float64, string) { } …
24
Apr 2021
Go 编译和打包
Go 编译和打包 你可以使用 go tool compile 命令来将代码编译为 .o (object)文件。 object文件中是go源代码的机器码。一般情况下,是无法直接执行的。 $ go tool compile example.go // 产生 .o 文件 -pack 命 …
23
Apr 2021
Go and JSON
Go - JSON encoding/json 包提供了对JSON格式文本的支持。 encoding/json 提供了4个函数 Encode() Decode() Marshal() Unmarshal() 前两者操作单个对象,后两者操作多个对象。 Encode and …
20
Apr 2021
Go的基本数据类型
Go的基本数据类型 数字数据类型 整数 Go 支持 int8, int16, int32, int64, uint8, uint16, uint32, 以及 uint64。 一般直接用 int 和 unint 。 另外,byte 是 uint8 的别名。 浮点数 Go …
01
Jan 0001