전체 글
-
[백준] 18110번: solved.ac - 코틀린(kotlin)알고리즘/백준 2023. 10. 2. 00:01
https://www.acmicpc.net/problem/18110 18110번: solved.ac 5명의 15%는 0.75명으로, 이를 반올림하면 1명이다. 따라서 solved.ac는 가장 높은 난이도 의견과 가장 낮은 난이도 의견을 하나씩 제외하고, {5, 5, 7}에 대한 평균으로 문제 난이도를 결정한다. www.acmicpc.net 문제해석 난이도의 평균을 구하는 문제이지만 의견이 없을 경우 예외처리와, 30% 절사평균에 대한 고려를 수행해야 합니다. 이때 항상 반올림을 수행하므로 반올림도 잘 수행해야 합니다. 예제 입력 1 복사 5 1 5 5 7 8 예제 출력 1 복사 6 5명의 15%는 0.75명으로, 이를 반올림하면 1명이다. 따라서 solved.ac는 가장 높은 난이도 의견과 가장 낮은 난..
-
[백준] 27866번: 문자와 문자열 - 코틀린(Kotlin)알고리즘/백준 2023. 10. 1. 00:01
https://www.acmicpc.net/problem/27866 27866번: 문자와 문자열 첫째 줄에 영어 소문자와 대문자로만 이루어진 단어 $S$가 주어진다. 단어의 길이는 최대 $1\,000$이다. 둘째 줄에 정수 $i$가 주어진다. ($1 \le i \le \left|S\right|$) www.acmicpc.net 문제해석 단어 S가 주어지고 정수 i가 주어졌을 때 i번째 글자를 출력하라 예제 입력 1 복사 Sprout 3 예제 출력 1 복사 r 코드 fun main() { val result = `27866_문자와문자열`() println(result) } fun `27866_문자와문자열`(): Char { val word = readln() val index = readln().toInt(..
-
RestTemplate Retry와 Interceptor 동작원리 - RestTemplate Hands On 8Spring Framework/RestTemplate 2023. 9. 30. 00:01
개요 Retry와 Interceptor의 동작원리에 대해 알아보고자 합니다. Interceptor의 등록 public RestTemplateBuilder additionalInterceptors(ClientHttpRequestInterceptor... interceptors) { Assert.notNull(interceptors, "interceptors must not be null"); return additionalInterceptors(Arrays.asList(interceptors)); } additionalInterceptors 메서드를 통해 인터셉터가 추가됩니다. ClientHttpRequestInterceptor는 Spring 3.1부터 사용가능하며 해당 인터페이스를 구현하여 RestTem..
-
RestTemplate Retry 실습 - RestTemplate Hands On 7Spring Framework/RestTemplate 2023. 9. 29. 00:01
개요 일시적인 네트워크 이슈로 에러가 발생하는 경우에는 한 번만 실패하고 끝내야 할까? 이런 경우에는 한번 더 재시도하면 성공할 가능성이 있습니다. RestTemplate Retry는 어떻게 가능할까요? 떠오르는 가장 간단한 방법 @RestController class RestTemplateRetryTestController( private val restTemplate: RestTemplate, ) { @GetMapping("time-out-retry") fun timeOut(){ val url = "http://localhost:8080/time-out-retry-test" var responseEntity: ResponseEntity try { responseEntity = restTemplate...
-
RestTemplate Timeout - ResetTemplate Hands On 7Spring Framework/RestTemplate 2023. 9. 28. 00:01
개요 만약 호출하는 서버에 네트워크에 문제가 생겨서 응답시간이 지연되거나, 장애로 응답시간이 지연되는 경우 어떻게 처리해야 할까요? 무한정 대기를 하게 되면 쓰레드를 점유하게 되어 서버의 자원도 낭비되고, 유저가 응답을 받기까지 무한정 대기할 수도 없습니다. @RestController class RestTemplateTimeoutTestController( private val restTemplate: RestTemplate, ) { @GetMapping("time-out") fun timeOut(){ val url = "http://localhost:8080/time-out-test" val newCreateRestTemplate = RestTemplate() newCreateRestTemplate...
-
RestTemplate Error Handling - RestTemplate Hands On 6Spring Framework/RestTemplate 2023. 9. 27. 00:01
개요 이전 글들에서는 RestTemplate의 Get, Post, Delete 등에 대해 알아보았습니다. 이번 글에서는 RestTemplate Error Handling에 대해 알아보고자 합니다. 에러는 매우 다양하게 발생할 수 있습니다. 일시적인 네트워크 에러, 호출하는 서버의 다운, 잘못된 요청 등등.. 에러를 발생시키는 코드 @RestController class RestTemplateErrorHandling { val baseUrl = "localhost:8080" @GetMapping("/error-handle") fun errorHandle(){ val apiUrl = "/error-handle-test" val restTemplate = RestTemplate() val responseEnt..
-
점진적 추상화 - 이승천세미나, 영상 요약정리 2023. 9. 26. 00:01
https://www.inflearn.com/conf/infcon-2023 인프콘 2023 - INFCON 2023 인프런이 만드는 IT인의 축제, 인프콘으로 초대합니다. 인프콘과 함께 배우고 나누고 성장하세요. 다양한 발표 세션, 핸즈온, 네트워킹까지 만나보세요. inflearn.com 인프콘 2023에서 점진적 추상화라는 주제로 발표한 토스증권의 이승천 님의 발표를 듣고 요약해보고자 합니다. 발표의 목적 하나의 예제를 통해 추가되는 요구사항에서 대응하며 느낀 추상화에서 느낀 주관적인 공유 합니다. 요구사항 원화/달러 입출금을 관리하는 시스템을 구축 중인 스타트업의 개발자 내부 직원이 사용할 백오피스 입출금 API 개발 입출금 요청 : 계좌번호, 입출금 타입(원화/달러), 금액 기대동작: 요청내역 저장..
-
RestTemplate Delete Request - RestTemplate Hands On 5카테고리 없음 2023. 9. 25. 00:01
개요 RestTemplate의 GET, POST에 이어 DELETE 메서드를 활용하는 방법에 대해 알아보고자 합니다. RestTemplate Delete Request의 2가지 방법에 대해 알아봅니다. delete 메서드 활용 exchange 메서드 활용 DELETE Method의 특성 하나 A payload within a DELETE request message has no defined semantics; sending a payload body on a DELETE request might cause some existing implementations to reject the request. HTTP rfc 7231 문서에는 delete 메서드에 body를 담아 전송하는 것은 클라이언트나 서버의..