묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
빌드된 Jar파일 실행시 "/"(Welcome Page)에서 404에러
jar파일을 실행하여 하여 웹서버를 열었을 때, "/hello" 에서는 화면이 잘 나오는데, "/" 루트 경로에서는 404에러가 나옵니다. (intellij에서 Run 했을때는 루트 경로에서도 잘 나왔습니다.) 혹시 "templates/..." 안의 html파일들은 인식하는데 "static/index.html"은 빌드시 인식을 못하는걸까요?
-
해결됨스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
현업에서 스프링-컨버터 를 객체매퍼 대용으로 사용을 하사는지에 대한 질문입니다.
안녕하세요 강사님!약간 Mapper 에 치중된 질문이 될 수도 있을것 같습니다. 저는 , 스프링 컨버전서비스를 활용할 줄 몰라, 스프링의 ObjectMapper 와 MapStruct 를 병행으로 매핑작업을 하고 있었는데요 `매핑작업`은 , Dto < > Entity 필드값 매핑을 의미합니다. 이번강의를 통해 `컨버전서비스`의 강력한 기능을 보고, 추가 라이브러리 Mapper(MapStruct) 가 필요없겠다는 생각이 들었습니다.(그래도 컴파일 시점에 매핑로직이 생성되는것은 환상적인 기능 같습니다^^) 그리고, 어디선가 강사님의 답글을 읽은 바 로는, 객체매퍼를 (ModelMapper, MapStruct 등) 추가로 사용을 않하시는 것으로 알고있습니다. 그래서 매퍼를 써야할지 고민을 꾸준히 해왔었는데요, 질문입니다 외부 LIB매퍼를 사용안하시는 이유가 , `객체매핑(DTO 엔티티 필드값 매핑)` 이 컨버터/포멧터 를 통해서도 가능하기 때문.이라 추측해도 될까요..? 조심스래 여쭤보아요.. 스프링 ConversionService 를 객체매퍼로 활용하는 것과, 업무처리 효율에 도움이 될지 강사님의 견해를 알고싶습니다. 객체매퍼 라이브러리를 지금도 사용을 쭉 안하시는지(수작업 매핑 선호),혹시 사용 중이시거나, 사용계획이 있으시다면, 어떤 라이브러리를 사용하실 지가 궁금합니다. 읽어주셔서 고맙습니다.
-
미해결C#과 유니티, 실전 게임으로 제대로 시작하기 (저자 직강)
콘솔창 문의 드립니다!
선생님 안녕하세요! 어제부터 갓 시작했는데 스크립트 강의에서 콘솔창에 결과값이 Hello World 할때는 떴었는데 그 이후에는 콘솔창에 결과값이 안뜨더라구요 계속해보고 찾아봐도 왜그런지 정보를 못찾겠더라구요...그러다 우연히 발견했는데 스크립트 이름을 바꿀경우에 오브젝트에 적용할때 체크표시창이 아예 없더라구요... 혹시 이 문제가 맞는건가요? 맞다면 체크창이 왜 없는걸까요ㅜㅜ
-
미해결스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술
csr 관련 질문있습니다!
csr을 하고자 할 때, 백엔드(spring)와 프론트엔드(react)가 동일한 환경에 있다면 localhost 서버 내에서 api 통신이 가능할 것 같습니다. 그렇다면 백엔드와 프론트엔드가 각각 독립된 환경에 있다면 api 통신을 어떻게 할 수 있는 건가요?
-
해결됨[C++과 언리얼로 만드는 MMORPG 게임 개발 시리즈] Part1: C++ 프로그래밍 입문
상수 참조 매개변수
template<typename T> class Node { public: Node() : _next(nullptr), _prev(nullptr), _data(T()) { } Node(const T& value) : _next(nullptr), _prev(nullptr), _data(value) { } public: Node* _next; Node* _prev; T _data; }; STL 리스트를 강좌를 듣다가 궁금한 점이 있어서 연속 질문 드립니다. 생성자에서 왜 cosnt T& value로 매개변수로 사용하는지 .. 잘 이해가 안갑니다. 참조변수를 받으려면 멤버변수가 T* _data로 포인터형이어야 되는것 아닌가 생각이 드는데 제가 뭘 잘못 알고 있는것인지 궁금합니다.
-
해결됨실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
IllegalStateException : Failed to load ApplicationContext오류가 자꾸 발생합니다.
3시간 정도 해결하다가 안되서.. 일단 오류 내용은 이렇습니다.. java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:123) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:244) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: No identifier specified for entity: jpabook.jpashop.Member at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:609) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1159) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:122) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) ... 27 more Caused by: org.hibernate.AnnotationException: No identifier specified for entity: jpabook.jpashop.Member at org.hibernate.cfg.InheritanceState.determineDefaultAccessType(InheritanceState.java:266) at org.hibernate.cfg.InheritanceState.getElementsToProcess(InheritanceState.java:211) at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:781) at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:248) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:239) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:282) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1224) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1255) at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1847) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1784) ... 43 more MemberRepositoryTest입니다! package jpabook.jpashop;import org.assertj.core.api.Assertions;import org.junit.Test;import org.junit.runner.RunWith;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.test.context.SpringBootTest;import org.springframework.test.annotation.Rollback;import org.springframework.test.context.junit4.SpringRunner;import org.springframework.transaction.annotation.Transactional;@RunWith(SpringRunner.class)@SpringBootTestpublic class MemberRepositoryTest { @Autowired MemberRepository memberRepository; @Test @Transactional public void testMember() throws Exception{ //given Member member = new Member(); member.setUsername("memberA"); //when Long savedId = memberRepository.save(member); Member findMember = memberRepository.find(savedId); //then Assertions.assertThat(findMember.getId()).isEqualTo(member.getId()); Assertions.assertThat(findMember.getUsername()).isEqualTo(member.getUsername()); }} MemberRepository입니다 package jpabook.jpashop;import jpabook.jpashop.Member;import lombok.extern.java.Log;import org.springframework.stereotype.Repository;import javax.persistence.EntityManager;import javax.persistence.PersistenceContext;@Repositorypublic class MemberRepository { @PersistenceContext private EntityManager em; public Long save(Member member) { em.persist(member); return member.getId(); } public Member find(Long id) { return em.find(Member.class, id); }} application.yml입니다! 그리고 질문란에 써있는데로, H2를 실행한 상태이고, jpashop.mv.db도 만들어져 있습니다. 또 혹시 제가 코드를 잘못 작성했을까봐 강의자료에 나와있는 자료들을 모두 복붙하였습니다. gradle까지 복붙했습니다.. 그런데 자꾸 오류가 생성되어 여쭤보게 되었습니다. 감사합니다! 추가로 컴퓨터도 껐다 켜봤습니다! 또 추가적으로, 그 영한님이 주신 강의 소스코드로 전체 완성본은 또 돌아가더라고요.. 그래서 더더욱 뭐가 문제인지를 모르겠습니다 ㅠㅠ
-
해결됨[C++과 언리얼로 만드는 MMORPG 게임 개발 시리즈] Part2: 게임 수학과 DirectX12
장치초기화 강의편에서 오류가 납니다..
이런식으로 동적할당을 해줬는데도 같은 오류가 납니다
-
미해결파이썬 무료 강의 (기본편) - 6시간 뒤면 나도 개발자
self. 은 왜 입력하는건가요? class에서 기본으로 들어가야하나요?
self. 은 왜 입력하는건가요? class에서 기본으로 들어가야하나요?
-
해결됨객체 지향 프로그래밍 입문
의존 주입 예제 관련 질문입니다.
의존 주입 관련 질문입니다. (동영상 5:13초)코드 예제에서 오른쪽 하단에 schSvc.setCalculator(cal); 코드가 존재하고 있습니다.Q1. 왜 SchSvc.setCalculcator(cal);은 굳이 생성자를 통해서 의존 주입을 하지 않나요? Q2. 혹시 SchSvc.setCalculator(cal);의 이유가 생성된 이후에도 여러 번 setCalculator을 통해 ScheduleService의 cal 필드 변경이 필요해서 일까요? Q3. Q2의 질문의 답변이 만약 맞는 경우(생성된 이후 여러 번 setCalculator를 통해 계산법 변경이 필요하다) setter는 지양해야 된다는 한 블로그를 보게 되었습니다.(출처: https://velog.io/@sezeom/Getter-Setter-%EC%A7%80%EC%96%91%ED%95%98%EA%B8%B0) 혹시 setCalculator 방식 말고 ScheduleService 객체가 이미 생성된 이후에도 private Calculator cal을 변경 시킬 수 있는 다른 방법이 있을까요? 지금 떠오르는 것은 setter로 cal을 갱신하는 것이 아닌 계산과 관련된 메소드를 만들고, 메소드의 파라미터를 계산 기능과 관련된 추상화를 통한 객체 다형성을 통해 해결하는 방법 밖에 생각이 나지 않습니다. 그 외 다른 방법이 존재할까요? Q4. Q3과 연관된 질문인데 만일 조립을 통해 생성된 객체가 생성된 이후 특정 상황에 따라 조립을 통해 생성된 객체가 다른 객체로 변경이 필요한 경우에는 setter(조립된 객체를 저장한 특정 필드를 변경) 말고 다른 방법을 통해 조립을 통해 이미 생성된 객체를 변경이 가능할까요? 기존 강의의 여러 내용을 훑어보았지만 마땅한 해결책이 떠오르지 않습니다. 이 경우는 조립을 쓰지 않는 게 답일까요? 아니면 다른 좋은 해결 방법이 존재하는 지 궁금합니다. Q5. 어떤 특정한 경우에는 새로운 객체를 생성하지 않고 기존 생성한 객체를 계속 사용하면서 setter 등을 통해서 기능을 바꾸어야 할 때가 있을 것 같습니다.(억지 예시로 생성에 비용이 큰 객체는 매번 재생산 시 비용의 부담이 있을수도 있어서 static을 통해 한번만 생성하고 여러 상황에 맞게 setter 등을 통해 기능을 바꾼다. 기능 기능과 책임의 분리 측면에서는 맞지 않지만 아주 억지적인 가정을 한다면요...) 이 때 setter 방식보다는 메소드의 파라미터를 통해서 기능을 메소드 내에서만 사용하도록 하는 방식이 객체지향에 알맞지 않을까 싶습니다. 근데 위 내용의 반론으로 만약 동일한 기능을 여러 메소드에게 공통적으로 전달하여 사용하고 setter 변경 주기가 짧은 편이 아니라면 어쩌면 setter 한번 쓰고 메소드의 파라미터로 기능을 전달하지 않고 메소드를 사용하는 게 옳을수도 있겠다는 생각이 듭니다. 하지만 또 생각해보면 setter를 통해 객체를 전달한 것 자체가 setter로 전달된 객체는 private일지라도 캡슐화 된 객체 내에서 다른 메소드가 접근이 가능해서 오류가 발생하지 않을까 싶기도 합니다.혹시 강사님이 생각하시는 좋은 해결법이 존재할까요?이상입니다.감사합니다.[기타 잡소리]강의 잘 보고 있습니다. 벌써 마지막에 강의에 가까워지네요.객체지향이 이렇게 신기한 건지 몰랐습니다. 강사님 책 중 개발자가 반드시 정복해야 할 객체 지향과 디자인 패턴 책을 오늘 서점에서 구매했습니다.해당 강의 다 보고 책 다시 정독하고 싶네요.좋은 하루 되세요
-
미해결인터랙티브 개발 실무 끝장내기 [역량 강화편]
title.querySelectorAll('div')[i]에 대해 질문 있습니다.
title의 하위 div에 각각 ".text"라는 클래스를 부여하고 .text 클래스를 titleText라는 변수에 할당했습니다. 그리고나서 텍스트 모션을 위한 for문을 동작하는데 트윈맥스가 작동하지 않아 질문드립니다. 첫 번째, 제가 작성한 코드는 어떤 오류때문인가요. f12에는 아무것도 나타나지 않았습니다. 두 번째, for문을 작성하실 때, title의 하위 div 속성을 변수로 할당해서 간편히 작성하신게 아니라 일부로 title.querySelectorAll('div').length와 title.querySelectorAll('div')[i]처럼 길게 작성하셨습니다. 따로 이유가 있으실까요?
-
해결됨스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
검증 질문 입니다
1. 필요한 검증 애노테이션이 존재하지 않는 경우 직접 구현하는데 강의에서 오브젝트 오류를 Controller 내부에서 구현한 것처럼 Controller 내부에서 구현하나요? 2. 1번이 답이 아니라면 Validator 인터페이스를 상속받아 구현한 검증기를 사용하여 검증하나요? 제가 jsp로 공부했을때 회원 가입시 비밀번호확인 하는 로직을 구현했을때 사용자 정의 Validator를 구현한게 생각나서 질문 드립니다.
-
미해결[리뉴얼] Node.js 교과서 - 기본부터 프로젝트 실습까지
passport 사용 시 localstrategy 부분에서 오류가 나는 것 같습니다
안녕하세요. passport local 로그인 실습을 하다가 막히는 부분이 있어 질문드립니다. 현재 postman으로 실험 시 회원가입은 정상적으로 진행이 되는 것 같은데, postman으로 로그인 시도 시 다음과 같은 오류코드가 발생합니다. Error: Invalid value <ref *1> IncomingMessage { _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: BufferList { head: null, tail: null, length: 0 }, length: 0, pipes: [], flowing: true, ended: true, endEmitted: true, reading: false, sync: false, needReadable: false, emittedReadable: false, readableListening: false, resumeScheduled: false, errorEmitted: false, emitClose: true, autoDestroy: false, destroyed: false, errored: null, closed: false, closeEmitted: false, defaultEncoding: 'utf8', awaitDrainWriters: null, multiAwaitDrain: false, readingMore: false, decoder: null, encoding: null, [Symbol(kPaused)]: false }, _events: [Object: null prototype] { end: [Function: clearRequestTimeout] }, _eventsCount: 1, _maxListeners: undefined, socket: Socket { connecting: false, _hadError: false, _parent: null, _host: null, _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 8, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: true, _sockname: null, _pendingData: null, _pendingEncoding: '', server: [Server], _server: [Server], parser: [HTTPParser], on: [Function: socketListenerWrap], addListener: [Function: socketListenerWrap], prependListener: [Function: socketListenerWrap], _paused: false, _httpMessage: [ServerResponse], _peername: [Object], [Symbol(async_id_symbol)]: 78, [Symbol(kHandle)]: [TCP], [Symbol(kSetNoDelay)]: false, [Symbol(lastWriteQueueSize)]: 0, [Symbol(timeout)]: null, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]: null, [Symbol(kBufferGen)]: null, [Symbol(kCapture)]: false, [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0, [Symbol(RequestTimeout)]: undefined }, httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, headers: { 'content-type': 'application/json', 'user-agent': 'PostmanRuntime/7.29.0', accept: '*/*', 'postman-token': '667cd00d-55cb-434f-80ee-6800fe7e4d60', host: 'localhost:3000', 'accept-encoding': 'gzip, deflate, br', connection: 'keep-alive', 'content-length': '76', cookie: 'connect.sid=s%3Atv5OOUthLZaPN8ZQChSAm4qaJB0CZbgU.MrtvXtMcWOoYkXGY0dY4H%2F6tGs25VsY8vJoRPQvx%2FMI' }, rawHeaders: [ 'Content-Type', 'application/json', 'User-Agent', 'PostmanRuntime/7.29.0', 'Accept', '*/*', 'Postman-Token', '667cd00d-55cb-434f-80ee-6800fe7e4d60', 'Host', 'localhost:3000', 'Accept-Encoding', 'gzip, deflate, br', 'Connection', 'keep-alive', 'Content-Length', '76', 'Cookie', 'connect.sid=s%3Atv5OOUthLZaPN8ZQChSAm4qaJB0CZbgU.MrtvXtMcWOoYkXGY0dY4H%2F6tGs25VsY8vJoRPQvx%2FMI' ], trailers: {}, rawTrailers: [], aborted: false, upgrade: false, url: '/login', method: 'POST', statusCode: null, statusMessage: null, client: Socket { connecting: false, _hadError: false, _parent: null, _host: null, _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 8, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: true, _sockname: null, _pendingData: null, _pendingEncoding: '', server: [Server], _server: [Server], parser: [HTTPParser], on: [Function: socketListenerWrap], addListener: [Function: socketListenerWrap], prependListener: [Function: socketListenerWrap], _paused: false, _httpMessage: [ServerResponse], _peername: [Object], [Symbol(async_id_symbol)]: 78, [Symbol(kHandle)]: [TCP], [Symbol(kSetNoDelay)]: false, [Symbol(lastWriteQueueSize)]: 0, [Symbol(timeout)]: null, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]: null, [Symbol(kBufferGen)]: null, [Symbol(kCapture)]: false, [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0, [Symbol(RequestTimeout)]: undefined }, _consuming: true, _dumped: false, next: [Function: next], baseUrl: '/auth', originalUrl: '/auth/login', _parsedUrl: Url { protocol: null, slashes: null, auth: null, host: null, port: null, hostname: null, hash: null, search: null, query: null, pathname: '/login', path: '/login', href: '/login', _raw: '/login' }, params: {}, query: {}, res: ServerResponse { _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: false, chunkedEncoding: false, shouldKeepAlive: true, _defaultKeepAlive: true, useChunkedEncodingByDefault: true, sendDate: true, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: null, _hasBody: true, _trailer: '', finished: false, _headerSent: false, socket: [Socket], _header: null, _keepAliveTimeout: 5000, _onPendingData: [Function: bound updateOutgoingData], _sent100: false, _expect_continue: false, req: [Circular *1], locals: [Object: null prototype] {}, _startAt: undefined, _startTime: undefined, writeHead: [Function: writeHead], __onFinished: [Function], end: [Function: end], [Symbol(kCapture)]: false, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype] }, _startAt: [ 779390, 642704127 ], _startTime: 2022-02-06T14:57:51.132Z, _remoteAddress: '::1', body: { email: 's2s2ss@naver.com', name: 'ddd', password: '12343' }, _body: true, length: undefined, secret: 'nodepracticesecret', cookies: {}, signedCookies: [Object: null prototype] { 'connect.sid': 'tv5OOUthLZaPN8ZQChSAm4qaJB0CZbgU' }, _parsedOriginalUrl: Url { protocol: null, slashes: null, auth: null, host: null, port: null, hostname: null, hash: null, search: null, query: null, pathname: '/auth/login', path: '/auth/login', href: '/auth/login', _raw: '/auth/login' }, sessionStore: MemoryStore { _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, sessions: [Object: null prototype] {}, generate: [Function (anonymous)], [Symbol(kCapture)]: false }, sessionID: '8oW9NcDPX2SJzfB5KT6guRURg59uUftq', session: Session { cookie: [Object] }, flash: [Function: _flash], _passport: { instance: [Authenticator] }, logIn: [Function (anonymous)], login: [Function (anonymous)], logOut: [Function (anonymous)], logout: [Function (anonymous)], isAuthenticated: [Function (anonymous)], isUnauthenticated: [Function (anonymous)], _sessionManager: SessionManager { _key: 'passport', _serializeUser: [Function: bound ] }, route: Route { path: '/login', stack: [Array], methods: [Object] }, [Symbol(kCapture)]: false, [Symbol(RequestTimeout)]: undefined } at Object.escape (/Users/macintosh/Desktop/node_practice/node_practice/node_modules/sequelize/dist/lib/sql-string.js:52:11) at MySQLQueryGenerator.escape (/Users/macintosh/Desktop/node_practice/node_practice/node_modules/sequelize/dist/lib/dialects/abstract/query-generator.js:709:22) at MySQLQueryGenerator.whereItemQuery (/Users/macintosh/Desktop/node_practice/node_practice/node_modules/sequelize/dist/lib/dialects/abstract/query-generator.js:1733:102) at /Users/macintosh/Desktop/node_practice/node_practice/node_modules/sequelize/dist/lib/dialects/abstract/query-generator.js:1646:25 at Array.forEach (<anonymous>) at MySQLQueryGenerator.whereItemsQuery (/Users/macintosh/Desktop/node_practice/node_practice/node_modules/sequelize/dist/lib/dialects/abstract/query-generator.js:1644:35) at /Users/macintosh/Desktop/node_practice/node_practice/node_modules/sequelize/dist/lib/dialects/abstract/query-generator.js:1752:30 at Array.map (<anonymous>) at MySQLQueryGenerator._whereGroupBind (/Users/macintosh/Desktop/node_practice/node_practice/node_modules/sequelize/dist/lib/dialects/abstract/query-generator.js:1751:21) at MySQLQueryGenerator.whereItemQuery (/Users/macintosh/Desktop/node_practice/node_practice/node_modules/sequelize/dist/lib/dialects/abstract/query-generator.js:1702:19) (node:8940) UnhandledPromiseRejectionWarning: TypeError: done is not a function at Strategy._verify (/Users/macintosh/Desktop/node_practice/node_practice/passport/localStrategy.js:30:13) (Use `node —trace-warnings …` to show where the warning was created) (node:8940) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `—unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:8940) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. PromiseRejectionWarning 부분이 async await 에러 핸들링을 안 해줘서 생긴다고 하는데, 교재에 나와있는대로 localstrategy부분의 에러 핸들링 부분은 교재와 비슷하게 적은 것 같은데...왜 오류가 나는지 잘 모르겠습니다ㅠㅠ //localStrategy.js const passport = require('passport'); const localStrategy = require('passport-local').Strategy; const bcrypt = require('bcrypt'); const { user } = require('../models'); module.exports = () => { passport.use(new localStrategy({ passReqToCallback : true, usernameField:'email', passwordField:'password', }, async (email, password, done) => { try{ const exUser = await user.findOne({where:{email}}); if (exUser) { const result = await user.findOne({where:{password}}); // const result = await bcrypt.compare(password, exUser.password); if(result){ done(null, exUser); } else { done(null, false, {message:'비밀번호가 불일치'}); } } else { done(null, false, {message:'가입되지 않은 회원입니다'}); } } catch (err) { console.error(err); done(err); } } )); }; 위의 코드는 passport/localStrategy.js 파일이며, 아래 코드는 routes/auth.js 파일입니다. const express = require('express'); const passport = require('passport'); const bcrypt = require('bcrypt'); const { isLoggedIn, isNotLoggedIn } = require('./middlewares'); const { user } = require('../models'); const router = express.Router(); //회원가입 라우터 router.post('/join', isNotLoggedIn, async (req,res,next) => { const { email, name, password } = req.body; try { const exUser = await user.findOne({where:{ email }}); if (exUser) { req.flash('joinError', '이미 가입된 이메일입니다') return res.redirect('/join') } await user.create({ email, name, password, }); return res.redirect('/'); } catch (error) { console.error(error); return next(error); } }); //db 확인 router.get('/list', async(req,res)=>{ try{ const rows = await user.findAll(); if (rows) return res.status(200).json({result : rows}); else throw console.log(error); } catch(err){ console.error(err); } }); //로그인 라우터 router.post('/login', isNotLoggedIn, (req,res,next)=>{ //로컬 로그인 전략 성공 시 수행되는 매서드 passport.authenticate('local', {session: false}, (authError, user, info)=>{ if (authError){ console.error(authError); return next(authError); } if (!user) { req.flash('login-error', info.message); return res.redirect('/'); } console.log(user); return req.login(user, (loginError) =>{ if (loginError) { console.error(loginError); return next(loginError); } return res.redirect('/'); }); })(req, res, next); }); //로그아웃 라우터 router.get('/logout', isLoggedIn, (req,res)=>{ req.logOut(); req.session.destroy(); res.redirect('/'); }); module.exports = router;
-
미해결[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part2: 자료구조와 알고리즘
RemoveAt 질문
16:33초 부터 진행하는 RemoveAt 관련 질문입니다. _data[i] = _data[i+1] 뒤에 있던 친구들이 앞으로 들어가는 부분은 이해했는데 17:45분 부터 18:20 말씀하시는 for문의 조건 Count, Count -1의 범위 부분을 제대로 이해하지 못하겠습니다 ㅠㅠ
-
해결됨[C++과 언리얼로 만드는 MMORPG 게임 개발 시리즈] Part4: 게임 서버
condition_variable 파트 질문입니다.
강사님 제가 이해한 부분이 맞는지 궁금합니다. 제가 처음에 이해한 부분입니다. 1. Consumer에서 먼저 잡은 lock을 한 경우 unlock 후 대기, Producer에서 lock을 하고 push한 후, cv.notify_one()을 실행한다. 2. Consumer에서 먼저 잡은 경우는 cv.wait()에서 lock을 걸고 진행하고, 늦게 잡은 경우도 unique_lock에서 lock을 건다. 3. Consumer에서 끝나면 Producer는 이미 계속 lock을 걸려고 하고 있으므로, 1, 2번을 반복한다. 위의 경우라면 큐의 사이즈가 0 1 0 1 0 1...이 반복되서 결과 값이 0 0 0 0... 이 된다고 생각했습니다. 하지만 결과 값은 확 늘었다가 1씩 줄어들다가 또 확 늘었다가 1씩 줄어들다를 반복하였습니다.(결과적으로 몇천, 몇만, 몇십만까지 증가하였습니다.) 코드의 첫 번째 주석대로 Producer를 기준으로 큐의 사이즈 값을 출력하니 0 0 0 0... 까지는 아니지만 모든 수가 4미만으로 나옵니다. Producer에서 lock을 해제할 경우 Consumer에서 접근이 가능하지만 조건이 걸려있어 0미만으로는 가지 않을 것이고, Consumer에서 lock을 해제할 경우 Producer에서 여러 번 값을 넣는 경우라면 이해는 갑니다. 위 경우를 생각하여 Producer에게 sleep_for 함수를 적용해서 코드의 두 번째 주석을 넣고 실행하니 기존 답에서 모든 수가 4미만으로 나왔습니다. 말이 길었습니다.. 질문입니다. 제가 이해한 경우가 맞는지 아니면 멀티쓰레드 쪽의 개념이 포괄적으로 이해해야 될까요? 강사님이 말씀하신대로 뇌가 말랑해지기위해 노력중입니다. mutex m; queue<int32> q; condition_variable cv; void Producer() { while (true) { { unique_lock<mutex> lock(m); q.push(100); } cv.notify_one(); //cout << q.size() << endl; //this_thread::sleep_for(0.001ms); } } void Consumer() { while (true) { unique_lock<mutex> lock(m); cv.wait(lock, []() {return q.empty() == false; }); int32 data = q.front(); q.pop(); cout << q.size() << endl; } }
-
미해결[백문이불여일타] 데이터 분석을 위한 고급 SQL
고급반 서브쿼리 해커랭크 challenges 문제 질문
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 해설에서는 count(*)를 사용했는데 count(challenge_id)를 사용하면 왜 값이 다른지 이해가 잘 되지 않습니다. 부연 설명으로 max(challenge_id)를 하면 50이 나오게 되어 같은 원리로 select hacker_id, count(challenge_id) as cnt from challenges group by hacker_id ) as suq_t2 group by cnt having count(challenge_id) = 1 을 하게 되면 hacker_id 당 카운트가 1번인 걸 뜻하는 걸로 나올 거라 예상했는데 횟수가 1번인 것만 나오게 되네요. select hacker_id, count(challenge_id) as cnt from challenges group by hacker_id ) as suq_t2 group by cnt having count(cnt) = 1 아래는 쿼리 전문을 첨부합니다. /* Enter your query here. */ select h.hacker_id ,h.name ,count(challenge_id) as cnt from Hackers as h inner join Challenges as c on h.hacker_id = c.hacker_id group by h.hacker_id,h.name having cnt in ( select max(cnt) from ( select hacker_id, count(challenge_id) as cnt from challenges group by hacker_id) as suq_t1) or cnt in ( select cnt from ( select hacker_id, count(challenge_id) as cnt from challenges group by hacker_id ) as suq_t2 group by cnt having count(challenge_id) = 1 ) order by 3 desc , 1 asc
-
미해결엑셀 매크로와 VBA 기초부터 실무활용까지 완전 정복
2강 (행 숨기기) 매크로
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 안녕하세요?2강 강의를 보고 업무에 활용하려는 직장인입니다. 다름이 아니라 2강에서 행 숨기기 매크로를 실행하니까 여러 행을 스크롤 안 해도 데는 장점이 있어서요제가 매일 입력하는 파일도 지점별/품목별(고정)/수량/금액 계산식 이렇게 스크롤할께 많습니다. 즉, 매번 입력을 하는데 짜증을 유발합니다. 그래서 강의에 알려주신 행숨기기 매크로를 활용할려고 합니다. 그런데그 엑셀파일이 모든 구성원과 공유해야햐는 파일이어서요 혹여 제가 실수를 할 수 도 있어서 먼저 질문 드립니다. 1. 행숨기기 매크로 파일에서 자료를 입력하고 저장후(매크로 파일 형태로 저장 후 ) 수정또는 내용 삭제가 가능할까요?!2. 매크로가 전체/지점 여러군데 만들건데요전체 매크로 실행후 ->통합엑셀파일(확장자 .xlsx)로 별도로 저장 후 업무 공유를 하는게 바람직할까요?즉, 매크로 파일과는 별도로 업무에 올리는 파일은 엑셀파일(매크로)제외 파일로 만드는게 안전하겠죠?!제가 입사한지 얼마 안되었지만 이 강의를 수강하는 목표도 업무를 빠르게 하고 잘 하고 싶어서 그렇습니다. 그런데 제가 배운지 얼마 안 되었는데 실수할까봐 걱정이 되서요 답변 부탁드리겠습니다! 연관 태그 # 매크로# VBA
-
미해결자바 ORM 표준 JPA 프로그래밍 - 기본편
@Entity와 @Table 질문드립니다
지금 강의 내용과는 조금 다르긴 합니다만 이해가 잘 안가서요 @Entity를 붙이면 해당 객체는 JPA가 관리하는게 되고, @Table을 붙이면 해당 객체의 필드를 바탕으로 db에 자동으로 테이블이 만들어지는 건가요? 그리고 만들어진 테이블이 엔티티와 매핑되는게 맞을까요? @Table의 name속성을 지정하지 않으면 테이블이 만들어질 때 이름이 엔티와 똑같이 되는거고, 지정해주면 해당 이름으로 테이블이 만들어져서 엔티티와 매핑이 되는건지 궁금합니다
-
미해결홍정모의 따라하며 배우는 C++
resize 함수 작성 중 문제가 있어 질문드립니다.
resize함수 작성 중에 위와 같이 배열의 길이를 저장하는 length의 길이를 변경하는 코드를 넣으면 아래와 같은 런타임 에러가 발생합니다 힙 버퍼 종료 후에 메모리에 작성을 했다는데, 어떤 의미인지 이해가 되지 않아서 질문 드립니다. 전체 코드 : class IntArray { private: int m_length = 0; int* m_ptr = nullptr; public: //Constructors IntArray(const int &length) :m_length(length) { m_ptr = new int[length]; } IntArray(const std::initializer_list<int>& list) : IntArray(list.size()) { int count = 0; for (auto& e : list) { m_ptr[count++] = e; } } //Destructors ~IntArray() { delete[] m_ptr; } //reset void reset() { delete[] m_ptr; m_ptr = new int[m_length]; } //resize void resize(const int& x) { if (m_length == x) return; else if (m_length < x) { int* temp = new int[x]; for (int i = 0; i < m_length; i++) { temp[i] = m_ptr[i]; } //m_length = x; delete[] m_ptr; m_ptr = temp; } else if (m_length > x) { int* temp = new int[x]; for (int i = 0; i < x; i++) { temp[i] = m_ptr[i]; } //m_length = x; delete[] m_ptr; m_ptr = temp; } } //insertBefore(const int & value , const int & ix); void insertBefore(const int& value, const int& ix) { resize(m_length + 1); for (int i = m_length; i > ix; i--) { m_ptr[i] = m_ptr[i - 1]; } m_ptr[ix] = value; } //remove(const int & ix); void remove(const int& ix) { for (int i = ix; i < m_length-1; i++) { m_ptr[ix] = m_ptr[ix + 1]; } } //push_back(const int& value); void push_back(const int& value) { resize(m_length + 1); m_ptr[m_length] = value; } friend std::ostream& operator << (std::ostream& out,const IntArray& intarr) { for (int i = 0; i <intarr.m_length ; i++) { out << intarr.m_ptr[i] << " "; } out << std::endl; return out; } }; int main() { IntArray my_arr {1,3,5,7,9}; my_arr.insertBefore(10, 1); //1,10,3,5,7,9 //my_arr.remove(3); //1,10,3,7,9 //my_arr.push_back(13); //1,10,3,7,9,13 std::cout << my_arr << std::endl; }
-
미해결Angular, 앵귤러 100분 핵심강의
클래스 수업 내용 중 오류 질문
두가지 파일에서 오류가 있습니다. 참고로 하기 환경에서 작업을 하고 있습니다. Angular CLI: 13.2.2 Node: 16.13.2 Package Manager: npm 8.1.2 OS: win32 x64 Angular: 13.2.1 클래스로 만든 Item.ts 클래스에서도 강사님하고 동일하게 작성하면 오류가 납니다. export class Item { id: String; name: String ; available: boolean ; } 오류 내용: 속성 'id'은(는) 이니셜라이저가 없고 생성자에 할당되어 있지 않습니다.ts name, available 다 동일한 오류가 뜹니다. 해결 방법이 있을까요? item.component.html <div> <label> <input [(ngModel)]="item.id" placeholder="ID"/> </label> </div> <div> <label> <input [(ngModel)]="item.name" placeholder="Name"/> </label> </div> <button (click)="saveItem()">Save</button> ngModel = item.id /item.name 의 item에서 모두 오류가 납니다. Property 'item' is private and only accessible within class 'ItemComponent'.ngtsc(2341) item.component.ts(11, 4): Error occurs in the template of component ItemComponent. Property 'item' is private and only accessible within class 'ItemComponent'.ngtsc(2341) item.component.ts(11, 4): Error occurs in the template of component ItemComponent. 문제 보기 빠른 수정을 사용할 수 없음
-
미해결프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
Atom과 vscode에서 파이썬 연동과 추가 프로그램들 installing 하는데 문제가 있습니다
Atom에서는 Installing “autocomplete-python@1.17.0” failed.Show output… Compiler tools not found Packages that depend on modules that contain C/C++ code will fail to install. Read here for instructions on installing Python and Visual Studio. Run apm install --check after installing to test compiling a native module. 문구가 뜨며 install이 안되고 Vscode에서도 python인식을 못하며 다운로딩이 안됩니다. 군인이라 사지방컴퓨터라 제한적인 것인지 문제가 뭔지 모르겠습니다. atom에서 해결법을 알 수 있을지 궁금합니다.