环境配置

maven环境配置

位置在于下载好的maven目录下apache-maven-3.5.2\conf

  1. 更改本地库位置(防止C盘撑爆)搜索即可找到
    1
    <localRepository>D:\Repository</localRepository>
  2. 换阿里云镜像(加速下载)在mirrors下
    1
    2
    3
    4
    5
    6
    <mirror>
    <id>nexus-aliyun</id>
    <mirrorOf>*</mirrorOf>
    <name>Nexus aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
  3. 配置JDK版本,profiles下
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <profile>
    <id>jdk18</id>
    <activation>
    <jdk>1.8</jdk>
    <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
    </properties>
    </profile>
  4. 配置环境变量
    文件夹->此电脑右键->属性->高级系统设置->环境变量->新建系统环境变量

  5. IDEA中的Maven配置

Vim多行注释

方法一

  1. 首先按 esc 进入命令行模式下,按下 Ctrl + v ,进入列(也叫区块)模式;
  2. 在行首使用上下键选择需要注释的多行;
  3. 按下键盘(大写) “I” 键,进入插入模式;
  4. 然后输入注释符( “//”、“#” 等);
  5. 最后按下 “Esc” 键。

方法2

1
在指令模式下,使用.,$s/^/^# (从指定行到最后一行)

Xshell连接Ubuntu

连接操作

https://blog.csdn.net/lianghe_work/article/details/47340141

遇到的问题

  1. sudo apt-get install openssh-server报错
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    ll@ubuntu:~$ sudo apt-get install openssh-server
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    openssh-server : Depends: openssh-client (= 1:7.2p2-4ubuntu2.8)
    Depends: openssh-sftp-server but it is not going to be installed
    Recommends: ssh-import-id but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

解决办法 sudo apt-get install openssh-client=1:7.2p2-4ubuntu2.8
执行以上命令后在执行安装就可以了, 不过要和以上报错的版本对应

  1. root用户无法登陆
  • 在其他用户下切换sudo su root切换到root用户
  • vi /etc/ssh/sshd_config
    1
    2
    3
    <!-- 加一句去一句 -->
    PermitRootLogin yes
    # PermitRootLogin prohibit-password
  • /etc/init.d/ssh restart 来重启ssh服务
  1. /usr/bin/xauth: file /root/.Xauthority does not exist
    1
    2
    3
    4
    vi /etc/ssh/sshd_config

    添加 AllowAgentForwarding yes
    /etc/init.d/ssh restart 来重启ssh服务
  2. Ubuntu 输入正确的密码后重新返回到登陆界面

Linux的一些笔记

Java NIO

Java NIO实例

Java基本套接字

基本操作

  • 连接远程机器。
  • 发送数据。
  • 接收数据。
  • 关闭连接。
  • 绑定端口。
  • 监听入站数据。
  • 在所绑定端口.上接受来自远程机器的连接。

其中,前四项用于客户端,后六项用于服务器,最后三项只有服务器才需要,即等待客
户端的连接,这些操作通过ServerSocket类实现。

Java动态代理

概述

Hadoop远程过程调用实现使用Java动态代理和新输入1输出系统(NewInput/Output,NIO)

Java动态代理类位于java.lang.reflect包下,主要包括java.lang rlfct.Proxy和java.lang.reflect.InvocationHandler

代理对象两大任务

  1. 创建代理接口
    实现由java.lang,reflect.Proxy完成
  2. 调用转发
    通过java.lang.reflect.InvocationHandler的实例完成

Java远程调用

概述

Java远程方法调用(Remote Method Invocation, RMI)是Java的一个核心API和类库,
允许一个Java虚拟机上运行的Java程序调用不同虚拟机上运行的对象中的方法,即使这两个
虚拟机运行于物理隔离的不同主机上。在某种程度上,RMI可以看成RPC的Java升级版。

和RPC一样,存在服务端和客户端
典型服务器端应用程序 创建多个远程对象(Remote Object),使这些对象能被客户端引用,并等待客户端调用远程对象的方法
典型的客户端程序 从服务器获得一个或多个远程对象的引用,然后调用远程对象的方法

DOM解析

说明:这里主要分析hadoop的DOM解析

DOM 的工作方式是:

  • 首先一次性将XML文档加入内存
  • 然后在内存创建一个“树形结构”,也就是对象模型
  • 然后使用对象提供的接口访问文档,进而操作文档

    处理步骤

    1. 获得用于创建DOM解析器的工厂对象
      1
      DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×