This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.walterinsh.datacompass.exception.OperationForbiddenException; | |
import org.apache.commons.lang.StringUtils; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.http.HttpStatus; | |
import org.springframework.http.ResponseEntity; | |
import org.springframework.web.bind.annotation.ControllerAdvice; | |
import org.springframework.web.bind.annotation.ExceptionHandler; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- <configuration debug="true"> 调试模式下,可输出logback的内部日志信息 --> | |
<configuration debug="false"> | |
<!-- 控制台输出 --> | |
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> | |
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 [%file:%line]日志所在文件及行数 %msg%n消息及换行--> | |
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%level][%thread]:%logger{50} [%method:%line] %msg%n</pattern> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.commons.beanutils.PropertyUtils; | |
import org.apache.commons.collections.CollectionUtils; | |
import org.apache.commons.lang.StringUtils; | |
import org.apache.commons.lang.math.NumberUtils; | |
import org.apache.commons.lang.time.DateFormatUtils; | |
import org.apache.poi.ss.usermodel.*; | |
import org.apache.poi.xssf.usermodel.XSSFCell; | |
import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.codehaus.jackson.annotate.JsonIgnore; | |
/** | |
* User: walter | |
* Date: 12/8/13 | |
* Time: 10:53 AM | |
*/ | |
public class Pagination { | |
// 每页显示数量 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean passesMillerRabin(int iterations, Random rnd) { | |
// Find a and m such that m is odd and this == 1 + 2**a * m | |
BigInteger thisMinusOne = this.subtract(ONE); | |
BigInteger m = thisMinusOne; | |
int a = m.getLowestSetBit(); | |
m = m.shiftRight(a); | |
// Do the tests | |
if (rnd == null) { | |
rnd = getSecureRandom(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.faolou.util; | |
/************************************************************************* | |
* Compilation: javac RSA.java | |
* Execution: java RSA N | |
* | |
* Generate an N-bit public and private RSA key and use to encrypt | |
* and decrypt a random message. | |
* | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static long getCRC32(String _source) throws UnsupportedEncodingException { | |
int crc = 0xFFFFFFFF; // initial contents of LFBSR | |
int poly = 0xEDB88320; // reverse polynomial | |
byte[] bytes = _source.getBytes("utf-8"); | |
for (byte b : bytes) { | |
int temp = (crc ^ b) & 0xff; | |
// read 8 bits one at a time | |
for (int i = 0; i < 8; i++) { | |
if ((temp & 1) == 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* User: walter | |
* Date: 5/5/14 | |
* Time: 5:09 PM | |
*/ | |
public class StringFormatter { | |
static final String DELIM_STR = "{}"; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* AngularJS v1.3.15 | |
*/ | |
var app = angular.module('fds-punisher', modules, function ($routeProvider, $locationProvider, $httpProvider) { | |
$httpProvider.interceptors.push(function($q) { | |
return { | |
'responseError': function(rejection) { | |
var status = rejection.status; | |
if (status == 400) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.watcher_switches = []; | |
$scope.add_status_watcher = function () { | |
//stop watching | |
angular.forEach($scope.watcher_switches, function (value) { | |
value(); | |
}); | |
//bind new watchers | |
var new_watchers = []; |
OlderNewer