Finology 大数据金融

通过大数据以量化金融

使用安卓搜狗输入法小米版时,经常会误点到如图所示的广告。

一般会启动小米的一个应用。关掉应用再回到原来页面,要耗费好几秒钟时间,非常恶心。

我原以为通过下图所示方法,修改工具栏选项就可以解决。

其实是不行的,这个方法只能修改这个广告左边的那些按钮。

要去掉这个广告按钮,得按如下方法操作:

设置 -> 更多设置 -> 语言和输入法 -> 搜狗输入法小米版 -> 输入习惯 -> 节日活动提醒 -> 关闭开关,搞定。

CentOS 环境

安装 udp 监测工具 netcat

1
$ sudo yum install nc

监听端口

1
2
3
4
5
6
$ nc -vul localhost 1080
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Listening on ::1:1080
Ncat: Connection from ::1.
123
1233

发送数据

1
2
3
4
5
$ nc -vu localhost 1080
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to ::1:1080.
123
1233

在 Java 程序中,我们可以通过如下代码获取本地的 ip 地址:

1
InetAddress.getLocalHost().getHostAddress()

但由于安装了虚拟机,或者由于本地回环网的问题,获取的 ip 地址可能不是想要的那个。可以采用如下方法获取到所有的 ip 地址列表,再做筛选。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package gy.finolo.ipdemo;

import java.net.*;
import java.util.Enumeration;

public class IPDemo {

public static void main(String[] args) throws UnknownHostException, SocketException {

System.out.println(InetAddress.getLocalHost().getHostAddress());

Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();

while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();

if (inetAddress instanceof Inet4Address) {

System.out.println(inetAddress.getHostAddress() + " loopback: " + inetAddress.isLoopbackAddress() +
" linklocal: " + inetAddress.isLinkLocalAddress() +
" sitelocal: " + inetAddress.isSiteLocalAddress());
}

if (inetAddress instanceof Inet6Address) {
System.out.println(((Inet6Address) inetAddress).getScopedInterface());
}
}
}
}
}

如果还不能区分,那就可能需要通过网卡名字来过滤了,这个是需要用到 Inet6Address 了。

0%