2012년 5월 7일 월요일

spring security SecurityContextHolder.getContext().getAuthentication()



VelostepUser user = (VelostepUser)SecurityContextHolder.getContext().getAuthentication().getPrincipal();

java.util.Collection<GrantedAuthority> auth = (java.util.Collection<GrantedAuthority>)SecurityContextHolder.getContext().getAuthentication().getAuthorities();

2012년 4월 18일 수요일

2012년 4월 15일 일요일

MySql 생성 및 갱신시에 자동 갱신 타이스탬프컬럼 만들기

http://www.kbedell.com/2009/03/07/how-to-create-a-timestampdatetime-column-in-mysql-to-automatically-be-set-with-the-current-time/


e.g.) 
ALTER TABLE sms_regular_msg_default MODIFY mod_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일'

2012년 3월 13일 화요일

JQuery Validate add Method


jQuery.validator.addMethod(
“notEqualTo”,
function (value, element, param) {
return this.optional(element) || value != param.val();
},
“Please specify a different value”
);
and:
…
rules: {
oneCity: {
notEqualTo: $(‘#anotherCityId)’)
},
anotherCity: {
notEqualTo: $(‘#oneCityId’)
}
},

2012년 2월 21일 화요일

Target runtime GlassFish 3.1.1 is not defined.


Don't show the error message beneath on Eclipse Problems Pane.

Target runtime GlassFish 3.1.1 is not defined.

Project > Properties > Project Facets > Runtimes > uncheck

2012년 2월 19일 일요일

Kill Tomcat process at port 8080


Kill Tomcat process at port 8080

Occasionally the Tomcat server doesn't shutdown in a clean way when using Eclipse. What happens is that port 8080 stays in use and the server can't restart. Exiting Eclipse is not sufficient in this case and a restart of Mac OSX is needed.

So, how to kill the running Tomcat and free port 8080.
Open the terminal window and execute the following commands.

  • sudo lsof -w -n -i tcp:8080
This will give you the pidnumber of the process that runs at 8080. You can then go ahead and kill it.


  • sudo kill -9 pidnumber

2012년 2월 17일 금요일

Eclipse “Errors occurred during the build. Errors running builder ‘JavaScript Validator’ on project ‘some-project’. java.lang.NullPointerException”


“Errors occurred during the build.
Errors running builder ‘JavaScript Validator’ on project ‘some-project’.
java.lang.NullPointerException”
At a first sight it seems that a Javascript validator is throwing a NullPointerException, so probably you will try to disable ‘Client-side Javascript’ validation from Project->Properties->Validation… but I tell you that the problem is not there, you must go to Project->Properties->Builders then disable ‘Javascript Validator’.
Problem solved. Indeed is not a real problem, but the message is a bit annoying because it happens in every build so….