Full of Troves, Blog
Development Blog
-
[Java]파일 다운로드 시 한글 및 특수문자 깨짐, 다운로드 불가 오류
문제 파일 업로드를 구현하고 업로드 한 파일을 다운받기 위해 기능을 구현하였다. 그런데 브라우져 별로 테스트를 해보니 문제가 있었다. 크롬(Chrome) : 파일 다운로드는 되지만 파일명의 특수문자 깨짐 익스플로러(Internet Explorer) : 크롬의 문제 + 한글 파일명을 가진 파일은 다운로드 자체가 안됨 파이어폭스(Firefox) : 파일에 공백이 있으면 그 공백을 기준으로 뒤쪽 이름은 다...
-
[Spring]Interceptor를 이용하여 세션 및 권한 체크 하기
1. Spring에서 Interceptor란? Interceptor는 Controller에 들어오는 요청(HttpRequest)과 응답(HttpResponse)를 가로채는 역할을 한다. 쉽게 말해 “eastglow.github.io/boardlist/10” 라는 URI를 사용자가 요청했을 때 그 요청과 받아주는 Controller가 반환하는 응답을 가로채는 녀석이다. 이와 비슷한 기능을 가진 Filter라는 것도 있는데 Interceptor와 다른 점은 실행되는 시점이다. Interceptor는 DispatcherServlet이 실행된 후(= Controller로 가기 전), Filter는 DispatcherServlet이 실행되기 전에...
-
[Lessons1]BinaryGap
문제 https://app.codility.com/programmers/lessons/1-iterations/binary_gap/ 풀이 public class Solution { public int solution(int N) { // write your code in Java SE 8 boolean flag = false; int biggerNum = 0; int tempNum = 0; String binaryStr = Integer.toBinaryString(N); char[] binaryArray = binaryStr.toCharArray(); for(char ch : binaryArray){ if('1' == ch){ if(tempNum > 0){...
-
[1차]비밀지도
문제 https://www.welcomekakao.com/learn/courses/30/lessons/17681 풀이 class Solution { public String[] solution(int n, int[] arr1, int[] arr2) { String[] answer = new String[n]; for(int i=0; i<n; ++i){ int tempNum = arr1[i]|arr2[i]; String tempBinary = Integer.toBinaryString(tempNum); int tempLength = tempBinary.length(); if(tempLength < n){ for(int j=0; j<n-tempLength; ++j){ tempBinary = "0"+tempBinary; } } answer[i] =...
-
[1차]다트 게임
문제 https://www.welcomekakao.com/learn/courses/30/lessons/17682 풀이 class Solution { public int solution(String dartResult) { int answer = 0; int[] tempArray = new int[3]; int temp = 0; int cnt = 0; char[] charArray = dartResult.toCharArray(); for(char ch : charArray){ if(Character.isDigit(ch)){ //숫자 if(temp == 1 && ch == '0'){ temp = 10; tempArray[cnt-1] =...