묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결[리뉴얼] React로 NodeBird SNS 만들기
scroll throttle 문제일까요?
useEffect(() => { const onScroll = () => { /* window.scrollY : 현재 스크롤 위치 document.documentElement.clientHeight : 현재 보고 있는 브라우저의 높이 document.documentElement.scrollHeight : 총 높이 */ // 스크롤 맨 아래에서 살짝 위에 있을 때 true const heightCheck: boolean = window.scrollY + document.documentElement.clientHeight > document.documentElement.scrollHeight - 300; if (heightCheck) { if (hasMorePosts && !loadPostLoading) { console.log('wow'); const lastId: number = mainPosts[mainPosts.length - 1]?.id; dispatch(loadPostAction(lastId)); } } }; window.addEventListener('scroll', _throttle(onScroll, 500)); return () => { window.removeEventListener('scroll', onScroll); }; }, [hasMorePosts, loadPostLoading, mainPosts]); saga에서는 throttle이 내장 되어서 사용하기 편한데 saga를 안 쓰고 lodash의 throttle을 이용해서 하려고 합니다. 그런데 데이터의 총 개수가 15개라 하면 처음 로드할 때 10개(1회 요청), 스크롤할 때 5개(1회 요청) 나와야 정상이잖아요? 그런데 처음 스크롤할 때 2회 요청, 그 다음 4회 요청, 또 내리면 7회 요청 이런식으로 증가하게 됩니다. throttle이 제대로 안 먹히는건가요? 질문 글 보면 '박민호'님 증상이랑 비슷한 것 같습니다.
-
미해결[리뉴얼] Node.js 교과서 - 기본부터 프로젝트 실습까지
localhost:4000/test에서 자꾸 에러가 납니다.
Request failed with status code 401 이런식으로 에러가 나서 제가 한번 알아서 해결을 해보려고 노력은 해보았습니다. - 질문 ch9/9.5/nodebird/models에 domain을 추가 안해서 그런건줄 알고 추가를 해서 다시해보았는데 아무 반응 없는 것 보니까 8001은 문제가 아닌 것 같습니다. 제가 느꼈던 크리티컬한 문제점은 유효하지 않은 토큰이라 뜨고 401 에러가 난다고 하면 토큰이 제대로 생성이 되지 않은 것이라는게 제 의견입니다. 이것이 맞나요? 제가 이렇게 생각하는 이유가 ch10/lecture/nodebird-api/routes/v1.js 토큰이 발급되면 "토큰이 발급되었습니다" 라는 문구가 터미널에 떠야하는 것 같은데 뜨질 않았기 때문입니다.
-
미해결피그마(Figma)를 활용한 UI디자인 입문부터 실전까지 A to Z
Tidy up 기능 관련 질문이 있습니다.
안녕하세요 :) 12개의 오브젝트를 Tidy up해서 첫 번째 이미지와 같이 정렬이 되었는데, smart selection 기능을 사용해서 오브젝트 위치를 변경할 때 두 번째 이미지처럼 오브젝트 위치가 변경이 되는 이유를 혹시 알 수 있을까요? 저는 Tidy up 기능을 모든 오브젝트를 알아서 자동으로 간격을 배열하여 위치시키고 정렬해주는 것으로 이해했는데 tidy up 기능을 적용했을 때 이런 식으로 위치가 변경이 되는 것이 가능한 이유를 알고 싶습니다.
-
미해결mongoDB 기초부터 실무까지(feat. Node.js)
updateBoby 질문있습니다.
findByIdAndUpdate(userId, updateBody,{new: true}); 이부분에 기존에는 인자로 age등을 넘겨줬었던거 같은데용 음? userId로 해당 객체 찾고 두번쨰 인자로 해당 키의 값으로 접근하여 업데이트하는 거구나. 정도로 인식했습니다. 이번 강좌에서 새 객체를 넣었는데 이부분이 햇갈립니다. 객체 내부의 속성을 넣다가(2뎁스) 객체를 넣으니까(1뎁스) 혼동이 있는데요. 아래와 같이 추론한게 맞을까요? findByIdAndUpdate에 두번째 인자로 객체를 넣으면 해당 객체 내부의 키값을 순회하면서 적용시키는 몽구스 내부로직이 있는건가요?
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
MVC강의 언제 오픈되나요?
스프링 코어는 따로 공부하고 부트 입문 강의로 소개받았는데 강의 흐름이나 속도가 좋네요. MVC강의는 언제 오픈되는지 궁금하네요. 강의 잘 봤습니다. 감사합니다.
-
미해결해외취업 ASP.NET Core 웹개발 기본 강좌
DbContext 상속
안녕하세요 현재 vs3.0.1 버전 쓰고있는데 DbContext 클래스를 상속받으려고하는데 에러가뜨네요. 전구눌렀을때 package 'Microsoft.EntityFrameworkCore' 와 package 'EntityFramework'를 설치하라고해서 둘다 설치를해도 빨간줄이 지워지지않네요. 에러메세지는 The type or namespace name 'DbContext' could not be found 라고떠요 도와주시면 정말 감사하겠습니다 ㅠㅠ
-
미해결청와대 청원 데이터 시각화
아나콘다 라이선스
안녕하세요. 아나콘다 설치하려고 하니까, 현재 라이선스 정책기준으로는 학생이나 연구자인 개인사용자만 무료고 기업용은 영업팀에 문의하라고 적혀있어서 선뜻 다운로드하기가 조금 꺼려지네요 회사 노트북으로 수강 중이라서 아나콘다를 설치하지 않으면 해당 강의를 수강함에 있어 문제가 있을까요?
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 쇼핑몰 사이트 만들기[전체 리뉴얼]
윈도우 10인데 npm i 문제 있습니다
윈도우 10인데 npm i 하면 자꾸 이런 문제가 생깁니다. npm run dev도 안됩니다.. ㅜ Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6 PS C:\Users\juno8\Desktop\New_Boilerplate-master\New_Boilerplate-master\server> npm i 2 vulnerabilities (1 low, 1 high) To address all issues, run: npm audit fix Run `npm audit` for details. PS C:\Users\juno8\Desktop\New_Boilerplate-master\New_Boilerplate-master\server> cd.. PS C:\Users\juno8\Desktop\New_Boilerplate-master\New_Boilerplate-master> npm i npm WARN deprecated node-pre-gyp@0.15.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future npm ERR! code 1 npm ERR! path C:\Users\juno8\Desktop\New_Boilerplate-master\New_Boilerplate-master\node_modules\bcrypt npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build npm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\juno8\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\juno8\Desktop\New_Boilerplate-master\New_Boilerplate-master\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\juno8\Desktop\New_Boilerplate-master\New_Boilerplate-master\node_modules\bcrypt\lib\binding\napi-v3 --napi_version=7 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1) npm ERR! node-pre-gyp info it worked if it ends with ok npm ERR! node-pre-gyp info using node-pre-gyp@0.15.0 npm ERR! node-pre-gyp info using node@15.8.0 | win32 | x64 npm ERR! node-pre-gyp WARN Using needle for node-pre-gyp https download npm ERR! node-pre-gyp info check checked for "C:\Users\juno8\Desktop\New_Boilerplate-master\New_Boilerplate-master\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node" (not found) npm ERR! node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.0/bcrypt_lib-v5.0.0-napi-v3-win32-x64-unknown.tar.gz npm ERR! node-pre-gyp http 302 https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.0/bcrypt_lib-v5.0.0-napi-v3-win32-x64-unknown.tar.gz npm ERR! node-pre-gyp http 200 https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.0/bcrypt_lib-v5.0.0-napi-v3-win32-x64-unknown.tar.gz npm ERR! node-pre-gyp info install unpacking napi-v3/bcrypt_lib.node npm ERR! node-pre-gyp WARN Pre-built binaries not installable for bcrypt@5.0.0 and node@15.8.0 (node-v88 ABI, unknown) (falling back to source compile with node-gyp) npm ERR! node-pre-gyp WARN Hit error bad download npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@7.1.2 npm ERR! gyp info using node@15.8.0 | win32 | x64 npm ERR! gyp info ok npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@7.1.2 npm ERR! gyp info using node@15.8.0 | win32 | x64 npm ERR! gyp ERR! find Python npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON npm ERR! gyp ERR! find Python checking if "python3" can be used npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error npm ERR! gyp ERR! find Python checking if "python" can be used npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error npm ERR! gyp ERR! find Python checking if "python2" can be used npm ERR! gyp ERR! find Python - "python2" is not in PATH or produced an error npm ERR! gyp ERR! find Python checking if Python is C:\Python37\python.exe npm ERR! gyp ERR! find Python - "C:\Python37\python.exe" could not be run npm ERR! gyp ERR! find Python checking if Python is C:\Python27\python.exe npm ERR! gyp ERR! find Python - "C:\Python27\python.exe" could not be run npm ERR! gyp ERR! find Python checking if the py launcher can be used to find Python npm ERR! gyp ERR! find Python - "py.exe" is not in PATH or produced an error npm ERR! gyp ERR! find Python npm ERR! gyp ERR! find Python ********************************************************** npm ERR! gyp ERR! find Python You need to install the latest version of Python. npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not, npm ERR! gyp ERR! find Python you can try one of the following options: npm ERR! gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe" npm ERR! gyp ERR! find Python (accepted by both node-gyp and npm) npm ERR! gyp ERR! find Python - Set the environment variable PYTHON npm ERR! gyp ERR! find Python - Set the npm configuration variable python: npm ERR! gyp ERR! find Python npm config set python "C:\Path\To\python.exe" npm ERR! gyp ERR! find Python For more information consult the documentation at: npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation npm ERR! gyp ERR! find Python ********************************************************** npm ERR! gyp ERR! find Python npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: Could not find any Python installation to use npm ERR! gyp ERR! stack at PythonFinder.fail (C:\Users\juno8\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:302:47) npm ERR! gyp ERR! stack at PythonFinder.runChecks (C:\Users\juno8\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:136:21) npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (C:\Users\juno8\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:200:18) npm ERR! gyp ERR! stack at PythonFinder.execFileCallback (C:\Users\juno8\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:266:16) npm ERR! gyp ERR! stack at exithandler (node:child_process:334:5) npm ERR! gyp ERR! stack at ChildProcess.errorhandler (node:child_process:346:5) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:378:20) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12) npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:480:16) npm ERR! gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:81:21) npm ERR! gyp ERR! System Windows_NT 10.0.19041 npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\juno8\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\juno8\\Desktop\\New_Boilerplate-master\\New_Boilerplate-master\\node_modules\\bcrypt\\lib\\binding\\napi-v3\\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\\Users\\juno8\\Desktop\\New_Boilerplate-master\\New_Boilerplate-master\\node_modules\\bcrypt\\lib\\binding\\napi-v3" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3" npm ERR! gyp ERR! cwd C:\Users\juno8\Desktop\New_Boilerplate-master\New_Boilerplate-master\node_modules\bcrypt npm ERR! gyp ERR! node -v v15.8.0 npm ERR! gyp ERR! node-gyp -v v7.1.2 npm ERR! gyp ERR! not ok npm ERR! node-pre-gyp ERR! build error npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\juno8\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\juno8\Desktop\New_Boilerplate-master\New_Boilerplate-master\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\juno8\Desktop\New_Boilerplate-master\New_Boilerplate-master\node_modules\bcrypt\lib\binding\napi-v3 --napi_version=7 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1) npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\juno8\Desktop\New_Boilerplate-master\New_Boilerplate-master\node_modules\node-pre-gyp\lib\util\compile.js:83:29) npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:378:20) npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1067:16) npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19041 npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\juno8\\Desktop\\New_Boilerplate-master\\New_Boilerplate-master\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" npm ERR! node-pre-gyp ERR! cwd C:\Users\juno8\Desktop\New_Boilerplate-master\New_Boilerplate-master\node_modules\bcrypt npm ERR! node-pre-gyp ERR! node -v v15.8.0 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.15.0 npm ERR! node-pre-gyp ERR! not ok npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\juno8\AppData\Local\npm-cache\_logs\2021-02-16T14_26_35_560Z-debug.log PS C:\Users\juno8\Desktop\New_Boilerplate-master\New_Boilerplate-master>
-
미해결[리뉴얼] React로 NodeBird SNS 만들기
swr 사용법에 대해 질문있습니다 ㅎㅎㅎ
const fetcher = (url) => axios.get(url, {withCredentials: true }).then( (result) => result.data) const Profile = () => { const { me } = useSelector((state) => state.user); const [followersLimit, setFollowersLimit] = useState(3) const [followingsLimit, setFollowingsLimit] = useState(3) const { data: followersData, error: followersError } = useSWR(`http://localhost:3065/user/followers?limit=${followersLimit}`, fetcher) const { data: followingsData, error: followingsError } = useSWR(`http://localhost:3065/user/followings?limit=${followingsLimit}`, fetcher) // useEffect(() => { // dispatch({ // type: LOAD_FOLLOWERS_REQUEST, // }); // dispatch({ // type: LOAD_FOLLOWINGS_REQUEST, // }); // }, []); useEffect(() => { if (!(me && me.id)) { Router.push('/'); } }, [me && me.id]); swr 사용하는 강의를 봤는데 너무 신기하더라고요 ㅎㅎ reducer, saga를 작성안해도 되는것처럼 보이는데... 코드가 엄청 짧아지겠네요. 다름이 아니라 기존 방법인 useEffect를 사용하면 처음 페이지가 랜더링할때 자동으로 액션을 디스패치해줬었는데 swr을 사용하면 useEffect같은거 사용안해도 처음 페이지가 랜더링될때 자동으로 실행되는건가요? useEffect에서 마지막 매개변수인 빈 배열에 특정 요소를 넣어주거나 return을 작성하면 componentDidMount였나 componentWillUnmount 같은 효과를 낼 수 있다고 기억하고있는데 swr에서도 같은 효과를 적용할 수 있는지 알 수 있을까요 ㅠㅠ
-
미해결프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
while
i = 1 while i < = 10: print(‘i’, i) if I == 6: break i += 1 - i = 1 i = 2 i = 3 i = 4 i = 5 i = 6 여기는 1부터 출력이되는데 n = 10 while n > 0: n -= 1 print(n) else: print(‘else out.’) 는 왜 9부터 출력이 되나요? + 와 - 의 차이인가요?
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
상품 기능 테스트하는 코드를 작성해보았는데 올바르게 작성했는지 궁금합니다.
안녕하세요, 스프링 부트 강의를 듣고있는 학생입니다. 다름아니라 상품 기능 테스트 부분은 회원 테스트와 비슷하다고 하셔서 제가 임의로 테스트 코드를 짜보았는데 올바르게 작성했는지가 궁금해서 질문드립니다. 아무래도 처음 배우다보니 확실히 알고싶어서 질문드립니다. 아래 코드는 상품 기능 중에 addStock 메소드를 테스트하기 위해 작성한 코드입니다. assertEquals 를 통해 재고를 2로 설정 후 1을 추가, 즉, 2+1=3 이 제대로 작동하는지 확인하는 코드입니다.
-
미해결비전공자를 위한 진짜 입문 올인원 개발 부트캠프
imgUrl 관련
안녕하세요! 아래처럼 물품의 사진이 나오지 않습니다. css도 다 적용을 했구요. 콘솔로그로도 받아보면 링크가 잘나오는데 왜 그러는지 모르겠습니다.
-
미해결프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
while문
제가 컴퓨터가 고장나서 이렇게 질문드립니다. ㅜㅜ i = 1 while i < = 10: print(‘i =’, i) if i == 6: break i += 1 출력은 i = 1 i = 2 i = 3 i = 4 i = 5 i = 6 이렇게 된다고 하셨는데. 혹시 아래 두가지의 경우도 같은 출력이 나오는지요? <<1>> i = 1 while i < = 10: i += 1 print(‘i =’, i) if i == 6: break <<2>> i = 1 while i < = 10: if i == 6: break i += 1 print('i =', i)
-
해결됨프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
객체지향 TypeError: Dog() takes no arguments
class Dog: species = 'firstdog' def init (self, name, age): self.name = name self.age = age print(Dog) a = Dog("mikky", 2) b = Dog("baby", 3) print(a == b, id(a), id(b)) <class '__main__.Dog'> Traceback (most recent call last): File "c:\Users\dlrkddlr\Desktop\pythonwork\practice.py", line 11, in <module> a = Dog("mikky", 2) TypeError: Dog() takes no arguments TypeError 뜨는 이유가 무었인가요? d
-
미해결스프링 웹 MVC
핸들러 메소드 - @ModelAttribute 강의 수강 중 의문사항이 있어서 문의합니다.
아래의 내용으로 오래전에 다른 분이 질문을 남겼습니다. 최신버전 부트를 사용하고 있어서 @Valid 어노테이션을 사용하기위해 의존성은 추가했습니다. 그런데 Event 의 limit 프로퍼티에 @Min(0) 을 추가했고, mock으로 -10을 넘기는데 BindingResult 에서 에러로 잡지 못하고 그대로 넘겨주는데 제가 뭘 잘못한걸까요 아래 의존성을 추가해서 해결이 되었네요. <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency> 이 의존성 전에 아래 의존성을 추가해서 시도했는데 @BindingResult에 에러가 바인딩 되지 않네요. 왜 안되는지 이유를 알고 싶어서 질문합니다. <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version>2.0.1.Final</version> </dependency>
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
postman 질문입니다..
ㅇ저는 이렇게 뜨는데 선생님께서 url 주소입력과 body 등 못찾겠습니다,,,
-
미해결파이썬 무료 강의 (기본편) - 6시간 뒤면 나도 개발자
선생님, 제가 푼 방법을 봐주실 수 있으신가요?
제가 푼 방법도, 답이 나오기는 했습니다. 이 방법도, 시행 착오가 많았기에 드디어 해냈구나라는 생각을 했는데 선생님의 풀이법을 보고 좌절했습니다. 어떻게 하면, 그런 식으로 풀이를 하는 습관을 가질 수 있을까요? 제 풀이 방식에서 이상하거나, 안 좋은 부분이 있다면 짚어주실 수 있으신가요? 항상 감사하게 생각하고 있습니다, 좋은 강의 정말 고맙습니다!! url= "http://naver.com" cut1 = url[7:] cut2 = cut1[:-4] result = cut2[0:3] + str(len(cut2)) + str(cut2.count("e")) + "!" print(result)
-
미해결iOS 개발을 위한 swift5 완벽 가이드
정규 표현식 오류
오류의 이유를 알 수 있을까요~?
-
미해결프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
while
혹시 while 구문을 작성하는 순서가 정의된게 있나요? 어떤 곳은 print를 제일 아래에 쓰시고 어떤 곳은 중간에 쓰셔서 너무 헷갈리네요. 어디에 쓰는 그 출력이 같다면 상관없지만 다르다고 하시니까 더 모르겠습니다. ex1 m = 5 while m > 0: m -= 1 if n == 2: contonue print(m) print(‘loop ended.’) - 4 3 1 0 Loop ended. ex2 i = 1 while i < = 10: print(‘i’, i) if I == 6: break
-
미해결프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
while 에서 continue
m = 5 while m > 0: m -= 1 if n == 2: contonue print(m) print(‘loop ended.’) - 4 3 1 0 Loop ended. loop ended는 왜 마지막에 출력되는건가요? 2가 출력되어야 하는 단계에서 출력되어야 하는거 아닌가요?