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
#include <iostream> | |
#include <vector> | |
#include <cmath> | |
#include <algorithm> | |
using namespace std; | |
struct node { | |
int z, o; | |
node() {} |
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
class Solution { | |
public: | |
struct node { | |
int z, o; | |
node() { | |
z = o = 0; | |
} | |
}; |
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
public class Solution { | |
class Node { | |
Node[] next = new Node[26]; | |
boolean end = false; | |
void add(String s) { | |
Node cur = this; | |
for (int i = 0;i < s.length(); ++i) { | |
int ind = s.charAt(i) - 'a'; | |
if (cur.next[ind] == null) { |
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
// <meta name="_csrf" th:content="${_csrf.token}"/> | |
// <meta name="_csrf_header" th:content="${_csrf.headerName}"/> | |
$(function () { | |
var token = $("meta[name='_csrf']").attr("content"); | |
var header = $("meta[name='_csrf_header']").attr("content"); | |
$(document).ajaxSend(function(e, xhr, options) { | |
xhr.setRequestHeader(header, token); | |
}); | |
}); |
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
//图片预览 | |
function previewPicture(file) { | |
var img = new moxie.image.Image(); | |
img.onload = function () { | |
$preview.attr('id', this.uid).addClass('thumbnail').html(''); | |
this.bind('embedded', function () { | |
$preview.children().css({ | |
width: '100%', | |
height: 'auto' | |
}); |
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
public class AjaxAwareAuthenticationEntryPoint extends LoginUrlAuthenticationEntryPoint { | |
public AjaxAwareAuthenticationEntryPoint(String loginFormUrl) { | |
super(loginFormUrl); | |
} | |
@Override | |
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { | |
String ajaxHeader = ((HttpServletRequest) request).getHeader("X-Requested-With"); | |
if ("XMLHttpRequest".equals(ajaxHeader)) { | |
response.sendError(HttpServletResponse.SC_FORBIDDEN, "Ajax Request Denied (Session Expired)"); |
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
var pluploadOptions = { | |
runtimes : 'html5,flash,silverlight,html4', | |
flash_swf_url : addBasePath('plugin/plupload/Moxie.swf'), | |
silverlight_xap_url : addBasePath('plugin/plupload/Moxie.xap'), | |
multi_selection: false, | |
file_data_name: 'file', | |
multipart_params : { | |
_csrf: token | |
}, | |
filters : { |
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
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(); | |
HttpClient httpClient = HttpClientBuilder.create().setRedirectStrategy(new LaxRedirectStrategy()).build(); | |
factory.setHttpClient(httpClient); | |
RestTemplate restTemplate = new RestTemplate(); | |
restTemplate.setRequestFactory(factory); |
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
git rm --cached -r . | |
git add . |
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
private void copyExcelSheet(Sheet sourceSheet, WritableSheet destSheet) { | |
for (int i = 0; i < sourceSheet.getRows(); ++i) { | |
for (int j = 0; j < sourceSheet.getColumns(); ++j) { | |
Cell cell = sourceSheet.getCell(j, i); | |
Label label = new Label(j, i, cell.getContents().trim()); | |
CellFormat readFormat = cell.getCellFormat(); | |
if (readFormat != null) { | |
label.setCellFormat( new WritableCellFormat(readFormat)); | |
} | |
try { |
OlderNewer