Swift 中的值类型和引用类型
May 30, 2022
Swift 中的 struct, enum, tuple 是值类型,class 是引用类型。 值类型在传递的时候是直接拷贝一份数据副本,而引用类型不拷贝数据,只是增加引用计数。 为了避免内存浪…
C++ 实现一个 AutoLayout 的 DSL
May 18, 2022
DSL 全称是 Domain-Specific Language,叫作领域专用语言。用于解决特定问题而提出的编程语言。比如 CSS 就是解决网页中布局问题而产生的 DSL。 自动布局(Aut…
在 FreeBSD 中安装 Bash Shell
May 17, 2022
FreeBSD 安装后默认可选的 Shell 只有 sh 和 tcsh,如果需要 bash 和 zsh 是需要自己安装配置的。 安装 bash: sudo pkg install bash 以上命令使用到了 sudo,在 FreeBSD 里 sudo 也是需要自…
FreeBSD 中的 pkg 使用代理
May 17, 2022
FreeBSD 13.1 发布了,终于修复了在 Apple Silicon 上不能使用网络的问题。 下载地址: https://download.freebsd.org/releases/arm64/aarch64/ISO-IMAGES/13.1/ pkg 是 FreeBSD 的包管理工具,类似于 Debian 上的 apt。 pkg 的配置文件路径是 /usr/local…
[推荐] 免费的编程字体
May 16, 2022
Source Code Pro Adobe 出品的开源字体,不支持连字符和 Powerline。 https://github.com/adobe-fonts/source-code-pro/releases 下载:Source-Code-Pro.tar.xz Cascadia Code 微软内置于 Windows Terminal 和 Visual Studio 2019 里的…
Visual Studio 2022 中使用 Clang
May 15, 2022
本文适用 Visual Studio 2017 以及更高版本 下载 LLVM for Windows 当前最新的 LLVM 版本是 14.0.3,在以下链接可以下载官方编译好的版本: https://github.com/llvm/llvm-project/releases x86: LLVM-14.0.3-win32.exe x86_64: LLVM-14.0.3-win64.exe arm64: LLVM-14.0.3-woa64.zip 我下载的是 LLVM-1…
Visual Studio 2022 以 UTF-8 编译 CMake 项目
May 14, 2022
本文适用 Visual Studio 2017 以及更高版本 默认情况下,MSVC 使用当前系统的代码页(Code Page)编译源文件,这样在编译字符串字面量的时候就和当前系统的…
制作 Visual Studio 2022 离线安装包
May 09, 2022
Create an offline installation of Visual Studio Workload Component ID Visual Studio 2022 version: 17.4 %~dp0\vs2022_Professional.exe ^ --lang zh-CN ^ --add Microsoft.VisualStudio.Workload.CoreEditor ^ --add Microsoft.VisualStudio.Workload.NativeDesktop ^ --add Microsoft.VisualStudio.Component.Git ^ --add Microsoft.VisualStudio.Component.VC.ATL.ARM ^ --add Microsoft.VisualStudio.Component.VC.ATL.ARM64 ^ --add Microsoft.VisualStudio.Component.VC.ATL.ARM.Spectre ^ --add Microsoft.VisualStudio.Component.VC.ATL.ARM64.Spectre ^ --add Microsoft.VisualStudio.Component.VC.ATL.Spectre ^ --add Microsoft.VisualStudio.Component.VC.ATLMFC.Spectre ^ --add Microsoft.VisualStudio.Component.VC.MFC.ARM ^ --add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ^ --add Microsoft.VisualStudio.Component.VC.MFC.ARM.Spectre ^ --add Microsoft.VisualStudio.Component.VC.MFC.ARM64.Spectre ^ --add Microsoft.VisualStudio.Component.VC.Redist.MSM ^ --add Microsoft.VisualStudio.Component.VC.Runtimes.ARM.Spectre ^ --add Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre ^ --add Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre…
Swift 使用泛型实现命名空间形式的扩展
May 03, 2022
什么是命名空间形式的扩展 什么是扩展? extension UIView { var v: ... } v 就是扩展出来的一个 UIView 属性。 什么是命名空间? 相较于 ObjC 没有命名空间的特性,Swift 使用模块…
Debian 手动设置 DNS 服务器地址
May 03, 2022
编辑 dhcpcd.conf 文件,在里面添加 DNS 地址: sudo vi /etc/dhcpcd.conf interface eth0 #static ip_address=10.2.2.250/24 #static ip6_address=fd51:42f8:caae:d92e::ff/64 #static routers=10.2.2.1 static domain_name_servers=127.0.0.1 domain_name_servers 支持设置 IPv4 和 IPv6 格式的地址,多个地址使用空格隔开。 保存修改后,重启 dhcpcd 服务: sudo systemctl restart dhcpcd 验…