Restful에서 HttpServletRequest, Get HttpServletResponse 파라미터로 가져오기

*** 사용법 ***
Context 어노테이션을 사용하여 가져온다.
@Context HttpServletRequest httpServletRequest;
@Context HttpServletResponse httpServletResponse;

*** 예제 ***
@Path("/login")
@POST
List<String> login(@Context HttpServletRequest httpServletRequest
                         , @Context HttpServletResponse httpServletResponse);

JQuery checkbox 사용법

*** 체크여부 조회 ***
var checkYn = $('#input_checkbox').is(':checked');

*** 체크 하기 ***
$('#input_checkbox').attr('checked', true);

*** 언체크 하기 ***
$('#input_checkbox').attr('checked', false);

HTML5 localStorage

*** 사용시 주의사항 ***
key, value 는 string 형식으로 저장.
데이터는 직접  삭제하기 전까지 영구적으로 보관


*** 데이터 저장 *** 
localStorage[key] = value;
localStorage.setItem(key, value);

*** 데이터 조회 ***
var value = localStorage[key];
var value = localStorage.getItem(key);

*** 데이터 삭제 ***
localStorage.removeItem(key);

*** 초기화 ***
localStorage.clear();

*** 저장된 키 갯수 ***
var length = localStorage.length;

*** value로 key 찾기 ***
var key = localStorage.key(value);

JQuery 객체 존재 여부 확인

*** 확인 방법 ***
$('#element').length 의 값이 0이면 존재하지 않고 0보다 크면 존재.

*** 예제 ***
if ($('#element').length)
{
    // 객체 존재하지 않는 경우 처리
}
else
{
   // 객체 존재하는 경우 처리
}

if ($('#element').length > 0)
{
   // 객체 존재하는 경우 처리
}

sessionStroge array 저장 및 불러오기

*** 저장 ***
var data = '{"name": "cars","count": 30}';

sessionStorage.setItem('data', JSON.stringify(data));

*** 불러오기 ***
var data = JSON.parse(sessionStorage.getItem('data'));

console.log(data.name);
=> cars

JavaScript - JSON 사용

*** 자바스크립트 ***
var json_string = '{"name": "cars","count": 30,"type": {"type1": "one","type2": "two"},"array": [{"month": "JAN","day": "31"},{"month": "NOV","day": "30"}]}';


var json = JSON.parse(json_string);
       
console.log(json["name"]);
=> cars

console.log(json.name);
=> cars

console.log(json.type.type1);
=> one

console.log(json["type"].type2);
=> two
       
console.log(json.array[0].month);
=> JAN

console.log(json.array[1].day);
=> 30
       
console.log(json.array.number);
=> undefined

JavaScript - URL 정보 조회하기

*** 현재 URL ***
http://localhost:8008/html/test.html?param=value

*** 자바스크립트 ***
console.log(location.href);           // => http://localhost:8008/html/test.html?param=value
console.log(location.protocol);    // => http:
console.log(location.host);          // => localhost:8080
console.log(location.pathname);  // => /html/test.html
console.log(location.search);      // => ?param=value


JQeury class 제어

*** class 추가 ***
$(this).addClass('class name');

*** class 변경 ***
$(this).attr('class', 'class name');

*** class 삭제 ***
$(this).removeClass('class name');

HTML5 sessionStorage 사용법

*** 데이터 저장 *** 
sessionStorage.key = value;
sessionStorage.setItem(key, value);

*** 데이터 조회 ***
var value = sessionStorage.getItem(key);
var value = sessionStorage.key;

*** 데이터 삭제 ***
sessionStorage.removeItem(key);

*** 초기화 ***
sessionStorage.clear();

JQuery trim 하기

*** 사용법 ***
$.trim($('#input').val());

JQuery Select 사용법

 *** 태그 ***
<select name="select_example" id="select_example">
    <option value="A">1</option>
    <option value="B" selected="selected">2</option>
    <option value="C">3</option>
</select>

*** 아이템 전체 삭제 ***
$('#select_example').empty();

*** 아이템 추가 ***
$('#select_example').append('<option value="A">1</option>');

*** 아이템 삭제 ***
$('#select_example option:first').remove();     // 첫번째 아이템 삭제
$('#select_example option:last').remove();     // 마지막 아이템 삭제
$("#select_language option:eq(0)").remove();  // 0번째 아이템 삭제

***값(value)으로 선택하기 ***
$('#select_example').val(fgLang);

*** 선택된 값(value) ***
$('#select_example option:selected').val();
$('select[name=select_example]').val();

*** 선택된 텍스트 ***
$('#select_example option:selected').text();

*** 선택된 인덱스 ***
$('#select_language option').index($('#select_language option:selected'));

*** 아이템 갯수 ***
$('#select_example option').size();

검색 엔진 피하는 meta 태그 설정

*** robots 메타 태그 ***
검색엔진 웹크롤러의 정보 수집 허용 여부를 문서별로 설정.
content가 index 이면 해당 문서 정보 수집, noindex 이면 정보 수집 X.
content가 follow 이면 문서에 링크된 문서 정보 수집, nofollow 이면 정보 수집 X.

*** 사용예 ***
<meta name="robots" content="index,follow" />
=> 해당 문서 및 링크된 문서 정보 수집

<meta name="robots" content="noindex,follow" />
=> 해당 문서는 수집하지 않고, 링크된 문서 정보 수집

<meta name="robots" content="index,nofollow" />
=> 해당 문서 정보 수집, 링크된 문서는 정보 수집하지 않음.


<meta name="robots" content="noindex,nofollow" />
=> 해당 문서 및 링크된 문서 정보 수집하지 않음.


HTML Page Redirect

*** 사용법 ***
헤드 태그 사이에 다음과 같이 Tag 추가.
<meta http-equiv="refresh" content="0; url=http://www.newpage.com/index.html" />

content  : 페이지 로딩 후 몇 초 후에 이동할 것인지 설정.
url          : 이동할 페이지 주소.

스프링 프레임워크 HikariCP Oracle 설정 Sample

*** xml configuration ***
<bean id="pcmsHikariConfig" class="com.zaxxer.hikari.HikariConfig">
  <property name="poolName"                    value="poolname" />
  <property name="connectionTestQuery"   value="SELECT 1 FROM DUAL" />
  <property name="dataSourceClassName" value="oracle.jdbc.pool.OracleDataSource" />
  <property name="maximumPoolSize"        value="10" />
  <property name="idleTimeout"                  value="600000" />
  <property name="dataSourceProperties">
        <props>
            <prop key="url">jdbc:oracle:thin:@localhost:1521:ORCL</prop>
            <prop key="user">admin</prop>
            <prop key="password">adminpw</prop>
        </props>
  </property>
</bean>

Android - 개발자 옵션 활성화

설정 -> 휴대폰 정보 -> 소프트웨어 정보 -> 빌드 번호를 계속 터치하면

'개발자가 되셨습니다'라는 토스트 메시지가 표시됨.

이후 설정 메뉴로 들어가면 개발자 옵션 항목이 보임.