분류 전체보기 645

첨부 파일 UI

첨부 파일 파일을 선택해 주세요. 파일을 선택하면 input에 파일명이 출력되는 함수다. 결과는 아래와 같다. 참고 👇 https://www.delftstack.com/ko/howto/javascript/javascript-filename-extension/ JavaScript에서 파일 이름 확장명 가져오기 이 튜토리얼은 자바스크립트에서 파일 확장자를 얻는 방법을 나열합니다. www.delftstack.com https://kyuhyuk.kr/article/spring-boot/2020/07/22/Spring-Boot-JPA-MySQL-Board-Post-File-Upload-Download [Spring Boot] 게시판 구현 하기 (4) - 파일 업로드 & 다운로드 앞의 글 에서 글을 수정하고 삭제하..

FE/html 2022.07.31

TreeMap

TreeMap 이진 검색 트리 검색과 정렬에 적합한 컬렉션 클래스 검색 성능은 HashMap이 더 뛰어나다. 범위검색이나 정렬이 필요할 경우 TreeMap 선택 예시) TreeMap treeMap=new TreeMap(Collections.reverseOrder()); treeMap.putAll(redisTemplate.opsForHash().entries("findAll")); 내림차순으로 key를 정렬하는 TreeMap 참고 👇 https://huskdoll.tistory.com/5 Map의 key(키)로 정렬(Sort) 및 역정렬(Reverse) TreeMap의 순서대로 정렬되는 기능을 사용하여 HashMap을 정렬 하는 소스를 작성해 보았습니다. 값으로 정렬하실 분은 http://huskdoll...

JAVA 2022.07.28

Redis Class 및 Interface | 어노테이션 | redis-cli | 메소드

✨ Class 및 Interface 정리 Interface RedisConnectionFactory Thread-safe factory of Redis connections. Class LettuceConnectionFactory Luttuce를 기반으로 연결을 생성하는 Connection factory Class RedisTemplate object와 binary data 사이에 자동으로 serialization/deserialization을 수행한다. thread-safe하다. Interface CacheManager 스프링의 중심 캐시 매니저 SPI SPI는 Synchronous serial communication 주로 임베디디 시스템에서 근거리 통신에서 사용되는 인터페이스 사양 Class Red..

DB/Redis 2022.07.27

Map을 List로 변환해서 PageImpl에 담기

Map postDto=postService.findAll(); int len_postDto=postDto.size(); int start=(int) pageable.getOffset(); int end = Math.min((start + pageable.getPageSize()), len_postDto); Page page=new PageImpl(new ArrayList(postDto.values()).subList(start, end), pageable, len_postDto); Map 타입 postDto의 값을 ArrayList에 담아서 리스트를 생성한다. LinkedList는 데이터가 많을수록 접근성이 떨어지기 때문에 ArrayList를 선택했다. subList로 start에서 end까지 자른다.(..

JAVA 2022.07.27

인덱스

인덱스(Index) 자료를 쉽고 빠르게 찾을 수 있도록 만든 데이터 구조 B-tree 구조 인덱스는 WHERE 절에 자주 사용되는 속성이어야 한다. 인덱스는 ORDER BY 절에 자주 사용되는 속성이어야 한다. 인덱스는 조인에 자주 사용되는 속성이어야 한다. 조건절이 없다면 인덱스는 사용되지 않는다! 단일 테이블에 인덱스가 많으면 속도가 느려질 수 있다.(테이블 당 4~5개가 적절) 속성이 가공되는 경우 사용하지 않는다. INSERT / UPDATE / DELETE가 자주 발생하지 않는 컬럼 속성의 선택도(1/서로 다른 값의 개수)가 낮을 때 유리하다. (=카디널리티가 높은 것) 데이터의 양이 별로 없거나 데이터 값이 몇 종류 안 되면 인덱스가 없는 게 더 빠를 수 있다. 결합 인덱스는 순서가 중요하다...

DB 2022.07.24

[Error] ERR wrong number of arguments for 'zrangebyscore' command

키의 값을 조회할 때 데이터 타입에 따라서 명령어가 다르다. get은 키의 값이 string일 때 쓴다. zrangebyscore는 키의 값이 sorted set일 때 쓴다. 키의 값 타입을 조회한다. type 키이름 참고 👇 https://stackoverflow.com/questions/37953019/wrongtype-operation-against-a-key-holding-the-wrong-kind-of-value-php WRONGTYPE Operation against a key holding the wrong kind of value php Hi I am using Laravel with Redis .When I am trying to access a key by get method then ..

DB 2022.07.23

[Error] Could not write JSON: Java 8 date/time type `java.time.LocalDateTime` not supported by default:

There was an unexpected error (type=Internal Server Error, status=500). Could not write JSON: Java 8 date/time type `java.time.LocalDateTime` not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling (through reference chain: java.util.ArrayList[0]->Bulletin.Board.domain.posts.Post["createdDate"]); nested exception is com.fasterxml.jackson.d..