#MongoDB - Setting up a Replica Set
cd \mongodbdir\
mkdir db1
mkdir db2
mkdir db3
###Primary mongod --dbpath ./db1 --port 30000 --replSet "demo"
public class CompletableFutureParallel { | |
private static final int CORE_POOL_SIZE = 4; | |
private static final int MAX_POOL_SIZE = 12; | |
private static final long KEEP_ALIVE_TIME = 5 L; | |
private final static int QUEUE_SIZE = 1600; | |
protected final static ExecutorService THREAD_POOL = new ThreadPoolExecutor(CORE_POOL_SIZE, MAX_POOL_SIZE, KEEP_ALIVE_TIME, TimeUnit.SECONDS, new LinkedBlockingQueue < > (QUEUE_SIZE)); | |
public static void main(String[] args) throws InterruptedException, ExecutionException, TimeoutException { | |
OrderInfo orderInfo = new OrderInfo(); //CompletableFuture 的List | |
List < CompletableFuture > futures = new ArrayList < > (); | |
futures.add(CompletableFuture.runAsync(() - > { |
Cache<Integer,byte[]> cache= CacheBuilder.newBuilder().maximumSize(1000).build(); | |
for (int i = 0; i < Integer.MAX_VALUE; i++) { | |
byte[] by=new byte[100000]; | |
cache.put(i,by); | |
Thread.sleep(10); | |
} | |
int str= System.in.read(); | |
System.out.print(str); | |
} |
private Properties fetchAllProperties() { | |
final Properties properties = new Properties(); | |
for (Iterator it = ((AbstractEnvironment) environment).getPropertySources().iterator(); it.hasNext(); ) { | |
PropertySource propertySource = (PropertySource) it.next(); | |
if (propertySource instanceof EnumerablePropertySource) { | |
for (String key : ((EnumerablePropertySource) propertySource).getPropertyNames()) { | |
properties.put(key, propertySource.getProperty(key)); | |
} | |
} | |
if (propertySource instanceof PropertiesPropertySource) { |
package cn.com.duibaboot.ext.autoconfigure.perftest; | |
/** | |
* Created by hujinliang on 2017/11/6. | |
*/ | |
import java.io.File; | |
import java.io.FileOutputStream; | |
import java.io.IOException; |
return named("zcount").or(named("sunionstore")).or(named("zunionstore")) | |
.or(named("del")).or(named("zinterstore")).or(named("echo")) | |
.or(named("hscan")).or(named("psubscribe")).or(named("type")) | |
.or(named("sinterstore")).or(named("setex")).or(named("zlexcount")) | |
.or(named("brpoplpush")).or(named("bitcount")).or(named("llen")) | |
.or(named("zscan")).or(named("lpushx")).or(named("bitpos")) | |
.or(named("setnx")).or(named("hvals")).or(named("evalsha")) | |
.or(named("substr")).or(named("geodist")).or(named("zrangeByLex")) | |
.or(named("geoadd")).or(named("expire")).or(named("bitop")) | |
.or(named("zrangeByScore")).or(named("smove")).or(named("lset")) |
/** | |
* 拦截redisclient,可以自动把压测流量导入影子库。 | |
*/ | |
@Configuration | |
@ConditionalOnResource(resources = "/autoconfig/perftest.properties") | |
@ConditionalOnClass({RedisClient.class, TransmittableThreadLocal.class}) | |
public static class RedisClientConfigurer { | |
private volatile Class<?> lastJedisConnectionProxyClass; | |
private static final Logger logger = LoggerFactory.getLogger(RedisClientConfigurer.class); |
#MongoDB - Setting up a Replica Set
cd \mongodbdir\
mkdir db1
mkdir db2
mkdir db3
###Primary mongod --dbpath ./db1 --port 30000 --replSet "demo"
package main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
type Config struct { | |
Name string | |
Meta struct { |
wget https://github.com/shadowsocks/shadowsocks-libev/archive/master.zip
unzip master.zip
cd shadowsocks-libev*
./autogen.sh
./configure --prefix=/usr && make
这两天在使用pillow完成图像识别的一个小任务,mac上配置起来还算方便,但是再centos服务器配置的时候遇到一些麻烦,记录下来
方案1:http://pkgs.org/download/tesseract,安装后和训练数据(https://code.google.com/p/tesseract-ocr/downloads/list)无法正常使用,提示actual_tessdata_num_entries <= TESSDATA_NUM_ENTRIES:Error:Assert failed:in file ..\ccutil\tessdatamanager.cpp,官方说法是训练文件不对应,但是安装了三个版本的tesseract都不行
方案3:使用PUIAS_6_computational源
$ vim /etc/yum.repos.d/puias-computational.repo 粘贴: