본문 바로가기

분류 전체보기42

[JAVA] charset에 따른 bytes 길이 구하기 Java에서 문자열의 바이트를 가져와서 문자열을 substring 해주는 기능을 만들었는데 로컬에선 정상적으로 작동하지만 운영에서는 기능이 작동하지 않았습니다. 해당오류는 문자열의 바이트를 가져올때 길이가 로컬과 서버가 달라서 발생한 오류입니다. tempStr.getBytes().length; 로컬은 utf-8인데 서버는 euc-kr 으로 charset이 달라서 발생한 이슈로 utf-8로 인코딩해주면 정상적으로 계산됩니다. tempStr.getBytes("utf-8").length; 또는 tempStr.getBytes("euc-kr").length; ※ 참고 utf-8 : 한글 3바이트 / 영문, 숫자, 공백, 특수문자 1바이트 euc-kr : 한글 2바이트 / 영문, 숫자, 공백, 특수문자 1바이트 2023. 5. 29.
[Javascript] 숫자를 한글로 표현하기 숫자를 읽기 쉽게 한글로 표현해보려고 합니다. 숫자를 한글로 변경하려면 우선 Array에 '조'까지 변환할 수 있게 변수 hanA와 danA를 추가해줍니다. 그 외 필요한 변수들도 추가합니다. var numFull = document.getElementById("nubmer").value; var hanA = new Array("","일","이","삼","사","오","육","칠","팔","구","십"); var danA = new Array("","십","백","천","","십","백","천","","십","백","천","","십","백","천"); var result = ""; var num = ""; var below = ""; var str = ""; 정수를 한글로 변경하는 방법 입니다. for(.. 2023. 5. 25.
[JAVA] 파일 업로드 이미지 Quality 변경하기 이미지 파일을 업로드하면서 용량을 줄이고 싶을 때는 ImageWriteParam을 사용하여 변경할 수 있습니다. 먼저 변경할 file을 선언하고 BufferedImage를 사용하여 불러옵니다. File file = new File("/path/img.jpg"); BufferedImage image = ImageIO.read(file); OutputStream os = new FileOutputStream(file); ImageOutputStream ios = ImageIO.createImageOutputStream(os); Iterator writers = ImageIO.getImageWritersByFormatName("jpg"); if (!writers.hasNext()) { throw new Ill.. 2023. 2. 18.
A problem occurred evaluating project ':app' 오류 npm run android 프로젝트명 을 실행하니 처음에는 잘 실행되나 싶었으나 오류가 발생했습니다. FAILURE: Build failed with an exception. * Where: Build file 'D:\app\weightLog\andro id\app\build.gradle' line: 1 * What went wrong: A problem occurred evaluating project ':app'. > Failed to apply plugin 'com.android.internal.application'. > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. You can try some .. 2023. 2. 16.
Execution failed for task ':react-native-gradle-plugin:compileKotlin' 오류 npm run android 프로젝트명 을 실행하니 오류가 발생했습니다. error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`. > Task :react-native-gradle-plugin:compileKotlin FAILED 'compileJava' task (current target is 1.8) and 'compileKotlin' task (current target is 11) jvm target compatibility should be set to the same Java version. 1 actionable task: 1 executed FAILURE: Build f.. 2023. 2. 14.
cli.init is not a function 오류 cli로 프로젝트를 생성하면 아래와 같은 오류가 발생합니다. (npx react-native init 프로젝트명 명령어 실행 후 오류) TypeError: cli.init is not a function Installing react-native... Consider installing yarn to make this faster: https://yarnpkg.com npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN.. 2023. 2. 12.