분류 전체보기
-
호스트 빌드에서 도커의 멀티 스테이지 빌드까지인프라/도커 2024. 1. 3. 01:22
도커에 익숙해지기 위한 몇 가지 실습들을 진행해보았습니다. 아래 순서로 글을 진행해보겠습니다. 1. 로컬에서 스프링 프로젝트 빌드해서 실행하기 2. 로컬에서 빌드한 파일을 컨테이너에서 실행시키기 3. 컨테이너에서 빌드 후 실행시키기 4. 멀티스테이지 빌드 후 실행시키기 1. 로컬에서 빌드해서 실행하기 개발환경에서 가장 기초적으로 사용하는 세팅입니다. localhost에서 서버를 띄우는 세팅입니다. 스프링 cli를 이용해서 프로젝트를 생성하고 8080에 접속했을 때 'Hello World'가 보이도록 index.html을 추가합니다. $ spring init --dependencies=web myserver 빌드명령어를 실행해서 jar파일을 생성합니다. $ ./gradlew build 빌드된 파일을 실행시..
-
손으로 적으면 보이는 것들OFF THE RECORD/회고 2023. 12. 30. 17:19
A회사에 지원한 서류가 통과되어서 코딩테스트를 볼 기회가 주어졌습니다. 가벼운 마음으로 보았고 그런대로 면접은 가지 않을까 했는데 다음 날 바로 탈락ㅎㅎ 문제를 풀면서 확신이 없었던 부분들을 확인차 정리를 해봅니다. 완전히 동일한 문제를 올리면 이슈가 있을 수도 있어서 조금 각색해서 올려보았습니다. 문제1. 별찍기 자바를 사용해서 콘솔에 아래와 같은 내용이 찍히도록 하세요. * ** *** **** *** ** * (반복) 시험 제출 버전 (아마 이런 느낌으로 적었던 것 같다) public class LogStarts { public static void main(String[] args) { int count = 0; boolean shouldWorking = true; while (shouldWork..
-
BST - Binary Search TreeCS/자료구조 2023. 12. 29. 01:09
요즘 프로그래밍을 공부하는 사람들을 만나면, 다들 '자료구조 = 코딩테스트 준비' 라는 생각을 하고 있는 것 같습니다. 저는 수학에 사칙연산이 기본이라면, 코드를 작성할 때는 자료구조가 그 역할을 한다고 생각하는데요. 이번에는 다양한 트리 중에 이진 검색 트리를 살펴보겠습니다. 1. BST 란? Binary Search Tree라는 이름에서 알 수 있듯이, BST는 일종의 Binary Tree 입니다. (부모가 2개 이하의 자식을 갖는 트리) 그리고 Binary Tree 중에 특정 조건을 만족하는 경우에 검색에 이점이 생기기 때문에, 이들을 따로 BST로 분류를 합니다. 2. 성립조건 성립 조건은 생각보다 간단합니다. '부모를 기준으로 부모 보다 작은 값은 왼편에, 부모 보다 큰 값은 오른편에 위치한다...
-
명령형 프로그래밍과 선언형 프로그래밍OFF THE RECORD/생각 2023. 12. 26. 00:28
프로그래밍을 하다보면 패러다임에 대한 이야기를 자주 접하게 된다. 어제 React의 Suspense 적용과 Java의 stream을 공부하면서 선언형 프로그래밍을 자꾸 마주치게 되어 적어본다. 나는 '명령형', '선언형'을 따지기 보다는 추상화 단계가 올라갈수록 자연스럽게 선언형의 방향으로 나아가는 것이 아닌가? 라는 생각을 한다. 추상화를 진행하면서 '어떻게-How'를 감추고 '무엇-What'을 보여주게 되기 때문에, 우리가 사용하는 framework나 api들은 선언형의 방향으로 나아가나는 것이라고 생각한다. 추상화 레벨을 높일수록 복잡도도 증가하고, 입맛에 맞는 내부로직 수정이 어렵기 때문에, 적당한 레벨에서 코드를 작성하는게 중요하다고 생각이 든다. 하지만 난 높은 추상화를 추구하는 편인듯.. 명..
-
nginx - fcgiCS/웹 2023. 12. 26. 00:20
서블리을 사용하기 전에 사용했던 cgi 형태의 통신은 어떻게 작동했는지 확인해보는 글 입니다. cgi보다 개선된 fcgi를 사용하였습니다. nginx 설치 $ brew nginx /opt/homebrew/etx/nginx에 설치된다. /opt/homebrew/etx/nginx경로의 conf파일을 수정해야된다. nginx 실행 $ brew services start nginx $ brew services stop nginx 하지만 nginx 키워드로도 가능 $ nginx $ nginx -s stop $ nginx -s reload root 설정 /opt/homebrew/etx/nginx경로의 conf파일을 수정해야된다. 서버 scope 속에서 root 경로 설정 가능하다. 서버 scope 에서 root 설..
-
정적 웹서버에서 MVC까지CS/웹 2023. 12. 26. 00:10
1. 초기의 서버 왜 웹을 쓰는가? 1. 컴퓨터하나에 모든 정보를 담기에는 정보의 양도 많고 복잡도 증가 2. 원격지에 있는 정보를 가져와서 보고 싶음 그럼 서버가 뭐야? 1. 클라이언트가 요청하는 자료를 전달하는 프로그램 클라이언트는 자료가 있는 컴퓨터의 ip로 요청을 한다. 서버는 요청이 들어오면 자기 컴퓨터의 저장매체에서 해당 자료를 찾는다. 해당 자료를 읽어서 응답을 보내준다. html 혹은 파일 주요 서버 프로그램들은 뭐가잇어? 1. CERN httpd - 연구원 간의 자료 공유로 목적으로 시작 2. apache - 90 중반등장, 오픈 소스로 커뮤니티의 지원으로 가장 보편화 (프로세스 기반) 3. nginx - 00 이후 등장 (이벤트 기반 아키텍쳐) 클라이언트 요청의 다양성, 복잡성 증가 1..
-
Observer 패턴 - Poll을 Push로!!CS/디자인패턴 2023. 12. 25. 23:56
목차 빠른 요약 옵저버 패턴 3장 그림 요약 시나리오 코드 Poll을 Push로!! 프로그래밍을 하다보면 a객체의 상태에 의존하여 b객체가 변경되어야하는 경우들이 생긴다. 보통은 b객체에서 a에게 '너의 상태가 변경되었니?' 물어보며 상태변화를 확인한다.(Poll) 하지만 언제 변할지 모르는 상태를 확인하기위해 몇 번을 얼마의 간격으로 물어봐야할까? 이런 문제를 a객체가 변경이 발생했을 때 '나 변했다~'를 b객체에게 알려주는 형태를 사용하면서 해결할 수 있다.(push) 이런 컨셉을 구현한 방법이 옵저버 패턴이다. 이번 글과 다음 글을 통해서 구체적인 예시를 확인해보자~ 그림으로 보면? A객체의 변화를 B객체가 알고 싶을 때 A객체의 변화를 여러개의 객체가 알고 싶을 때 유튜브 알림설정을 해보자 내가 ..
-
왜 타입스크립트는 환영받는가? (feat.타입과 에러)언어/자바스크립트 2023. 12. 25. 23:46
🎉 타입스크립트를 왜 써야하는가를 살펴보다가 JS의 에러에 관한 이야기로 흘러들어와버렸다.. 타입스크립트 문법을 배우기에 앞서, 자바스크립트의 수퍼셋이라고 하는데 무엇이 나아졌길래 사람들에게 사랑받는걸까? 찾아보니 가장 먼저 눈에 띄는 부분은 runtime error가 발생하지 않도록 개발단계에서 error를 처리할 수 있게 해준다는 거 같은데... 뭔가 확 와닿지 않았다. 런타임 에러? 왜 발생하면 안되는거야? 👀 프로그래밍을 하면서 에러는 나의 프로젝트의 진행을 방해하고, try-catch 구문으로 처리하는 것들이라고만 생각했지, 그 이상 생각해보지 않았던 것 같다.. 런타임이란 무엇인가 간단하게 생각하면, 프로그램이 실행되는 환경을 이야기한다. JS를 다루는 사람들에게 런타임 환경은 browser나..