2010년 10월 13일 수요일

[안드로이드] EditText 엔터키 입력시 포커스 이동

EditeText 속성에 아래와 같이 추가 하면

엔터키 입력시 @+id/next 로 이동

android:nextFocusDown="@+id/next"

2010년 4월 23일 금요일

[javascript] indexof, substring, charAt

indexof

var str = "abcdefg";
var index =  str.indexof("c");

index = 2

해당 문자열이 없으면  -1을 반환


substring

var str = "abcdefg";
var index = str.substring(2,4);

index => cd

2부터 4 이전까지


charAt


var str = "abcde";
var index = str.charAt(1);

index => b

1번째 위치한 문자열 한개 반환


출처 : http://ifone420.tistory.com/65

2010년 4월 13일 화요일

[spring] FormController에서 Validation 에러 처리

FormController에서 Validation을 하는 경우 에러 처리 하는 경우 onSubmit 메서드안에서 파라미터로 넘어오는 BindException 객체를 사용해서 간단하게 처리할 수 있다.
onSubmit {

errors.reject("ID_REQUIRED, "아이디가 필요합니다.");
errors.rejectValue("id", "ID_REQUIRED, "아이디가 필요합니다.");
return showForm(request, response, errors);

}



출처 : http://evilimp.tistory.com/397

2010년 2월 22일 월요일

[서버] apache2 설정 관련 모음

특정 파일 로그 남기지 않기


<IfModule log_config_module>
    SetEnvIf Request_URI \.gif notLogging
    SetEnvIf Request_URI \.jpg notLogging
    SetEnvIf Request_URI \.png notLogging
    SetEnvIf Request_URI \.bmp notLogging
    SetEnvIf Request_URI \.swf notLogging

    CustomLog logs/access_log combined env=!notLogging
</IfModule>

2010년 2월 5일 금요일

[javascript] replace

replace


String.replace(orgExp, replaceText)
var text = "a1234";

일반
text.replace("a", "XXX");   -> "XXX1234"

정규식
text.replace(/a/g, "XXX"); -> "XXX1234"

g : 전역 검색
i : 대소문자구분 X