묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결게임 프로그래머 취업 전략 가이드
안녕하세요.
이번에 서버 직군으로 취업을 하게되었습니다. (선생님이 추천해주신 책과 강의가 정말 많은 도움이 되었습니다!) 취업전에는 취업은 할 수 있을까가 걱정이었는데 막상 붙으니 걱정이 많이드네요ㅠ.. 입사까지 조금 시간이 있는데 미리 준비해가면 좋은것들이 있을까요? 협업경험이 없어서 git등을 볼까 고민중입니다.
-
해결됨초보를 위한 도커 안내서
docker file 외부에서 환경 변수 값 변경이 가능한가요 ?
안녕하세요 :) 강의를 통해 학습하고 실제 프로젝트를 도커 이미지로 만들고, 허브에 올린 뒤 ec2 서버에서 도커 이미지를 불러와서 컨테이너를 띄워보고.. 그렇게 학습 하고 있습니다! 한가지 궁금한게 생겼는데요, 현재 개인적으로 진행하고 있는 스프링 프로젝트의 경우 application.properties에 db 정보를 입력받고 있습니다. 예를 들면 db -> my_db (마찬가지로 도커로 띄웠고, 이름을 my_db라고 했습니다) spring.datasource.hikari.username=계정명spring.datasource.hikari.password=비밀번호 이런식으로 이미 값을 주입한 뒤, docker build 로 이미지를 만들고, ec2 서버에서 해당 이미지를 받아와서 docker run 할 때 저 username , password, db이름 같은 정보를 이미 만들어진 image 외부에서 변경할 수 있나요 ? docker run 시 -e 를 통해서 application-prod.properties 이런식으로 환경 파일을 다른걸 적용하게끔은 할 수 있는데 해당 변수의 값들이 이미 정해진 상황에서 -e 옵션을 통해 값 변경도 가능한지 궁금합니다. 감사합니다 :)
-
미해결Vue.js 중급 강좌 - 웹앱 제작으로 배워보는 Vue.js, ES6, Vuex
권한 요청드립니다
인프런 아이디 : guinness987@gmail.com 인프런 이메일 : guinness987@gmail.com 깃헙 아이디 : guinness987@gmail.com 깃헙 Username : kimchulyeon
-
해결됨스프링 핵심 원리 - 고급편
LogTraceAspect 에 @Component 애노테이션을 붙여서 스프링 빈 등록하기
LogTraceAspect 에 @Component 애노테이션을 붙여서 스프링 빈 등록을 해도 된다고 하셔서 해봤는데 로그가 안나오더라구요ㅠㅠ LogTraceAspect.java -> @Aspect와 @Component 추가 AopConfig.java -> 사용 x ProxyApplication.java -> @Import({AppV1Config.class, AppV2Config.class}) @SpringBootApplication(scanBasePackages = "hello.proxy.app") 이렇게 하고 실행했는데 작동 자체는 잘 되지만 로그가 찍히지 않습니다 제가 뭘 잘못했을까요??
-
미해결스프링 핵심 원리 - 기본편
SOLID에 관해서
안녕하세요. SOLID에 관한 형식에 맞게 Appconfig를 작성해서 의존관계 주입을 해서 해결하는건 정말 멋진 생각입니다. 그러다 문득 드는 생각이 구현체에 new RateDiscountPolicy 를 수정하던지 AppConfig에 new RateDiscountPolicy로 수정하던지 프로그래밍적으로는 실행시점(런타임 상태)에 어떤 정책을 선택할지가 결정되지만 결국 프로그래머가 물리적으로 수정하는 영역은 동일하지 않나라는 생각이 들어서요. 제가 아직 프로젝트를 만들어보지 않아서 이런 생각을 하는건지.. 어떤 이점이 있는지 많이 궁금합니다.
-
해결됨한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지
윈터루드님~! 이미지 경로에 관해서 질문 드리겠습니다!!
안녕하세요! img src 주소 관련 질문드리겠습니다! process.env.PUBLIC_URL + `/... 경로`를 하셨는데 src에 그냥 /assets/emotion1.png를 해도 잘 나오는데 상관없는거죠??
-
해결됨한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지
onCreate 함수 호출에 대해 질문드립니다.
안녕하세요 강사님 강의 잘 듣고 있는 중에 궁금한 부분이 있어서 질문드립니다. 지금은 DiaryEditor.js에서 prop으로 받은 onCreate 함수를 호출할때 인수로 (state.author, state.content, state.emotion) 3 가지를 전달하고 있습니다. 이렇게 객체의 프로퍼티를 각각 함수의 인수로 전달하는 것은 객체의 프로퍼티가 추가되거나 삭제되었을 때 함수의 호출부를 수정해야되니 비효율적이라는 생각이 들었습니다. 그리하여 ES6의 구조분해할당을 이용하여 DiaryEditor.js에서 onCreate 함수를 호출할 때 onCreate(state)로 객체를 전달하고 App.js에서 onCreate 함수의 매개변수 부분을 onCreate({author, content, emotion})으로 수정하였습니다. 이렇게 코드를 수정한다면 문제가 되는 부분이 있는지, 문제가 있다면 그것을 어떻게 해결해야 되는지에 대해 질문드립니다. 감사합니다 :)
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
중복 회원 예외 테스트 insert 가 날라가는 이유가 궁급합니다!
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]회원가입 테스트는 insert 없이 select 쿼리만 날라가고, 테스트 트랜잭션 기본 롤백규칙을 통해서 롤백이 되는걸 확인했습니다. 그런데, 중복회원예외 테스트에서는 마지막에 롤백이 날라가서 데이터는 안 들어가지만, 두 번째 member2 를 join할 때 member1 엔티티가 insert가 된 후에 select가 날라가는 것 같더라구요! 마지막에 롤백이 되긴 하지만, insert 쿼리가 날라가는 이유가 궁금해서 질문 남겨봅니다!
-
미해결실전! 스프링 데이터 JPA
Lazy 강제 초기화를 해도 프록시 객체가 유지 됩니다.
public List<Drawing> getDrawingList() { List<Drawing> drawings = drawingService.findDrawings(); for (Drawing drawing : drawings) { drawing.getDrawingCategory().getName(); } return drawings;} 위 코드 실행시에러 내용입니다. Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: java.util.ArrayList[0]->.drawing.entity.Drawing["drawingCategory"]->.drawingcategory.entity.DrawingCategory$HibernateProxy$dtz0HezH["hibernateLazyInitializer"])] with root cause findDrawings 에서 JpaRepository가 findAll을 return 해줍니다. @ManyToOne(fetch = FetchType.LAZY)@JoinColumn(name = "category_id", nullable = false)private DrawingCategory drawingCategory; Drawing은 DrawingCategory를 ManyToOne으로 단방향 연관관계를 맺고 있습니다. 그래서, drawing.getDrawingCateogory.getName 으로 Lazy 강제 초기화를 해주었는데 위의 에러가 나오네요.. fetch join을 사용하면 해결이 되긴 합니다만 get으로 Lazy연관관계의 값을 직접 가져와도 HibernateProxy객체가 유지되는지 궁금합니다.
-
미해결스프링 핵심 원리 - 기본편
ac.getBean()의 반환값에 대해서
안녕하세요. 스프링 입문강의부터 열심히 보고 있는 수강생 입니다. 강의를 듣다가. 스프링 빈조회 기본 편에서는 assertThat().isInstanceOf(구현객체.class)이렇게 하셔서 getBean()의 반환값이 config의 return값이 들어오는줄 알았습니다. 근데 해당강의에서는 구현객체 클래스가 아닌 MemberRepository.class인 인터페이스로 비교를 하길래, 궁금하여 질문합니다. 코드상에서는 인터페이스든, 구현 클래스든 둘다 상관없이 비교가 가능한 것 같은데, 그 이유가 궁금합니다 !
-
미해결홍정모의 따라하며 배우는 C++
if문을 이용한 프로그램 질문드립니다.
먼저, 질문 하기에 앞서 이렇게 질 좋은 강의에 감사의 말씀드립니다. 제가 의도하는 프로그램은 a~z, A~Z 의 알파벳을 입력하면 “alphabet”이 출력되고, 정수를 입력하면 “number”가 출력됩니다. 이를 위해서 input 되는 값을 int형으로 casting 하여 ASCII TABLE을 통해 if()의 범위를 64<num<91 && 96<num<123 로 설정하여 “alphabet”이 출력되도록 합니다. ------------------------------------------------------------------------------------------------ #include <iostream> using namespace std; int main() { cout << "Enter a number or an alphabet character : "; char input; cin >> input; int num = int(input); cout << "The ASCII number of your input : " << num << endl; if(64<num<91 && 96<num<123) { cout << "alphabet" << endl; } else { cout << "number" << endl; } return 0; } ------------------------------------------------------------------------------------------------ 하지만, 5를 input 하여 ASCII number가 53되어서 범위에 if()의 범위에 포함이 되지 않았어도 “alphabet”으로 출력되는 오류가 생겼습니다. 그래서 이번엔 else if()를 사용하여 범위를 나눠봤습니다. ------------------------------------------------------------------------------------------------ #include <iostream> using namespace std; int main() { cout << "Enter a number or an alphabet character : "; char input; cin >> input; int num = int(input); cout << "The ASCII number of your input : " << num << endl; if(num>96 && num<123) { cout << "alphabet" << endl; } else if(num>64 && num<91) { cout << "alphabet" << endl; } else { cout << "number" << endl; } return 0; } ------------------------------------------------------------------------------------------------ else if()를 사용하여 수정해보니 5를 넣으면 “number”가 출력되도록 바꿨습니다. 정상적으로 의도한 프로그램이 작동합니다. 하지만, 제 질문은 1. 첫 번째 프로그램에서 if(64<num<91 && 96<num<123) 이 부분이 제대로 작동하지 않은 것 같은데, 이유가 궁금합니다. 2. else if 문을 사용한 것이 최선인지 궁금합니다. 다른 방법이 있다면 가르쳐 주시길 바랍니다.
-
해결됨유니티 머신러닝 에이전트 완전정복 (기초편)
목표물이 움직이는 상태에서의 학습
안녕하세요, 드론 오브젝트를 통해 학습하는 부분에서, 목표물이 등속(드론보다는 느리게) 이동하는 것을 가정하여 코드를 작성하려고 합니다. 이 경우, DroneSetting.cs 부분에만 코드를 부분적으로 수정해서 작성할 수 있을까요? 아니면 어떤 부분의 수정이 추가적으로 필요할까요?
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
회원가입 실행시 오류 문제
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)예3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)예[질문 내용]여기에 질문 내용을 남겨주세요. 회원가입 돌리면 자꾸 오류가 생깁니다.. java.lang.NullPointerException 관련 오류인 것 같은데요. 관련 질문도 없는 것 같아 직접 질문 드리고 싶습니다.. 에러코드는 다음과 같이 납니다. java.lang.NullPointerException at hello.hellospring.service.MemberServiceIntegrationTest.회원가입(MemberServiceIntegrationTest.java:32) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725) at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131) at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84) at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115) at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37) at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104) at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86) at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86) at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71) 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) Process finished with exit code -1 제 코드도 같이 적어 올립니다 ㅠ package hello.hellospring.service;import hello.hellospring.domain.Member;import hello.hellospring.repository.MemberRepository;import hello.hellospring.repository.MemoryMemberRepository;import org.junit.jupiter.api.AfterEach;import org.junit.jupiter.api.BeforeEach;import org.junit.jupiter.api.Test;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.transaction.annotation.Transactional;import static org.assertj.core.api.Assertions.assertThat;import static org.junit.jupiter.api.Assertions.assertThrows;@SpringBootApplication//@Transactionalclass MemberServiceIntegrationTest { @Autowired MemberService memberService; @Autowired MemberRepository memberRepository; @Test void 회원가입() { // given Member member = new Member(); member.setName("spring"); // when Long saveId = memberService.join(member); // then Member findMember = memberService.findOne(saveId).get(); assertThat(member.getName()).isEqualTo(findMember.getName()); } @Test public void 중복_회원_예외() { //given Member member1 = new Member(); member1.setName("spring"); Member member2 = new Member(); member2.setName("spring"); //when memberService.join(member1); IllegalStateException e = assertThrows(IllegalStateException.class, () -> memberService.join(member2)); assertThat(e.getMessage()).isEqualTo("이미 존재하는 회원입니다."); }}
-
미해결실전! 스프링 부트와 JPA 활용2 - API 개발과 성능 최적화
update후 다시 member를 조회할때 쿼리가 날라가지 않는이유
[질문 내용]update후 트랜젝션이 끝나면 그 후에 발생하는 memberService.findOne(id)에서는 새로운 트랜젝션에서 실행돼서 새롭게 select쿼리가 날아가야 한다고 생각했는데 실제 실행을 해보니까 update쿼리 이후에 다른 쿼리가 날아가지 않던데 이유가 궁금합니다!
-
해결됨
pygame설치가 안되요 해결책을 알려주세요
보시는 것 처럼 이렇게 뜨면 오류가 떴는 데 어떻게 해야 고칠 수 있는 거죠?
-
미해결[신규 개정판] 이것이 진짜 크롤링이다 - 실전편 (인공지능 수익화)
안녕하세요 그저께 까지 만 해도 잘되던게...
갑자기 일반 뉴스 만 크롤링을 하지 못하네요. 제가 테스트 해본결과 일반 뉴스만 못가지고 오는데 코드를 확인해보니 달라진게 없는거 같은데. 코드 한번 봐주시기 발바니다. import requests from bs4 import BeautifulSoup import time import pyautogui #사용자 입력 keyword = pyautogui.prompt("검색어를 입력해주세요") lsatpage = int(pyautogui.prompt("몇페이지 까지 크롤링 할까요?")) page_num = 1 for i in range(1, lsatpage * 10, 10): print(f".==========================={page_num}페이지를 가지고 오는 중입니다.===========================") response = requests.get(f"https://search.naver.com/search.naver?where=news&sm=tab_jum&query={keyword}") html = response.text soup = BeautifulSoup(html,'html.parser') articles = soup.select("div.news_info") # 뉴스기사 디브 10개 추출 for article in articles: links = article.select("a.info") # 링크만 가지고 오기 a 태그 안에 info추출 if len(links) >= 2: #링크를 len 함수로 세어주고 2개보다 많으면 url = links[1].attrs['href'] # 링크중 2번째 것을 선택 # print(url) response = requests.get(url, headers={'User-agent':'mozila/5.0'}) html = response.text # print(html) soup = BeautifulSoup(html, 'html.parser') # print(soup) #만약 연예뉴스라면 if "entertain" in response.url: title = soup.select_one(".end_tit") #네이버 뉴스 첫뻔재링크 contant = soup.select_one("#articeBody") elif "sports" in response.url: #리스폰스 변수에 있는 유알엘중 스포츠스가 있으면 title = soup.select_one("h4.title") contant = soup.select_one("#newsEndContents") divs = contant.select("div") #본문에 불필요한 dvi p 삭제 for div in divs: div.decompose() #decompose 는 없애주는 함수 ps = contant.select("p") for p in ps: p.decompose() else: title = soup.select_one("#articleTitle") #신문사 뉴스 두번째링크 contant = soup.select_one("#articleBodyContents") print("==========링크========\n", url) print("==========제목========\n", title.text.strip()) #strip 함수는 공백을 없애는 거임 print("==========본문========\n", contant.text.strip()) time.sleep(0.3) page_num = page_num + 1
-
해결됨실전! Querydsl
querydsl and(,) or 처리 질문있습니다.
a,b,c.or(d)제가 원하는 쿼리는 (a) and (b) and (c ) or (d)인데 실제 쿼리는(a) and (b) and (c or d)이렇게 쿼리문이 나갑니다. 어떻게 해야할까요? 개별 괄호는 쳐도 다 생략이 되고 (a,b,c).or(d)이렇게도 불가한데 BooleanExpression으로는 제가 원하는 방식을 사용할 수 없을까요?
-
해결됨[리뉴얼] React로 NodeBird SNS 만들기
createStore대신 configureStore사용시 에러
안녕하세요! 강의듣는중 에러해결을 못하고 있어서 문의드립니다. 에러가 나서보니 createStore대신 configureStore를 사용하라고 되어있어서 구글링으로 문법을 찾아보고, configureStore로 바꾸어 주었습니다. configureStore는 '{reducer: rootReducer}' 이렇게 객체로 적어줘야 한다고 해서 객체로 바꿨는데 에러가 나고, `{reducer}`로 해봐도 에러가 납니다., 데브툴즈가 내장?되어있다고 해서 빼보기도 하고, 다시 넣어도 보고.. 어떻게 작성해도 계속 에러가 나네요.. 참고로 버전은 아래의 버전들을 사용중입니다. "@reduxjs/toolkit": "^1.8.1", "antd": "^4.19.5", "next": "^9.5.5", "next-redux-wrapper": "^6.0.2", "prop-types": "^15.8.1", "react": "^16.14.0", "react-dom": "^16.14.0", "react-redux": "^8.0.1", "redux": "^4.2.0", "redux-devtools-extension": "^2.13.9", configureStore.js 파일 코드 ( 주석속의 방법으로도 해봐도 에러 발생) configureStore.js 파일의 에러메세지 https://www.inflearn.com/questions/518406 위에 링크질문하신 분과 원인?이 `configureStore`를 사용한다는 점에서 유사한듯 한데, 에러 내용은 다르네요
-
미해결딥러닝 CNN 완벽 가이드 - TFKeras 버전
Batch Normalization 질문
안녕하세요. Dense layer 다음에는 BatchNormalization을 하지 않고 , Conv2D 다음에만 BatchNormalization을 하는 건지 궁금합니다! 감사합니다!
-
미해결선형대수학개론
Example 1. scaling 질문
2를 나눠주는 scaling을 해서 앞에 2가 튀어나왔다고 하셨는데, 저는 1/2를 곱하는 scaling을 했다고 생각해서 1/2라고 생각했습니다. chapter 3.1.에서 2x2 elementary determinant 구할 때, scaling한 (det E) = k인 이유가 2번째 row에 k를 곱했기 때문이라고 이해했기 때문입니다. 제가 scaling에 대해서 잘못 이해를 하고 있는 것 같습니다. scaling은 한 row에 임의의 k를 곱해주는 걸로 이해했었는데, 제대로 이해한 게 맞나요? 제대로 이해했다면, Example 1.에서는 1번째 row에 1/2를 곱해줬기에 1/2를 곱해줘야 하는거 아닌가요?