-
Notifications
You must be signed in to change notification settings - Fork 1
/
content.json
1 lines (1 loc) · 10.6 KB
/
content.json
1
{"meta":{"title":"戎码一生","subtitle":"反正山高水长,还有一生可以嚣张","description":"反正山高水长,还有一生可以嚣张","author":"捕风","url":"http://houxiaoyi.cn","root":"/"},"pages":[{"title":"tags","date":"2019-08-11T04:51:50.000Z","updated":"2019-08-19T11:34:31.516Z","comments":true,"path":"tags/index.html","permalink":"http://houxiaoyi.cn/tags/index.html","excerpt":"","text":""},{"title":"categories","date":"2019-08-11T04:52:21.000Z","updated":"2019-08-19T11:34:31.516Z","comments":true,"path":"categories/index.html","permalink":"http://houxiaoyi.cn/categories/index.html","excerpt":"","text":""}],"posts":[{"title":"Java 泛型","slug":"Java-泛型","date":"2019-08-22T12:58:58.000Z","updated":"2019-08-27T02:45:07.525Z","comments":true,"path":"2019/08/22/Java-泛型/","link":"","permalink":"http://houxiaoyi.cn/2019/08/22/Java-泛型/","excerpt":"","text":"Java 泛型简单点就是一个占位符,这个型是任意的,所以就是叫做泛型,也就是<AnyWord> 尖括号里面的字符是任意的,但是在上下文中应该是一致的,它标识统一类型,至于是什么类型,后期使用者自己觉得,所以重复一遍,泛型可以简单理解为占位符。 1234567891011121314151617181920212223242526272829303132333435363738394041424344public class GeneticProgramming { public static void main(String[] args) { Box<String> box = new Box<String>(); box.set(\"Hello World!\"); String a = box.get(); System.out.println(a); Cox<Integer> cox = new Cox<Integer>(); cox.set(12); int b = cox.get(); System.out.println(b); }}class Box<T> { // T stands for \"Type\" private T t; public void set(T t) { this.t = t; } public T get() { return t; }}class Cox<AnyValue> { // AnyValue stands for \"Type\" private AnyValue t; public void set(AnyValue t) { this.t = t; } public AnyValue get() { return t; }} 在Java的源代码中比较常见的泛型有HashMap<K,V>,其中的K,V。都是泛型的表示,如果有兴趣可以看下源代码。 1234567891011121314public class HashMap<K,V> extends AbstractMap<K,V> implements Map<K,V>, Cloneable, Serializable { private static final long serialVersionUID = 362498820763181265L; public V put(K key, V value) { return putVal(hash(key), key, value, false, true); } public V get(Object key) { Node<K,V> e; return (e = getNode(hash(key), key)) == null ? null : e.value; }} 上面只是部分源代码,可以看出HashMap对泛型的应用。","categories":[],"tags":[{"name":"Java","slug":"Java","permalink":"http://houxiaoyi.cn/tags/Java/"}]},{"title":"Logback框架的配置文件","slug":"Logback框架的配置文件","date":"2019-08-19T14:16:11.000Z","updated":"2019-08-27T02:51:44.352Z","comments":true,"path":"2019/08/19/Logback框架的配置文件/","link":"","permalink":"http://houxiaoyi.cn/2019/08/19/Logback框架的配置文件/","excerpt":"","text":"SpringBoot中使用的是面向日志框架是slf4j,使用的日志框架应该是logback。因此可以直接在SpringBoot中使用。 1private final static org.slf4j.Logger logger = org.slf4j.LogFactory.getLogger(ClassName.class); 没有配置文件,直接去使用虽然没有太大问题问题,但是如果要详细配置输出文件,以及日志等级,可能就需要详细的设计了。 logback详细配置显示文件行数,点击可以跳转。需要在application.properties中配置 12# log configlogging.config=classpath:logback.xml logback.xml文件内容如下 1234567891011121314151617181920212223242526272829<?xml version=\"1.0\" encoding=\"UTF-8\"?><configuration debug=\"false\" scan=\"true\" scanPeriod=\"1 seconds\"> <contextName>logback</contextName> <property name=\"log.path\" value=\"/tmp/applogs/xxl-job/xxl-job-executor-sample-springboot.log\"/> <appender name=\"console\" class=\"ch.qos.logback.core.ConsoleAppender\"> <encoder> <pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %highlight(%-5level) %yellow(at %class.%method) \\(%file:%line\\) - %msg%n</pattern> </encoder> </appender> <appender name=\"file\" class=\"ch.qos.logback.core.rolling.RollingFileAppender\"> <file>${log.path}</file> <rollingPolicy class=\"ch.qos.logback.core.rolling.TimeBasedRollingPolicy\"> <fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern> </rollingPolicy> <encoder> <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n </pattern> </encoder> </appender> <root level=\"info\"> <appender-ref ref=\"console\"/> <appender-ref ref=\"file\"/> </root></configuration> 效果如下图 logback.png eclipse版本的SpringBoot的内置logback配置由于eclipse的console并不能输出各种彩色,只能输出蓝色,红色以及黑色。因此基于idea版本去掉了特殊颜色设置。 1234567891011121314151617181920212223242526272829<?xml version=\"1.0\" encoding=\"UTF-8\"?><configuration debug=\"false\" scan=\"true\" scanPeriod=\"1 seconds\"> <contextName>logback</contextName> <property name=\"log.path\" value=\"/tmp/applogs/xxl-job/xxl-job-executor-sample-springboot.log\"/> <appender name=\"console\" class=\"ch.qos.logback.core.ConsoleAppender\"> <encoder> <pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level at %class.%method \\(%file:%line\\) - %msg%n</pattern> </encoder> </appender> <appender name=\"file\" class=\"ch.qos.logback.core.rolling.RollingFileAppender\"> <file>${log.path}</file> <rollingPolicy class=\"ch.qos.logback.core.rolling.TimeBasedRollingPolicy\"> <fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern> </rollingPolicy> <encoder> <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n </pattern> </encoder> </appender> <root level=\"debug\"> <appender-ref ref=\"console\"/> <appender-ref ref=\"file\"/> </root></configuration> 参考:https://logback.qos.ch/manual/layouts.html","categories":[],"tags":[{"name":"Java","slug":"Java","permalink":"http://houxiaoyi.cn/tags/Java/"}]},{"title":"Hello World","slug":"hello-world","date":"2019-08-19T11:34:31.512Z","updated":"2019-08-19T11:34:31.512Z","comments":true,"path":"2019/08/19/hello-world/","link":"","permalink":"http://houxiaoyi.cn/2019/08/19/hello-world/","excerpt":"","text":"Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick StartCreate a new post1$ hexo new \"My New Post\" More info: Writing Run server1$ hexo server More info: Server Generate static files1$ hexo generate More info: Generating Deploy to remote sites1$ hexo deploy More info: Deployment","categories":[],"tags":[]},{"title":"数据结构-插入排序","slug":"数据结构-插入排序","date":"2019-08-19T11:26:22.000Z","updated":"2019-08-19T11:34:31.512Z","comments":true,"path":"2019/08/19/数据结构-插入排序/","link":"","permalink":"http://houxiaoyi.cn/2019/08/19/数据结构-插入排序/","excerpt":"","text":"C语言实现的插入排序算法两种实现方式 代码繁多(逻辑简单) 1234567891011121314151617181920212223242526272829#include<stdio.h>int main(){ int a[10]={2,4,7,3,1,9,8,6,0,5}; for(int i=1;i<10;i++) { int k=i; for(int j=i-1;j>=0;j--) { if(a[i]<a[j]) { k=j; } } //k为a[i]应该所在的位置 //置换位置 int temp=a[i]; for (int m=i;m>k;m--) { a[m]=a[m-1]; } a[k]=temp; } for(int h=0;h<10;h++) { printf(\"%d\",a[h]); } return 0;} 代码简洁(逻辑复杂) 12345678910111213141516171819#include<stdio.h>int main(){ int a[10] = {2,6,3,1,4,8,5,9,7,0}; for(int i = 1 ; i< 10 ; i++){ int tem = a[i]; int j = i-1; while (j >= 0&& a[j] > tem) { a[j+1] = a[j]; j--; } a[++j]=tem; } for (int i = 0; i < 10; i++) { printf(\"%d\",a[i]); } return 0;} 上面两种代码。代码简洁一般逻辑复杂,代码繁多的一般逻辑简单。逻辑简单一般符合机器思维,逻辑复杂一般符合人脑符合。 Java实现插入排序 12345678910111213141516171819public class InsertSort { public static void main(String[] args) { int[] a = {2,6,3,1,4,8,5,9,7,0}; for(int i=1;i<10;i++) { int tmp = a[i]; int j=i-1; while(j>=0&&a[j]>tmp) { a[j+1]=a[j]; j--; } a[++j]=tmp; } for(int b:a) { System.out.print(b); } }} Java编辑的可以使用eclipse或者IDEA调试!方便找出问题所在,相比较于C语言要更加容器找到问题所在。","categories":[],"tags":[{"name":"数据结构","slug":"数据结构","permalink":"http://houxiaoyi.cn/tags/数据结构/"}]},{"title":"Docker学习","slug":"Docker学习","date":"2019-08-11T04:45:56.000Z","updated":"2019-08-19T11:34:31.512Z","comments":true,"path":"2019/08/11/Docker学习/","link":"","permalink":"http://houxiaoyi.cn/2019/08/11/Docker学习/","excerpt":"","text":"docker基础命令重启docker1sudo service docker restart 常用命令12345678910111213141516171819202122# 开始一个新的容器$ JOB=$(sudo docker run -d ubuntu /bin/sh -c "while true; do echo Hello world; sleep 1; done")# 停止容器$ docker stop $JOB# 开始容器$ docker start $JOB# 重启容器$ docker restart $JOB# 杀死一个工作$ docker kill $JOB# 删除一个容器$ docker stop $JOB # Container must be stopped to remove it$ docker rm $JOB# 查看所有容器$ docker ps -a #所有实例化的容器 容器内部操作进入容器内部 1docker exec -it ContainerId /bin/bash docker运行应用docker跑一个Tomcat第一步:拉取一个Tomcat镜像1docker pull tomcat 第二步:运行Tomcat实例化一个Tomcat容器 1docker run --name tomcat -p 8080:8080 -v $PWD/test:/usr/local/tomcat/webapps/test -d tomcat 实例化第二个Tomcat容器 1docker run --name tomcat2 -p 9080:8080 -v /home/eric/Project/Docker/tomcat2/webapps/test:/usr/local/tomcat/webapps/test -d tomcat 命令说明: -p 8080:8080:将容器的8080端口映射到主机的8080端口 -v $PWD/test:/usr/local/tomcat/webapps/test:将主机中当前目录下的test挂载到容器的/test查看容器启动情况","categories":[],"tags":[{"name":"Docker","slug":"Docker","permalink":"http://houxiaoyi.cn/tags/Docker/"}]}]}