묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결스프링 DB 1편 - 데이터 접근 핵심 원리
트랜잭션 질문입니다.
트랜잭셔널 어노테이션 잘 쓰다가 갑자기 혼란이 와서요.. void updateName(string id){ person=repo.findById(id) person.setName() // 변경 감지에 의한 update 쿼리 } 이런경우에 트랜잭셔널 걸어줄 필요가 없다는 글을 봐서 혼란이 옵니다.. 제가 생각했을때는 findById로 조회하고--1setName으로 변경--2 여기서 1이 실행됐을때다른 트랜잭션B가 침투해서 해당 데이터를 임의로 바꿔주고 커밋까지 하면 2가 실행되는 순간 트랜잭션B가 그냥 무시되는것 아닌거 생각했어요.그래서 1,2는 무조건 atomic하게 연결되어야된다 생각을했는데.. 그래서 꼭 @Transactional 을 해줘야 한다고 생각했는데 아니라면 그 이유가 궁금합니다!
-
미해결비전공자를 위한 가장 쉬운 데이터분석 입문
apply lambda 질문
appy lambda 수면시간이 빈공간으로 나오는 이유가 무엇인가요?
-
미해결[리뉴얼] Node.js 교과서 - 기본부터 프로젝트 실습까지
req.params.title 질문
nodecat/routes/index.js 에서 해시태그 라우터에서 request(req, /posts/hashtag/${encodeURIComponent(req.params.hashtag)} 이 부분에서 params.hashtag를 encodeURI컴포넌트를 사용해서 v1에 있는 router.get('/posts/hashtag/:title' <--- 이부분에 title쪽에 인코드URI컴포넌트가 되었기때문에 Hashtag.findOne에서 where: req.params.title <---- 이부분을 다시 디코딩 해줘야하는거 아닌가요?
-
미해결따라하며 배우는 리액트 A-Z[19버전 반영]
Uncaught TypeError: Cannot read properties of null (reading 'scrollLeft')
안녕하세요 강사님. "<" ">"에 대한 클릭 이벤트에서 아래와 같은 에러가 나타며 양쪽 다 작동이 안됩니다 ㅠㅠ.. 제 코드는 이렇게 되어있고요.. 도와주세요ㅠㅠㅠ
-
미해결Vue.js 중급 강좌 - 웹앱 제작으로 배워보는 Vue.js, ES6, Vuex
store값 설정시 화면 애니메이션 효과사라짐
기존의 코드로 진행할때는 css를 입혔던 부분들이 잘 나타났습니다. 할일을 입력한다면 리스트에 실시간으로 반영이 되었습니다. 하지만 store값으로 설정을 바꾼 뒤에는 실시간 반영이 안되고 새로고침을 해야하는데 이유가 무엇인가요? 왜 실시간 반영이 안되며 실시간으로 반영이 되게하려면 어떻게 해야하나요?
-
미해결스프링 핵심 원리 - 기본편
policyMap과 polices에 아무것도 안 나옴
System.out.println("policyMap = " + policyMap);System.out.println("policies = " + policies);했을 때, 영상과 다르게 아무것도 나오지 않습니다.분명 영상 코드와 똑같이 쳤는데, 무엇을 확인하면 좋을지 알 수 있을까요?아래는 제가 작성한 AllBeanTest class 코드 입니다ㅡㅡㅡㅡㅡㅡpackage hello.core.autowored;import hello.core.AutoAppConfig;import hello.core.discount.DiscountPolicy;import hello.core.member.Grade;import hello.core.member.Member;import org.assertj.core.api.Assertions;import org.junit.jupiter.api.Test;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.context.ApplicationContext;import org.springframework.context.annotation.AnnotationConfigApplicationContext;import java.util.List;import java.util.Map;public class AllBeanTest { @Test void findAllBean() { // 이렇게 클래스를 두개 모두 등록하면, 두개 모두 땡겨와서 등록시켜줌 ApplicationContext ac = new AnnotationConfigApplicationContext(AutoAppConfig.class, DiscountService.class); DiscountService discountService = ac.getBean(DiscountService.class); Member member = new Member(1L, "userA", Grade.VIP); int discountPrice = discountService.discount(member, 10000, "fixDiscountPolicy"); Assertions.assertThat(discountService).isInstanceOf(DiscountService.class); Assertions.assertThat(discountPrice).isEqualTo(1000); int rateDiscountPrice = discountService.discount(member, 20000, "rateDiscountPolicy"); Assertions.assertThat(rateDiscountPrice).isEqualTo(2000); } static class DiscountService { private final Map<String, DiscountPolicy> policyMap; private final List<DiscountPolicy> policies; @Autowired public DiscountService(Map<String, DiscountPolicy> policyMap, List<DiscountPolicy> policies) { this.policyMap = policyMap; this.policies = policies; System.out.println("policyMap = " + policyMap); System.out.println("policies = " + policies); } public int discount(Member member, int price, String discountCode) { DiscountPolicy discountPolicy = policyMap.get(discountCode); return discountPolicy.discount(member, price); } }}
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
스프링 이니셜라이저의 디펜던시 부분
디펜던시 부분에서 Spring Web Starter 이라는게 검색되지않습니다. 찾던중 Spring Web 이라는 이름의 디펜던시를 찾았는데, 작게쓰인 세부 내용이 같아보입니다. 이걸로 add 해도 괜찮을까요?
-
미해결구글 애널리틱스4 (GA4) 미니 코스
GTM의 앱에서 활용방안에 대해 질문드립니다!
강의 넘 잘들었습니다 ㅎㅎ GA4와 GTM을 사용해보며 질문이 생겨서 강사님께 여쭤봅니다. 웹에서는 트리거 생성 시 페이지, 클릭, 스크롤 등의 다양한 트리거 유형으로 선택이 가능한데요, 반면 앱에서는 '맞춤설정'외에는 구체적인 설정은 불가능해보이더라구요. 만약 앱에서도 웹에서처럼 트리거 설정이 가능하다면 어떠한 방법으로 가능한가요? 예를들어 웹에서는 class나 id값을 이용하여 클릭 이벤트 트리거를 생성하는 것처럼요 :)
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
ENUM 타입 조회가 안됩니다
실습 도중 여러가지를 해보다 문제가 발생하여 질문드립니다. SQL 쿼리를 통해 조회할 경우 값이 보이나 JPQL을 실행할 경우 ENUM 컬럼 자체를 조회하지 못하는 문제가 있습니다. P.S. SELECT concat('', o.status) FROM Order as o JPA 쿼리를 위와 같이 비틀어서 사용하면 정상적으로 출력됨을 확인하였으나, 엔티티 자체를 select 하거나 new 키워드를 통해 VO, DTO 클래스 생성자로 매핑하는 방식은 불가능했습니다.
-
미해결스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
로그인 세션 방식
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]여기에 질문 내용을 남겨주세요. 안녕하세요!! 요즘은 세션 방식 말고 JWT토큰방식을 이용한다고 하는데 실무에서 정말 그러나요,?
-
해결됨Slack 클론 코딩[백엔드 with NestJS + TypeORM]
dms 의 서비스에서 코드를 봐도 모르겠는 부분이 있어서 질문합니다.
function getKeyByValue(object, value) { return Object.keys(object).find((key) => object[key] === value); } ... async getWorkspaceDMChats( url: string, id: number, myId: number, perPage: number, page: number, ) { return this.dmsRepository .createQueryBuilder('dms') .innerJoinAndSelect('dms.Sender', 'sender') .innerJoinAndSelect('dms.Receiver', 'receiver') .innerJoin('dms.Workspace', 'workspace') .where('workspace.url = :url', { url }) .andWhere( '((dms.SenderId = :myId AND dms.ReceiverId = :id) OR (dms.ReceiverId = :myId AND dms.SenderId = :id))', { id, myId }, ) .orderBy('dms.createdAt', 'DESC') .take(perPage) .skip(perPage * (page - 1)) .getMany(); } ... async createWorkspaceDMChats( url: string, content: string, id: number, myId: number, ) { const workspace = await this.workspacesRepository.findOne({ where: { url }, }); const dm = new DMs(); dm.SenderId = myId; dm.ReceiverId = id; dm.content = content; dm.WorkspaceId = workspace.id; const savedDm = await this.dmsRepository.save(dm); const dmWithSender = await this.dmsRepository.findOne({ where: { id: savedDm.id }, relations: ['Sender'], }); const receiverSocketId = getKeyByValue( onlineMap[`/ws-${workspace.url}`], Number(id), ); this.eventsGateway.server.to(receiverSocketId).emit('dm', dmWithSender); } ... 1. getKeyByValue가 어떠한 역할을 하나요? 소켓을 사용할 때 필요한 부분이라고 짐작만 하고 있습니다. 코드에 대한 간단한 해석과 역할을 간단하게 알려주시면 감사하겠습니다. 2. async getWorkspaceDMChats 기능에서 .innerJoinAndSelect('dms.Sender', 'sender') 부분이 헷갈립니다. dms라는 별칭과 Sender라는 테이블이 join 되는 부분이라고 생각하고 있었는데, Sender 라는 테이블이 존재했었나요?저는 여태까지 dms.Workspaces 이런식으로 DMs와 Workspaces 테이블을 join 하는 부분이라고 생각하고 있었는데 잘못 알고 있는건가요..? 3. async createWorkspaceDMChats 중 const dmWithSender 부분에서 2번과 비슷한 내용의 질문인데, relations: ['Sender']가 나오는데 이 부분 또한 테이블과의 관계를 나타내는 부분으로 알고있었는데 Sender라는 테이블이 존재하는건가요?
-
미해결
How much will scuba diving in Mallorca be a chilling experience for all?
For those who are accustomed to diving in cold waters, scuba diving in Mallorca can be a chilly experience. Luckily, when there is a need for thermal protection while diving in Mallorca, Scubanautic is here to deliver the necessary warmth. We offer a range of products that protect you from the cold water and allow you to enjoy your cave diving Mallorca as much as before. With products such as merino wool undersuits, balaclavas, neck gaiters, gloves, and more, we are confident that we have what it takes to suit your needs—no matter what they may be. Visit us today to find out which product is right for you.
-
미해결대세는 쿠버네티스 (초급~중급편)
설치 중 에러가 나서 문의 드립니다.
안녕하세요 virtualbox로 kubernetes를 사용하려고 설치하는 도중 vagrant up을 하였을때 다음과 같은 에러가 발생해서 문의 남깁니다. 해결할 수 있는 방법이 있을까요? There was an error while executing `VBoxManage`, a CLI used by Vagrantfor controlling VirtualBox. The command and stderr is shown below. Command: ["hostonlyif", "create"] Stderr: 0%...Progress state: NS_ERROR_FAILUREVBoxManage: error: Failed to create the host-only adapterVBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directoryVBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterfaceVBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg *)" at line 95 of file VBoxManageHostonly.cpp
-
해결됨아이폰 앱 개발 입문 2편
Xcode Version 13.4.1 (13F100)
Version 13.4.1 (13F100) 사용중입니다 image Literal 이 자동완성에 뜨지않아서.. 업그레이드버전에서 리터럴을 넣는법을 알고싶습니다!
-
미해결데이터 분석 SQL Fundamentals
case when 질문있습니다.
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. select * , case when sal_rn_desc = 1 then 'top' when sal_rn_asc = 1 then 'bottom' else 'middle' end as gubun 위 구문에서 case when 조건 when 조건 else '' end 로 한번에 case when 구절 안에 조건을 여러개 넣은걸까요? 미리 감사드립니다.
-
미해결웹 게임을 만들며 배우는 React
useRef 관련 질문 있습니다.
useRef와 useState의 차이는 화면 상의 리렌더링이 되냐 안되냐의 차이로 알고 있습니다. 하지만 useState로 interval을 설정해도 잘 되어서 왜 useRef를 쓰신것인지 궁금해서 여쭤봅니다!
-
미해결10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
문제를 풀었다고 생각했는데 75%에서 틀립니다. 뭐가 문제일까요 ㅜㅜ
기준을 배열 내에 있는 가장 높은 높이로 잡았습니다. 강수량이 배열 내부에서 가장 높은 높이보다 같거나 크다면 안전지역이 없는 것이니 0이 나온다고 생각했습니다. 배열 내부 최대값 보다 작은 것 중에 찾으면 되겠다고 생각하고 문제에 접근했습니다. 어느 부분을 잘못생각할 걸까요? ㅠㅠ #include<bits/stdc++.h> using namespace std; int n, m,ret=0, nx, ny, x, y, ma = 0; int max_len; int h[104][104]; bool sc[104][104]; set<int> _set; int dy[4] = {-1,0,1,0}; int dx[4] = {0,1,0,-1}; void dfs(int y, int x, int m){ sc[y][x] = 1; for (int i =0; i<4; i++){ ny = y + dy[i]; nx = x + dx[i]; // 인덱스로 표현하면 n보다 하나 작아야하니깐 n까지 포함시켜서 커지면 안됨 if(nx < 0 || ny < 0 || nx >= n || ny >= n) continue; if(h[ny][nx] > m && !sc[ny][nx]){ dfs(ny,nx,m); } } } int main(){ cin >> n; for (int i =0; i < n; i++){ for (int j = 0;j < n; j++){ cin >> h[i][j]; if(h[i][j] > max_len){ max_len = h[i][j]; } } } for (int i = 1 ; i < max_len; i++){ m = i; int ret = 0; fill(&sc[0][0],&sc[0][0] + 104*104,0); for (int i =0; i <= n; i++){ for (int j = 0;j < n; j++){ if(h[i][j] > m && !sc[i][j]){ dfs(i,j,m); ret++; } } } if(ma <= ret) { ma = ret; } } cout << ma << "\n"; return 0; }
-
미해결스프링 핵심 원리 - 기본편
ComponentScan과 Configuration 어노테이션을 같이 사용하는 이유
=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? 예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예[질문 내용]강의 내용 85쪽 AutoAppConfig 클래스의 @Configuration 어노테이션이 있을때와 없을 때 모두, AnnotationConfigApplicationContext의 생성자 인자로 AutoAppConfig.class를 넘겨줬을 때 싱글턴 패턴을 보입니다. (각 컴포넌트의 생성자에 로그성 코드를 심어둠) @Configuration 어노테이션을 붙이는것과 붙이지 않는것에 차이가 존재하나요? 그렇다면 그것이 무엇인지 알 수 있을까요? 추가적으로 https://www.baeldung.com/spring-component-scanning 다른 참고문서도 찾아보았는데, we use the @ComponentScan annotation along with the @Configuration annotation to specify the packages that we want to be scanned라는 문구에서, 컴포넌트 스캔을 시작할 위치는 @ComponentScan의 basePackages 필드로 설정하는것으로 사료되는데 더더욱 이해가 되지 않아 질문드립니다.
-
미해결비전공자를 위한 풀스택 맛집지도 만들기 프로젝트!: Front, Back-end 그리고 배포까지
winSCP 연결문제
디렉토리 구조가 완전 달라서 당황스러운데 다시 다운받아서 설정해도 원래 설정이 그대로 가져와 져서 똑같이 설정되더라구요 ... 어디서 부터 다시 해야 할까요 ㅜㅠㅜㅠㅜ
-
해결됨처음 만난 리액트(React)
NotificationList.jsx 챕터 6장 실습 내용 질문 - 동시에 2개씩 나옴
요약: 3개가 각각 1-1-1 로 1초 간격으로 나와야 하지만, 2-1 로 나옴. 즉 2개가 한번에 나오고 나머지 1개가 나옴, notification 개수를 5개로 늘려봤더니, 1-1-1-1-1이 나와야 하지만 2-2-1로 나옵니다. 어디가 문제일까요.. 1. NotificationList import React from "react"; import Notification from "./Notification"; const reservedNotifications = [ { message: "안녕하세요, 오늘 일정을 알려드립니다.", }, { message: "오전은 피곤합니다", }, { message: "점심식사 시간입니다.", }, { message: "30분 후 잠시 휴식하겠습니다.", }, { message: "퇴근합시다.", }, ]; var timer; class NotificationList extends React.Component { constructor(props){ super(props); this.state = { notifications: [], }; } componentDidMount() { const { notifications } = this.state; timer = setInterval( () => { if (notifications.length < reservedNotifications.length){ const index = notifications.length; notifications.push(reservedNotifications[index]); this.setState({ notifications : notifications }); } else { clearInterval(timer); } }, 5000); } render() { return ( <div> {this.state.notifications.map((notification) => { return <Notification message={notification.message}/>; })} </div> ); } } export default NotificationList; 2. Notification import React from "react"; const styles = { wrapper: { margin: 8, padding: 8, display: "flex", flexDirection: "row", border: "1px solid grey", borderRadius: 16 }, messageText: { color: "black", fontSize: 16 } }; class Notification extends React.Component { constructor(props) { super(props); this.state = {}; } render() { return ( <div style={styles.wrapper}> <span style={styles.messageText}>{this.props.message}</span> </div> ) } } export default Notification; 도와주세요!