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 static Date toDate(String value) throws ParseException { | |
final String[] formats = {"yyyyMMdd", "yyyy/MM/dd", "yyyy-MM-dd"}; | |
ParseException parseEx = null; | |
for (String format : formats) { | |
try { | |
return toDate(value, format); | |
} catch (ParseException e) { | |
parseEx = e; | |
continue; |
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 org.apache.commons.lang.time.DateUtils; | |
public static long differenceDay(Date date1, Date date2) { | |
final long millsecsOfDay = 24 * 60 * 60 * 1000; | |
Date day1 = DateUtils.truncate(date1, Calendar.DATE); | |
Date day2 = DateUtils.truncate(date2, Calendar.DATE); | |
return (day1.getTime() - day2.getTime()) / millsecsOfDay; | |
} |
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 static long ceil(long num, int precision) { | |
if (num == 0) { | |
return num; | |
} | |
int digits = calcTruncateDigits(num, precision); | |
return ceilTruncate(num, digits); | |
} | |
private static int calcTruncateDigits(long num, int precision) { | |
int log = (int) Math.log10(Math.abs(num)); |
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 static org.junit.Assert.*; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.io.PrintStream; | |
import java.net.CookieHandler; | |
import java.net.CookieManager; | |
import java.net.CookiePolicy; | |
import java.net.HttpURLConnection; | |
import java.net.MalformedURLException; |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE configuration> | |
<project basedir="." default="start" name="sample"> | |
<property name="tool.dir" value="tool"/> | |
<property name="cobertura.home" value="${tool.dir}/cobertura-1.9.4.1"/> | |
<property environment="env"/> | |
<property name="catalina.home" value="${env.CATALINA_HOME}"/> | |
<property name="manager.url" value="http://localhost:8080/manager/text"/> | |
<property name="manager.user" value="manager"/> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE configuration> | |
<project basedir="." default="all" name="sample"> | |
<property environment="env"/> | |
<property name="catalina.home" value="${env.CATALINA_HOME}"/> | |
<property name="manager.url" value="http://localhost:8080/manager/text"/> | |
<property name="manager.user" value="manager"/> | |
<property name="manager.pass" value=""/> | |
<property name="src.web.dir" value="WebContent" /> |
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
/** | |
* Ajax用オブジェクト(XMLHttpRequest)生成. | |
*/ | |
function createAjaxRequest() { | |
var req; | |
try { | |
req = new XMLHttpRequest(); | |
} catch (e) { | |
try { | |
req = new ActiveXObject("Msxml2.XMLHTTP"); |
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
<html><body> | |
<table><tbody id="tbody1"></tbody></table> | |
<script> | |
var tbody1 = document.getElementById("tbody1"); | |
replaceTableRows( | |
"<table><tr><td>01</td><td>02</td></tr></table>", tbody1); | |
replaceTableRows( | |
"<table><tr><td>03</td><td>04</td></tr></table>", tbody1); | |
function replaceTableRows(newTableHTML, targetTbody) { |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE configuration> | |
<project basedir="." default="all" name="sample"> | |
<property name="dest.dir" value="dest"/> | |
<property name="war.filename" value="${ant.project.name}.war"/> | |
<property name="src.war.file" value="${dest.dir}/${war.filename}"/> | |
<property name="dest.release.dir" value="${dest.dir}/release"/> | |
<property name="dest.unpack.dir" value="${dest.dir}/temp"/> | |
<target name="all" depends="clean,unpack,war1,war2"/> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE configuration> | |
<!-- 参考: Jenkinsではじめるビルド職人入門 --> | |
<!-- http://gihyo.jp/dp/ebook/2011/978-4-7741-4952-3 --> | |
<project basedir="." default="build" name="sample"> | |
<property name="tool.dir" value="tool"/> | |
<property name="cobertura.home" value="${tool.dir}/cobertura-1.9.4.1"/> | |
<property name="checkstyle.home" value="${tool.dir}/checkstyle-5.5"/> | |
<property name="findbugs.home" value="${tool.dir}/findbugs-1.3.9"/> | |
<property name="javancss.home" value="${tool.dir}/javancss-32.53"/> |