Skip to content

Instantly share code, notes, and snippets.

View benelog's full-sized avatar

Sanghyuk Jung benelog

View GitHub Profile
@benelog
benelog / ConnectionMonitor.java
Last active September 3, 2021 19:18
Btrace scripts
import static com.sun.btrace.BTraceUtils.*;
import com.sun.btrace.BTraceUtils.Aggregations;
import com.sun.btrace.BTraceUtils.Sys;
import com.sun.btrace.aggregation.Aggregation;
import com.sun.btrace.aggregation.AggregationFunction;
import com.sun.btrace.annotations.BTrace;
import com.sun.btrace.annotations.Duration;
import com.sun.btrace.annotations.Kind;
import com.sun.btrace.annotations.Location;
import com.sun.btrace.annotations.OnEvent;
@benelog
benelog / gist:1335412
Created November 3, 2011 00:24
total block
total = 0
for i in range (1,11):
total += pow(i-1,2) + pow(i,2)
print total
/*
* @(#)NaverWebClient.java 1.0 2011. 7. 15
*/
package testsupport;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.Cookie;
@benelog
benelog / header.jsp
Created January 13, 2012 08:33
JSP tags
<%@ page contentType="text/html; charset=UTF-8" session="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
@benelog
benelog / fmt.jsp
Created January 13, 2012 08:35
Spring i18n
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<fmt:message key="main_hello">
<fmt:param>benelog</fmt:param>
</fmt:message>
@benelog
benelog / LogAspect.java
Created January 17, 2012 07:09
AspectJ expression Test with Spring 3.1
package edu.tdd.aop;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
@Aspect
public class LogAspect {
private LogRepository repository;
@benelog
benelog / RankFinder.java
Created February 29, 2012 06:21
RankFinder
package net.benelog.quiz;
import java.util.ArrayList;
import java.util.List;
public class RankFinder<T extends Comparable<T>> {
private List<T> topValues;
private int rankToFind;
@benelog
benelog / dateEdit.xml
Created April 18, 2012 02:00
Spring value parsing
<bean id="dateEditor" class="org.springframework.beans.propertyeditors.CustomDateEditor">
<constructor-arg>
<bean class="java.text.SimpleDateFormat">
<constructor-arg value="yyyy/MM/dd HH:mm:ss" />
</bean>
</constructor-arg>
<constructor-arg value="true" />
</bean>
@benelog
benelog / one-ftpserver.md
Created May 16, 2012 16:34
one-ftpserver 설명

배경

서버 작업을 하다보면, PC에 있는 파일을 서버에 올리거나, 서버에 있는 로그파일을 PC로 받고 싶을 때가 있습니다. 그런 용도로 저는 다운로드를 할 때는 Winstone을, 업로드를 할 때는 간단한 웹애플리케이션인 만든 Uploader 를 사용합니다.

제 블로그의 아래 포스트를 통해서 그 방법을 설명했었습니다.

또는 파이썬이 설치되어 있아면 'python -m SimpleHTTPServer'를 실행하면 간단한 웹서버를 띄울 수도 있습니다.

@Test
public void batchUpdateTest(){
SqlParameterSource[] source = new SqlParameterSource[]{new MapSqlParameterSource("id", 1), new MapSqlParameterSource("id", 2),new MapSqlParameterSource("id", 3)};
int[] updated = simpleJdbcTemplate.batchUpdate("update perform set id=:id where id = :id", source);
System.out.println(Arrays.toString(updated));
}