Python 零食铺
终端相关 输入输出 清理终端用户输入缓冲区的数据 如果希望在调用 input 前清理输入缓存区的数据,可以使用如下代码: import termios termios.tcflush(sys.stdin, termios.TCIFLUSH) input('your input prompt') 函数功能描述如下: termios.tcflush(fd, queue): ...
终端相关 输入输出 清理终端用户输入缓冲区的数据 如果希望在调用 input 前清理输入缓存区的数据,可以使用如下代码: import termios termios.tcflush(sys.stdin, termios.TCIFLUSH) input('your input prompt') 函数功能描述如下: termios.tcflush(fd, queue): ...
Swift Concurrency 异步感染问题 当我们在一个非 async 的方法 A 里面调用 async 的方法 B 时,Xcode 会提示我们无法这么做: 'async' call in a function that does not support concurrency,并且引导我们给 A 加上 async 标识。 ⬆️ 这就是异步感染问题,async 方法的调用方在不知...
memgraph 文件导出方法 在 App 调试状态下点击 View Memory Graph Hierarchy 或者点击这里 生成 memgraph 文件后,点击 File → Export Memory Graph memgraph 文件可以用 Xcode 直接打开,但是直接打开查看的话,信息...
类型修饰符 decltype 类型指示符 decltype 即 declare type,译为“声明类型“。decltype 是为了解决这样的场景:根据表达式的类型推断出想要定义的变量的类型,但并不使用表达式的值去初始化这个变量,即灵活定义变量的类型。 例如, const int ci = 0, &cj = ci; decltype(ci) x = 0; // x 的...
最近在做一个分享需求的时候遇到了一个问题:将比较长的 UIView 绘制为 UIImage 的时候,会绘制失败,得到的是全黑/全白的图片 我们知道,将 UIView 绘制为 UIImage 的方法有以下几种: 使用 UIView 的系统方法 - (BOOL)drawViewHierarchyInRect:(CGRect)rect afterScreenUpda...
objc 格式 参考链接:https://stackoverflow.com/a/19169271/16991379 /** First line text. Putting \\n doesn't create a new line.\n One way to create a newline is by making sure nothing is on that lin...
Dart 官方文档:https://dart.cn/guides/language/language-tour 变量 const 和 final 的区别 const值在编译时确定,final值在运行时确定。 方法 函数简写 如果函数体只有一个表达式,则函数可以简写为: bool isNoble(int atomicNumber) => _nobleGases[a...
隐藏指令输出 如果想让终端不打印某条指令的运行结果,可以使用: command > /dev/null 2>&1 解决引入另一个脚本后,在其他路径执行脚本报错的问题 脚本 A 引入了脚本 B 和 C。如果不在脚本 A 所在的路径执行脚本 A,那么终端会因为找不到 B 和 C 而报错:CommonEcho.sh: No such file or directory...
关于继承 SwiftUI 的解决方案 struct没有继承的功能,所以SwiftUI里面也不能像UIKit那样做写一个BaseView,然后子类继承里面的所有功能。网上有大神给出了这一点的解决方案 Creating BaseView class in SwiftUI 重写 子类重写父类的属性后,也能通过super.someProperty获取父类的属性 关于类初始化 ...