我最近在生产中使用经典Bloom过滤器之前在Google上进行了测试。我正在使用番石榴库的版本18。当我运行以下程序时,由于sysout中的计数变化,我得到200多个。我看不到这里可能出什么问题,有人可以再看一眼吗?
import com.google.common.collect.Lists;
import com.google.common.hash.BloomFilter;
import com.google.common.hash.Funnels;
import com.google.common.hash.Hashing;
import org.apache.commons.lang3.RandomStringUtils;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.*;
/**
* http://code.google.com/p/guava-libraries/wiki/HashingExplained
* stackoverflow.com/questions/12319560/how-should-i-use-guavas-hashingconsistenthash
*/
public class GuavaHashing {
private static final int N = 2500;
public static void main(String[] args) throws IOException {
List<String> ids = generateStoryIds(N);
Set<String> testIds = generateTest(ids);
bloomfiltertime(ids, testIds);
}
private static List<String> generateStoryIds(int size) {
List<String> stories = new ArrayList<>();
for (int i=0; i<size; ++i) {
stories.add(RandomStringUtils.randomAlphanumeric(16));
}
return stories;
}
private …Run Code Online (Sandbox Code Playgroud) 能否管道聚集在elasticsearch转换为图形上kibana 4?
例如,在文档"t-shirt-percentage"示例中 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-script-aggregation.html
更新:发现目前尚不支持 - https://discuss.elastic.co/t/kibana-4-2-beta-release-and-elastic-2-0-beta-pipeline-aggregations/28383
使用Kibana 4和ES 1.7.4实现相同(管道聚合)的替代方法是什么?
当 put() 的参数都不为 null 时,以下代码中会发生 java.util.Hashtable 的空指针异常:
import java.util.Hashtable;
interface action
{
void method();
}
class forclass implements action
{
public void method()
{
System.out.println("for(...){");
}
}
class ifclass implements action
{
public void method()
{
System.out.println("if(..){");
}
}
public class trial
{
static Hashtable<String,action> callfunc;
//a hashtable variable
public static void init()
{
//System.out.println("for"==null); //false
//System.out.println(new forclass() == null); //false
callfunc.put("for",new forclass()); //exception occuring here
callfunc.put("if",new ifclass());
//putting values into the hashtable
}
public static void main(String[] args)
{ …Run Code Online (Sandbox Code Playgroud) http://docs.spring.io/spring/docs/current/spring-framework-reference/html/cache.html#cache-annotations-cacheable-key 上面的链接显示了当一个默认的缓存键不需要方法。但是如何在 Cacheable 注释中指定多个参数(但不是全部在方法 arg 列表中)作为缓存的键?