This file contains hidden or 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 aa.web; | |
import org.springframework.core.MethodParameter; | |
import org.springframework.http.MediaType; | |
import org.springframework.http.converter.HttpMessageConverter; | |
import org.springframework.http.server.ServerHttpRequest; | |
import org.springframework.http.server.ServerHttpResponse; | |
import org.springframework.http.server.ServletServerHttpRequest; | |
import org.springframework.web.bind.annotation.ControllerAdvice; | |
import org.springframework.web.filter.OncePerRequestFilter; |
This file contains hidden or 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.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.datatype.joda.JodaModule; | |
import com.fasterxml.jackson.module.afterburner.AfterburnerModule; | |
public interface JsonMapper { | |
ObjectMapper mapper = ObjectMapperWrapper.init(); | |
class ObjectMapperWrapper { | |
private static com.fasterxml.jackson.databind.ObjectMapper init() { |
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Form latin-1 input validation</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.10/angular.min.js"></script> | |
<script type="text/javascript"> | |
(function(angular) { | |
'use strict'; |
This file contains hidden or 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
'use strict'; | |
angular.module('portal') | |
.factory('PrefixCalculator', function () { | |
/** | |
* Sums up the prefixLengths given a specified bitSize | |
* | |
* @param prefixes prefixLength integers (e.g. 22, 39 etc) | |
* @param bitSize the bitSize of the IP (e.g. 32 or 128) |
This file contains hidden or 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
object PrefixCalculator { | |
def sumIpv4(ipv4Prefixes: Seq[Int]) : Int = doSumIpvX(ipv4Prefixes, 32) | |
def sumIpv6(ipv6Prefixes: Seq[Int]) : Int = doSumIpvX(ipv6Prefixes, 128) | |
private def doSumIpvX(prefixes: Seq[Int], bitSize: Int) : Int = { | |
val addressSize = prefixes.map(prefix => Math.pow(2, bitSize - prefix)).sum | |
(bitSize - (Math.log(addressSize) / Math.log(2))).floor.toInt | |
} |
NewerOlder