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.sun.btrace.annotations.*; | |
import static com.sun.btrace.BTraceUtils.*; | |
@BTrace | |
public class TracingScript { | |
@OnMethod( | |
clazz="java.net.Socket", | |
method="setImpl", | |
location=@Location(Kind.RETURN) |
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
#!/usr/bin/env bash | |
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You under the Apache License, Version 2.0 | |
# (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.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
#!/usr/bin/env bash | |
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You under the Apache License, Version 2.0 | |
# (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.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 void exportProj(HttpServletResponse response) { | |
HSSFWorkbook workbook = new HSSFWorkbook(); | |
final List<String> headers = new ArrayList<>(); | |
headers.add("列1"); | |
headers.add("列2"); | |
headers.add("列3"); | |
headers.add("列4"); | |
Map<Integer, JSONArray> map; | |
for (Integer cityId : map.keySet()) { |
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
//关于乱码解决,将相应的字体文件拷贝到$JAVA_HOME/jre/lib/fonts/fallback文件夹下即可 | |
static private Font font = new Font("宋体", Font.PLAIN, 12); | |
public byte[] jFreeChartExample(String day) { | |
try { | |
Date end = DateUtils.parseDate(day, TableHelper.YYYY_MM_DD); | |
Date start = DateUtils.addDays(end, -29); | |
TimeSeriesCollection collTransfer = new TimeSeriesCollection(); | |
TimeSeriesCollection collWaitTime = new TimeSeriesCollection(); | |
TimeSeries seriesTransfer = new TimeSeries("平均转接次数"); |
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 { |
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
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
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
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)"); |
NewerOlder