小肥橘 [......] 继续阅读
[TOC] 笔者前段时间在学习数据结构时,恰好听说了 LSM Tree,于是试着通过 LSM Tree 的设计思想,自己实现一个简单的 KV 数据库。 代码已开源,代码仓库地址:https://github.com/whuanle/lsm 笔者使用 Go 语言来实现 LSM Tree 数据库,因为 LSM Tree 的实现要求对文件进行读写、锁的处理、数据查找、文件压缩等,所以编码过程中也提高了对 Go 的使用经验,项目中也使用到了一些栈、二叉排序树等简单的算法,也可以巩固了基础算法能力。适当给自己设定挑战目标,可…
Pursuit is not about getting what you wish for, but rather about the twists and turns of fate. [......] 继续阅读
Face yourself and maintain a calm mindset. Everyone goes through periods of underestimation and discomfort, and there are many things that cause us pain. It's natural to hope for someone to accompany you. In fact, instead of focusing on finding someone to shar…
要正视自己,放平心态,每个人处于低估和难受的时期,很多事让自己痛苦,希望可以找一个人一起陪伴。 其实,不用管想着有人陪伴你受苦,经历磨难。而是你应该经历苦难后,走出低谷,摆脱困境,这才是当前最应该做的事情。 即使是找到另一半,别人也没有义务承担你的痛苦,何必在痛苦的时候,让另一个也痛苦呢。 悲喜自渡。 [......] 继续阅读
Title: Given an integer array nums. Return true if any value appears at least twice in the array, and return false if every element is distinct. Example 1: Input: nums = [1,2,3,1] Output: true Example 2: Input: nums = [1,2,3,4] Output: false Example 3: Input: …
题目: 给你一个整数数组 nums 。如果任一值在数组中出现 至少两次 ,返回 true ;如果数组中每个元素互不相同,返回 false 。 示例 1: 输入:nums = [1,2,3,1] 输出:true 示例 2: 输入:nums = [1,2,3,4] 输出:false 示例 3: 输入:nums = [1,1,1,3,3,4,3,2,4,2] 输出:true 提示: 1 <= nums.length <= 105 -109 <= nums[i] <= 109 来源:力扣(LeetC…
第一种: private bool IsDefaultValue(T value) { Span<byte> valueBytes = MemoryMarshal.AsBytes<T>(new T []{ value }.AsSpan()); var defaultBytes = new byte[valueBytes.Length]; return valueBytes.SequenceEqual(defaultBytes); } 第二种: public class Test<T&g…
第一种: private bool IsDefaultValue(T value) { Span<byte> valueBytes = MemoryMarshal.AsBytes<T>(new T []{ value }.AsSpan()); var defaultBytes = new byte[valueBytes.Length]; return valueBytes.SequenceEqual(defaultBytes); } 第二种: public class Test<T&g…
<ItemGroup> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0-preview.2.22152.2" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0-preview.2.22152.2&qu…
<ItemGroup> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0-preview.2.22152.2" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0-preview.2.22152.2" /> <PackageReference Include="…
Using interfaces has another benefit: it facilitates mocking. To evaluate whether your code is good, properly separated, or over-designed, write comprehensive unit tests for yourself. If it's difficult or impossible to write unit tests for your own code, then …
Packages: Microsoft.AspNetCore.Mvc.Testing Microsoft.AspNetCore.TestHost Moq Integration testing can ensure that application components are functioning correctly at levels that include application support infrastructure such as databases, file systems, and net…
包: Microsoft.AspNetCore.Mvc.Testing Microsoft.AspNetCore.TestHost Moq 集成测试可在包含应用支持基础结构(如数据库、文件系统和网络)的级别上确保应用组件功能正常。 ASP.NET Core 通过将单元测试框架与测试 Web 主机和内存中测试服务器结合使用来支持集成测试。 集成测试确认两个或更多应用组件一起工作以生成预期结果,可能包括完整处理请求所需的每个组件。 这些更广泛的测试用于测试应用的基础结构和整个框架,通常包括以下组件: 数据库 文件系统 …
using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; using BenchmarkDotNet.Running; public unsafe class Model { public int Id { get; set; } public string Name { get; set; } public string Description { get; set; } private static Model _model = new Mode…
using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; using BenchmarkDotNet.Running; public unsafe class Model { public int Id { get; set; } public string Name { get; set; } public string Description { get; set; } private static Model _model = new Mode…
What is DDD Domain Model What is a domain model? A domain model is a software model that pertains to a specific business domain. Typically, a domain model is implemented through an object model that encapsulates both data and behavior, expressing accurate busi…