묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨모의해킹 실무자가 알려주는, SQL Injection 공격 기법과 시큐어 코딩 : PART 1
ampsetup monitor 오류
설치는 잘 됐다고 뜨는데실행시키면 이렇게 뜨네요어떻게 해야 하나요?
-
해결됨홍정모의 따라하며 배우는 C언어
5-11 형변환 질문
안녕하세요! 형변환 공부 중 예상치 못한 결과가 나와서 질문드립니다.11행의 float 자료형을 갖는 변수 f에 double 표현식의 값이 들어갔습니다.그래서 '분명 표현식의 값이 커지면 절삭되겠군?' 이라는 생각을 갖고, 변수 d와 비교하며 그 값을 크게 설정했습니다.그런데 그 크기를 늘리니 둘 다 똑같은 값이 절삭되어 나오는 것 같습니다.왜 이런 현상이 일어났는지 설명해주시면 감사하겠습니다.
-
미해결[신규 개정판] 이것이 진짜 크롤링이다 - 실전편 (인공지능 수익화)
좋은 강의 잘 듣고 있습니다.
저는 테슬라 키워드로 응용을 하고 있었는데요, 아래 기사에서 https://www.yna.co.kr/view/AKR20230706003700075?input=1195mtitle을 어떻게 가져와야 할지, 일반화 되는 방법을 아무리 봐도 잘 모르겠습니다 ㅠ 본문은 #contents로 가져왔습니다. 도와주세요..import requests import time from bs4 import BeautifulSoup response = requests.get("https://search.naver.com/search.naver?where=news&sm=tab_jum&query=%ED%85%8C%EC%8A%AC%EB%9D%BC") html = response.text soup = BeautifulSoup(html, 'html.parser') articles = soup.select("div.info_group") # 뉴스 기사 div 10개 추출 for article in articles: links = article.select("a.info") if len(links) > 1: # 링크가 2개 이상이면 url = links[1].attrs['href'] # 두번째 링크의 herf를 추출 # requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer')) 방지를 위해 header 추가 response = requests.get(url, headers={'User-agent': 'Mozila/5.0'}) html = response.text soup = BeautifulSoup(html, "html.parser") content = soup.select_one("#contents") print(content.text) time.sleep(0.3)
-
미해결
Next.js - Vercel net::ERR_ABORTED 405
API Route관련 질문입니다.. 로컬 환경에선 잘 작동하는api route가 vercel 배포 후에 계속 제목에 적어놓은 405 에러가 발생합니다. 파일은 정확하게 pages/api/myapi.ts 이런식으로 되어있구요. 핸들러에 접근도 못하는 상황 입니다 매우답답하네요,,POST 나 GET 등 메소드 관련 로직은 당연히 다 적용 시켜봤습니다 머리로는 도저히 이해가 안가는 상황이라 같은 경우 겪어보신분 계시면 답좀 부탁드리겠습니다.. vercel 커뮤니티에서도 저랑 비슷한경우인 분들 계시던데 답을 다 못받으셧더라구요 혹시나 해서 질문올립니다. 참고로 405가 일반적으로 생기는 경우는 다 막아놨습니다.혹시나 코드에서 문제가 있다고 생각하시는분들 계실 수도 있으시니 클라이언트, 서버 코드 올려놓겠습니다.serverexport const config = { runtime: 'edge', }; export default async function handler (req: Request): Promise<Response> { if(req.method === 'POST') { // some code } }client const response = await fetch(endpoint, { method: 'POST', headers: { 'Content-Type': 'application/json', }, signal: controller.signal, body });
-
미해결실리콘밸리 엔지니어가 가르치는 파이썬 장고 웹프로그래밍
import 오류
path('signup/', views.SignUpView.as_view(), name='signup'),이 부분에서 from . import views가 되지 않아 오류가 생기는 것 같습니다 왜 오류인지 잘 모르겠습니다 ImportError: cannot import name 'views' from 'dealershop' (/Users/minjiwon/Desktop/py/dealershop/dealershop/__init__.py)inventory 에서는 from . import views를 해도 잘 되는데 저쪽 부분에서만 되질 않습니다
-
미해결스프링 핵심 원리 - 기본편
AllBeanTest시, NoUniqueBeanDefinitionException 오류
AllBeanTest에서,강사님하고는 다른 오류가 뜹니다 ㅠ < 강사님 오류 > < 저의 오류 >org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'orderServiceImpl' defined in file [C:\study2\core\out\production\classes\hello\core\order\OrderServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'hello.core.discount.DiscountPolicy' available: expected single matching bean but found 2: fixDiscountPolicy,rateDiscountPolicy 라고 뜨는데, 왜 강사님과 다르게 저는 빈이 2개가 있다는 오류가 뜰까요?? ㅠㅠ orderServiceImplpackage hello.core.order; import hello.core.annotation.MainDiscountPolicy; import hello.core.discount.DiscountPolicy; import hello.core.member.Member; import hello.core.member.MemberRepository; import hello.core.member.MemoryMemberRepository; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.AutoConfigurationPackage; import org.springframework.stereotype.Component; @Component public class OrderServiceImpl implements OrderService{ private final MemberRepository memberRepository; private final DiscountPolicy discountPolicy; // final이 붙으면 필수값이 됨.@RequiredArgsConstructor는 필수값을 가지고 생성자를 만들어준다. @Autowired private DiscountPolicy rateDiscountPolicy; @Autowired public OrderServiceImpl(MemberRepository memberRepository, DiscountPolicy discountPolicy) { this.memberRepository = memberRepository; this.discountPolicy = discountPolicy; } @Override public Order createOder(Long memberId, String itemName, int itemPrice) { Member member = memberRepository.findById(memberId); int discountPrice = discountPolicy.discount(member, itemPrice); return new Order(memberId, itemName, itemPrice, discountPrice); } public MemberRepository getMemberRepository(){ return memberRepository; } } RateDiscountPolicypackage hello.core.discount; import hello.core.annotation.MainDiscountPolicy; import hello.core.member.Grade; import hello.core.member.Member; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; @Component public class RateDiscountPolicy implements DiscountPolicy{ private int discountPercent = 10; @Override public int discount(Member member, int price) { if(member.getGrade() == Grade.VIP){ return price * discountPercent / 100; } else { return 0; } } } FixDiscountPolicypackage hello.core.order; import hello.core.annotation.MainDiscountPolicy; import hello.core.discount.DiscountPolicy; import hello.core.member.Member; import hello.core.member.MemberRepository; import hello.core.member.MemoryMemberRepository; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.AutoConfigurationPackage; import org.springframework.stereotype.Component; @Component public class OrderServiceImpl implements OrderService{ private final MemberRepository memberRepository; private final DiscountPolicy discountPolicy; // final이 붙으면 필수값이 됨.@RequiredArgsConstructor는 필수값을 가지고 생성자를 만들어준다. @Autowired private DiscountPolicy rateDiscountPolicy; @Autowired public OrderServiceImpl(MemberRepository memberRepository, DiscountPolicy discountPolicy) { this.memberRepository = memberRepository; this.discountPolicy = discountPolicy; } @Override public Order createOder(Long memberId, String itemName, int itemPrice) { Member member = memberRepository.findById(memberId); int discountPrice = discountPolicy.discount(member, itemPrice); return new Order(memberId, itemName, itemPrice, discountPrice); } public MemberRepository getMemberRepository(){ return memberRepository; } } AppConfigpackage hello.core; import hello.core.discount.DiscountPolicy; import hello.core.discount.FixDiscountPolicy; import hello.core.discount.RateDiscountPolicy; import hello.core.member.MemberService; import hello.core.member.MemberServiceImpl; import hello.core.member.MemoryMemberRepository; import hello.core.order.OrderService; import hello.core.order.OrderServiceImpl; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; // @Bean memberService -> new MemoryMemberRepository() // @Bean orderService -> new MemoryMemberRepository() // call AppConfig.memberService // call AppConfig.memberRepository // call AppConfig.memberRepository // call AppConfig.orderService // call AppConfig.memberRepository // 예상은 위와 같지만, 실제 실행된 것은 // call AppConfig.memberService // call AppConfig.memberRepository // call AppConfig.orderService @Configuration public class AppConfig { @Bean public MemberService memberService() { System.out.println("call AppConfig.memberService"); return new MemberServiceImpl(memberRepository()); } @Bean public MemoryMemberRepository memberRepository() { System.out.println("call AppConfig.memberRepository"); return new MemoryMemberRepository(); } @Bean public OrderService orderService() { System.out.println("call AppConfig.orderService"); return new OrderServiceImpl(memberRepository(), discountPolicy()); // return null; } @Bean public DiscountPolicy discountPolicy() { //return new FixDiscountPolicy(); return new RateDiscountPolicy(); } } AllbeanTestpackage hello.core.Autowired; 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; import static org.assertj.core.api.Assertions.*; 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"); // discount가 얼마나 되는지 보는 서비스 assertThat(discountService).isInstanceOf(DiscountService.class); assertThat(discountPrice).isEqualTo(1000); } 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 i, String fixDiscountPolicy) { return 0; } } }
-
해결됨풀스택 리액트 라이브코딩 - 간단한 쇼핑몰 만들기
routes.tsx에서 질문이 있습니다!
라우츠 파일에 보면 제일 밑에 코드에서 pages 를 익스포트해주는데, 쓰는곳이 없더라구요...!혹시 이 코드가 반드시 필요한 것인지 궁금해서 질문 남깁니다:)import GlobalLayout from './pages/_layout'; import Index from './pages/index'; import ProductsIndex from './pages/products/index'; import ProductsId from './pages/products/[id]'; import Cart from './pages/cart'; export const routes = [ { path: '/', element: <GlobalLayout />, children: [ { path: '/', element: <Index />, index: true }, { path: '/products', element: <ProductsIndex />, index: true }, { path: '/products/:id', element: <ProductsId /> }, { path: '/cart', element: <Cart />, index: true }, ], }, ]; export const pages = [{ route: '/' }, { route: '/products' }, { route: '/products/:id' }, { route: '/cart' }];
-
해결됨직장인에게 꼭 필요한 파이썬-아래아한글 자동화 레시피
누름틀 없는 한글문서 엑셀로 취합하기 응용 질문드려요
해당 강의 잘 보고 응용해보려고 하는데 잘 풀리지 않는 부분이 있어 문의 드립니다.제가 자동화하고자 하는 파일은 예시의 서식이 여러파일형태로 존재하는 게 아니라 한 파일안에 동일한 양식의 표가 반복되는 형태인데요.동일한 양식의 표를 엑셀에 항목별로 입력하고자 합니다.강의로 예를 들면 강의에서는 용역과제 심의신청서가 각 파일에 1개씩 이어서 폴더내의 파일을 하나하나 열면서 안의 내용을 리스트로 정리하고, 리스트 중 옮길 값을 추출했지만제 경우에는 용역과제 심의신청서가 한 파일에 모두 모여있는 경우라고 할 수 있을 것 같습니다.그래서 파일안에 있는 텍스트를 모두 추출하여 list화 까지는 수행했는데, 거기서 엑셀로 옮길 값만 추출하는데 있어서 어떤 규칙성을 찾기가 어려워서 어떻게 해야할지 좀 막막하네요...예를 들면 예시에서 과제명이 contents[1]이었으면 다음 표에서는 과제명이 contents[26] (<-연구결과활용방안다음)이어야 하는데 중간중간 끊기는 부분이 있는지 갑자기 contents[27]이라던가 번호가 하나씩 밀리는 문제가 발생합니다.이런 경우에는 어떤 for문으로 반복되는 표 양식 안의 내용을 가져올 수 있을까요..?
-
해결됨[라이브 멘토링] 유니티 뱀파이어 서바이벌 장르 모작
안녕하세요. 7월 예정강의에 대해 질문이 있습니다.
유니티 & 웹서버(키우기 게임 + 웹서버) 강의가 7월 예정으로 들었는데 항상 강의 전달 말쯤에소식이 들렸는데 이번엔 아직 소식이 없어서 질문드립니다!관련해서 예정이 있으신건가요?
-
미해결토비의 스프링 부트 - 이해와 원리
테스트시에 나오는 문제
안녕하세요. 토비님스프링부트로 api테스트시에 가끔식 400 Bad Request 가 나오는데요.호출하는 header와 body는 모두 동일한데, 2~30번 호출 중에 한번씩 튀어나오는 경우는 어떤 설정에 문제일까요?api 내용은 별게 없고 로그를 다 찍기도 전에 앞에서 400에러가 나는 상황입니다. 혹시 관련해서 경험하신 바가 있으신지 궁금합니다.
-
미해결SCSS(SASS)+FLEX 실전 반응형 웹 프로젝트 with Figma
강의 자료가 열리지 않습니다.
안녕하세요~디자인 작업(beyound+insight) > 피그마(Figma)원본 폴더 안에 있는 두 개 파일이 열리지 않아서요.어떻게 볼 수 있을까요~?
-
미해결아두이노 시작하기
3색 led 아두이노 연결ㄹ
영상에서 3색 led를 아두이노를 연결할 떄, 아두이노의 5V도 빵판에 연결시키셨는데, 5V의 역할은 무엇인지 궁금합니다. 그냥 LED에서는 5V연결이 없었는데, 3색 LED에서는 5V연결이 필요한 것인지도 궁금하네요.
-
미해결홍정모의 따라하며 배우는 C언어
강의 4:29 0.01f 위에 커서를 올렸을 때
강의의 경우 (float)(0.009999999776F)라고 뜨는데왜 저는 그냥 단순하게 (flat)(0.01F)라고 뜰까요?비쥬얼스튜디오에서 따로 설정해야하는건가요?
-
미해결이득우의 언리얼 프로그래밍 Part1 - 언리얼 C++의 이해
VS2022 Always show Error List if... 옵션을 끄는 이유
강의 10:13 부분에서 VS2022 옵션 중 Always show Error List if build finishes with errors 를 끄시는 데.. 옵션 내용만 보면 켜놓는 게 좋을 것 같다고 생각이 드는데요. 왜 끄는 지 이유를 알수 있을까요.
-
해결됨10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
8 - L 질문입니다.
안녕하세요 선생님! 8주차와서 많은 질문으로 찾아뵙는 것 같습니다... 항상 감사합니다.http://boj.kr/f01a3b3704f147638cb5d548fbe26459바로 이전 문제였던 8 - K의 풀이처럼 펜윅트리를 행별로 형성하게 해서 코드를 짜보았습니다. 테스트케이스는 잘 통과하는데 틀렸습니다...ㅠ 혹시 제 코드에서 어떤 점이 문제였을지 알 수 있을까요?
-
미해결실전! Querydsl
sort관련 질문드립니다.
직접 파라미터를 받아 처리하는걸 권장 한다고 하셨는데 @Data public class MemberSearchDto { private String username; private String teamName; private Integer ageGoe; private Integer ageLoe; private String sort; private String orderBy; } sort=desc; orderby=username 으로 값을 받는다면 .orderBy(addSort(searchDto.getSort(),searchDto.getOrderBy())) private OrderSpecifier<?> addSort(String sort, String orderBy) { if(StringUtils.hasText(sort) && StringUtils.hasText(orderBy) && (sort.equals("desc") || sort.equals("asc"))){ if(orderBy.equals("username")){ return sort.equals("desc") ? member.username.desc() : member.username.asc(); } } return member.age.desc(); } 이런식으로 처리하면 되는지 궁금합니다.
-
해결됨스프링 DB 1편 - 데이터 접근 핵심 원리
트랜잭션 범위 최소화
안녕하세요. 영한님궁금한게 생겨 질문 드립니다.! 일반적으로 서비스 레이어에서 @Transactional(AOP 기술)을 사용하여 트랜잭션을 걸어주는데, DB 조회와 관련된 로직에서 트랜잭션이 없어도 될것 같은 생각이 듭니다. DB 조회에서 트랜잭션을 수행하지 않는 방법이 있을까요?다시 말씀드리면, 트랜잭션 범위를 최소화 하려면 어떻게 해야할까요?제가 생각한 방법은 트랜잭션이 필요한 부분과 필요하지 않은 부분을 분리하는 것이 있을 것 같습니다.현업에서는 어떻게 해결하는지 궁금 합니다.🤔 예를 들어 아래와 같은 로직에서1,2,3에서는 트랜잭션이 필요 없을것으로 판단됩니다.@Service public class OrderService { @Transactional public void order() { /** * 1. 회원 조회 * 2. 배송 가능한 지역인지 조회 * 3. 상품 조회 * 4. 배송 생성 * 5. 결제 생성 * 6. 주문 생성 */ } } 4,5,6에만 트랜잭션이 필요하다고 생각이 됩니다.@Service public class OrderService { @Transactional public void order() { /** * 1. 회원 조회 * 2. 배송 가능한 지역인지 조회 * 3. 상품 조회 * * // 트랜잭션 시작 * 4. 배송 생성 * 5. 결제 생성 * 6. 주문 생성 * // 트랜잭션 종료 */ } } 감사합니다.
-
해결됨ProtoPie Master Courses (프로토파이 마스터 클래스)
하단 팝업 부분을 그냥 탭 했을 때도 닫히는데,
dim 부분만 탭 했을 때, 꺼지도록 하는 방법은 따로 없을까요?..
-
미해결나도코딩의 자바 기본편 - 풀코스 (20시간)
패키지 부문에서 로또 생성번호하는 과정에서 질문이 있습니다.
System.out.print("랜덤 로또 번호 : ");for (int i = 0; i < 6; i++) {System.out.print((random.nextInt(45) + 1));System.out.print(" ");6개의 숫자를 동시에 생성 해보려고 for 문 이용해서 숫자를 생성 해봤는데 중복된 숫자들이 나열되는 경우들이 있더라구요. 이럴경우 숫자가 중복되지 않게 나오게 하는 방법이 있을까요?
-
해결됨최신 딥러닝 기술 Vision Transformer 개념부터 Pytorch 구현까지
헷갈리는게 몇개 있습니다ㅠㅠ
안녕하세요 강사님.Transformer 에 대해 처음 공부해보니 헷갈리는 부분들이 있어서 질문남깁니다.1) k 개의 Multi-Head를 만든 후에 Linear를 해주는 이유가 따로 있는지 궁금합니다. 단순히 Residual Connection을 위해 차원을 맞춰주기 위해 하는 것인가요??2) Head의 개수(k)는 CNN에서 필터 개수처럼 사용자가 정해주는 파라미터인가요??3) 클래스 토큰까지 Positional Embedding을 더해줘야 하는 이유가 따로 있을까요??좋은 강의 덕분에 따라가긴 하는데 한 번에 이해하려하니 과부하가 와서 헷갈리는게 생기네요ㅠㅠ코드 분석 파트 들어가면 조금 더 이해가 될 것 같은데 우선적으로 질문남겨봅니다.