In this article you will understand how SQL injection attacks are used to compromise the security of a web application, and how to write code more securely to protect against this type of attack.Let’s start with a SQL injection example. Suppose there’s an online application with a login page. Registered users of the application can do the specific business. Tom...
26 Feb 2017
Readmore →
In many times we encounter the demand that need to perform lots of same tasks which are produced constantly during our coding work. The tasks need to be consumed rapidly, otherwise they may pile up damaging the system.The following examples require this kind of demand: A web crawler that constantly browses the web and scans through web pages to create...
17 Feb 2017
Readmore →
Let’s say we have a big feature branch myFeature that contains a lot ofchanges (because we want to test the feature locally end-to-end firstbefore sending out any CRs). For some reason we need to split these changes into two or more CR requests. For example, a common practice is to send interface changes first. Here’s one kind of measure which...
15 Feb 2017
Readmore →
Log4j 是 Apache 的一个开源项目,使用 log4j,我们可以定义日志的输出格式,日志级别,输出目的等。log4j2 是 log4j的升级版,主要特点是异步日志输出,性能较 log4j 有大幅度提升,特别适合高并发场景下。 log4j 使用目前很火的 disruptor 无锁并发队列,世道日志事件处理非常迅速。并且,增加了 nosql 的 appender,如:kafka, flume 等。Spring Boot 升级 log4j2 需要移除原先的 log4j1.x的 maven 依赖。可以使用 mvn dependency:tree 找出所有的 log4j1.x 的依赖包,显示 exclusion:<dependency> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId> <version>3.4.6</version> <exclusions> <exclusion> <groupId>log4j</groupId> <artifactId>log4j</artifactId> </exclusion> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </exclusion> </exclusions> </dependency>同时,加入 log4j2的依赖,可以直接使用 spring-boot 提供的 starter:<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions></dependency><dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-log4j2</artifactId></dependency> 在升级过程中,由于exclusion某些包里的...
28 Nov 2015
Readmore →
Intellij 打开某个非常大的java文件(如使用thrift自动生成的java文件)时,会超出其的默认配置,导致 Intellij 报错:File size exceeds configured limit(2560000). Code insight features are not available.解决办法是修改Intellij 的 idea.max.intellisense.filesize属性配置,位于:/Applications/{Intellij Home}/bin/idea.properties由于 Intellij 默认内存堆栈的设置是128MB, 打开多个项目时能够明显感到Intellij很卡。此时,可以增加其内存堆的大小,位于:/Applications/{Intellij Home}/bin/idea.vmoptions
11 Jul 2015
Readmore →