Zhuangkh

A .Net Developer

All Posts


「读书笔记:周志明的软件架构课」

Reference Murphy’s Law: Anything that can go wrong will go wrong. 墨菲定律:凡事只要有可能出错,那就一定会出错。 Conway's law: Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure. 康威定律:设计系统的架构受制于产生这些设计的组织的沟通结构。 演进中的架构 架构并不是被“发明”出来的,而是持续进化的结果。 技术架构者的第一职责就是做决策权衡。 单体架构(巨石系统 Monolithic Application) 并非 "不可拆分 All in One Piece", …

Book Notes Architecture

Helix Toolkit 介绍

Introduction WPF与WinForm, DirectX与GDI 众所周知, WPF使用了DirectX作为底层的渲染技术, 截至今日, 仍然使用着DirectX 9 (.Net和.Net Core实现均是如此). 作为对比, Windows Form使用的是GDI/GDI+技术. GDI/GDI+ 全称是 Graphics Device Interface, 有着30+年的历史, 它是一个用于操作图像和执行绘图的API, 几乎在所有的windows应用程序中都使用. 其中GDI+是GDI的升级版本, 出现在Windows XP版本中, 增加了渐变笔刷、样条、多种图片格式支持等等. GDI/GDI+在.NET中,封装存在于System.Drawing.dll程序集中. GDI/GDI+是2D渲染API, 基于cpu实现, 假设你要画一个Cube,你必须在cpu上先处理好Cube的 …

WPF Helix Toolkit 3D Render

ROS配置零碎记录

记录一下最近遇到两个需求的配置. DHCP特定分配 由于旁路由使用了fake-ip模式的clash, 但是遇到一些情况对这种模式不适用, 比如使用了Teredo IPv6转换技术的Xbox网络, 会无法进行限定, 开了加速器都没办法让他稳定和别人连接; 还有一个是家里的扫地机, 在此模式下App一直显示离线. 没找到合适的旁路设置方案, 就先从设备的网关下手了, 改回主路由上. 首先需要在DHCP Server的Options加两条记录, 代表你想要赋予给特定机器的网关和DNS, 特别需要注意的是Value的值需要用单引号包括起来. DHCP Option 然后在我们需要特定分配网关的客户端记录里, 将刚才新增的两条option记录加上. Lease 这样分配给这台机器的就是我们刚才配置的设置而不是DHCP server默认的设置了. 附Option Code表 <table class= …

Router ROS

How to check if a process is using dotnet

As we all know, we can get information about the processes in the system simply by using the methods provided by the Process class in the System.Diagnostics namespace. For example, you can get all processes by Process.GetProcesses() and all processes by the specified name by Process.GetProcessesByName(). But how do we know if the process is using dotnet or was created by dotnet? Here are three …

.Net Process

Get information of the installed MSI products

MSI files are Windows Installer data packages that actually contain application files stored in a COM structure and a database containing applications information for installing, updating, uninstalling. Windows provides a set of APIs for manipulating msi programs, contained in msi.dll, three of which are listed below. [DllImport(msi.dll, CharSet = CharSet.Unicode)] private static extern uint …

Revit MSI Navisworks GUID SQUID

家庭网络环境改造Ⅱ:系统

Proxmox安装 去除订阅弹窗 免费版本的PVE会在登陆WEB管理页面时提示 没有有效的订阅。 You do not have a valid subscription for this server. Please visit www.proxmox.com to get a list of available options. 我们可以通过修改源码来去除这个提示,打开文件 /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js ,找到第381行。 if (data.status !== = 'Active') { Ext.Msg.show({ title: gettext('No valid subscription'), icon: Ext.Msg.WARNING, …

Network Router

ConfigureAwait的使用

ConfigureAwait的使用 Task.ConfigureAwait(bool)指示了Awaiter完成任务时是否尝试将结果返回原上下文中继续执行,Ture为尝试返回,False则相反。 在讨论ConfigureAwait的正确使用场景之前,则应该先了解SynchronizationContext类型。 SynchronizationContext SynchronizationContext提供了在同步模型中传播上下文的基本功能,其中Send()方法将一个同步消息调度到一个上下文中,Post()方法将一个异步委托调度到一个上下文中。 例如,WinForms具有一个SynchronizationContext的派生类型,它重写了Post方法,以完成相当于Control.BeginInvoke的功能;这意味着对它的Post方法的任何调用都将导致委托稍后在该Control的UI线程上被调 …

.Net Task SynchronizationContext

Revit Stable Reference

Reference Reference in revit is the geometric reference object of the model element ,it is often used when inserting a new face-base instance of a family , or when creating the demensions. The following is an introduction to some of the methods used to obtain the reference. Reference Type <table class="table"> <thead> <tr> <th>Enum</th> <th>Representation</th> <th>StableRepresentation Comment</th> …

Revit Reference

「读书笔记:Concurrency in .Net」Compose&Closure

函数组合 <table class="table"> <thead> <tr> <th>流水线</th> <th>函数组合</th> </tr> </thead> <tbody> <tr> <td>每个函数输出是下一个函数输入</td> <td>返回多个函数组合而成的新函数</td> </tr> <tr> <td>立即求值</td> <td>延迟求值</td> </tr> </tbody> </table> Example: 咖啡豆 -> 磨豆 -> [咖啡粒] -> 冲咖啡 -> [咖啡] 使用链的方式调用 FuncBeans,Ground grind = beans = new Ground(beans); FuncGround,Coffee brew = ground = new Coffee(ground); Coffee coffee = brew(grind(beans)); …

FP BookNotes Closure

「读书笔记:Concurrency in .Net」Functional Programming

函数式编程Functional Programming FP是一种将计算是为对表达式求值的编程范式 FP优点 可组合性和模块化 表达性 可靠性和测试 易于并发 延迟求值 生产力 正确性 可维护性 FP原则 高阶函数(HOF)作为头等值 不可变性 纯函数 声明式编程风格 HOF FP中函数作为头等值,意味着函数可以由变量命名、分配给变量,可以出现在任何构造可以出现的地方。 HOF使编程专注于结果,而不是步骤。 HOF优点 组合和模块化 实现函数式组合的方式 组合 柯里化 部分应用函数 代码可重用性 创建高度动态和适应性强的系统 HOF与lambda 一种重构代码,减少代码冗余的方式,一个优雅的解决方案。 简洁的内联编码 限制类级别变量的暴露 代码流易读性高 Example: stream在使用后被Disposed,一种不可重复使用的模式。 string text; using(var …

Book Notes FP