摘要: >protoc --proto_path=c:\prototest --java_out=c:\prototest\result c:\prototest\calculator.proto 阅读全文
posted @ 2014-05-15 10:28 tree.liang 阅读(187) 评论(0) 推荐(0) 编辑
摘要: mac上自带了svn ,很方便本地管理代码,但是每次都要手工执行svnserver启动命令,干脆就直接作为启动脚本1、新建一个autorunsvn.sh,命令是svnserve -d -r /Users/liangzheng/svn/repo2. 右键脚本文件->显示简介->打开方式修改为终端(在下拉菜单中选择其他,然后直接搜索终端,若终端是灰色不可选状态,把窗口下端的“启用:推荐的应用程序”改成“所有应用程序”即可)。3.此时脚本还不能执行,打开终端,运行引用chmod +x filename使脚本可执行。filename即脚本路径。4.左上角苹果图标->系统偏好设置-&g 阅读全文
posted @ 2014-04-09 21:01 tree.liang 阅读(667) 评论(0) 推荐(0) 编辑
摘要: murmurhash的c++版 1 //----------------------------------------------------------------------------- 2 // MurmurHash2, by Austin Appleby 3 4 // Note - This code makes a few assumptions about how your machine behaves - 5 6 // 1. We can read a 4-byte value from any address without crashing 7 // 2. size.. 阅读全文
posted @ 2014-03-22 01:14 tree.liang 阅读(1128) 评论(0) 推荐(0) 编辑
摘要: hash 是用于分配值到一或多个存储里,并且为了之后快速检索.如下图,需要插入一个新的item基于hash值,必须在一定时间(当然是越快越好)告知值在哪个块中保存这个是非常慢的hash检索逻辑12345for(i = 0; i in comp.lang.c , October, 1990." in Rich * Salz's USENIX 1992 paper about INN which can be found at * . * * The magic of number 33, i.e. why it works better than many ot... 阅读全文
posted @ 2014-03-21 16:22 tree.liang 阅读(564) 评论(0) 推荐(0) 编辑
摘要: jedis 的shard使用的是MurmurHash算法(一种非加密型哈希函数),该算法已在nginx,hadoop等开源上使用.回顾String的hashcode()方法//把char型数字转换成的int型数字,因为它们的ASCII码值恰好相差48 char val[] = "111".toCharArray(); int hcode=0; for (int i = 0; i < val.length; i++) { hcode = 31 * hcode + val[i]; }例如业界最好的字符串hash是tim... 阅读全文
posted @ 2014-03-21 13:58 tree.liang 阅读(868) 评论(0) 推荐(0) 编辑
摘要: # Redis configuration file example# http://blog.sina.com.cn/s/blog_636415010101970j.html# Note on units: when memory size is needed, it is possible to specify# it in the usual form of 1k 5GB 4M and so forth:## 1k => 1000 bytes# 1kb => 1024 bytes# 1m => 1000000 bytes# 1mb => 1024*1024 byt 阅读全文
posted @ 2014-03-20 17:27 tree.liang 阅读(678) 评论(0) 推荐(0) 编辑
摘要: http://redis.readthedocs.org/en/latest/启动服务器[root@ltzyerpeip /]# redis-server /opt/soft/redis-2.8.7/redis.conf停止服务器[zyerp@ltzyerpeip ~]$ redis-cli shutdown客户端连接[zyerp@ltzyerpeip ~]$ redis-cli 阅读全文
posted @ 2014-03-20 16:10 tree.liang 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 为什么用REDIS目前常有大批量数据ETL场景,比如给予一个合同号,可能涉及上千至万的面料同步(并且该接受到合同号请求的实例还必须把所有同步之后的新面料ID返回给rest客户端),按以往完全由一个EIP实例去完成的话,客户端等待时间过长,现考虑使用REDIS来辅助完成。实例1将获取到的需转换ID及其类型(可能是单据,基础资料,人员等等唯一类型标识),目标列表(目标列表名由发起实例1指定,实例1将从这里获取到所有新ID)提交到REC列表。其他EIP实例就可以通过REC列表获得ID,经过转换后把新ID放到目标列表中,实例1异步判断目标列表KEY值数量是否与需转换ID数量一致,当一致时,获取列表所有 阅读全文
posted @ 2014-03-20 15:56 tree.liang 阅读(258) 评论(0) 推荐(0) 编辑
摘要: Monday, 26 August 2013Lock-Based vs Lock-Free Concurrent AlgorithmsLast week I attended a review session of the newJSR166StampedLockrun byHeinz Kabutzat the excellentJCreteunconference. StampedLock is an attempt to address the contention issues that arise in a system when multiple readers concurrent 阅读全文
posted @ 2014-03-14 15:41 tree.liang 阅读(283) 评论(0) 推荐(0) 编辑
摘要: Netty 4 内存管理:sun.misc.Cleaner 阅读全文
posted @ 2014-03-14 15:26 tree.liang 阅读(820) 评论(0) 推荐(0) 编辑