2022年1月31日

Python3下约瑟夫环的不同实现方式

摘要: 基于python的约瑟夫环 思路一:递归 # 约瑟夫环:递归 def KillYuesefu(n,m): if(n == 1): return 0 return (KillYuesefu(n - 1, m) + m ) % n def main(): for num in range(1,11): 阅读全文

posted @ 2022-01-31 17:22 李军浩 阅读(117) 评论(0) 推荐(0) 编辑

Golang下基于uint32的BitMap类库

摘要: 关注点:目标:BitMap的目标是用更小的内存空间,存放更多的key的状态(仅支持1、0状态,如果需要支持更多的状态,那么就得用更多的字节来表达value)思路:使用golang下的uint32类型的数组来实现,原因有2点: (1)uint32位数组,定长,数组中每个元素都是一个uint32的整型, 阅读全文

posted @ 2022-01-31 17:18 李军浩 阅读(557) 评论(0) 推荐(0) 编辑

2020年2月9日

MySQL工具类

摘要: 1 package tools 2 3 4 import ( 5 "database/sql" 6 "fmt" 7 _"github.com/go-sql-driver/mysql" 8 ) 9 10 type MySQLHelper struct { 11 Connection string 12 阅读全文

posted @ 2020-02-09 15:05 李军浩 阅读(735) 评论(0) 推荐(0) 编辑

螺旋矩阵输出

摘要: 1 private static void PrintMatrix(){ 2 //region 使用随机数构建矩阵(二维数组) 3 long seed=System.currentTimeMillis(); 4 Random objRandom = null; 5 int arrLength=4; 阅读全文

posted @ 2020-02-09 14:40 李军浩 阅读(373) 评论(0) 推荐(0) 编辑

2017年3月23日

IntelliJ Idea下Go项目开启Debug调试

摘要: 1、新建Go项目,创建入口go文件(Test1.go),随便写点啥,比如: 2、新增运行配置信息: 3、这一步选择很重要,选择:Go Application,而不是Go Single File 4、随便起个名字,设置go文件路径: 5、保存即可 注: 如果在第3步选择Go Single File,也 阅读全文

posted @ 2017-03-23 19:07 李军浩 阅读(2643) 评论(0) 推荐(0) 编辑

2016年12月13日

GRpc-Go使用笔记

摘要: linux下配置GRpc-golang 1、git中下载protobuf包 2、解压(/usr/local/protobuf) unzip protobuf-cpp-3.0.0-alpha-3.zip 3、进入解压后的目录 cd protobuf/ 4、编译安装 ./configure make & 阅读全文

posted @ 2016-12-13 13:38 李军浩 阅读(1727) 评论(0) 推荐(0) 编辑

GRpc-Proto3语法

摘要: SPEED (default): The protocol buffer compiler will generate code for serializing, parsing, and performing other common operations on your message type 阅读全文

posted @ 2016-12-13 13:37 李军浩 阅读(14793) 评论(0) 推荐(1) 编辑

2016年12月6日

常规RPC通讯过程【转载】

摘要: 在 HTTP2 协议正式开始工作前, 如果已经知道服务器是 HTTP2 的服务器, 通讯流程如下: gRPC Helloworld 的例子完整的数据包依次如下: 来自Wireshark 的内容。 可以看到 18 开始才是正常请求的包。 常规RPC的交互流程: 可以看到 18 开始才是正常请求的包。 阅读全文

posted @ 2016-12-06 15:59 李军浩 阅读(336) 评论(0) 推荐(0) 编辑

2016年10月19日

thrift-go(golang)Server端笔记

摘要: 1、从thrift源码中拷贝go语言包(thrift\lib\go\thrift),放到go/src/下 2、新建go项目,实现server端服务接口 package main import ( "fmt" "os" "taochees" "thrift" "strconv" ) type Test 阅读全文

posted @ 2016-10-19 11:57 李军浩 阅读(3828) 评论(0) 推荐(0) 编辑

2016年10月17日

thrift - C#(CSharp)客户端连接池(ConnectionPool)

摘要: 调用示例: var tran = ThriftPool.Instance().BorrowInstance(); TProtocol protocol = new TBinaryProtocol(tran); var client = new xxxx(protocol); //xxxx为生成的th 阅读全文

posted @ 2016-10-17 15:04 李军浩 阅读(1225) 评论(0) 推荐(0) 编辑

导航