분류 전체보기
-
[sed/error] sed -i 사용 시, 발생하는 unterminated substitute in regular expression / undefined label / extra characters at the end of l command 오류🐳Dev/Issue 2023. 6. 4. 16:12
문제 상황 blue-green 배포 구현을 위해 nginx의 default.conf 파일을 수정하는 과정에서, sed -i 명령어를 사용했다. sed -i [suffix] sed는 stream editor의 약자로 표준 입력 또는 파일에서 오는 텍스트에 대한 편집 작업을 수행한다. 이때 -i 옵션은 표준 출력이 아닌 파일을 편집하기 위해 사용한다. sed -i 's/{변경전문자열}/{변경후문자열}/g' file 위 명령은 suffix는 작성하지 않고, 부속 명령으로 s, 플래그는 g를 사용해, 파일 안의 특정 문자를 전부 치환하고자 했다. 하지만 위 명령어는 리눅스 서버에서는 잘 작동하지만, 맥 서버에서 오류를 반환한다. (특정 오류가 나기 보다는 상황에 따라 여러 오류가 나.) sed: 1: "ngin..
-
[Lombok] @RequiredArgsConstructor에 @Qualifier를 적용하는 방법🐳Dev 2023. 5. 21. 02:45
@RequiredArgsConstructor Lombok은 반복적으로 사용되는 생성자와 getter, setter 등의 보일러플레이트 코드를 줄여주는 Java 라이브러리이다. @RequiredArgsConstructor는 이 Lombok에 포함된 어노테이션이다. @RequiredArgsConstructor는 각각의 필드를 매개변수로 가지는 생성자를 만들어준다. 이때 필드는 초기화 되지 않은 final 필드거나 @NonNull이 붙은 필드여야 한다. 또한 스프링은 "생성자가 딱 1개만 있으면 @Autowired를 생략해도 스프링 빈을 자동 주입된다"는 개념을 사용해 생성자 주입도 깔끔하게 해결할 수 있다. @Qualifier @Autowired는 타입으로 조회한다. 그래서 같은 상위 타입을 가진 여러 개의..
-
LeetCode : 1484. Group Sold Products By The Date🐳Dev/LeetCode 2023. 5. 13. 23:30
문제 Write an SQL query to find for each date the number of different products sold and their names. The sold products names for each date should be sorted lexicographically. Return the result table ordered by sell_date. The query result format is in the following example. 풀이 반환해야 하는 요소와 조건 날짜 : 중복 없이 오름차순 날짜에 따른 각 제품의 수 제품의 이름 : 중복 없이 사전순으로 정렬 날짜에 따라 묶고, 날짜 오름차순으로 정렬해서 조회하기 : group by sell_date, ..
-
LeetCode : 200. Number of Islands🐳Dev/LeetCode 2023. 5. 8. 16:02
문제 Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. Constraints: m == grid.length n == grid[i].length 1
-
-
LeetCode : 235. Lowest Common Ancestor of a Binary Search Tree🐳Dev/LeetCode 2023. 5. 5. 15:36
문제 Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as descendants (where we allow a node to be a descendant of itself).” Constraints: The number of nodes in the tree is in the ra..
-
LeetCode : 98. Validate Binary Search Tree🐳Dev/LeetCode 2023. 5. 3. 21:42
문제 Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follows: The left of a node contains only nodes with keys less than the node's key. subtree The right subtree of a node contains only nodes with keys greater than the node's key. Both the left and right subtrees must also be binary search trees. Constraints: The number of nodes in t..