전체 글(26)
-
[Web] WebServer와 Was(Web Application Server)
📌 WebServerHTTP Protocol 기반으로 동작정적 리소스를 제공하는 서버 (static resources) => html, css, js 등대표적인 서버 => Nginx, Apache 등 📌 WAS (Web Application Server)HTTP Protocol 기반으로 동작WebServer의 대부분의 기능을 포함프로그램 코드를 통한 동적 리소스(=비즈니스 로직)를 수행하는데 특화된 서버 (dynamic resources) => 동적 html, RestAPI(=JSON)Servlet, JSP, Spring MVC 등의 기능을 사용대표적인 서버 => tomcat, Jetty, Undertow 등 📌 웹 구조1. Client ↔️ WAS ↔️ DB WAS가 WebServer의 대부분의 ..
2024.05.20 -
[Algorithm] Bubble Sort
📌 What is bubble sort? 0 ~ N 번째 배열까지의 값을 순서대로 비교 총 n - 1번 수행 인접한 두 자료를 비교하여 오름차 순으로 저장되어 있지 않으면 교환 flag 변수를 사용하여 한번의 pass동안 한번도 교환이 이뤄지지 않으면 끝내도록 개선 값을 임시 저장할 temp, 총 시행횟수 i, 배열의 현재위치 및 비교위치 j로 할당 import time.h의 srand 함수를 사용하여 랜덤함수 발급 📌 Code #define _CRT_SECURE_NO_WARNINGS #include #include #include #define N 10 void bubble(int arr[], int n) { int i = n - 1, j, tmp, flag = 1; while (flag && i !=..
2024.04.04 -
[C] 이차방정식 계산
#define _CRT_SECURE_NO_WARNINGS #include #include int main() { double a, b, c; while (1) { printf("Input coefficients(A, B, C) : "); int rV = scanf("%lf %lf %lf", &a, &b, &c); if (rV 0) { double root1 = (-b + sqrt(result)) / 2 * a; double root2 = (-b - ..
2024.03.27 -
[C] 시프트 연산자를 이용한 bit 변환
📌 정수 => bit #define _CRT_SECURE_NO_WARNINGS #include int main() { int temp; printf("Input number : "); scanf("%d", &temp); for(int i=31; i>=0; i--) { printf("%d", (temp >> i) & 1); } } 📌 실수 => bit // 배정밀도 초과수 : 1023 / 단정밀도 초과수 : 127 #define _CRT_SECURE_NO_WARNINGS #include #include int main() { double temp; long long int* p = (long long int*)&temp; printf("Input number : "); scanf("%lf", &temp);..
2024.03.27 -
[Spring] Bean LifeCycle & Callback Method
📌 Life-Cycle 기본적인 SpringBean의 Life-Cycle은 다음과 같은 과정을 가진다. "객체 생성" => "의존관계 주입" SpringBean은 객체를 생성하고 의존관계 주입이 다 끝나야 필요한 데이터를 가져올 수 있는 준비가 완료된다. 따라서, 초기화 작업은 의존관계 주입이 다 끝난 후에 호출하여야 한다. ※ Constructor Injection은 유일하게 객체 생성과 같이 이뤄진다. # What is Dependency Injection? [Spring] 의존 관계 주입 (DI : Dependency Injection) 📌 DI(Dependency Injection)의 4가지 방법 1. 생성자 주입 (constructor injection) 2. 수정자 주입 (setter inje..
2024.03.21 -
[Spring] 의존 관계 주입 (DI : Dependency Injection)
📌 DI(Dependency Injection)의 4가지 방법 1. 생성자 주입 (constructor injection) 2. 수정자 주입 (setter injection) 3. 필드 주입 (field injection) 4. 일반 메서드 주입 (method injection) # Constructor Injection (권장 O) 생성자를 통해서 의존 관계를 주입받는 방식이다. 생성자 호출 시점에 딱 1번만 호출되는 것이 보장된다. "불변", "필수" 의존 관계에 유효하다. (Getter, Setter => X, 값이 무조건 존재) Bean이고 생성자가 한 개일 때, @Autowired를 생략해도 자동으로 의존 관계가 주입된다. @Service public class MemberServiceImpl ..
2024.03.17