본문 바로가기
반응형

전체 글714

Comparable & Comparator Comparable This interface imposes a total ordering on the objects of each class that implements it. This ordering is referred to as the class's natural ordering, and the class's compareTo method is referred to as its natural comparison method. Lists (and arrays) of objects that implement this interface can be sorted automatically by Collections.sort (and Arrays.sort). Objects that implement this.. 2020. 7. 6.
투 포인터(Two Pointer) 투 포인터는 1차원 배열에서 선형시간에 2개의 배열요소(인접 할 경우 2개 이상의 배열요소)를 이용하여 문제를 해결해야 하는 경우 사용한다. 2개의 배열요소를 이용한다는 것은 2개를 비교한다는 것을 의미한다. 보통의 방식으로는 배열에서 요소 2개를 배교하면 시간복잡도 O(N^2)로 풀게 되는데, 왜냐하면 모든 배열 요소들을 처음부터 끝까지 확인해야 하기 때문이다. 하지만, 이전에 방문한 것을 다시 방문하지 않는 투 포인터 방식을 사용하면 O(N)만에 해결이 가능하다. 투 포인터의 포인터는 당연하게도 C언어와 관련한 포인터가 아닌 배열의 특정 원소위치를 가리키는 것을 의미한다. 기본적인 개념을 넘어가고 백준 알고리즘에서 풀었던 문제에 대한 팁을 몇가지 적는다. 2003번: 수들의 합 2 import jav.. 2020. 7. 5.
spring-boot-starter-actuator Spring Boot includes a number of additional features to help you monitor and manage your application when you push it to production. You can choose to manage and monitor your application by using HTTP endpoints or with JMX. Auditing, health, and metrics gathering can also be automatically applied to your application. actuator는 spring boot application을 모니터하고 관리하는 기능을 가지고 있다. HTTP endpoints, JMX을 .. 2020. 6. 26.
LocaleResolver Locale : 사용자의 언어, 국가(뿐 아니라 사용자 인터페이스에서 사용자가 선호하는 사항을 지정한 매개변수의 모임) This interface allows for implementations based on request, session, cookies, etc. The default implementation is AcceptHeaderLocaleResolver, simply using the request's locale provided by the respective HTTP header. LocaleResolver로 다국어를 설정하는 방법은 AcceptHeaderLocaleResolver(default), SessionLocaleResolver, CookieLocaleResolver, Fixe.. 2020. 6. 25.
URI 만들 때 encode()의 역할 URL ASCII 코드 Unicode , ISO-8859, UTF-8 차이 퍼센트 인코딩(Percent Encoding) 스프링에서 URL 만들 시, encode() 역할 차이 URL 웹 브라우저는 URL주소를 통해 웹 서버로부터 페이지를 요청한다. ex) https://www.w3schools.com ASCII 코드 ASCII(American Standard Code for Information Interchange)는 그 의미처럼 정보 교환을 위한 미국의 표준 코드이다. 처음 60년대에 탄생했고, 전기장치나 컴퓨터끼리의 정보 교환을 위한 charset으로 사용되었다. 하지만 이 초기의 charset인 ASCII 코드는 7bit의 크기로 구성은 [0-9] [a-z] [A-Z] [!@#$%^&*()..... 2020. 6. 25.
UriComponenetsBuilder Goal UriComponents UriComponentsBuilder ServletUriComponenetsBuilder UriComponenets Represents an immutable collection of URI components, mapping component type to String values. Contains convenience getters for all components. Effectively similar to URI, but with more powerful encoding options and support for URI template variables. UriComponenets는 각 URI 부분들의 불변의 집합이다. UriComponentsBuilder Buil.. 2020. 6. 25.
JSON에서 원하는 값 선택하기 var txt = '{"name":[{"John" : "hello"},{"Selly" : "bye"}], "age":30, "city":"New York"}' var obj = JSON.parse(txt); document.getElementById("demo").innerHTML = obj.name[1].John + ", " + obj.age; txt는 String형이므로, 먼저 JSON.parse를 통해 Json 형태로 바꿔준 후 사용한다. key-value이며 key를 입력하면 value를 반환한다. {}는 "." 을 계속 입력하면서 값을 찾을 수 있으며, [ ]는 "[]"를 통해 값을 찾는다. Q> Selly의 bye를 얻고 싶다면? Q> age의 30을 얻고 싶다면? A> obj.name[1]... 2020. 5. 30.
미니프로젝트 오늘의 공부 (@RequestParam), (@ModelAttribute) 매개변수 넘어왔을 때, request객체에 등록되는 것은 ModelAttribute뿐이다. @RequestParam의 변수를 jsp에서도 사용하고 싶으면 (Model model)을 주입받아 model.addAttribute를 사용하여 jsp에 넘긴다. form 커스텀에서 modelAttribute를 통해서 값들을 넘기지 않으면, request 객체에 담기지 않는다. ex)form 태그 안에 value에 ${}을 사용하면 파라미터에 넘어오지 않는다. form 커스텀에서 modelAttribute를 넘기기 위해서는 아무내용없는 Bean 객체를 (@RequestParam)에 보낸다. ex) 글쓰기를 한 내용을 파라미터로 넘기기 위해 f.. 2020. 5. 29.
Restful API 기본 웹 애플리케이션은 응답 결과를 브라우저가 사용하는 html, css,javascript 로 생성하여 전달한다. Restful API 서버는 응답결과를 "데이터만으로 구성"하여 클라이언트로 전달하는 서버이다. Restful API 서버는 웹, 모바일 PC 등 다양한 플랫폼으로 "데이터"를 전달할 때 사용한다. @RestController @Controller는 return하는 값이 jsp를 지정하는 의미이지만 @RestController에서 return은 "그 값자체를 브라우저에 전달"하는 방식이다. 객체나 리스트를 json 데이터로 만들어 주는 것이 Jackson Databind @RestController public class RestTestController { @GetMapping("/tes.. 2020. 5. 28.
반응형