묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결[코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!
어드민 페이지 문의
안녕하세요~ 궁금한게 있어 문의 드립니다. 강의랑은 살짝 관련없지만 관련있는 문의 입니다. 혹시 플러터 앱을 제작 후 (쇼핑몰) 웹에서 별도 어드민 페이지를 만들어서 플러터 앱과 json으로 연동하는 방법이 있을까요?그리고 admin페이지 역시 플로터로 개발하는게 좋을지 아니면 장고나 스프링이나 다른 언어에 프레임워크로 연결이 될런지 궁금해서 문의드립니다!
-
미해결
스프링부트 3.0 query dsl 에러
plugins { id 'java' id 'org.springframework.boot' version '3.0.0' id 'io.spring.dependency-management' version '1.1.0' } group = 'study' version = '0.0.1-SNAPSHOT' sourceCompatibility = '17' configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'mysql:mysql-connector-java' implementation 'org.mapstruct:mapstruct:1.4.2.Final' compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok-mapstruct-binding:0.2.0' annotationProcessor "org.mapstruct:mapstruct-processor:1.4.2.Final" testImplementation 'org.springframework.boot:spring-boot-starter-test' developmentOnly 'org.springframework.boot:spring-boot-devtools' // Querydsl 추가 implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta' annotationProcessor 'com.querydsl:querydsl-apt:5.0.0:jakarta' annotationProcessor "jakarta.annotation:jakarta.annotation-api" annotationProcessor "jakarta.persistence:jakarta.persistence-api" } tasks.named('test') { useJUnitPlatform() } 위와 같이 설정 후 build - clean, other - compileJava 하여 Q파일 생성까지는 잘 됩니다. 하지만 프로젝트 실행하려고 하면 아래와 같이 오류가 발생하네요Description: A component required a bean of type 'jakarta.persistence.EntityManagerFactory' that could not be found. Action: Consider defining a bean of type 'jakarta.persistence.EntityManagerFactory' in your configuration. Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings 그래서 Q파일.java를 확인해보니 아래와 같이 javax를 기반으로 @Generated 어노테이션이 생성된 것을 확인했습니다. 이거 잡고 몇일째인지 모르겠네요 ㅜㅜ 혹시 원인을 아시는 분 계실까요??(혹시 몰라서 config파일까지 첨부합니다.)
-
미해결팀 개발을 위한 Git, GitHub 입문
안녕하세요 강의자료 부탁드립니다!
안녕하세요. 이번에 이직을하게되어 svn에서 git으로 형상관리툴이 변경되어 강의를 수강하게 되었습니다. 강의 자료 요청드립니다!stylealist@gmail.com
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스
포스트맨 실습 진행 시 undefined 오류
같은 코드를 이용해 포스트맨 호출 시, 다음 에러가 발생합니다.TypeError: Cannot read property 'moneyService' of undefined at buyProduct (file:///home/xxx/%EB%B0%94%ED%83%95%ED%99%94%EB%A9%B4/codecamp-backend-online/class/12/12-01-express-with-DI-IoC/mvc/controllers/product.controller.js:11:31) at Layer.handle [as handle_request] (/home/xxx/바탕화면/codecamp-backend-online/node_modules/express/router/layer.js:95:5) at next (/home/xxx/바탕화면/codecamp-backend-online/node_modules/express/lib/router/route.js:144:13) at Route.dispatch (/home/xxx/바탕화면/codecamp-backend-online/node_modules/express/lib/router/route.j4:3) at Layer.handle [as handle_request] (/home/xxx/바탕화면/codecamp-backend-online/node_modules/express/router/layer.js:95:5) at /home/xxx/바탕화면/codecamp-backend-online/node_modules/express/lib/router/index.js:284:15 at Function.process_params (/home/xxx/바탕화면/codecamp-backend-online/node_modules/express/lib/routedex.js:346:12) at next (/home/xxx/바탕화면/codecamp-backend-online/node_modules/express/lib/router/index.js:280:10) at jsonParser (/home/xxx/바탕화면/codecamp-backend-online/node_modules/body-parser/lib/types/json.js:7) at Layer.handle [as handle_request] (/home/xxx/바탕화면/codecamp-backend-online/node_modules/express/router/layer.js:95:5)이 때, app.post 미들웨어 함수 부분에 bind()로 엮어주어야만 정상 작동하는데 이유가 무엇일까요?코드는 아래 첨부합니다.import express from "express"; import {ProductController} from "./mvc/controllers/product.controller.js"; import {CouponController} from "./mvc/controllers/coupon.controller.js"; import {CashService} from "./mvc/controllers/services/cash.service.js"; import {ProductService} from "./mvc/controllers/services/product.service.js"; import {PointService} from "./mvc/controllers/services/point.service.js"; const app = express(); app.use(express.json()); const cashService = new CashService(); const productService = new ProductService(); const pointService = new PointService(); // 상품 API const productController = new ProductController(cashService, productService); app.post("/products/buy", productController.buyProduct) app.post("/products/refund", productController.refundProduct) // 쿠폰 구매하기 const couponController = new CouponController(pointService); app.post("/coupons/buy", couponController.buyCoupon); app.listen(3000, () => { console.log("3000번 포트에서 연결 중..."); })index.jsexport class ProductController { constructor(moneyService, productService) { // DI (IoC) this.moneyService = moneyService; this.productService = productService; } buyProduct(req, res){ // 지불 금액 검증 const hasMoney = this.moneyService.checkValue(); // 재고 검증 (재고 있으면 구매) const isSoldOut = this.productService.checkSoldOut(); // 상품 구매 코드 if (hasMoney && !isSoldOut) { res.send("상품 구매 완료"); } } refundProduct(req, res){ // 재고 검증 (재고 없으면 환불) (구매 코드와 중복) const isSoldOut = this.productService.checkSoldOut(); // 환불 코드 if (isSoldOut) res.send("환불 완료"); } }ProuductControllerexport class CouponController{ constructor(moneyService) { this.moneyService = moneyService; } buyCoupon(req, res){ const hasMoney = this.moneyService.checkValue(); // 쿠폰 구매 코드 if (hasMoney){ res.send("쿠폰 구매 완료"); } } }CouponControllerexport class ProductService{ checkSoldOut(){ console.log("판매 완료 검증."); // 재고 검증 } }ProductServiceexport class PointService{ checkValue(){ console.log("포인트 검증."); // 지불 금액 검증 } }PointServiceexport class CashService{ checkValue(){ console.log("현금 검증.") // 지불 금액 검증 } }CashService
-
해결됨실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
선생님들 도와주세요~
package com.example.demo; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.Rollback; import javax.transaction.Transactional; @SpringBootTest @Transactional(rollbackOn = {Exception.class}) class Repository_CookerTest { @Autowired Service_Cooker Service_Cooker; @Autowired Repository_Cooker repositoryCooker; @Test @Rollback(value = false) void 테스트(){ Cooker cooker=new Cooker(); cooker.setId(123L); cooker.setExp(1); cooker.setName("123"); cooker.setAge(23); Long id=Service_Cooker.save(cooker); Assertions.assertEquals(cooker,repositoryCooker.find_one(id)); } } package com.example.demo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import javax.persistence.EntityManager; @Repository public class Repository_Cooker { @Autowired private EntityManager entityManager; public void save(Cooker cooker){ entityManager.persist(cooker); } public Cooker find_one(Long id){ return entityManager.find(Cooker.class,id); } }package com.example.demo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class Service_Cooker { @Autowired Repository_Cooker repository_Cooker; public Long save(Cooker cooker){ repository_Cooker.save(cooker); return cooker.getId(); } } org.springframework.dao.InvalidDataAccessApiUsageException: detached entity passed to persist: com.example.demo.Cooker; nested exception is org.hibernate.PersistentObjectException: detached entity passed to persist: com.example.demo.Cooker insert into cooker (cooker_id, age, exp, name) values (null, 23, 1, '123');안녕하세요 영한 선생님덕분에 쑥쑥 자라나고 있는 코린이입니다.질문은 아이디 없이테스트를 돌리면 통과가 되는데요아이디를 설정하고 돌리면 에러가 납니다.왜 그런건지 어디가 잘못된 건지 알고싶어요 ~도와주세요~
-
미해결자바 개발자를 위한 코틀린 입문(Java to Kotlin Starter Guide)
코루틴의 대한 질문이 있습니다.
강사님, 강의 내용에는 코루틴이 없어 학습중에 궁금한 점이 있어서 문의드립니다.아래 코드의 실행 순서를 제가 정리 해봤습니다.제가 코루틴의 suspend, resume을 잘 이해한게 맞나 궁금해서요.물어볼 곳이 없어서, 죄송스럽게도 강사님께 문의를 하게 되었습니다.강의 내용과는 관련이 없어 답변을 해주시면 감사하겠지만, 답변이 안달리다도 괜찮습니다.감사합니다. println("Coroutine Outer") 이 실행된다.A 코루틴에서 delay를 만나, B 코루틴으로 실행권을 넘겨간다.B 코루틴도 delay를 만나, A 코루틴으로 실행권을 넘겨준다.1초가 지나고 A코루틴의 println("Coroutine A, Si")을 실행한다.반복문에 의하여 A코루틴의 2번째 delay를 만나, 다시 B 코루틴으로 실행권을 넘겨준다.B 코루틴도 1초가 지난 상태여서, 바로 println("Coroutine B, Si")을 실행한다.반복문에 의하여 B코루틴의 2번째 delay를 만나, 다시 A 코루틴으로 실행권을 넘겨준다.그 다음 4~7을 반복문이 끝날 때 까지 반복 후 코루틴이 종료된다.fun main() = runBlocking { // A 코루틴 launch { repeat(5) { i -> delay(1000L) println("Coroutine A") } } // B 코루틴 launch { repeat(5) { i -> delay(1000L) println("Coroutine B") } } println("Coroutine Outer") } fun <T> println(msg: T) { kotlin.io.println("$msg [${Thread.currentThread().name}]") }
-
미해결[개정판] 딥러닝 컴퓨터 비전 완벽 가이드
Soft max Class score 질문입니다!
오른쪽 처럼 car: 0.8 이라고 되어있는데 이는 vgg/resnet 학습시에 label 데이터와의 대조를 통하여 산출한 값인가요?현업에서쓰는 label 데이터는 주로 어떤걸 쓰는지 궁금합니다!
-
미해결모든 개발자를 위한 HTTP 웹 기본 지식
쿠키와 세션
쿠키랑 세션이랑 다른거잖아요둘다 인증에 사용되는 작은 저장소같은거예요저는 둘이 다르다고해서어떤로그인에는 전과정에 쿠키만 쓰이고 어떤과정에는 전과정에 세션만쓰이고이런건줄알았는데 이 그림을 보니로그인이라는건 세션+쿠키가 둘다쓰이는 작업인거네요..?로그인을 하면 항상 sessionid를 발급해줘야하니까 세션이 쓰이고클라이언트 측에서는 그정보를 저장하고있어야하니 sessionid를 담은쿠키가 생성되는거구요.제 말이 맞나요?https://sjparkk-dev1og.tistory.com/12. 쿠키정보는 항상 서버에 전송되기때문에 네트워크 트래픽이 유발돼요근데 쿠키는 웹브라우저에 있는 작은저장소예요 이말은 곧 서버의 자원을 활용하지 않는다는얘기죠근데 서버에 항상 전송돼서 네트워크 트래픽을 유발하는게 서버의 자원을 쓰는것과 다른얘기인가요?자꾸 요청이 오면 그거 처리하느라 자원을 써야하는거아닌가요?
-
미해결따라하며 배우는 NestJS
update를 repository로 빼서 작성했는데 오류가 나옵니다
boards.service.ts 코드입니다.import { Injectable, NotFoundException } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { BoardStatus } from './board-status.enum'; import { Board } from './board.entity'; import { BoardRepository } from './board.repository'; import { CreateBoardDto } from './dto/create-board.dto'; @Injectable() export class BoardsService { constructor( @InjectRepository(Board) private boardRepository: BoardRepository, ) {} createBoard(createBoardDto: CreateBoardDto): Promise<Board> { return this.boardRepository.createBoard(createBoardDto); } async getBoardById(id: number): Promise<Board> { console.log(id, 'ididid'); return this.boardRepository.getBoardById(id); } async deleteBoard(id: number): Promise<void> { const result = await this.boardRepository.delete(id); if (result.affected == 0) { throw new NotFoundException(`Can't find Board with id ${id}`); } } async updateBoardStatus(id: number, status: BoardStatus): Promise<Board> { const board = await this.getBoardById(id); board.status = status; await this.boardRepository.save(board); return board; } } board.repository.ts 코드입니다import { Injectable, NotFoundException } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { BoardStatus } from './board-status.enum'; import { Board } from './board.entity'; import { BoardRepository } from './board.repository'; import { CreateBoardDto } from './dto/create-board.dto'; @Injectable() export class BoardsService { constructor( @InjectRepository(Board) private boardRepository: BoardRepository, ) {} createBoard(createBoardDto: CreateBoardDto): Promise<Board> { return this.boardRepository.createBoard(createBoardDto); } async getBoardById(id: number): Promise<Board> { console.log(id, 'ididid'); return this.boardRepository.getBoardById(id); } async deleteBoard(id: number): Promise<void> { const result = await this.boardRepository.delete(id); if (result.affected == 0) { throw new NotFoundException(`Can't find Board with id ${id}`); } } async updateBoardStatus(id: number, status: BoardStatus): Promise<Board> { const board = await this.getBoardById(id); board.status = status; await this.boardRepository.save(board); return board; } } [Nest] 12296 - 2023. 01. 26. 오후 4:25:43 ERROR [ExceptionsHandler] this.boardRepository.getBoardById is not a functionTypeError: this.boardRepository.getBoardById is not a function at BoardsService.getBoardById (C:\Users\lgh38\Desktop\GH\nest-board-app\src\boards\boards.service.ts:22:33) at BoardsService.updateBoardStatus (C:\Users\lgh38\Desktop\GH\nest-board-app\src\boards\boards.service.ts:33:30) at BoardsController.updateBoardStatus (C:\Users\lgh38\Desktop\GH\nest-board-app\src\boards\boards.controller.ts:44:31)오류 내용은 위와 같습니다. 자세히 보면 this.boardRepository.getBoardById is not a function이라고 나오는데 제가 생각 했을 땐 처음 service의 updateBoardStatus 함수에서 getBoardById 함수로 넘겨주고 또 getBoardById 함수가 repository 안에 있는 getBoardById 함수에게 값을 넘겨서 두 번 리턴 받아서 해결 될 줄 알았는데 에러가 나오더라구요..오히려 분리를 안 시켰을 땐 오류가 안 나옵니다 무슨 이유일까요..?
-
미해결[코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!
문법 관련 질문있습니다.
0:08:30 쯤에 설명하신 this 키워드에 관해 질문있습니다.영상에서 설명하신 내용은 이해가 됐습니다.제가 영상과는 다르게 객체 내의name과 members 생성자를 다른 임의의 문자열과 리스트로 정의하고Idol생성자를Idol(this.name, this.members);로 바꾸고 출력해 봤습니다.이때, Idol 생성자의 변수가 클래스 내의 생성자 갑과는 무관하게 파라미터의 값을 받는것 같습니다.왜 파라미터안에 this를 선언했음에도 왜 클래스 내의 생성자 값을 받지 않는지 궁금합니다.
-
미해결홍정모의 따라하며 배우는 C언어
putchar() getchar()
char ch; ch = getchar(); while (ch != '\n') { putchar (ch); ch = getchar (); } putchar (ch); 위쪽에 있는 ch = getchar();를 통해 qwer의 문자를 입력 받았다고 하면 putchar()에서 한문자씩 출력이 되서 처음에는 q값이 출력이 되면그 다음 코드인 ch = getchar();를 만나는데 여기서 다시 ch의 값을 다시 입력해줘달라는 코드 아닌가요? 처음 ch = getchar();에서는 입력을 받았는데 왜 while문 안에있는 ch = getchar();에서는 입력을 다시 안하는 건가요??
-
미해결자바(Java) 알고리즘 문제풀이 입문: 코딩테스트 대비
배열 합치기 다른 방법
안녕하세요 강사님 배열 합치기 문제에서제가 먼저 풀었을때는 아래와 같이 풀어서 accept가 떴긴 했는데 강사님이 강의해주신 코드와 제 코드 시간 비교를 해보니 10ms 정도 차이가 나더라고요 (제 코드가 조금 더 running time이 깁니다.)혹시 아래 코드를 코딩테스트에서 사용해도 딱히 무방한가요??? - 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. import java.util.*; public class Main { public ArrayList<Integer> solution(int n, int[] arr1, int m, int[] arr2) { ArrayList<Integer> answer = new ArrayList<>(); for (int x : arr1) answer.add(x); for (int x : arr2) answer.add(x); Collections.sort(answer); return answer; } public static void main(String[] args) { Main T = new Main(); Scanner kb = new Scanner(System.in); int n = kb.nextInt(); int[] arr1 = new int[n]; for (int i = 0; i < n; i++) { arr1[i] = kb.nextInt(); } int m = kb.nextInt(); int[] arr2 = new int[m]; for (int i = 0; i < m; i++) { arr2[i] = kb.nextInt(); } for (int x : T.solution(n, arr1, m, arr2)) { System.out.print(x + " "); } } }
-
미해결
spring pet-clinic 빌드 오류
Execution default of goal org.springframework.boot:spring-boot-maven-plugin:3.0.1:build-info failed: Unable to load the mojo 'build-info' in the plugin 'org.springframework.boot:spring-boot-maven-plugin:3.0.1' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/springframework/boot/maven/BuildInfoMojo has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 59.0 검색해봤더니 자바 버전 차이래서 프로젝트 밑 환경변수설정까지 해서 자바 11로 맞추었는데 빌드조차 하지 못하고 있습니다ㅜㅜ 그리고 git clone했는데 저는 의존성에서 wro4j가 보이지 않는데 이유를 잘 모르겠습니다..
-
해결됨시스템엔지니어가 알려주는 리눅스 실전편 Bash Shell Script
VSCode나 Putty로 서버에 원격접속하려면 어떻게 환경을 구성해야하나요?
안녕하세요? 먼저, vagrant를 사용할 수 없어 N. vagrant를 사용하지 않고 구축할 수 있는 실습환경을 참고하여 실습환경을 구축했습니다.하지만 제가 리눅스 서버로 원격 접속하여 과제를 한 경험이 많아서 이번에도 그렇게 하고 싶은데 configuration에서 애를 먹는 중이에요.VSCode에서 ssh 원격접속을 위해서는 ~/. ssh/config 파일에 host를 새로 추가해야하는데HostName을 cent1의 경우 192.168.56.1로 하는게 맞는지 확실하지가 않습니다. 주석 친 172.18.1.91로는 connection timed out이 뜹니다.그리고 개인 비밀키인 IdentityFile은 https://github.com/bashbomb/VWS_vagrant_script/blob/master/CONF/ssh/id_rsa 에서 받았는데깃허브의 authorized_keys와 cent1 vm의 authorized_keys가 서로 달라서 깃허브의 ssh 설정이 제 로컬 환경에서 그대로 사용가능한 것인지 모르겠습니다.VSCode terminal로 원격접속을 시도하면 아래와 같은 메시지가 나옵니다. 아마 IdentityFile로 지정한 개인 키가 vm 서버의 authorized_keys 공개키로 검증이 되지 않는 것 같은데 그렇다면 어떤 개인 키를 사용해야될까요? 혼자서 해결이 되지 않아 도움 부탁드립니다.
-
미해결데이터 분석 SQL Fundamentals
dbeaver에 연결한 dbms에 따라 쿼리를 다르게 써야 하나요?
수업은 디비버에 postgre를 연결시켜서 쓰고 있는데, 만일 mysql을 디비버에 연결하면 mysql에 맞는 문법으로 쿼리를 적용해야 하는건가요?각 dbms마다 조금씩 문법이 다른걸로 알고 있어서 문의드립니다그리고, 수업에서 배우는 쿼리문은 posrgre에서만 사용할수 있는 문법인가요?
-
해결됨외워서 끝내는 네트워크 핵심이론 - 응용
할인 끝난건가요?
"외워서 끝내는 네트워크 핵심이론 - 기초"와"외워서 끝내는 SSL과 최소한의 암호기술"수강하고 싶은데 혹시 쿠폰 이벤트 해주시면...감사합니다.^^;;;;
-
미해결[개정판] 딥러닝 컴퓨터 비전 완벽 가이드
Cofidence threshhold 질문입니다!.
오른쪽 0.9 흰색 박스 안에 차의 Confidence threshold를 0.9라는 값이 나오는 것은 "유사도 90%미만의 이미지는 적용 하지 않는다."의 의미로 해석을 했는데, 이 때도 Object Localization을 통해 바운더리 박스를 찾고 난 뒤 그 이미지와의 유사도가 90%이하면 버린다. 라고 해석했는데 맞나요?
-
미해결홍정모의 따라하며 배우는 C언어
while(getchars() != '\n')continue;
scanf("%c %d %d", c, rows, cols)while(getchars() != '\n')continue; 에서 의문이 드는 점은 scanf로 입력을 받고 while문 안에있는 putchar에서 입력을 한번 더 받아야 하는거 아닌가요?
-
미해결유니티 머신러닝 에이전트 완전정복 (기초편)
학습 관련
안녕하세요, 수업 따라가면서 코드 오류는 없었지만 내용에 질문이 생겨 글 남기게 되었습니다. 드론 agent 스크립트 중 Heuristic()에서 키보드 입력을 주었을 때 OnActionReceived()로 전달되어 드론을 움직이는 것으로 이해했는데, 학습 과정에서는 키보드 입력 없이 드론이 어떤 방법으로 스스로 움직이며 학습을 하는 것인지 궁금합니다. 감사합니다!
-
미해결
Spring chart.js
spring chart 관련해서 질문드려요..spring chart 월별,일별,년도별 방문자수 에 따른 차트를 생성하려하는데 어려움을 겪고있습니다..혹시 관련 자료나 강의영상 또는 팁같은게 있으면 알려주시면 감사하겠습니다..