728x90
반응형

R 설치


작성일자 : 2019년 01월 07일

환경 : Win7, R 3.5.2


1. R이란?


R 프로그래밍 언어(줄여서 R)는 통계 계산[2]과 그래픽을 위한 프로그래밍 언어이자 소프트웨어 환경 - 위키백과



2. R 설치


2.1 http://healthstat.snu.ac.kr/CRAN/ 접속

2.2 Download R for Windows > base > Download R 3.5.2 for Windows 순서로 설치파일 다운로드 후 설치



3. Hello World


R x64 3.5.2 실행


728x90
반응형

'도구, 툴' 카테고리의 다른 글

[ELK] Elasticsearch  (0) 2019.01.24
[ELK] ELK 개요  (0) 2019.01.23
SVN 권한 설정  (1) 2018.02.10
Eclipse/SVN 연동  (0) 2018.02.10
[Linux, Tomcat7] WAS 개념, 설치  (0) 2018.02.09
728x90
반응형

[ajax] Error code 0, error undefined


작성일자 : 2018년 11월 18일



1. 현상


HTML form 내에서 ajax를 사용하는 Javascript 함수 호출 시 간헐적 에러 발생


예시


HTML

<form onsubmit='JavaScript:example(data)> 

// submit 시 example 함수 실행 --------------------(2)


<!-- Logic -->


<button type="submit" value="submit"></button>

//button Click 시 form에 submit 전달 --------------------(1) 


</form>



Javascript

function example(data){


        // 아래 오류 발생 ajax 수행 ---------------(3)

$.ajax({

method : "GET",

url : "url",

data : {data: data},

success: function(){

//Logic

},

                // 에러 발생 후 아래 함수 실행 -----------(4)

error: function(request, status, error){ 


alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);  

                        // 실행 결과 code 0, undefined Error 발생 문구 alert --------------- (5)


}

});



alert 내용

code : 0

message :       

error : undefined




2. 원인


 AJAX 응답을 받기 전에 브라우저 새로 고침이 트리거 된 경우 발생


즉 Submit에 의해 form의 (action 미 설정 시 현재위치 새로고침) action과, ajax 호출 함수인 example이 트리거 되고,

example 함수에 의한 ajax 수행 중 ajax 결과를 받기 전에 action에 의해 새로고침이 트리거 될 때 발생


응답 속도에 따라 동일한 Flow가 success가 될 수도, Fail이 될 수도 있는 상황




3. 해결방안


form에 의한 action을 없애고, ajxa 결과 반환 후 action을 수행하도록 설정


수정 후 예시


HTML

<form onsubmit='JavaScript:example(data, event)>  // event 인자 추가

// submit 시 example 함수 실행 --------------------(2)


<!-- Logic -->


<button type="submit" value="submit"></button>

//button Click 시 form에 submit 전달 --------------------(1) 


</form>



Javascript

function example(data, event){

        event.preventDefault(); // event 중단 함수


        // 아래 오류 발생 ajax 수행 ---------------(3)

$.ajax({

method : "GET",

url : "url",

data : {data: data},

success: function(){

// Logic

                        // Ajax 응답 후 수행 할 Action 추가

},

                // 에러 발생 후 아래 함수 실행 -----------(4)

error: function(request, status, error){ 


alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);  

                        // 실행 결과 code 0, undefined Error 발생 문구 alert --------------- (5)


}

});





4. 참고


https://stackoverflow.com/questions/2000609/jquery-ajax-status-code-0

728x90
반응형
728x90
반응형

[postgreSQL] FATAL:  pg_hba.conf rejects connection for host ‘IP’

 

작성일자 : 2018 0927

환경 : PostgreSQL 9.2.14, AWS Linux

 


1. 현상 :


사용하던 데이터베이스의 접속이 거부 된다는 로그 확인


FATAL:  pg_hba.conf rejects connection for host "127.0.0.1", user "postgres", database "postgres"

 



- 설정 확인

PGDATA/data/ > vi pg_hba.conf



 

추가한 적 없는 옵션이 상단에 추가된 것을 확인


host all postgres 0.0.0.0/0 reject

host all pgdbadm 0.0.0.0/0 md5

# 기본계정인 postgres 계정으로 접속을 제한하고 pgdbadm 계정으로 접속 허용


pgdbadm 계정은 최근 crypto-mining 공격 계정으로 알려져 있다.

 

 


2. 해결 방안 :



추가 된 옵션을 주석 처리 후 PostgreSQL 재시작

 



3. 권고 사항 :



서비스 시 기본 계정인 postgres 계정 외 계정 사용


pg_hba.conf 파일 수정 제한

 



4. 참조


https://dba.stackexchange.com/questions/215294/why-does-pg-hba-conf-sometimes-have-random-rules-added-to-it-postgresql?rq=1


728x90
반응형

+ Recent posts