DB 설계를 해야 할 필요가 생겨 ERD 툴을 한번 찾아봄.

https://www.holistics.io/blog/top-5-free-database-diagram-design-tools/

https://dbdiagram.io/

 

DB 설계에 대한 다양한 이야기들

https://brunch.co.kr/@kooslab/181

https://brunch.co.kr/@skykamja24/265

다양한 시각은 뇌를 자극해 준다.

다양한 시각으로 내게 도움을 준 컨텐츠를 링크해 두는 것일 뿐 작성자의 의견에 동의 해서 링크를 거는 것은 아니다.

오히려 어떤 경우는 나의 의견과 반대되는 링크를 걸 수도 있다.

 

DAO, DTO, VO ..

https://jungwoon.github.io/common%20sense/2017/11/16/DAO-VO-DTO/

https://berrrrr.github.io/programming/2019/11/03/dao-vo-do-dto/

 

 

 

 

 

 

 

linux, CentOS 7

사무실이 이전에 테스트 서버 ip 가 바뀌어서 재 설정이 필요해 참고함

https://m.blog.naver.com/tequini/220977723865

https://www.cyberciti.biz/faq/howto-setting-rhel7-centos-7-static-ip-configuration/

 

[root@localhost ~]# nmcli d
DEVICE  TYPE      STATE          CONNECTION
ens33   ethernet  connected      ens33
lo      loopback  unmanaged      --

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33

 

1. DHCP setting

BOOTPROTO=dhcp
...
ONBOOT=yes

2. Static IP setting

BOOTPROTO="static"
...
ONBOOT="yes"
IPADDR=192.168.203.129
NETMASK=255.255.255.0
GATEWAY=192.168.203.254

 

 

MariaDB 자동 실행 설정 (CentOS 7)

systemctl enable mariadb.service

 

 

Json, RDB

DB에 Json을 저장할 때 어떻게 저장하는 것이 좋을까 ?.. 에 대한 사람들의 의견.

Rule 을 Json 형태의 파일로 다뤘었는데 DB에 Rule 을 저장하는 것에 대해 고려해볼 필요가 생겼음.

https://stackoverflow.com/questions/15367696/storing-json-in-database-vs-having-a-new-column-for-each-key

 

MySql 참고:

https://dev.mysql.com/doc/refman/5.7/en/json.html

 

Oracle 참고 : 

https://www.kdata.or.kr/info/info_04_view.html?field=&keyword=&type=techreport&page=19&dbnum=183534&mode=detail&type=techreport

 

 

Tools

https://dbdiagram.io/home

https://www.quickdatabasediagrams.com/

 

JQuery

문자열이 json 인지 확인하는 스크립트

https://stackoverflow.com/questions/38972207/how-to-check-if-a-json-string-is-valid-or-not-in-javascript-or-jquery

function isJson(str) {
  if( typeof( str ) !== 'string' ) { 
    return false;
  }
  try {
    JSON.parse(str);
    return true;
  } catch (e) {
    return false;
  }
}

 

#JSON

JSON을 보기 편하게 해주는 방법 (JAVA6 기반 JSP 에서 사용가능해야 함. Gson 가능)

https://coderwall.com/p/ab5qha/convert-json-string-to-pretty-print-java-gson

에서 알려준 방법 기준 테스트

public static String toPrettyFormat(String uglyJson) {
      JsonObject json = JsonParser.parseString(sData).getAsJsonObject();

      Gson gson = new GsonBuilder().setPrettyPrinting().create();
      String prettyJson = gson.toJson(json);

      return prettyJson;
}

Script를 통해 처리하는 방식으로 구현 하게 됨

function loadData(data) {
	$.ajax({
		type : 'POST',
		url : 'loadData.jsp',
		data : data,
		dataType : 'JSON'
	}).done(function(response) {
		// .....
		if (response.type == "JSON") {
			var prettyJson = JSON.stringify(response.data, undefined, 4);
			// console.log(pretty);
			$('textarea#req-data').val(prettyJson);
		} else {
			$('textarea#req-data').val(response.data);
		}
	})
}

JSON

minifier (online) 심플함.

https://www.webtoolkitonline.com/json-minifier.html

 

 

JAVA

AJAX POST 데이터 수신 방법에 대해 지식이 모호 했음

https://stackoverflow.com/questions/15063218/how-to-receive-data-sent-by-ajax-in-a-jsp-file

https://stackoverflow.com/questions/5046930/jquery-send-string-as-post-parameters

https://stackoverflow.com/questions/28046051/jquery-ajax-request-and-jsp-response

 

등을 참고해서 처리 함 (아직도 지식이 모호함. 만족스럽지 않음. 다시 볼것)

 

Java

다음과 같은 오류 발생 - Java 6 + tomcat 7 + thread 25 (=> 800 req / 1 thread) -> 20000 건 처리 시간 63초 

계속 실행하니 다음과 같은 오류가 발생.

INFO: I/O exception (java.net.BindException) caught when processing request to {}->http://127.0.0.1:9443: Address already in use: connect
Jun 3, 2020 10:16:01 AM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->http://127.0.0.1:9443
Jun 3, 2020 10:16:01 AM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->http://127.0.0.1:9443
Jun 3, 2020 10:16:01 AM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->http://127.0.0.1:9443
Jun 3, 2020 10:16:01 AM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.BindException) caught when processing request to {}->http://127.0.0.1:9443: Address already in use: connect
Jun 3, 2020 10:16:01 AM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.BindException) caught when processing request to {}->http://127.0.0.1:9443: Address already in use: connect
Jun 3, 2020 10:16:01 AM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->http://127.0.0.1:9443

다음의 글을 보고 해결함

boneman.tistory.com/entry/Jmeter-%EC%98%A4%EB%A5%98javanetBindException-Address-already-in-use-connect

 

어쨋든 이리저리 알아보다 시간날때 읽어볼 글도 하나 찾음

jojoldu.tistory.com/318

 

1. AWS Beanstalk을 이용한 성능 튜닝 시리즈 - DB Connection Pool

안녕하세요 이번 시간에는 AWS Beanstalk을 이용한 웹 어플리케이션 서버 성능 튜닝 시리즈를 시작합니다. 모든 코드는 Github에 있으니 참고하시면 됩니다. 신규 서비스를 출시할때마다 성능 테스트

jojoldu.tistory.com

 

# Java

시간을 기반으로 한 유니크한 문자열 만드는 방법
https://stackoverflow.com/questions/9191288/creating-a-unique-timestamp-in-java

    private static final AtomicLong LAST_TIME_MS = new AtomicLong();
    private static long uniqueCurrentTimeMS() {
        long now = System.currentTimeMillis();
        while (true) {
            long lastTime = LAST_TIME_MS.get();
            if (lastTime >= now)
                now = lastTime + 1;
            if (LAST_TIME_MS.compareAndSet(lastTime, now))
                return now;
        }
    }

 

소요시간 구하기

https://www.baeldung.com/java-measure-elapsed-time

long start = System.currentTimeMillis();

// ... code

long finish = System.currentTimeMillis();
long timeElapsed = finish - start;

 

# MySql

시간 차이 구하는 SQL

https://stackoverflow.com/questions/10907750/calculate-difference-between-two-datetimes-in-mysql

SELECT TIMESTAMPDIFF(SECOND, '2020-06-02 14:11:20', '2020-06-01 16:10:25')

 

 

+ Recent posts