惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AWS News Blog
AWS News Blog
T
Tenable Blog
Project Zero
Project Zero
T
The Exploit Database - CXSecurity.com
L
LINUX DO - 热门话题
T
Threat Research - Cisco Blogs
T
Threatpost
Security Latest
Security Latest
C
Cisco Blogs
L
Lohrmann on Cybersecurity
S
Security @ Cisco Blogs
Google Online Security Blog
Google Online Security Blog
NISL@THU
NISL@THU
AI
AI
V
Vulnerabilities – Threatpost
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Last Watchdog
The Last Watchdog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
H
Hackread – Cybersecurity News, Data Breaches, AI and More
H
Hacker News: Front Page
U
Unit 42
A
Arctic Wolf
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MyScale Blog
MyScale Blog
O
OpenAI News
Scott Helme
Scott Helme
V2EX - 技术
V2EX - 技术
P
Proofpoint News Feed
博客园 - 叶小钗
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Cyberwarzone
Cyberwarzone
博客园 - 【当耐特】
H
Heimdal Security Blog
S
Schneier on Security
阮一峰的网络日志
阮一峰的网络日志
Help Net Security
Help Net Security
D
DataBreaches.Net
Y
Y Combinator Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
TaoSecurity Blog
TaoSecurity Blog
K
Kaspersky official blog
N
News and Events Feed by Topic
WordPress大学
WordPress大学
P
Palo Alto Networks Blog

博客园 - zqzdong

word 宏(图片锐度和对比度) Maven父子结构的项目依赖使用以及打包依赖 在linux下执行不带主函数的jar Maven项目打包 eclipse调用c语言类库 scala rdd的交集 差集 并集 cdh 的 oozie时间校准 java 调用c语言类库 java jar包代码混淆 在windows下查找java服务cup过高问题 AES 加密解密 logger日志配置 hadoop安装 flume配置及其执行命令 java批量导入数据 kafka配置及其使用 kafkaConsumer(从topic 拿数据存入hdfs) 自定义flume的sink 在mongodb中存值,如果存在则修改,不存在插入
mongodb3.2链接设置
zqzdong · 2017-02-24 · via 博客园 - zqzdong
try {  
			ServerAddress serverAddress = new ServerAddress("localhost", 27017);  
			List<ServerAddress> addrs = new ArrayList<ServerAddress>();  
			addrs.add(serverAddress);  
			MongoCredential credential = MongoCredential.createScramSha1Credential("admin", "admin","admin".toCharArray());  
			List<MongoCredential> credentials = new ArrayList<MongoCredential>();  
			credentials.add(credential);  
			//通过连接认证获取MongoDB连接  
			MongoClient mongoClient = new MongoClient(addrs,credentials);  
			//连接到数据库  
			db = mongoClient.getDatabase("test");
			MongoCollection<Document> collection = db.getCollection("aa");
		} catch (Exception e) {  
			System.err.println( e.getClass().getName() + ": " + e.getMessage() );  
		}
//条件查询并去重
public static List<String> query2(MongoCollection<Document> collection,long beginDay,long endDay) {  
		//db.routedata.distinct(('lanmac'),{"time":{$gte:1464624000000,$lte:1464659580000}})
		List<String> list = new ArrayList<String>();
		Document query = new Document();
		query.put("time", new BasicDBObject("$gte",beginDay).append("$lte",endDay));
		MongoCursor<String> li = collection.distinct("lanmac",query,String.class ).iterator();
		while (li.hasNext()) {
			String n = li.next();
			list.add(n);
		}  
		return list;  
	}