1.3k 1 分钟

# Kotlin 基础语法

方法的定义

1
2
3
fun sum(a: Int, b: Int): Int {   // Int 参数,返回值 Int
return a + b
}
1
2
3
fun printSum(a: Int, b: Int): Unit { //无参数
print(a + b)
}
333 1 分钟

# 示例:Jul 24, 2019 3:00:46 PM # 示例代码: 12345678String str="Jul 24, 2019 3:00:46 PM";SimpleDateFormat format=new SimpleDateFormat("MMM dd, yyyy hh:mm:ss aa", Locale.ENGLISH);try { System.out.println(format.format(new Date()));...
4k 4 分钟

# 添加架包

在 pom 文件中添加一下坐标

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
 <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>2.9.5</version>
</dependency>

2.4k 2 分钟

# 一。使用 AccessibilityService 实现按钮监听,在资源文件夹新建 xml 资源文件夹,然后新 accessibility_service_config.xml。
1
2
3
4
5
6
7
8
9
10
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityEventTypes="typeAllMask"
android:accessibilityFeedbackType="feedbackGeneric"
android:accessibilityFlags="flagRequestFilterKeyEvents"
android:canRetrieveWindowContent="true"
android:canRequestFilterKeyEvents="true"
android:description="@string/accessibility_service_description"
/>

2.6k 2 分钟

# 一 Spring boot 打包 war 包时   websocket 报错问题

错误信息:’serverEndpointExporter’ defined in class path resource [red/bury/rtc/WebSocketConfig.class]: Invocation of init method failed;

解决办法:当使用外部 Tomcat 时,需要注释掉一下代码,即可正常启动

1
2
3
4
5
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}

584 1 分钟

# 创建镜像

  • 创建文件 Dockerfile
1
2
3
4
5
FROM centos:7
MAINTAINER bury "2054084196@qq.com"
RUN rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
RUN yum install -y nginx
EXPOSE 80