当前位置: 首页 > 编程日记 > 正文

hadoop 2 java hdfs_Hadoop2.6.0学习笔记(二)HDFS访问

鲁春利的工作笔记,谁说程序员不能有文艺范?

通过hadoop shell与java api访问hdfs

工作笔记之Hadoop2.6集群搭建已经将集群环境搭建好了,下面来进行一些HDFS的操作

1、HDFS的shell访问

HDFS设计主要用来对海量数据进行处理,即HDFS上存储大量文件。HDFS将这些文件进行分割后存储在不同的DataNode上。HDFS提供了一个shell接口,屏蔽了block存储的内部细节,所有的Hadoop操作均由bin/hadoop脚本引发。

不指定任何参数的hadoop命令将打印所有命令的描述,与hdfs文件相关的操作为hadoop fs(hadoop脚本其他的命令此处不涉及)。[hadoop@nnode ~]$ hadoop fs

Usage: hadoop fs [generic options]

[-appendToFile  ... ]

[-cat [-ignoreCrc]  ...]

[-checksum  ...]

[-chgrp [-R] GROUP PATH...]

[-chmod [-R]  PATH...]

[-chown [-R] [OWNER][:[GROUP]] PATH...]

[-copyFromLocal [-f] [-p] [-l]  ... ]

[-copyToLocal [-p] [-ignoreCrc] [-crc]  ... ]

[-count [-q] [-h]  ...]

[-cp [-f] [-p | -p[topax]]  ... ]

[-createSnapshot  []]

[-deleteSnapshot  ]

[-df [-h] [ ...]]

[-du [-s] [-h]  ...]

[-expunge]

[-get [-p] [-ignoreCrc] [-crc]  ... ]

[-getfacl [-R] ]

[-getfattr [-R] {-n name | -d} [-e en] ]

[-getmerge [-nl]  ]

[-help [cmd ...]]

[-ls [-d] [-h] [-R] [ ...]]

[-mkdir [-p]  ...]

[-moveFromLocal  ... ]

[-moveToLocal  ]

[-mv  ... ]

[-put [-f] [-p] [-l]  ... ]

[-renameSnapshot   ]

[-rm [-f] [-r|-R] [-skipTrash]  ...]

[-rmdir [--ignore-fail-on-non-empty]

[-setfacl [-R] [{-b|-k} {-m|-x } ]|[--set  ]]

[-setfattr {-n name [-v value] | -x name} ]

[-setrep [-R] [-w]   ...]

[-stat [format]  ...]

[-tail [-f] ]

[-test -[defsz] ]

[-text [-ignoreCrc]  ...]

[-touchz  ...]

[-usage [cmd ...]]

Generic options supported are

-conf      specify an application configuration file

-D             use value for given property

-fs       specify a namenode

-jt     specify a ResourceManager

-files     specify comma separated files to be copied to the map reduce cluster

-libjars     specify comma separated jar files to include in the classpath.

-archives     specify comma separated archives to be unarchived on the compute machines.

The general command line syntax is

bin/hadoop command [genericOptions] [commandOptions]

hadoop2.6版本中提示hadoop fs为“Deprecated, use hdfs dfs instead.”(2.6之前的版本未接触过,这里就没有深究从哪一个版本开始的,但是hadoop fs仍然可以使用)。[hadoop@nnode ~]$ hdfs dfs

Usage: hadoop fs [generic options]

[-appendToFile  ... ]

[-cat [-ignoreCrc]  ...]

[-checksum  ...]

[-chgrp [-R] GROUP PATH...]

[-chmod [-R]  PATH...]

[-chown [-R] [OWNER][:[GROUP]] PATH...]

[-copyFromLocal [-f] [-p] [-l]  ... ]

[-copyToLocal [-p] [-ignoreCrc] [-crc]  ... ]

[-count [-q] [-h]  ...]

[-cp [-f] [-p | -p[topax]]  ... ]

[-createSnapshot  []]

[-deleteSnapshot  ]

[-df [-h] [ ...]]

[-du [-s] [-h]  ...]

[-expunge]

[-get [-p] [-ignoreCrc] [-crc]  ... ]

[-getfacl [-R] ]

[-getfattr [-R] {-n name | -d} [-e en] ]

[-getmerge [-nl]  ]

[-help [cmd ...]]

[-ls [-d] [-h] [-R] [ ...]]

[-mkdir [-p]  ...]

[-moveFromLocal  ... ]

[-moveToLocal  ]

[-mv  ... ]

[-put [-f] [-p] [-l]  ... ]

[-renameSnapshot   ]

[-rm [-f] [-r|-R] [-skipTrash]  ...]

[-rmdir [--ignore-fail-on-non-empty]

[-setfacl [-R] [{-b|-k} {-m|-x } ]|[--set  ]]

[-setfattr {-n name [-v value] | -x name} ]

[-setrep [-R] [-w]   ...]

[-stat [format]  ...]

[-tail [-f] ]

[-test -[defsz] ]

[-text [-ignoreCrc]  ...]

[-touchz  ...]

[-usage [cmd ...]]

Generic options supported are

-conf      specify an application configuration file

-D             use value for given property

-fs       specify a namenode

-jt     specify a ResourceManager

-files     specify comma separated files to be copied to the map reduce cluster

-libjars     specify comma separated jar files to include in the classpath.

-archives     specify comma separated archives to be unarchived on the compute machines.

The general command line syntax is

bin/hadoop command [genericOptions] [commandOptions]

如:[hadoop@nnode ~]$ hdfs dfs -ls -R /user/hadoop

-rw-r--r--   2 hadoop hadoop       2297 2015-06-29 14:44 /user/hadoop/20130913152700.txt.gz

-rw-r--r--   2 hadoop hadoop        211 2015-06-29 14:45 /user/hadoop/20130913160307.txt.gz

-rw-r--r--   2 hadoop hadoop   93046447 2015-07-18 18:01 /user/hadoop/apache-hive-1.2.0-bin.tar.gz

-rw-r--r--   2 hadoop hadoop    4139112 2015-06-28 22:54 /user/hadoop/httpInterceptor_192.168.1.101_1_20130913160307.txt

-rw-r--r--   2 hadoop hadoop        240 2015-05-30 20:54 /user/hadoop/lucl.gz

-rw-r--r--   2 hadoop hadoop         63 2015-05-27 23:55 /user/hadoop/lucl.txt

-rw-r--r--   2 hadoop hadoop    9994248 2015-06-29 14:12 /user/hadoop/scalog.txt

-rw-r--r--   2 hadoop hadoop    2664495 2015-06-28 20:54 /user/hadoop/scalog.txt.gz

-rw-r--r--   3 hadoop hadoop   28026803 2015-06-24 21:16 /user/hadoop/test.txt.gz

-rw-r--r--   2 hadoop hadoop      28551 2015-05-27 23:54 /user/hadoop/zookeeper.out

[hadoop@nnode ~]$

# 这里的点为当前目录,我是通过hadoop用户操作的因此类似于/user/hadoop

# hdfs默认具有/user/{hadoop-user},但是在/下也可以自己通过mkdir命令来创建自己的目录

[hadoop@nnode ~]$ hdfs dfs -ls -R .

-rw-r--r--   2 hadoop hadoop       2297 2015-06-29 14:44 20130913152700.txt.gz

-rw-r--r--   2 hadoop hadoop        211 2015-06-29 14:45 20130913160307.txt.gz

-rw-r--r--   2 hadoop hadoop   93046447 2015-07-18 18:01 apache-hive-1.2.0-bin.tar.gz

-rw-r--r--   2 hadoop hadoop    4139112 2015-06-28 22:54 httpInterceptor_192.168.1.101_1_20130913160307.txt

-rw-r--r--   2 hadoop hadoop        240 2015-05-30 20:54 lucl.gz

-rw-r--r--   2 hadoop hadoop         63 2015-05-27 23:55 lucl.txt

-rw-r--r--   2 hadoop hadoop    9994248 2015-06-29 14:12 scalog.txt

-rw-r--r--   2 hadoop hadoop    2664495 2015-06-28 20:54 scalog.txt.gz

-rw-r--r--   3 hadoop hadoop   28026803 2015-06-24 21:16 test.txt.gz

-rw-r--r--   2 hadoop hadoop      28551 2015-05-27 23:54 zookeeper.out

[hadoop@nnode ~]$

如果不清楚hdfs命令的详细操作,可以查看帮助信息:[hadoop@nnode ~]$ hdfs dfs -help ls

-ls [-d] [-h] [-R] [ ...] :

List the contents that match the specified file pattern. If path is not

specified, the contents of /user/ will be listed. Directory entries are of the form:

permissions - userId groupId sizeOfDirectory(in bytes)

modificationDate(yyyy-MM-dd HH:mm) directoryName

and file entries are of the form:

permissions numberOfReplicas userId groupId sizeOfFile(in bytes)

modificationDate(yyyy-MM-dd HH:mm) fileName

-d  Directories are listed as plain files.

-h  Formats the sizes of files in a human-readable fashion rather than a number of bytes.

-R  Recursively list the contents of directories.

[hadoop@nnode ~]$

2、HDFS的Java API访问

Hadoop中通过DataNode节点存储数据,而NameNode节点则记录数据的存储位置。Hadoop中各部分的通信基于RPC来实现,NameNode也是hadoop中RPC的server端(dfs.namenode.rpc-address说明了rpc端的主机名和端口号),而Hadoop提供的FileSystem类为hadoop中RPC Client的抽象实现。

a.) 通过java.util.URL来读取hdfs的数据

为了让java程序能够识别Hadoop的hdfs URL需要通过URL的setURLStreamHandlerFactory(...);

每个Java虚拟机只能调用依次这个方法,因此通常在静态方法中调用。package com.invic.hdfs;

import java.io.IOException;

import java.io.InputStream;

import java.io.OutputStream;

import java.net.URL;

import org.apache.hadoop.fs.FsUrlStreamHandlerFactory;

import org.apache.hadoop.io.IOUtils;

/**

*

* @author lucl

* @ 通过java api来访问hdfs上特定的数据

*

*/

public class MyHdfsOfJavaApi {

static {

/**

* 为了让java程序能够识别hadoop的hdfs url需要配置额外的URLStreamHandlerFactory

* 如下方法java虚拟机只能调用一次,若原有的其他程序已经声明过该factory,则我的java程序将无法从hadoop中读取数据

*/

URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory());

}

public static void main(String[] args) throws IOException {

String path = "hdfs://nnode:8020/user/hadoop/lucl.txt";

InputStream in = new URL(path).openStream();

OutputStream ou = System.out;

int buffer = 4096;

boolean close = false;

IOUtils.copyBytes(in, ou, buffer, close);

IOUtils.closeStream(in);

}

}

b.) 通过Hadoop的FileSystem来访问HDFS

Hadoop有一个抽象的文件系统概念,HDFS只是其中的一个实现。java抽象类org.apache.hadoop.fs.FileSystem定义了Hadoop中的一个文件系统接口。java.lang.Object

org.apache.hadoop.conf.Configured

org.apache.hadoop.fs.FileSystem

|--org.apache.hadoop.fs.FilterFileSystem

|----org.apache.hadoop.fs.ChecksumFileSystem

|----org.apache.hadoop.fs.LocalFileSystem

|--org.apache.hadoop.fs.ftp.FTPFileSystem

|--org.apache.hadoop.fs.s3native.NativeS3FileSystem

|--org.apache.hadoop.fs.RawLocalFileSystem

|--org.apache.hadoop.fs.viewfs.ViewFileSystempackage com.invic.hdfs;

import java.io.IOException;

import java.io.OutputStream;

import java.net.URI;

import java.util.Scanner;

import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.fs.FSDataInputStream;

import org.apache.hadoop.fs.FSDataOutputStream;

import org.apache.hadoop.fs.FileStatus;

import org.apache.hadoop.fs.FileSystem;

import org.apache.hadoop.fs.FileUtil;

import org.apache.hadoop.fs.LocatedFileStatus;

import org.apache.hadoop.fs.Path;

import org.apache.hadoop.fs.PathFilter;

import org.apache.hadoop.fs.RemoteIterator;

import org.apache.hadoop.io.IOUtils;

import org.apache.hadoop.util.Progressable;

/**

*

* @author lucl

* @ 通过FileSystem API来实现

*  FileSystem get(Configuration)            通过设置配置文件core-site.xml读取类路径来实现,默认本地文件系统

*  FileSystem get(URI, Configuration)       通过URI来设定要使用的文件系统

*  FileSystem get(URI, Configuration, user) 作为给定用户来访问文件系统,对安全来说至关重要

*/

public class MyHdfsOfFS {

private static String HOST = "hdfs://nnode";

private static String PORT = "8020";

private static String NAMENODE = HOST + ":" + PORT;

public static void main(String[] args) throws IOException {

Configuration conf = new Configuration();

String path = NAMENODE + "/user/";

/**

* 由于这里设计的为hadoop的user目录,默认会查询hdfs的用户家目录下的文件

*/

String user = "hadoop";

FileSystem fs = null;

try {

fs = FileSystem.get(URI.create(path), conf, user);

} catch (InterruptedException e) {

e.printStackTrace();

}

if (null == fs) {

return;

}

/**

* 递归创建目录

*/

boolean mkdirs = fs.mkdirs(new Path("invic/test/mvtech"));

if (mkdirs) {

System.out.println("Dir ‘invic/test/mvtech’ create success.");

}

/**

* 判断目录是否存在

*/

boolean exists = fs.exists(new Path("invic/test/mvtech"));

if (exists) {

System.out.println("Dir ‘invic/test/mvtech’ exists.");

}

/**

* FSDataInputStream支持随意位置访问

* 这里的lucl.txt默认查找路径为/user/Administrator/lucl.txt

因为我是windows的eclipse

* 如果我上面的get方法最后指定了user

则查询的路径为/user/get方法指定的user/lucl.txt

*/

FSDataInputStream in = fs.open(new Path("lucl.txt"));

OutputStream os = System.out;

int buffSize = 4098;

boolean close = false;

IOUtils.copyBytes(in, os, buffSize, close);

System.out.println("\r\n跳到文件开始重新读取文件。。。。。。");

in.seek(0);

IOUtils.copyBytes(in, os, buffSize, close);

IOUtils.closeStream(in);

/**

* 创建文件

*/

FSDataOutputStream create = fs.create(new Path("sample.txt"));

create.write("This is my first sample file.".getBytes());

create.flush();

create.close();

/**

* 文件拷贝

*/

fs.copyFromLocalFile(new Path("F:\\Mvtech\\ftpfile\\cg-10086.com.csv"),

new Path("cg-10086.com.csv"));

/**

* 文件追加

*/

FSDataOutputStream append = fs.append(new Path("sample.txt"));

append.writeChars("\r\n");

append.writeChars("New day, new World.");

append.writeChars("\r\n");

IOUtils.closeStream(append);

/**

* progress的使用

*/

FSDataOutputStream progress = fs.create(new Path("progress.txt"),

new Progressable() {

@Override

public void progress() {

System.out.println("write is in progress......");

}

});

// 接收键盘输入到hdfs上

Scanner sc = new Scanner(System.in);

System.out.print("Please type your enter : ");

String name = sc.nextLine();

while (!"quit".equals(name)) {

if (null == name || "".equals(name.trim())) {

continue;

}

progress.writeChars(name);

System.out.print("Please type your enter : ");

name = sc.nextLine();

}

/**

* 递归列出文件

*/

RemoteIterator it = fs.listFiles(new Path(path), true);

while (it.hasNext()) {

LocatedFileStatus loc = it.next();

System.out.println(loc.getPath().getName() + "|" + loc.getLen() + "|"

+ loc.getOwner());

}

/**

* 文件或目录元数据:文件长度、块大小、复本、修改时间、所有者及权限信息

*/

FileStatus status = fs.getFileStatus(new Path("lucl.txt"));

System.out.println(status.getPath().getName() + "|" +

status.getPath().getParent().getName() + "|" + status.getBlockSize() + "|"

+ status.getReplication() + "|" + status.getOwner());

/**

* 列出目录中文件listStatus,若参数为文件则以数组方式返回长度为1的FileStatus对象

*/

fs.listStatus(new Path(path));

fs.listStatus(new Path(path), new PathFilter() {

@Override

public boolean accept(Path tmpPath) {

String tmpName = tmpPath.getName();

if (tmpName.endsWith(".txt")) {

return true;

}

return false;

}

});

// 可以传入一组路径,会最终累计合并成一个数组返回

// fs.listStatus(Path [] files);

FileStatus [] mergeStatus = fs.listStatus(new Path[]{new Path("lucl.txt"),

new Path("progress.txt"), new Path("sample.txt")});

Path [] listPaths = FileUtil.stat2Paths(mergeStatus);

for (Path p : listPaths) {

System.out.println(p);

}

/**

* 文件模式匹配

*/

FileStatus [] patternStatus = fs.globStatus(new Path("*.txt"));

for (FileStatus stat : patternStatus) {

System.out.println(stat.getPath());

}

/**

* 删除数据

*/

boolean recursive = true;

fs.delete(new Path("demo.txt"), recursive);

fs.close();

}

}

c.) 访问HDFS集群package com.invic.hdfs;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.fs.FileSystem;

import org.apache.hadoop.fs.LocatedFileStatus;

import org.apache.hadoop.fs.Path;

import org.apache.hadoop.fs.RemoteIterator;

import org.apache.log4j.Logger;

/**

*

* @author lucl

* @ 通过访问hadoop集群来访问hdfs

*

*/

public class MyClusterHdfs {

public static void main(String[] args) throws IOException {

System.setProperty("hadoop.home.dir", "E:\\Hadoop\\hadoop-2.6.0\\hadoop-2.6.0\\");

Logger logger = Logger.getLogger(MyClusterHdfs.class);

Configuration conf = new Configuration();

conf.set("fs.defaultFS", "hdfs://cluster");

conf.set("dfs.nameservices", "cluster");

conf.set("dfs.ha.namenodes.cluster", "nn1,nn2");

conf.set("dfs.namenode.rpc-address.cluster.nn1", "nnode:8020");

conf.set("dfs.namenode.rpc-address.cluster.nn2", "dnode1:8020");

conf.set("dfs.client.failover.proxy.provider.cluster",

"org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider");

FileSystem fs = FileSystem.get(conf);

RemoteIterator it = fs.listFiles(new Path("/"), true);

while (it.hasNext()) {

LocatedFileStatus loc = it.next();

logger.info(loc.getPath().getName() + "|" + loc.getLen() + loc.getOwner());

}

/*for (int i = 0; i

String str = "the sequence is " + i;

logger.info(str);

}*/

try {

Thread.sleep(10);

} catch (InterruptedException e) {

e.printStackTrace();

}

System.exit(0);

}

}

说明:System.setProperty("hadoop.home.dir", "E:\\Hadoop\\hadoop-2.6.0\\hadoop-2.6.0\\");

# 在main方法的第一行配置hadoop的home路径,否则在Windows下可能报错如下:

15/07/19 22:05:54 DEBUG util.Shell: Failed to detect a valid hadoop home directory

java.io.IOException: HADOOP_HOME or hadoop.home.dir are not set.

at org.apache.hadoop.util.Shell.checkHadoopHome(Shell.java:302)

at org.apache.hadoop.util.Shell.(Shell.java:327)

at org.apache.hadoop.util.GenericOptionsParser.preProcessForWindows(GenericOptionsParser.java:438)

at org.apache.hadoop.util.GenericOptionsParser.parseGeneralOptions(GenericOptionsParser.java:484)

at org.apache.hadoop.util.GenericOptionsParser.(GenericOptionsParser.java:170)

at org.apache.hadoop.util.GenericOptionsParser.(GenericOptionsParser.java:153)

at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:64)

at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)

at com.invic.mapreduce.wordcount.WordCounterTool.main(WordCounterTool.java:29)

15/07/19 22:05:54 ERROR util.Shell: Failed to locate the winutils binary in the hadoop binary path

java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.

at org.apache.hadoop.util.Shell.getQualifiedBinPath(Shell.java:355)

at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:370)

at org.apache.hadoop.util.Shell.(Shell.java:363)

at org.apache.hadoop.util.GenericOptionsParser.preProcessForWindows(GenericOptionsParser.java:438)

at org.apache.hadoop.util.GenericOptionsParser.parseGeneralOptions(GenericOptionsParser.java:484)

at org.apache.hadoop.util.GenericOptionsParser.(GenericOptionsParser.java:170)

at org.apache.hadoop.util.GenericOptionsParser.(GenericOptionsParser.java:153)

at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:64)

at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)

at com.invic.mapreduce.wordcount.WordCounterTool.main(WordCounterTool.java:29)

相关文章:

知乎如何洞察你的真实喜好?首页信息流技术揭秘

11月8-9日,由中国 IT 社区 CSDN 与硅谷 AI 社区 AICamp 联合出品的 2018 AI 开发者大会(AI NEXTCon) 在北京举行,就人工智能的最新技术及深度实践,进行了全方位的解读及论证。本文是机器学习技术专题中知乎首页业务总监…

[Web开发] 微软的RSS协议扩展 - FeedSync 介绍 (4)

上一篇文章介绍了在2台电脑上同时修改数据的feedsync 同步过程&#xff0c; 今天再讨论一下当在2台电脑上同时删除同一个数据的情况。 假设最初feed 里面数据是这样的<item><sx:sync id"ep2.100" updates"1" deleted"false" noconflict…

weblogic 修改控制台密码

关掉weblogic所有进程切换到域下面$cd /home/weblogic/Oracle/Middleware/user_projects/domains/jydomain/security$java -classpath /home/weblogic/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.security.utils.AdminAccount weblogic weblogic123 …

WPF框架的内存泄漏BUG

用户在使用GIX4某模块的过程中&#xff0c;内存只见加不见减。我们怀疑出现了内存泄漏&#xff0c;所以我花了相当一段时间来进行此问题的排查。 我使用Red Gate公司的产品ANTS Memory Profiler 5进行应用程序的内存进行监视。并在过程中修改程序中出现的一些问题。但是最后留下…

java map深拷贝_java 实现Map的深复制

在java中有一个比较有趣的特性&#xff0c;在对对象进行赋值&#xff0c;或者clone时候一般都是我们所说的浅复制&#xff0c;Object A B;也就是说我们获取的并非在堆中重新分配的一块内存&#xff0c;而是一个指向原有数据内存的一个引用。这样的后果就是我们修改了A中的属性…

出门问问工程副总裁黄美玉入选IEEE Fellow,曾担任微软Cortana首席NLP科学家

虽然 IEEE&#xff08;国际电子电气工程协会&#xff09;2019 年的 Fellow 评选结果还未正式出炉&#xff0c;但记者刚刚获悉&#xff0c;IEEE Fellow 又新增一名华人科学家入选——出门问问工程副总裁、Mobvoi AI Lab 的负责人黄美玉博士。黄美玉博士是由于其在语音/语言技术领…

Windows2003服务器不支持FLV视频的解决方法

Windows2003服务器不支持FLV视频的解决方法2007年10月19日 星期五 10:43 A.M.原因&#xff1a;WIN2003加强了IIS6的MIME验证&#xff0c;一切未注册扩展文件格式统统显示404错误。手动在IIS中HTTP头->MIME添加MIME影射关系&#xff0c;MIME类型: video/x-flv 扩展名:.flv&am…

mpi并行 java_【并行计算】用MPI进行分布式内存编程(一)

通过上一篇关于并行计算准备部分的介绍&#xff0c;我们知道MPI(Message-Passing-Interface 消息传递接口)实现并行是进程级别的&#xff0c;通过通信在进程之间进行消息传递。MPI并不是一种新的开发语言&#xff0c;它是一个定义了可以被C、C和Fortran程序调用的函数库。这些函…

JQuery——选择器分类

JQuery选择器1 什么是JQuery选择器快速高效的找到指定节点&#xff0c;支持css语法设置页面2 JQuery选择器分类2.1 基本选择器CSS选择器层级选择器表单域选择器2.2 过滤选择器简单过滤选择器内容过滤选择器属性过滤选择器子元素过滤选择器表单域属性过滤选择器可见性过…

3月6日工作日志-88250

今天&#xff1a; 1. 与zy、vanessa一起使用mingle做了开发计划 2. 使用了XStream重写了XML格式的Dynamic Dictionary Basic Engine TODO&#xff1a; 1. 提高Dynamic Dict引擎的效率 2. 分片转换一部43W词汇的英&#xff0d;中词库(按字母、大小写分片) 转载于:https:/…

专注文本处理,达观数据完成B轮融资,累计融资超2亿元

11月22日&#xff0c;达观数据宣布成功完成1.6亿元B轮融资&#xff0c;由宽带旗下基金晨山资本领投&#xff0c;元禾重元、联想之星、钟鼎资本及老股东等跟投。达观数据总部位于上海张江高科技园区&#xff0c;目前已在北京、成都、深圳、西安等地开设分支机构。2015年获真格基…

Asp.Net Core写个共享磁盘文件Web查看器

查看器功能说明与演示 本查看器主要是为了方便大家查看服务器上的日志&#xff0c;这里没有考虑其他安全性问题&#xff0c;比如特定人员登录才能查看&#xff0c;这个需要您们自己去增加&#xff1b;如果你服务器有对外开放了ip&#xff0c;那么运行这个软件的时候建议考虑配置…

ImageNet时代将终结?何恺明新作:Rethinking ImageNet Pre-training

译者 | 刘畅 林椿眄整理 | Jane出品 | AI科技大本营Google 最新的研究成果 BERT 的热度还没褪去&#xff0c;大家都还在讨论是否 ImageNet 带来的预训练模型之风真的要进入 NLP 领域了。如今&#xff0c;Facebook AI Research 的何恺明、Ross Girshick 及 Piotr Dollar 三位大佬…

java 序列化 缓存_java_缓冲流、转换流、序列化流

一、缓冲流缓冲流的基本原理&#xff0c;是在创建流对象时&#xff0c;会创建一个内置的默认大小的缓冲区数组&#xff0c;通过缓冲区读写&#xff0c;减少系统IO次数&#xff0c;从而提高读写的效率。字节缓冲流构造方法创建字节缓冲输入流&#xff1a;BufferedInputStream bi…

QQ2007去广告教程(本地vip)

只要是vip就可以去掉广告了 关键函数QQHelperDll.dll的IsQQServiceEnable 在入口点修改: mov eax,1 retn 好了这样就成了本地的vip了 因为那个dll的版本太多了不能通用&#xff0c;所以就不提供下载了&#xff08;我的版本7.1.644.1777&#xff09; 同时qq每次升级都有可能替换…

java instanceof 报错_java instanceof方法

基本用法null instanceof Object 为false&#xff1b; null instanceof 任意类 为false&#xff1b;任意实例 instanceof 对应的类或者父类 都为true&#xff1b;基本数据类型 instanceof Object 编译时会报错(如 int a&#xff1b;a instanceof Object 编译不通过)&#xff…

grep的常用命令语法

grep的常用命令语法 1. 双引号引用和单引号引用 在g r e p命令中输入字符串参数时&#xff0c;最好将其用双引号括起来。例如&#xff1a;“m y s t r i n g”。这样做有两个原因&#xff0c;一是以防被误解为 s h e l l命令&#xff0c;二是可以用来查找多个单词组成的字符串&…

千呼万唤始出来!OpenCV 4.0正式发布!

作者 | 周强&#xff08;本文为作者独立观点&#xff0c;转载请联系作者&#xff09;来源 | 我爱计算机视觉OpenCV 4.0 正式版来啦&#xff01;重回英特尔的 OpenCV 终于迎来一次大版本更新&#xff0c;增加了诸多新特性&#xff0c;快来一起看看吧&#xff5e;因为 OpenCV 最开…

ORA-01031: insufficient privileges的解决方法

原文出自:http://www.chinaunix.net/jh/19/132866.html############################################# # # NAME: troubleshoot connect internal.txt # # DESCRIPTION: # connect internal # connect / as sysdba 要口令问题&#xff1a;# refer (METALINK,ORACLEDOC), # me…

java 线程通讯_java多线程(五)线程通讯

1.1. 为什么要线程通信多个线程并发执行时&#xff0c;在默认情况下CPU是随机切换线程的&#xff0c;有时我们希望CPU按我们的规律执行线程&#xff0c;此时就需要线程之间协调通信。1.2. 线程通讯方式线程间通信常用方式如下&#xff1a;l 休眠唤醒方式&#xff1a;Object的w…

合并排序(C语言实现)

递归算法是把一个问题分解成和自身相似的子问题&#xff0c;然后再调用自身把相应的子问题解决掉。这些算法用到了分治思想。其基本模式如下&#xff1a; 分解&#xff1a;把一个问题分解成与原问题相似的子问题 解决&#xff1a;递归的解各个子问题 合并&#xff1a;合并子问题…

工程实践也能拿KDD最佳论文?解读Embeddings at Airbnb

作者 | Mihajlo Grbovic&#xff0c;Airbnb 资深机器学习科学家译者 | Lang Yang&#xff0c;Airbnb 工程经理【导读】本文最早于 2018 年 5 月 13 日发表&#xff0c;主要介绍了机器学习的嵌入技术在 Airbnb 爱彼迎房源搜索排序和实时个性化推荐中的实践。Airbnb 爱彼迎的两位…

计算点、线、面等元素之间的交点、交线、封闭区域面积和闭合集(续1)

继续上一节的内容&#xff0c;本节主要讲解三维空间中射线、线段与平面及三维物体的交点及距离的计算&#xff0c;它们在碰撞检测和可见性剔除等应用中是必不可少的。首先给出3D空间下点乘和叉乘的定义与定理的推导&#xff0c;再谈如何应用到程序编码的工作中。 设三维空间中任…

android 抓取native层奔溃

使用android的breakpad工具 使用这个工具需要下载Breakpad的源码&#xff0c;然后进行编译&#xff0c;编译之后会生成两个工具 我们使用这两个工具来解析奔溃的位置。这里我们可以下载已经编译好的工具 下载地址是&#xff1a;链接&#xff1a;http://pan.baidu.com/s/1jIiU5c…

渗透各行各业,这家RPA外企宣布全面进军中国市场

11月15日&#xff0c;全球机器人流程自动化&#xff08;RPA&#xff09;领域平台UiPath首次在中国举办UiPath Together年度大会&#xff0c;来自自动化、人工智能和机器学习领域的行业专家&#xff0c;以及来自中国和世界的领先公司的客户与合作伙伴共同参与了此次活动。在此次…

java gettext_JAVA中getText()怎么从一个JTextArea中读出内容?

想先创建一个JTextArea&#xff0c;然后在里面输入内容(几个字母)&#xff0c;然后用getText读出里面的内容&#xff0c;可是好像只能是先在JTextArea里面写&#xff0c;然后getText才能读出&#xff0c;而不能先运行&#xff0c;在图形界面的JTex...想先创建一个JTextArea&…

想在SqlDbHelper.cs类中加的垃圾方法

虽然没改写SqlDbHelper.cs类的能力&#xff0c;但好不容易想出来的&#xff0c;放着留个纪念~~~~~/**//// <summary> /// 执行SQL语句&#xff0c;返回第一行&#xff0c;第一列&#xff08;sea&#xff09; /// </summary> /// <param na…

java全站_javaWeb_全站编码

目的 : 实现javaweb项目的全站编码问题需要解决的问题 : 在何时进行编码问题的解决, 在何处进行编码问题的解决, 才用什么方法进行解决设计思路 : 在Filter进行全站的编码转换, 对于GET请求 : 使用装饰者模式(是你有你一切拜托你), 修改Request.getParameter()方法, 在getparam…

在Linux系统中修改目录的权限如何恢复

在我工作中的某一天执行了chmod -R 777 /home后我十分后悔&#xff0c;这下不知道该怎么办&#xff1f;心里面很是着急。此时灵机一动问了一下谷哥&#xff0c;终于找到了方法解决此问题&#xff0c;不过前提是要自己做了文件权限备份工作&#xff0c;现在我就给大家讲解一下我…

.Net Framework 3.5 结构图

从打印社用A0或A1的纸打出来&#xff0c;大概10RMB&#xff0c;看起来超爽。 转载于:https://www.cnblogs.com/habin/archive/2008/03/15/1107196.html