- 博客(568)
- 资源 (14)
- 收藏
- 关注
原创 GLIBC_2.29 not found
GLIBC_2.29 not found(Jin Qing’s Column, Nov. 4, 2021)My Rust program failed when running in docker:root@a26b49c91efb:/myapp# ldd libmyapp_py.so./libmyapp_py.so: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by ./libmyapp_py.
2021-11-05 09:26:04 6379
原创 Clustering provider in Orleans
Clustering provider in Orleans(Jin Qing’s Column, Nov. 3, 2021)When deployed to a cluster of nodes,Orleans internally implements a protocol to manage it’s silos,including discovery, failure and reconfigure,which is called cluster membership management
2021-11-03 13:30:18 954
原创 Why Orleans‘ actor is virutal
Why Orleans’ actor is virutal(Jin Qing’s Column, Nov. 2, 2021)Virtual Actor is a concept invented by Microsoft Orleans, which is a framework of distributed actor.Orleans: Distributed Virtual Actors for Programmability and Scalability describes the virtu
2021-11-02 15:21:37 149
原创 What comes after microservice?
What comes after microservice?(Jin Qing’s Column, Oct. 25, 2021)Reading “The Evolution of Distributed Systems on Kubernetes” from Bilgin Ibryam.https://www.infoq.com/articles/distributed-systems-kubernetes/What are the purpose of projects like Dapr, Is
2021-10-29 11:14:00 140
原创 Display Non-UTF-8 output
Display Non-UTF-8 output(Jin Qing’s Column, Oct. 27, 2021)Cargo build output Non-UTF-8. Use python to decode it as gbk and print.C:\Users\jinqing01>python>>> s = b'Non-UTF-8 output: \xd5\xfd\xd4\xda\xb4\xb4\xbd\xa8\xbf\xe2 E:\\gitlab\\myp
2021-10-27 12:16:32 503
转载 Advice for Rust library writers about Error
Advice for library writersFrom: https://blog.burntsushi.net/rust-error-handling/Idioms for Rust libraries are still forming, but if your library needs to report custom errors, then you should probably define your own error type. It’s up to you whether or
2021-09-02 11:23:05 134
原创 How to show the first few errors of rustc
How to show the first few errors of rustc(Jin Qing’s Column, Sep. 1, 2021)When using VS Code to develop Rust, “cargo check” output maybe thousands of lines.Use “cargo check --color=always 2>&1 | head -n100” to limit the output.Change powershell
2021-09-01 10:53:35 122
转载 &‘a mut self is restrictive
&'a mut self is restrictiveFrom https://github.com/pretzelhammer/rust-blog/blob/master/posts/common-rust-lifetime-misconceptions.md#5-if-it-compiles-then-my-lifetime-annotations-are-correct#[derive(Debug)]struct NumRef<'a>(&'a i32);impl&
2021-08-25 13:30:37 148
原创 Rust callback idiom
Rust callback idiomCode is from: https://stackoverflow.com/questions/41081240/idiomatic-callbacks-in-rustandhttps://morestina.net/blog/793/closure-lifetimes-in-ruststruct Processor<'a> { callback: Box<dyn FnMut() + 'a>,}impl<'a>
2021-08-24 10:18:02 282
转载 Rust variable rebinding for closure
Rust variable rebinding for closureFrom: https://rust-unofficial.github.io/patterns/idioms/pass-var-to-closure.htmlRust closure captures variables by reference by default.You can use “move” keyword to change to move variables.In most cases, some variab
2021-08-22 17:28:45 136
转载 Rust Deref coercion example
Rust Deref coercion examplehttps://doc.rust-lang.org/std/ops/trait.Deref.htmluse std::ops::Deref;struct DerefExample<T> { value: T}impl<T> Deref for DerefExample<T> { type Target = T; fn deref(&self) -> &Sel
2021-08-22 12:32:36 148
转载 Rust Error Return Check Policy
Rust Error Return Check PolicyFrom: https://www.ockam.io/learn/how-to-guides/contributing/ockam_rust_code_standardNever use unwrap on Result. If the type is Err, it will panic and crash the program. The only exception is if it has already been checked f
2021-08-09 17:06:42 122
转载 Rust visibility
Rust visibility: pub(in path), pub(crate), pub(super), and pub(self)From: https://doc.rust-lang.org/reference/visibility-and-privacy.htmlIn addition to public and private, Rust allows users to declare an item as visible only within a given scope. The rul
2021-08-09 13:43:02 182
原创 Why does Rust check borrow even in single thread
Why does Rust check borrow even in single thread(Jin Qing’s Column, Aug. 7, 2021)The Rust book says borrow checking is to prevent data race.But the borrow checker forbids multiply mutable borrows even in the same thread.Is there data race in single thr
2021-08-07 16:26:22 138
原创 UE4 Blueprint Multiple Event BeginPlay
Multiple Event BeginPlay(金庆的专栏 2021.7)How to do multiple actions on Event BeginPlay in UE4 Blueprints?Sams-Teach-Yourself-Unreal-Engine-4-Game-Development-in-24-Hours says:Q. When I try to add a second event node, BeginPlay, the Editor shows me the fir
2021-07-31 15:17:54 548
原创 Visual Studio 2019 Compiler Hangs
Visual Studio 2019 Compiler Hangs(金庆的专栏 2021.7)Discovered by my colleague Shen Yichai:Share a interesting MS Build bug:For file a.cpp, enable optimization for Win64 or XSX. The MSBuild always compiling without error and ending (infinite compile). The
2021-07-23 20:25:44 189
原创 Fbx File Format Identifier
Fbx File Format Identifier(金庆的专栏 2021.5)Print the list of FBX file format identifiers.FBX SDK FbxExporter can set the file format identifier which is an int parameter.The commnet says: User does not need to specify it by default.If not specified, plug
2021-05-30 09:51:27 420 2
翻译 第9代游戏主机
第9代游戏主机原文:Ninth generation of video game consoles2020.11,微软(MS) Xbox Series X/S 和 Sony PlayStation 5 (PS5) 发布,标志着游戏主机进入第9代。和前代的 Xbox One 和 PS4 相比,新一代主机有可观的性能提升,支持实时光线跟踪,4K分辨率,目标帧率为60。内部都使用了固态硬盘(SSD)。低配版没有光驱,仅支持网络和USB。定位上要胜过任天堂Switch和云游戏服务如 Stadia 和 Am
2021-05-07 10:37:22 506
原创 Canvas Scaler 的3种模式
Canvas Scaler 的3种模式(金庆的专栏 2021.3)参考:https://wenku.baidu.com/view/83991090336c1eb91b375db8.htmlUnity Canvas 有个 Canvas Scaler 组件,用来决定 Canvas 的 Scale(缩放)值。Scale 有 X,Y,Z 3个分量,都是同一值,即在各个方向上都是同倍率缩放的。它有3种Scale Mode。因为设计时的宽高比与目标机型宽高比不同,Canvas 需要先增减为目标高宽比,然后
2021-03-02 11:53:33 466
原创 C#异步方法返回void和Task的区别
C#异步方法返回void和Task的区别(金庆的专栏 2021.2)如果异步(async关键字)方法有返回值,返回类型为T时,返回类型必然是 Task。但是如果没有返回值,异步方法的返回类型有2种,一个是返回 Task, 一个是返回 void: public async Task CountDownAsync(int count) { for (int i = count; i >= 0; i--) { await Task
2021-02-25 10:29:39 4693
原创 net.LookupSRV()查询k8s无头服务
net.LookupSRV()查询k8s无头服务(金庆的专栏 2021.2)如下创建 StatefulSet 和 Headless Service: test.yamlapiVersion: v1kind: Servicemetadata: name: headless-svc labels: app: headless-svcspec: ports: - port: 80 name: aaaa - port: 20080 name: bbbb s
2021-02-22 16:15:39 693 2
原创 kubectl 的标签选择器
kubectl 的标签选择器(金庆的专栏 2021.1)摘自:Kubenetes in Action首先可以给 pod 添加 label:kubectl label pod mypod abc=123显示 label:kubectl get pod --show-labels显示部分 label:kubectl get pod -L app,abc更改kubeclt label --overwrite pod mypod abc=456删除不需要 --overwritekub
2021-01-26 08:56:14 1161
转载 命名
命名摘自:[警惕软件复杂度困局][1]软件中的API、方法、变量的命名,对于理解代码的逻辑、范围非常重要,也是设计者清晰传达意图的关键。然而,在很多的项目里我们没有给Naming /命名足够的重视。我们的代码一般会和一些项目关联,但是需要注意的是项目是抽象的,而代码是具体的。项目或者产品可以随意一些命名,如阿里云喜欢用中国古代神话(飞天、伏羲、女娲)命名系统,K8s也是来自于希腊神话,这些都没有问题。而代码中的API、变量、方法不能这样命名。一个不好的例子是前一段我们的Cluster API
2020-12-31 09:35:36 156
原创 帧同步是否允许客户端指定命令帧号
帧同步是否允许客户端指定命令帧号(金庆的专栏 2020.10)帧同步服务器以固定的帧率收集每个客户端的输入命令,每帧打包一个命令帧,打上服务器当前帧号,然后广播该命令帧到每个客户端,由客户端执行。如果没有客户端输入命令,则该命令帧可能只有一个帧号。客户端的输入命令分2种模式:不指定帧号和指定帧号。客户端不指定帧号的模式下,客户端仅告诉服务器自己的动作,由服务器为该动作打上当前的服务器帧号,然后再广播。服务器实现较简单,只需要缓存当前帧的所有客户端输入,下一帧时全部打包广播。指定帧号的模式下,
2020-10-08 11:37:34 439 1
原创 避免RPC回调死锁
避免RPC回调死锁(金庆的专栏 2020.9)今天发现一例 RPC 回调死锁,现象为一串相关的 RPC 调用全部超时失败。A 调用 B 的 RPC, B 再回调 A, 形成一个 RPC 调用环后,如果 A 调用 B 时先加了一个锁,然后 B 回调 A 时又需要这个锁,而此时 A 正在等待 B 的 RPC 返回,之后才会释放锁,这样就形成了死锁。这个 RPC 调用环最终会全部超时失败。这个调用环可能会涉及多个服务,如 A->B->C->…->A。避免回调死锁有以下方法。
2020-09-19 13:55:05 926
原创 rpc应答太快造成请求超时
rpc应答太快造成请求超时(金庆的专栏 2020.9)在压测中发现总有几个请求超时,超时时长设大也会有,而成功的请求延时远小于超时时间。查错的第一方向是查网络库中有消息丢失。跟踪所有消息,发现超时的消息应该是正常处理并返回了。于是查接收应答消息后的处理,最终找到代码:func (c *Client) onRpcRet(cbIndex uint32, ...) { ii, ok := c.callbacks.Load(cbIndex) if !ok { // logger.Errorf("
2020-09-17 15:57:08 781
转载 golang各数值类型的最大最小值
golang各数值类型的最大最小值(金庆的专栏 2020.9)golang 的 math 包已经定义了以下常量:Constantsconst ( E = 2.71828182845904523536028747135266249775724709369995957496696763 // https://oeis.org/A001113 Pi = 3.14159265358979323846264338327950288419716939937510582097494459 /
2020-09-11 14:53:13 3222
原创 测试 tolua 例子 TestErrorStack
测试 tolua 例子 TestErrorStack(金庆的专栏 2020.9)Error1点击 “Error1” 按钮c# showStack.PCall()lua ShowStack()c# Test1()c# try { show.PCall() }lua Show() error(‘this is error’)LuaException: TestErrorStack:2: this is errorstack traceback: [C]: in function 'er
2020-09-03 16:27:12 655
原创 lua变量缺少local造成unity死锁
lua变量缺少local造成unity死锁(金庆的专栏 2020.9.1)这几天在开发 grpc-tolua, 可以在 unity 项目中使用 lua 发送 grpc 请求,无需生成代码.现已实现 route_guide 示例中的全部4种rpc.见:https://github.com/jinq0123/grpc-tolua昨天的开发中就发现,运行 RecordRoute 和 RouteChat 之后Unity无法再次运行,必须杀进程。在 await 语句添加 ConfigureAwait(fa
2020-09-02 13:34:15 312
原创 C# tolua 之间互传 byte[]
C# tolua 之间互传 byte[](金庆的专栏 2020.8)lua中不区分 string 和 byte[], 而在 C# 中 string 和 byte[] 之间转换涉及编码。C# 中一般这样转:string类型转成byte[]:byte[] byteArray = System.Text.Encoding.Default.GetBytes(str);byte[]转成string:string str = System.Text.Encoding.Default.GetString(
2020-08-19 09:00:14 1968
原创 参数太灵活容易出错
参数太灵活容易出错(金庆的专栏 2020.7)golang中可以将参数类型设为 interface{}, 这样就可以传入任意类型的参数,和 C++ 中 void* 的作用相似。但是这种万能类型应该尽量少用,尽量使用具体的类型,或者使用一个具体的接口类型。主要的原因是, 让编译期的类型检查挡住编码错误,减少运行期的错误。例如,go-mongo-driver 有个创建索引的参数:type IndexModel struct { // A document describing which
2020-07-24 09:11:17 344
原创 Unity使用异步grpc
Unity使用异步grpc(金庆的专栏 2020.6)Unity 保证 async 方法运行在主线程中,所以用异步方式调用 grpc 可以大大简化网络通信的代码。以下示例中将 grpc 的 RouteGuide 示例移到 Unity 中运行。https://github.com/grpc/grpc/tree/master/examples/csharp/RouteGuide其中 Main() 中的代码移到 Start() 中运行,阻塞调用改成异步调用, GetFeature() 改成 GetFea
2020-06-22 15:17:27 551
原创 grpc外部负载均衡器测试
grpc外部负载均衡器测试(金庆的专栏 2020.4)grpc 对每个请求进行负载均衡。负载均衡的方式有:代理模式客户端实现外部负载均衡参考:gRPC LB https://blog.csdn.net/xiaojia1100/article/details/78842295gRPC 中负载均衡的主要机制是外部负载均衡。gRPC 定义了外部负载均衡服务的接口:https://gi...
2020-04-17 10:03:58 1058
原创 有房间匹配和无房间匹配
有房间匹配和无房间匹配(金庆的专栏 2020.4)网游的匹配可以分为2种:有房间匹配和无房间匹配。有房间匹配请求匹配即搜索并加入一个房间,或者开一个新房间。匹配过程中可以看到房间人数增加。可以列出其他房间,加入指定房间,如棋牌类大厅可以无需等待人满即开始,开始后还可以继续加人无房间匹配请求匹配即进入等待状态,匹配成功才能看到所有人匹配成功, 如人满了, 才可以进入游戏...
2020-04-09 14:34:01 935
原创 数组make参数错误
数组make参数错误(金庆的专栏 2020.3)用 mgo 的 Bulk 接口操作 mongodb 的代码,在 mongodb 4.2 正常,而连 mongodb 2.6 报错:error parsing element 0 of field documents :: caused by :: wrong type for '0' field, expected object, found...
2020-03-19 13:36:14 352
原创 试用 go test suite
试用 go test suite(金庆的专栏 2020.3)github.com/stretchr/testify/suite 提供了测试套件功能,可以在整个套件开始结束时执行动作,也可以在每个测试开始结束时执行动作。假设有以下2个函数需要测试:func foo() { fmt.Printf("foo...\n")}func goo() { fmt.Printf("goo......
2020-03-13 12:03:18 4072
转载 go不要导出channel
go不要导出channel(金庆的专栏 2020.3)导出 channel 的包都比较难用。平常也不会将接口设计成 channel.以下摘自:https://studygolang.com/articles/12135?fr=sidebar不要导出并发原语Go 提供了非常易于使用的并发原语,这也导致了它被过度的使用。我们主要担心的是 channel 和 sync package 。有的...
2020-03-10 15:55:42 186
原创 go代码覆盖测试
go代码覆盖测试(金庆的专栏 2020.2)假设应用名为 MyMod, 主函数的文件为 main.go, 那就创建如下的 main_test.go 文件:package main/* 测试整个服务器。 go test -c -covermode=count -coverpkg ./...生成 MyMod.test.exe. 复制到 bin 目录下运行: MyMod.test.exe...
2020-02-29 09:07:27 280
原创 考察go一致性hash库
考察go一致性hash库(金庆的专栏 2020.2)github 搜 consistent, 按星数依次察看stathat/consistentConsistent hash package for Go.stathat 应该是个数据统计的云服务。consistent被认为是生产可用的。所有文档都在 godoc. 示例和接口简洁易懂。lafikl/consistentA Go li...
2020-02-22 11:38:49 623
原创 将go函数指针转为接口
将go函数指针转为接口(金庆的专栏 2020.2)golang 中的接口如下:type Writer interface { Write func(p []byte) (n int, err error)}一般API参数要求一个接口,而不是一个函数指针,如 io.Copy() 需要输入一个 Writer 和 Reader:func Copy(dst Writer, src R...
2020-02-13 14:33:44 803
grpc-lua 代码及示例Windows执行程序
2018-04-13
grpc-lua 示例 CentOS 7.4 执行程序打包
2018-04-13
go1.9.2.windows-amd64.msi
2017-10-26
LuaPbIntf VS2015工程带依赖库
2017-05-26
XMPP测试工具Peek
2016-10-25
gloox_1_0_17_API_Documentation
2016-09-13
gloox 1.0.17 released
2016-09-12
跨服与跨区的设计.ppt
2014-12-05
Wmvcopy的源程序
2011-11-24
Boost.Python中文文档
2008-06-16
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人