spring学习(7):加入log4g日志系统

点击show dependencies popup

修改pom.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.geyao</groupId><artifactId>spring01geyao</artifactId><version>1.0-SNAPSHOT</version><dependencies><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>4.3.13.RELEASE</version></dependency><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.17</version></dependency></dependencies>
</project>

在resourse下面建立一个log4j.properties

log4j.properties

### 设置###
log4j.rootLogger = INFO,stdout### 输出信息到控制抬 ###
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n
log4j.category.org.springframework.beans.factory=DEBUG
MesasageService 类
package hello;//去掉注解public class MesasageService {public MesasageService() {super();System.out.println("MessageService...");}/*** 执行打印功能* @return 返回要打印的字符串*/public String getMessage(){return "Hello World";}
}
MessagePrinter类
package hello;//去掉注解public class MessagePrinter {//无参构造方法的加入public MessagePrinter() {super();System.out.println("MessagePrinter...");}private MesasageService service;/** 简历和MessageService的关系* *///设置service的值//创建关联关系public void setService(MesasageService service){this.service =service;}public void printMessage(){System.out.println(this.service.getMessage());}
}
ApplicationSpring类
package hello;import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;//加入扫描public class ApplicationSpring {public static void main(String[] args){System.out.println("appliaction....");//初始化springApplicationContext context =new ClassPathXmlApplicationContext("applicationContext.xml");//获取messagePrinter对象MessagePrinter printer=context.getBean(MessagePrinter.class);printer.printMessage();}
}

运行结果

G:\java\jdk\bin\java.exe "-javaagent:G:\idea\IntelliJ IDEA 2018.3.5\lib\idea_rt.jar=63337:G:\idea\IntelliJ IDEA 2018.3.5\bin" -Dfile.encoding=UTF-8 -classpath D:\spring\target\classes;C:\Users\geyao\.m2\repository\org\springframework\spring-context\4.3.13.RELEASE\spring-context-4.3.13.RELEASE.jar;C:\Users\geyao\.m2\repository\org\springframework\spring-aop\4.3.13.RELEASE\spring-aop-4.3.13.RELEASE.jar;C:\Users\geyao\.m2\repository\org\springframework\spring-beans\4.3.13.RELEASE\spring-beans-4.3.13.RELEASE.jar;C:\Users\geyao\.m2\repository\org\springframework\spring-core\4.3.13.RELEASE\spring-core-4.3.13.RELEASE.jar;C:\Users\geyao\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\geyao\.m2\repository\org\springframework\spring-expression\4.3.13.RELEASE\spring-expression-4.3.13.RELEASE.jar;C:\Users\geyao\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar hello.ApplicationSpring
appliaction....
[INFO ] 2019-10-27 20:33:27,506 method:org.springframework.context.support.AbstractApplicationContext.prepareRefresh(AbstractApplicationContext.java:583)
Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@59a6e353: startup date [Sun Oct 27 20:33:27 CST 2019]; root of context hierarchy
[INFO ] 2019-10-27 20:33:27,606 method:org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:317)
Loading XML bean definitions from class path resource [applicationContext.xml]
[DEBUG] 2019-10-27 20:33:27,713 method:org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:73)
Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl]
[DEBUG] 2019-10-27 20:33:27,819 method:org.springframework.beans.factory.xml.PluggableSchemaResolver.getSchemaMappings(PluggableSchemaResolver.java:141)
Loading schema mappings from [META-INF/spring.schemas]
[DEBUG] 2019-10-27 20:33:27,828 method:org.springframework.beans.factory.xml.PluggableSchemaResolver.getSchemaMappings(PluggableSchemaResolver.java:147)
Loaded schema mappings: {http://www.springframework.org/schema/context/spring-context-3.2.xsd=org/springframework/context/config/spring-context-3.2.xsd, http://www.springframework.org/schema/cache/spring-cache-4.3.xsd=org/springframework/cache/config/spring-cache-4.3.xsd, http://www.springframework.org/schema/beans/spring-beans-4.0.xsd=org/springframework/beans/factory/xml/spring-beans-4.0.xsd, http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/context/spring-context-4.0.xsd=org/springframework/context/config/spring-context-4.0.xsd, http://www.springframework.org/schema/util/spring-util-4.3.xsd=org/springframework/beans/factory/xml/spring-util-4.3.xsd, http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd, http://www.springframework.org/schema/tool/spring-tool-4.3.xsd=org/springframework/beans/factory/xml/spring-tool-4.3.xsd, http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd, http://www.springframework.org/schema/cache/spring-cache-4.2.xsd=org/springframework/cache/config/spring-cache-4.2.xsd, http://www.springframework.org/schema/context/spring-context-3.1.xsd=org/springframework/context/config/spring-context-3.1.xsd, http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-4.3.xsd, http://www.springframework.org/schema/beans/spring-beans-3.2.xsd=org/springframework/beans/factory/xml/spring-beans-3.2.xsd, http://www.springframework.org/schema/util/spring-util-4.2.xsd=org/springframework/beans/factory/xml/spring-util-4.2.xsd, http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-4.3.xsd, http://www.springframework.org/schema/tool/spring-tool-4.0.xsd=org/springframework/beans/factory/xml/spring-tool-4.0.xsd, http://www.springframework.org/schema/util/spring-util-4.1.xsd=org/springframework/beans/factory/xml/spring-util-4.1.xsd, http://www.springframework.org/schema/beans/spring-beans-4.2.xsd=org/springframework/beans/factory/xml/spring-beans-4.2.xsd, http://www.springframework.org/schema/context/spring-context-4.2.xsd=org/springframework/context/config/spring-context-4.2.xsd, http://www.springframework.org/schema/cache/spring-cache-4.1.xsd=org/springframework/cache/config/spring-cache-4.1.xsd, http://www.springframework.org/schema/lang/spring-lang-3.0.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd, http://www.springframework.org/schema/jee/spring-jee-4.3.xsd=org/springframework/ejb/config/spring-jee-4.3.xsd, http://www.springframework.org/schema/aop/spring-aop-4.3.xsd=org/springframework/aop/config/spring-aop-4.3.xsd, http://www.springframework.org/schema/beans/spring-beans-4.3.xsd=org/springframework/beans/factory/xml/spring-beans-4.3.xsd, http://www.springframework.org/schema/tool/spring-tool-4.1.xsd=org/springframework/beans/factory/xml/spring-tool-4.1.xsd, http://www.springframework.org/schema/task/spring-task-4.3.xsd=org/springframework/scheduling/config/spring-task-4.3.xsd, http://www.springframework.org/schema/util/spring-util-4.0.xsd=org/springframework/beans/factory/xml/spring-util-4.0.xsd, http://www.springframework.org/schema/beans/spring-beans-4.1.xsd=org/springframework/beans/factory/xml/spring-beans-4.1.xsd, http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-4.3.xsd, http://www.springframework.org/schema/cache/spring-cache-4.0.xsd=org/springframework/cache/config/spring-cache-4.0.xsd, http://www.springframework.org/schema/context/spring-context-4.1.xsd=org/springframework/context/config/spring-context-4.1.xsd, http://www.springframework.org/schema/aop/spring-aop-4.2.xsd=org/springframework/aop/config/spring-aop-4.2.xsd, http://www.springframework.org/schema/tool/spring-tool-4.2.xsd=org/springframework/beans/factory/xml/spring-tool-4.2.xsd, http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-4.2.xsd=org/springframework/ejb/config/spring-jee-4.2.xsd, http://www.springframework.org/schema/lang/spring-lang-3.1.xsd=org/springframework/scripting/config/spring-lang-3.1.xsd, http://www.springframework.org/schema/task/spring-task.xsd=org/springframework/scheduling/config/spring-task-4.3.xsd, http://www.springframework.org/schema/task/spring-task-4.2.xsd=org/springframework/scheduling/config/spring-task-4.2.xsd, http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-4.3.xsd, http://www.springframework.org/schema/lang/spring-lang-4.0.xsd=org/springframework/scripting/config/spring-lang-4.0.xsd, http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd, http://www.springframework.org/schema/task/spring-task-4.1.xsd=org/springframework/scheduling/config/spring-task-4.1.xsd, http://www.springframework.org/schema/tool/spring-tool-3.1.xsd=org/springframework/beans/factory/xml/spring-tool-3.1.xsd, http://www.springframework.org/schema/util/spring-util-3.2.xsd=org/springframework/beans/factory/xml/spring-util-3.2.xsd, http://www.springframework.org/schema/jee/spring-jee-4.1.xsd=org/springframework/ejb/config/spring-jee-4.1.xsd, http://www.springframework.org/schema/lang/spring-lang-3.2.xsd=org/springframework/scripting/config/spring-lang-3.2.xsd, http://www.springframework.org/schema/cache/spring-cache-3.2.xsd=org/springframework/cache/config/spring-cache-3.2.xsd, http://www.springframework.org/schema/aop/spring-aop-4.1.xsd=org/springframework/aop/config/spring-aop-4.1.xsd, http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-4.3.xsd, http://www.springframework.org/schema/jee/spring-jee-3.2.xsd=org/springframework/ejb/config/spring-jee-3.2.xsd, http://www.springframework.org/schema/util/spring-util-3.0.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang-4.1.xsd=org/springframework/scripting/config/spring-lang-4.1.xsd, http://www.springframework.org/schema/aop/spring-aop-3.2.xsd=org/springframework/aop/config/spring-aop-3.2.xsd, http://www.springframework.org/schema/tool/spring-tool-3.2.xsd=org/springframework/beans/factory/xml/spring-tool-3.2.xsd, http://www.springframework.org/schema/context/spring-context-4.3.xsd=org/springframework/context/config/spring-context-4.3.xsd, http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-4.3.xsd, http://www.springframework.org/schema/util/spring-util-3.1.xsd=org/springframework/beans/factory/xml/spring-util-3.1.xsd, http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/task/spring-task-4.0.xsd=org/springframework/scheduling/config/spring-task-4.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-4.3.xsd, http://www.springframework.org/schema/cache/spring-cache-3.1.xsd=org/springframework/cache/config/spring-cache-3.1.xsd, http://www.springframework.org/schema/aop/spring-aop-4.0.xsd=org/springframework/aop/config/spring-aop-4.0.xsd, http://www.springframework.org/schema/jee/spring-jee-4.0.xsd=org/springframework/ejb/config/spring-jee-4.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/task/spring-task-3.2.xsd=org/springframework/scheduling/config/spring-task-3.2.xsd, http://www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd, http://www.springframework.org/schema/jee/spring-jee-3.0.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd, http://www.springframework.org/schema/aop/spring-aop-3.1.xsd=org/springframework/aop/config/spring-aop-3.1.xsd, http://www.springframework.org/schema/jee/spring-jee-3.1.xsd=org/springframework/ejb/config/spring-jee-3.1.xsd, http://www.springframework.org/schema/lang/spring-lang-4.3.xsd=org/springframework/scripting/config/spring-lang-4.3.xsd, http://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd, http://www.springframework.org/schema/beans/spring-beans-3.1.xsd=org/springframework/beans/factory/xml/spring-beans-3.1.xsd, http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd, http://www.springframework.org/schema/task/spring-task-3.1.xsd=org/springframework/scheduling/config/spring-task-3.1.xsd, http://www.springframework.org/schema/lang/spring-lang-4.2.xsd=org/springframework/scripting/config/spring-lang-4.2.xsd, http://www.springframework.org/schema/tool/spring-tool-3.0.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd, http://www.springframework.org/schema/task/spring-task-3.0.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd, http://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd, http://www.springframework.org/schema/cache/spring-cache.xsd=org/springframework/cache/config/spring-cache-4.3.xsd}
[DEBUG] 2019-10-27 20:33:27,831 method:org.springframework.beans.factory.xml.PluggableSchemaResolver.resolveEntity(PluggableSchemaResolver.java:119)
Found XML schema [http://www.springframework.org/schema/beans/spring-beans.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-4.3.xsd
[DEBUG] 2019-10-27 20:33:27,913 method:org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
Loading bean definitions
[DEBUG] 2019-10-27 20:33:27,944 method:org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224)
Loaded 2 bean definitions from location pattern [applicationContext.xml]
[DEBUG] 2019-10-27 20:33:28,037 method:org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:730)
Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7920ba90: defining beans [service,printer]; root of factory hierarchy
[DEBUG] 2019-10-27 20:33:28,039 method:org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
Creating shared instance of singleton bean 'service'
[DEBUG] 2019-10-27 20:33:28,039 method:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:449)
Creating instance of bean 'service'
MessageService...
[DEBUG] 2019-10-27 20:33:28,072 method:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
Eagerly caching bean 'service' to allow for resolving potential circular references
[DEBUG] 2019-10-27 20:33:28,074 method:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:485)
Finished creating instance of bean 'service'
[DEBUG] 2019-10-27 20:33:28,075 method:org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
Creating shared instance of singleton bean 'printer'
[DEBUG] 2019-10-27 20:33:28,075 method:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:449)
Creating instance of bean 'printer'
MessagePrinter...
[DEBUG] 2019-10-27 20:33:28,076 method:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
Eagerly caching bean 'printer' to allow for resolving potential circular references
[DEBUG] 2019-10-27 20:33:28,081 method:org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:251)
Returning cached instance of singleton bean 'service'
[DEBUG] 2019-10-27 20:33:28,111 method:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:485)
Finished creating instance of bean 'printer'
[DEBUG] 2019-10-27 20:33:28,113 method:org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:251)
Returning cached instance of singleton bean 'lifecycleProcessor'
[DEBUG] 2019-10-27 20:33:28,120 method:org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:251)
Returning cached instance of singleton bean 'printer'
Hello WorldProcess finished with exit code 0

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/424596.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

[hackinglab][CTF][脚本关][2020] hackinglab 脚本关 writeup

脚本关 1 key又又找不到了 关键字&#xff1a; 知识点&#xff1a; 步骤:点击提供的链接后&#xff0c;实际发生了两次跳转&#xff0c;key 在第一次跳转的网页中&#xff0c;key is : yougotit_script_now 脚本关 2 快速口算 关键字&#xff1a; 知识点&#xff1a;python基…

用递归树求解递归算法时间复杂度

文章内容、图片均来自极客时间。 递归代码复杂度分析起来比较麻烦。一般来说有两种分析方法&#xff1a;递推公式和递归树。 1 递推公式法 归并排序的递推公式是&#xff1a; merge_sort(p…r) merge(merge_sort(p…q), merge_sort(q1…r)) 终止条件&#xff1a; p > r …

spring学习(8):log4j.properties 详解与配置步骤

一、入门实例 1.新建一个JAva工程&#xff0c;导入包log4j-1.2.17.jar&#xff0c;整个工程最终目录如下 2、src同级创建并设置log4j.properties ### 设置### log4j.rootLogger debug,stdout,D,E### 输出信息到控制抬 ### log4j.appender.stdout org.apache.log4j.ConsoleAp…

[hackinglab][CTF][注入关][2020] hackinglab 注入关 writeup

服务器挂了 咕咕咕 参考链接&#xff1a;https://blog.csdn.net/weixin_41924764/article/details/107095963?utm_mediumdistribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.control&depth_1-utm_sourcedistribute.pc_relevant_t0.none-task-bl…

数据结构六——堆

文章出处&#xff1a;极客时间《数据结构和算法之美》-作者&#xff1a;王争。该系列文章是本人的学习笔记。 1 堆定义 1.1 定义和结构 堆是一个完全二叉树&#xff08;完全二叉树&#xff1a;除了叶子节点外每一层节点都是满的&#xff0c;最后一层的子节点都靠左排列&…

spring学习(9):idea的config配置

点开eventlog 点击之后 勾选 apply---ok

[hackinglab][CTF][上传关][2020] hackinglab 上传关 writeup

上传关 1 请上传一张jpg格式的图片 关键字&#xff1a; 步骤&#xff1a; 1.F12查看源码 2.输入网址 获得key http://lab1.xseclab.com/upload1_a4daf6890f1166fd88f386f098b182af/upload_file.php上传关 2 关键字&#xff1a;burp 知识点&#xff1a; 步骤&#xff1a;看源…

靠谱的Pycharm安装详细教程

如何在本机上下载和安装Pycharm&#xff0c;具体的教程如下&#xff1a; 1、首先去Pycharm官网&#xff0c;或者直接输入网址&#xff1a;http://www.jetbrains.com/pycharm/download/#sectionwindows&#xff0c;下载PyCharm安装包&#xff0c;根据自己电脑的操作系统进行选择…

第四十四期:Keep突然大裁员,回应称“属正常调整”!

10 月 24 日程序员节原本是程序员们最开心的一天&#xff0c;但 Keep 程序员却开心不起来&#xff0c;因为不少人突然面临失业危机。\ 作者&#xff1a;51CTO 10 月 24 日程序员节原本是程序员们最开心的一天&#xff0c;但 Keep 程序员却开心不起来&#xff0c;因为不少人突然…

第四十五期:万亿级日访问量下,Redis在微博的9年优化历程

Redis在微博内部分布在各个应用场景&#xff0c;比如像现在春晚必争的“红包飞”活动&#xff0c;还有像粉丝数、用户数、阅读数、转评赞、评论盖楼、广告推荐、负反馈、音乐榜单等等都有用到Redis。 作者&#xff1a;兰将州来源 一、Redis在微博的应用场景 Redis在微博内部…

数据结构七——图

文章出处&#xff1a;极客时间《数据结构和算法之美》-作者&#xff1a;王争。该系列文章是本人的学习笔记。 1 基本概念 顶点、边 微信&#xff1a;A和B是好朋友&#xff0c;B也和A是好朋友&#xff0c;A和B之间有条边。 入度&#xff1a;每个顶点链接的边的个数每个人好朋友…

[CTF][Web][PHP][JavaScript]弱类型问题

弱类型问题 类型转换是无法避免的问题。例如需要将GET或者是POST的参数转换为int类型&#xff0c;或者是两个变量不匹配的时候&#xff0c;PHP会自动地进行变量转换。但是PHP是一个弱类型的语言&#xff0c;导致在进行类型转换的时候会存在很多意想不到的问题。 如果在用于密…

第四十六期:最近程序员频繁被抓,如何避免面向监狱编程?!

最近&#xff0c;有很多关于程序员被抓甚至被判刑的新闻在朋友圈疯传&#xff1a;"某程序员因为接了个外包&#xff0c;帮别人写了个软件&#xff0c;结果这个软件被用于赌博导致被抓。某公司利用爬虫抓取用户信息&#xff0c;最后被发现&#xff0c;导致该公司的程序员被…

算法五——字符串匹配(上)

文章内容、图片均来自极客时间。 如何借助哈希算法实现高效字符串匹配 1 概念和用途 字符串匹配&#xff1a;查找一个字符串A在字符串B中是否出现&#xff0c;这个过程就是字符串匹配。A称为模式串&#xff0c;B称为主串。主串的长度记为n&#xff0c;模式串长度记为m。n>…

算法五——字符串匹配(中)

文章出处&#xff1a;极客时间《数据结构和算法之美》-作者&#xff1a;王争。该系列文章是本人的学习笔记。 1文本编辑器中的查找功能怎么实现 在word中有一个功能&#xff1a;查找某个字符串&#xff0c;将其替换为另一个字符串&#xff0c;就会用到这个功能。 需要新算法的…

第四十七期:漫画:什么是公有云、私有云和混合云?

为了方便大家理解&#xff0c;我们尽量用通俗的语言和举例子的方式讲解&#xff0c;并且文中还配备了漫画供大家参考学习。 作者&#xff1a;漫话编程 为了方便大家理解&#xff0c;我们尽量用通俗的语言和举例子的方式讲解&#xff0c;并且文中还配备了漫画供大家参考学习。 …

第四十八期:你太菜了,竟然不知道Code Review?

我一直认为Code Review(代码审查)是软件开发中的优秀实践之一&#xff0c;可以有效提高整体代码质量&#xff0c;及时发现代码中可能存在的问题。 作者&#xff1a;宝玉 我一直认为Code Review(代码审查)是软件开发中的优秀实践之一&#xff0c;可以有效提高整体代码质量&…

算法五——字符串匹配(下)KMP

文章出处&#xff1a;极客时间《数据结构和算法之美》-作者&#xff1a;王争。该系列文章是本人的学习笔记。 KMP&#xff0c;是三个作者&#xff08;D.E.Knuth&#xff0c;J.H.Morris和V.R.Pratt&#xff09;的简称。   KMP算法和BM一样&#xff0c;也是一个字符串匹配算法。…

第四十九期:大牛总结的MySQL锁优化,写得太好了!

随着 IT 技术的飞速发展&#xff0c;各种技术层出不穷&#xff0c;让人眼花缭乱。尽管技术在不断更新换代&#xff0c;但是有些技术依旧被一代代 IT 人使用至今。 作者&#xff1a;崔皓 随着 IT 技术的飞速发展&#xff0c;各种技术层出不穷&#xff0c;让人眼花缭乱。尽管技…

数据结构八-Trie树

文章出处&#xff1a;极客时间《数据结构和算法之美》-作者&#xff1a;王争。该系列文章是本人的学习笔记。 1 Trie树的使用场景 搜索引擎中的搜索词建议。当你在搜索引擎中输入词&#xff0c;搜索引擎提示给你一个词的列表&#xff0c;帮助你快速输入想搜索的词。 这个功能…