[SQL] INSERT 문에 조건을 걸고 싶을 때
·
개발 ━━━━━/SQL
일반 INSERT 문INSERT INTO TB_USER (USER_ID, USER_EMAIL)VALUES (#{USER_ID}, #{USER_EMAIL}) 쿼리를 짜다보니 INSERT 를 할 때 그냥 값을 넣는 것이 아닌 INSERT 하는 조건을 걸어야하는 상황이 생겨서 알아보게 되었다. INSERT 문에 조건 걸기INSERT 문 컬럼 뒤에 SELECT 문을 걸어줌으로서 조건을 걸어줄 수 있다. 예시 1)퇴사하지 않은 직원의 장비 정보를 INSERT 하고 싶은 경우INSERT INTO TB_USER_EQUIP (USER_ID, EQUIP_SEQ, NOTE)SELECT #{USER_ID}, #{EQUIP_SEQ}, #{NOTE}FROM DUALWHERE #{USE_YN} = 'Y' 예시 2)부서 테이블에 ..
electron-builder 오픈 소스에 인생 첫 PR 을 날려보다! - ②
·
개발 ━━━━━/Dev Life
지난 글https://gukjan9.tistory.com/148 electron-builder 오픈 소스에 인생 첫 PR 을 날려보다! - ①개발자 인생 첫 PR!https://github.com/electron-userland/electron-builder/pull/8539 fix(linux): continue update process even if AppImage is not available by gukjan9 · Pull Request #8539 · electron-userland/elecSituation To update the AppImage, curregukjan9.tistory.com 지난 글에 이어서 쓰도록 하겠다. PR 날리는 방법PR 거리를 찾았기 때문에 그 다음은 어떻게 오픈 소스..
electron-builder 오픈 소스에 인생 첫 PR 을 날려보다! - ①
·
개발 ━━━━━/Dev Life
개발자 인생 첫 PR!https://github.com/electron-userland/electron-builder/pull/8539 fix(linux): continue update process even if AppImage is not available by gukjan9 · Pull Request #8539 · electron-userland/elecSituation To update the AppImage, current (now running) version of AppImage must had to be on path that declared in code. (process.env.APPIMAGE) If not, downloaded new version of AppImage disapper..
[Spring] PDFBox 로 텍스트 추출시 null 값이 추출될 때
·
개발 ━━━━━/Spring(boot)
문제PDFBox 를 이용해서 이력서 형식의 PDF (잡코리아, 사람인) 에 있는 텍스트를 출력하는데public String extractPDF(MultipartFile file) { try (PDDocument document = PDDocument.load(file.getInputStream())) { PDFTextStripper stripper = new PDFTextStripper(); stripper.setSortByPosition(true); String content = stripper.getText(document); } catch { } 잡코리아는 null 문자 없이 정상적으..
[Ubuntu] '/swapfile': Text file busy
·
개발 ━━━━━/Troubleshoot
문제electron 앱을 빌드하기 위해 virtualbox 에 ubuntu 를 올려서 빌드를 하는데 시간이 너~무 오래걸려서 다른 작업을 할건 없고 swapfile 을 좀 만져보고자 했다. sudo dd if=/dev/zero of=/swapfile bs=128M count=32냅다 생성하려니 뜨는 오류 찾아보니 이미 swapfile 이 존재해서 발생하는 오류였다. 현재 사용하고 있는 swap 파티션을 확인해보았다.sudo swapon --show이미 1기가가 할당이 되어있다. 해결나는 swapfile 의 용량을 늘릴 목적이기 때문에 1. 기존 swapfile 해제sudo swapoff -v /swapfile한 1분 정도 시간이 걸렸다. 2. swapfile 삭제sudo rm /swapfile 3. sw..
[Electron] APPIMAGE env is not defined, current application is not an AppImage
·
개발 ━━━━━/Troubleshoot
문제 Linux 환경에서 앱을 빌드하고 electron-updater (autoUpdater) 의 checkForUpdatesAndNotify() 함수가 작동되면위처럼 APPIMAGE 가 정의되지 않았다 뜨고 업데이트 확인 기능이 실행되지 않는다. Windows 환경에서는 문제가 없고Linux 에서는 APPIMAGE 환경변수가 따로 필요한 것 같다. 해결app.js 에const os = require('os');const path = require('path');const platform = os.platform();if(platform == 'linux'){ process.env.APPIMAGE = path.join(__dirname, 'dist', `*-${app.getVersion()}.AppIm..
[Spring] Singleton, Prototype Scope Bean
·
개발 ━━━━━/Spring(boot)
김영한 강사님의 스프링 강의를 보던 중 Singleton, Prototype 에 대한 내용이 나온 적이 있다. ServiceController@Controllerpublic class ServiceController { private final ApplicationContext context; @Autowired public ServiceController(ApplicationContext context) { this.context = context; } @GetMapping("/") public String getServiceHashes(Model model) { SingletonService singletonService = context.ge..
[Java] 개선된 Switch 문 (Enhanced Switch Expressions)
·
개발 ━━━━━/Java
Java 14 Switch Expressions기존 C 나 Java 에서 사용하던 Switch 문은 if-else 문을 놔두고 굳이 쓸만한 이유를 딱히 찾지 못했기 때문에 거의 사용하지 않던 문법이다. 하지만 Java 14 이후로 개선된 Switch 문이 도입되었고 아래와 같은 feature 들이 추가되었다.Arrow LabelsSwitch expressionsYielding a value Arrow Labelsbeforeswitch (day) { case MONDAY: case FRIDAY: case SUNDAY: System.out.println(6); break; case TUESDAY: System.out.println(7); break; case THURSDAY: case SATURDAY: Sy..