Skip to content

Instantly share code, notes, and snippets.

View gist:c4fec03f4eec7b38b5f1508df2fe93f5
package vtest.bio;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
public class BioClient {
View logback
<?xml version="1.0" encoding="UTF-8" ?>
<configuration scan="true" scanPeriod="30 seconds" debug="false">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern><![CDATA[%d{HH:mm:ss.SSS} %-5level %logger{10}[%method,%line] - %msg%n]]></pattern>
</layout>
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoding>UTF-8</encoding>
View TimeTask_scala
import java.util.Timer
import java.util.TimerTask
import scala.concurrent._
/** Create Future[T] instances which will be completed after a delay.
*/
object TimedEvent {
val timer = new Timer
View autopurchase_mysql
create user 'newuser'@'localhost' identified by 'password';
create database 'dbname' character set utf8;
grant all privileges on dbname.* to 'newuser'@'localhost';
flush privileges;
create table TT_RESERVE_TEMPLATE
(
@booleguo
booleguo / new_tech
Last active Feb 29, 2016
30 天学习 30 种新技术系列
View new_tech
[30 天学习 30 种新技术系列](https://segmentfault.com/a/1190000000349384)
@booleguo
booleguo / AdminExceptionHandler.java
Created Feb 28, 2016
@Valid Hibernate validation in a Spring REST controller
View AdminExceptionHandler.java
@ControllerAdvice
public class AdminExceptionHandler {
@ExceptionHandler(AdminNotFoundException.class)
@ResponseBody
public ResponseEntity<ErrorInfo> adminNotFoundException(HttpServletRequest request, AdminNotFoundException e) {
String url = request.getRequestURL().toString();
String errorMessage = localizeErrorMessage("error.admin.not.found", new Object[] { e.getAdminId() });
return new ResponseEntity<ErrorInfo>(new ErrorInfo(url, errorMessage), HttpStatus.NOT_FOUND);
}