dump 복구

 

 

psql -U user -d db < dump.sql

 

 

해당 db에 dump 파일이 복구 된다.

 

$(element).bind('keypress', function(e) {
    e.preventDefault();
}) 

 

e.preventDefault(); 디폴드 Submit 을 막는다.

 

 

no-cache 옵션을 주어 항상 서버에서 최신 데이터를 받도록 유지 한다.

 

<meta http-equiv="Expires" content="0"/> 
<meta http-equiv="Pragma" content="no-cache"/>

'Html' 카테고리의 다른 글

HTML Input File 크기 체크 하기  (0) 2014.11.04
HTML Form Submit 시 Checkbox 클릭 안된 경우 값 전달 방법  (0) 2014.10.15
HTML Input 자동완성 막기  (0) 2013.04.01
Form 태그 기본 Submit 막기  (0) 2013.02.28
HTML DOCTYPE 이란  (0) 2012.12.08


jQuery Selector를 이용하여 대상을 걸고, Enter Code로 처리 하면 된다.


Example



// enter event
$('input').keyup(function(e) {
    if (e.keyCode == 13) action();       
});



위의 예제는 모든 input 태그에 관한 Event 이다.



Nodejs에서 Query를 이용 할 경우 Java에서 JDBC를 이용한 것이 JavaScript 라고 생각 하면 된다.


JDBC



// STEP1: Query 작성
PreparedStatement preparedStatement = connection.prepareStatement("select * from tb_test where test_no = ? and test_title = ? and test_content = ?");
   
// STEP2: 조건 처리
preparedStatement.setInt(1, 2);

preparedStatement.setString(2, "title");

preparedStatement.setString(3, "content");



Nodejs



client.query('select * from tb_test where test_no = $1 and test_title = $2 and test_content = $3',

[2, 'title', 'content'],

function(error, result) {

// result...

})



위와 같은 모습은 기본 형태라고 볼 수 있다.


Java는 set 하는 순간에 type을 다 정해주기 때문에 고민 할 필요가 없지만 javascript는 동적으로 타입이 변하기 때문에 문제가 발생 한다.

IN 절을 썼을 때 ',' 과 숫자가 결합이 되는 형태가 되면 문자열로 인식 하게 되어 Error가 발생 할 수 있다.


해결 방법



var nos = '1, 2, 3, 4, 5';


client.query('select * from tb_test where test_no in (' + nos + ') and test_title = $1 and test_content = $2',

['title', 'content'],

function(error, result) {

// result...

})



위와 같이 문자열로 직접 결합 해주어야 해결 할 수 있다.


'Nodejs' 카테고리의 다른 글

node-gyp rebuild 시 command not found 해결 방법  (0) 2013.04.26
file system library mkdirp  (0) 2013.03.29
Debian Linux에서 Eclipse, Nodejs 연동하기  (0) 2013.02.16
Nodejs is that ?  (0) 2013.02.10
Nodejs 설치 하기  (0) 2013.02.10


Date의 처리가 까다로운 관계로 개선을 위해서 opensource library인 sugar.js 를 활용 하였다.


※ 공식 사이트: http://sugarjs.com/



공식 사이트 일부 화면이다. Download 한다. 아래와 같이 js 파일을 추가 해 준다.



<script type="text/javascript" src="/javascripts/sugar/sugar-1.3.9.min.js"></script>



Date와 String의 간단한 변환을 위해서 작성 하였다.


추가 소스

whitelife.js



// whitelife.js
// sugar.js is used

Date.prototype.toShortString = function() {
    return this.format('{yyyy}-{MM}-{dd}');
}

Date.prototype.toLongString = function() {
    return this.format('{yyyy}-{MM}-{dd} {hh}:{mm}:{ss}');
}

Date.prototype.beforeDate = function(regex) {
    return this.rewind(regex);
}

Date.prototype.afterDate = function(regex) {
    return this.advance(regex);
}

String.prototype.toDate = function() {
    return Date.create(this);
}

String.prototype.isBeforeDate = function(endDate) {
    return this.toDate().isBefore(endDate.toDate());
}

String.prototype.isAfterDate = function(endDate) {
    return this.toDate().isAfter(endDate.toDate());
}



사용 예제

sugar.js 의 Date 라이브러리 와 추가된 함수들의 조합 이다.



var startDate = Date.create('today').beforeDate('5 day').toShortString();

var endDate = Date.create('today').afterDate('5 day').toShortString();
           
console.log(Date.create('today').toShortString());
console.log(Date.create('today').toLongString());
console.log(Date.create('today').beforeDate('5 day').toLongString());
console.log(Date.create('today').afterDate('5 day').toLongString());
           
console.log(startDate.isBeforeDate(endDate)); // 시작 날짜가 마지막 날짜 보다 [이전: true, 이후: false]
console.log(startDate.isAfterDate(endDate)); // 시작 날짜가 마지막 날짜 보다 [이전: false, 이후: true]
           
console.log(startDate.toDate());
console.log(endDate.toDate());



결과



2013-02-18

2013-02-18 12:00:00

2013-02-13 12:00:00

2013-02-23 12:00:00

true

false

Date {Wed Feb 13 2013 00:00:00 GMT+0900 (KST)}

Date {Wed Feb 23 2013 00:00:00 GMT+0900 (KST)}



조금 더 수월하게 작업을 할 수 있다.



사용법: jar {ctxui}[vfm0Me] [jar 파일] [manifest 파일] [시작 지점] [-C 디렉토리] 파일 ...
옵션:
    -c  새 아카이브 만들기
    -t  아카이브에 대한 내용 목록 테이블
    -x  명명된(또는 모든) 파일을 아카이브에서 추출
    -u  기존 아카이브 업데이트
    -v  표준 출력에 세부 정보 표시 출력 생성
    -f  아카이브 파일 이름 지정
    -m  지정한 매니페스트 파일로부터 매니페스트 정보 포함
    -e  jar 실행 파일에 번들로 제공된 독립 실행형 응용 프로그램의
        응용 프로그램 시작 지점 지정
    -0  저장 전용, ZIP 압축 사용 안 함
    -M  항목에 대해 매니페스트 파일을 만들지 않음
    -i  지정한 jar 파일에 대한 색인 정보 생성
    -C  지정한 디렉토리로 변경하고 다음 파일 포함
어떤 파일이 디렉토리면 재귀적으로 처리됩니다.
매니페스트 파일 이름, 아카이브 파일 이름 및 시작 지점 이름은
'm', 'f' 및 'e' 플래그와 동일한 순서로 지정됩니다.

예 1: classes.jar라는 아카이브에 두 클래스 파일을 아카이브하는 방법:
       jar cvf classes.jar Foo.class Bar.class
예 2: 기존의 매니페스트 파일 'mymanifest'를 사용하여
           foo/ 디렉토리의 모든 파일을 'classes.jar'로 아카이브하는 방법:
       jar cvfm classes.jar mymanifest -C foo/ .



whitelife@whitelife-server ~/was $ jar cf whitelife.war *


위와 같이 실행 하면 해당 경로에 있는 파일이 war로 생성 된다.


'Server,Was' 카테고리의 다른 글

Nginx Ubuntu에서 설치하기  (0) 2013.04.23
Nginx OSX에서 설치하기  (0) 2013.04.23
Tomcat7 Web Application Deploy 하기  (0) 2013.02.01
Apache Friends XAMPP 설치 하기  (0) 2013.01.30
jBoss7 Path 설정 하기  (0) 2013.01.30


CSS가 중첩 되어 적용 되는 경우가 있다. 흔히 이런 경우 간단한 옵션을 주더라도 적용이 되지 않는다.



Debug을 하면 위와 같은 모습을 확인 할 수 있다.



width: 100% !important;



!important; 옵션을 적용 하면 우선 순위 대상이 된다.


'Css' 카테고리의 다른 글

CSS 로 Div 영역에 Text 맞추는 방법  (0) 2014.10.30
IE7 CSS 속성 적용에 대해서  (0) 2013.04.21
CSS 선택자의 이용  (0) 2012.12.10
그러데이션 효과 관련 사이트  (0) 2012.12.06

+ Recent posts