전체 글
-
전략 패턴이란?Java 2022. 5. 25. 19:43
다음 글은 아래의 영상을 기반으로 제작되었습니다. https://www.youtube.com/watch?v=vNsZXC3VgUA 전략 패턴이란? 전략이란 특정한 목표를 수행하기 위한 행동 계획입니다. 디자인 패턴 중 하나로써 객체가 할 수 있는 행위를 각각의 전략으로 만들어 놓고 사용하며 동적으로 전략 수정이 가능한 패턴입니다. 디자인 패턴이란? 소프트웨어 디자인을 하는 데 있어 공통적으로 마주치는 문제의 해결하는 방법이 하나의 패턴처럼 굳어진 것을 말합니다. 전략 패턴의 예시 예를 들어 배민 로봇 전략 예시가 있습니다. 이동 전략에는 "걸어서, 뛰어서, 날아서, 로켓으로" 가 있다고 가정하겠습니다. 온도 전략에는 "차갑게 따뜻하게 냉동으로 뜨겁게" 가 있다고 가정하겠습니다. 동일 계열의 알고리즘 군을 ..
-
뉴스 정보를 가져와 보자(크롤링, 네이버 뉴스 API 사용법)프로젝트/게시판 프로젝트 2022. 5. 25. 14:18
크롤링이란? Crwaling 사전적으로는 포복, 기다 라는 의미를 가지고 있으며 전산 쪽에서는 Web상을 돌아다니면서 정보를 수집하는 행위를 뜻합니다. 웹 크롤링, 스파이더링, 스크래핑, 데이터 긁기 등 다양한 단어로 불리기도 합니다. 크롤링 대상 크롤링의 대상은 Web상의 자원들입니다. 이 자원은 정적인 문서가 될 수 있고, API와 같은 서비스가 될 수 있습니다. 어느 쪽이던 다수의 데이터를 수집하고 여기서 필요한 정보만 추출하게 됩니다. 현재 진행하는 프로젝트에서는 어떤 키워드에 대한 네이버 뉴스데이터를 수집해보려고 합니다. 크롤링하기 전 주의 사항 개인정보가 들어있는 사이트들은 크롤링이 안 되도록 막고 싶을 수 있습니다. 무분별한 크롤링을 막고 제어하기 위해 1994년 6월 로봇 배제 규약이 만들..
-
[백준] 2610번 : 회의준비 - 자바(JAVA)알고리즘/백준 2022. 5. 25. 00:01
https://www.acmicpc.net/problem/2610 2610번: 회의준비 첫째 중에 회의에 참석하는 사람의 수 N이 주어진다. 참석자들은 1부터 N까지의 자연수로 표현되며 회의에 참석하는 인원은 100 이하이다. 둘째 줄에는 서로 알고 있는 관계의 수 M이 주어진다. 이 www.acmicpc.net 문제 해석 위원회를 구성하려고 하는데 위원회를 구성하는 방식은 다음과 같습니다 1. 서로 알고 있는 사람은 반드시 같은 위원회에 속해야 합니다. 2. 효율적인 회의 진행을 위해 위원회의 수는 최대가 되어야 합니다. 이후에 각 위원회의 대표를 한 명씩 뽑아 대표만이 회의 시간 중 발언권을 가질 수 있습니다. 회의 참석자들은 자신의 의견을 말하기 위해서는 자신이 속한 위원회의 대표에게 의견을 전달해..
-
MySQL 테이블 생성CS/데이터베이스 2022. 5. 24. 11:26
1. 데이터베이스 먼저 만들기 CREATE DATABASE 'DB이름'; /*생성*/ DROP DATABASE 'DB이름'; /*삭제*/ USE 'DB이름'; /*사용*/ 2. 테이블 만들기 CREATE TABLE [테이블명] ( [컬럼명] [데이터타입] (NOT NULL / DEFAULT NULL), [컬럼명] [데이터타입] (NOT NULL / DEFAULT NULL), PRIMARY KEY([기본키로 지정할 컬럼명]), FOREIGN KEY ([외래키로 지정할 컬럼명]) REFERENCES [참조테이블명] ([참조테이블의 컬럼명]) ) ENGINE=[엔진명] DEFAULT CHARSET=[인코딩] create table boardcomment( boardcommentno int primary key..
-
MySQL foreign key 조회 및 삭제 갱신CS/데이터베이스 2022. 5. 24. 10:57
foreign key를 갱신하기 위해 조회 삭제를 하고 갱신하는 법을 기록해두고자 합니다. 특정 테이블에 생성되어 있는 foreign key 조회 방법 select * from information_schema.table_constraints where table_name = 'TABLE NAME'; select * from information_schema.table_constraints where table_name = 'board'; 특정 데이터베이스에 생성되어 있는 foreign key 조회 방법 select * from information_schema.table_constraints where constraint_schema = 'DATABASE NAME'; Foreign key에 제약사항 추..
-
JWT란? JWT 원리, 사용법프로젝트/게시판 프로젝트 2022. 5. 24. 10:43
JWT란? JWT란 Json Web Token의 약자로써 Json 포맷을 이용하여 사용자에 대한 속성을 저장하는 Claim 기반의 Web Token입니다. Claim이란 사용자 정보나 데이터 속성 등을 의미합니다. 즉, Claim 토큰이라 하면 토큰 안에 정보를 담고 있는 토큰을 의미합니다. 주로 회원 인증이나 정보 전달에 사용되는 됩니다. 일반 토큰 vs Claim 토큰의 차이점 일반 토큰 과거에 많이 사용하던 방식으로 주로 의미가 없는 문자열(Random String) 기반으로 구성되어 있으면 아래와 같이 표현됩니다. a9ace025c90c0da2161075da6ddd3492a2fca776 단순한 문자열이기 때문에 정보를 담거나 할 수 없습니다. Claim 토큰 사용자의 정보를 담고 있는 토큰을 의미..
-
Optional을 올바르게 활용해보기프로젝트/게시판 프로젝트 2022. 5. 24. 09:31
Optional이란? 간단하게 말하자면 값이 null일 수도 아닐 수도 있는 객체입니다. 즉, null이 될 수도 있는 객체를 포장해주는 Wrapper Class입니다. 여기까지만 읽었을 때 이해가 되지 않는다면 다음 글을 읽고 오면 좋습니다. https://junuuu.tistory.com/90 { result = member.getPassword().equals(memberLoginRequestDTO.getPassword()); }); return result; } ifPresent 메서드를 활용하여 userId가 존재한다면 패스워드 검증을 통해 true, false를 result에 기록하도록 하였습니다. 또한 내부의 result값을 전달하기 위해서 전역 변수인 result를 선언하였습니다. 하지만 ..
-
@Bean vs @ComponentSpring Framework 2022. 5. 24. 01:55
@Bean과 @Component를 언제 사용해야 할지 명확하게 대답할 수 없었기 때문에 이를 공부하고자 했습니다. @Bean과 @Component란? Ioc Container는 @Configuration, @Bean, @Component, @Repository, @Service, @Controller가 달린 클래스를 감지하여 빈을 가져오기 옵니다. 이때 대표적으로 빈을 등록하는 어노테이션이 바로 @Bean과 @Component입니다. (실제로 @Repository, @Service, @Controller 내부에는 @Component가 정의되어 있습니다.) @Bean이란? 단일 bean을 명시적으로 선언하는 데 사용됩니다. 클래스 정의에서 빈 선언을 분리하고 선택한 방식대로 빈을 만들고 구성할 수 있습니다..