java

CDH 大数据平台搭建

我与影子孤独终老i 提交于 2021-02-18 12:31:12
一、概述 Cloudera版本(Cloudera’s Distribution Including Apache Hadoop,简称“CDH”),基于Web的用户界面,支持大多数Hadoop组件,包括HDFS、MapReduce、Hive、Pig、 Hbase、Zookeeper、Sqoop,简化了大数据平台的安装、使用难度。 二、安装部署 | 序号 | IP地址 | 主机名 |系统版本| | -------- | -------- | -------- | | 1 | 172.20.2.222 | cm-server |centos7.3 | 2 | 172.20.2.203 | hadoop-1 |centos7.3 | 3 | 172.20.2.204 | hadoop-2 |centos7.3 | 4 | 172.20.2.205 | hadoop-3 |centos7.3 2.2.1 基础环境部署 a.修改主机名配置hosts systemctl stop firewalld hostnamectl set-hostname cm-server #更改个主机名 sed -i 's/SELINUX=enforcing/SELINUX=disable/g' /etc/selinux/config setenforce 0 cat >>/etc/hosts<<EOF

How to emulate Android's productFlavors in a pure java gradle module?

北城余情 提交于 2021-02-18 12:28:15
问题 I need three flavors: fake staging prod fake will provide classes like FakeUser , FakeUserDb - it's very important that these classes are not compiled into the prod flavor. prod and staging are completely identical, except that I need to compile a different String url into prod vs staging . So, I need to create an "abstract" real flavor that both prod and staging inherit. This can be easily done with the android gradle plugin, but how can I do it in a pure java gradle module? 回答1: For each

How to emulate Android's productFlavors in a pure java gradle module?

喜你入骨 提交于 2021-02-18 12:28:12
问题 I need three flavors: fake staging prod fake will provide classes like FakeUser , FakeUserDb - it's very important that these classes are not compiled into the prod flavor. prod and staging are completely identical, except that I need to compile a different String url into prod vs staging . So, I need to create an "abstract" real flavor that both prod and staging inherit. This can be easily done with the android gradle plugin, but how can I do it in a pure java gradle module? 回答1: For each

Convert parametized Enum to Enumerated Annotation in android

 ̄綄美尐妖づ 提交于 2021-02-18 12:27:20
问题 I have a question regarding to the andriod @IntDef Annotation. I know that in its basic usage, it should replace the enum . But what if I have a parameterized enum with multiple hardwired values for example public enum MyEnum { YES(true, 1), NO(false, 0); private boolean boolState; private boolean intState; MyEnum(boolean boolState, int intState) { this.boolState = boolState; this.intState = intState; } public boolean getBoolState() { return boolState; } public int getIntState() { return

How can I reproduce and prevent the Billion Laughs attack in Java?

江枫思渺然 提交于 2021-02-18 12:18:28
问题 After a bit of research here's a code sample I've come up that I think should be vulnerable to the Billion Laughs attack. However it doesn't seem to be working, Done. is printed to the console much too quickly (instantly from a humans point of view). import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.InputSource; public class BillionLOLs { public static void vuln(String xml) {

Specfiy columns which should be considered for distinct calculation

孤街醉人 提交于 2021-02-18 12:18:12
问题 I'm using javax.persistence.criteria.CriteriaBuilder and javax.persistence.criteria.CriteriaQuery to select some entities. I now want to select only the entities that are unique which should be specified by a certain column. There is the method javax.persistence.criteria.CriteriaQuery#distinct which only returns unique entities. I would rather need something like CriteriaQuery<T> distinct(String... columnNames) Do you know how I can bake such a distinct in my JPA CriteriaQuery ? It seems to

JPA Native query get a Single Object

佐手、 提交于 2021-02-18 12:17:06
问题 How can i get a single object by using JPA Native query. I did some researches but all give an answer is use "getSingleResult", however it didn't return what i want to get. For example, what should i do if i want to get a count of table in my database and fetch it into a Integer. This code below shows how i get this by using Sessison hibernate: int check = Integer.parseInt((String) sessionF.createSQLQuery("select to_char(count(*)) as count from user_tables where table_name upper('TEST')")

when does FileInputStream.read() block?

不打扰是莪最后的温柔 提交于 2021-02-18 12:10:58
问题 The question is similar to the following two questions. Java InputStream blocking read Why is the FileInputStream read() not blocking? But I still cannot fully understand it. So far I think the read() method in following code will block due to the empty file 'test.txt'. FileInputStream fis = new FileInputStream("c:/test.txt"); System.out.println(fis.read()); System.out.println("to the end"); Actually it will print -1, I want to know why. The javadoc says This method blocks if no input is yet

detecting a file downloaded in selenium java

南笙酒味 提交于 2021-02-18 12:09:23
问题 I wrote an automation test in selenium java that detects if the page is redirecting (the automation detects if a new page is opened, the page redirects to other page, a new tab is opened and if an alert window is opened) Now to the problem. one of the redirects i can't find any way to detect is an automatic downloaded file (you enter a website and the website automatically downloads a file without any trigger from the user) p.s. I know the download process may differ in each browser, I need

detecting a file downloaded in selenium java

寵の児 提交于 2021-02-18 12:07:43
问题 I wrote an automation test in selenium java that detects if the page is redirecting (the automation detects if a new page is opened, the page redirects to other page, a new tab is opened and if an alert window is opened) Now to the problem. one of the redirects i can't find any way to detect is an automatic downloaded file (you enter a website and the website automatically downloads a file without any trigger from the user) p.s. I know the download process may differ in each browser, I need