코드는 영상과 똑같이 작성하고 useState를 사용하니 컴파일은 성공했지만 브라우저에선 아래와 같은 오류가 발생하면서 흰 화면만 보입니다ㅠㅠ 해결할 수 있도록 도와주세요! Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
안녕하세요, count(distinct) 구문을 사용하려고 할 때마다 해당 오류가 발생합니다. limit의 경우도 오류가 발생하여 구글링해보니 SQLServer에서는 top을 사용한다고 하여 문제를 해결하였는데, count(distinct)에 대해서는 문제 해결방법을 찾지 못해 질문 드립니다. 또한, 같은 실습 환경에서 실행하였는데 왜 저는 limit이 작동하지 않는 등 문제가 발생하는 것인지도 궁금하여 질문드립니다. 감사합니다.
다른 질문에서 배열의 크기는 const 상수로 컴파일 크기를 통해서 정해줘야한다는 답변은 이해했습니다! 그런데 int scores[] = { ...}; 는 올바른 형식이잖아요? 그렇다면 배열의 크기는 알아서 설정이 되었다고 생각됩니다. 그래서, 여기서 num_students에 const를 하신 이유가 궁금합니다. 여기서의 num_students는 배열 정의시에 들어가지 않고 for문에서 단순 조건문에 들어갈 뿐인데, const를 한 이유가 궁금합니다!. 제가 cosnt를 빼고 실행했을때도 실행이 되더라구요!. 처음에 배열 사이즈 변수로 넣으려고 할 때 const가 붙여있어서 그랬던 것이고, 나중에 다른 케이스 변경하면서 굳이 지우지 않았던 것인가요? 감사합니다.
아래와 같이 강의와 똑같이 코드를 작성하고 텍스트 파일도 Project1.vcxproj 파일과 같은 파일에 있는데 파일이 열리지 않습니다! 뭐를 잘못하고 있는지 알고 싶습니다! 코드 #define CRT SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> //exit() int main() { int c; FILE* file = NULL; char file_name[] = "my_file.txt"; file = fopen(file_name, "r"); if (file == NULL) { printf("Failed to open file.\n"); exit(1); } while ((c = getc(file)) != EOF) putchar(c); fclose(file); return 0; } 출력 Failed to open file. C:\Users\LG\Documents\Visual Studio 2022\Project1\x64\Debug\Project1.exe (process 18144) exited with code 1. Press any key to close this window . . .
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 아두이노 IDE 최신 버전에서 툴-->시리얼 플로터, 클릭해도 실행이 안됩니다. 혹시 어떻게 실행 해야 할까요 ? 소스 코드가 필요하나요 ?
#include <bits/stdc++.h> // --- (1) using namespace std;// --- (2) string a;// --- (3) int main(){ cin >> a;// --- (4) cout << a << "\n";// --- (5) return 0; // - (6) } 1.2 기본 예제로 이해하는 c++에서 vscode에서 실행 시 a.cpp:18:8: error: use of undeclared identifier 'a' cin >> a;// --- (4) ^ a.cpp:19:9: error: use of undeclared identifier 'a' cout << a << "\n";// --- (5) return 0; // - (6) ^ 2 errors generated. 아래처럼 에러가 납니다. 파일은 꼭 include/bits 폴더안에 정리하지않고 데스크탑내에 따로 폴더를 만들어서 실행해도 무방한가요? 그렇게 했을 때 위 코드말고는 코드러너로 실행은 잘 되는데 혹시나해서 여쭤봅니다!
여기서 react-router-dom에 쓰이는 Switch, Route, Redirect에서 오류가 발생했습니다. 그래서 react-router-dom 버전 문제가 있어서 코드를 바꿔서 진행했습니다. 결론은 여전히 빨간색 오류가 발생하는데 어떤 부분이 오류인지 찾기 힘들어서 여쭤봅니다!! BrowserRouter 추가하는 것도 오류가 발생합니다 Its instance type 'BrowserRouter' is not a valid JSX element. TS2786: 'BrowserRouter' cannot be used as a JSX component. The types returned by 'render()' are incompatible between these types. Type 'React.ReactNode' is not assignable to type 'import("C:/Users/user/node_modules/@types/hoist-non-react-statics/node_modules/@types/react/index").ReactNode'. Type '{}' is not assignable to type 'ReactNode'. 오류메시지입니다 react-router-dom 버전 "react-router": "^5.3.4", "react-router-dom": "^5.3.4", "@types/react-router": "^5.1.20", "@types/react-router-dom": "^5.3.3",
안녕하세요. 우선 타 강의 플랫폼과 달리 큰돌님 강의는 개념과 문제풀이를 그림으로 그리면서 설명 해주셔서 너무 잘 듣고 있습니다. (C++ 은 안하고 Javascript로만 풀이 중) 그런데 비트연산자 개념강의 2번째 영상에서 일부 확인이 필요한 설명이 있는것 같아서 글 남깁니다. (오타는 이미 공지를 해주셨네요) 마지막 XOR 연산자에서 0은 1로 1은 0으로 라는 설명이 있는데 위키피디아에 설명된 것 처럼 각 자릿수를 비교해 같으면 0, 다르면 1이라는 설명이 맞지 않나 싶습니다. ( https://ko.wikipedia.org/wiki/%EB%B9%84%ED%8A%B8_%EC%97%B0%EC%82%B0 ) 강의 중 예제로 보면 n = 5 이고 idx = 0 일 때 n ^= (1 << idx) = 101 ^ 001 = 100 ////////// 101 ^ 001 ----- 100 ////////// 앞에서부터 각 자릿수를 비교해보면 1과 0은 다르므로 1 , 0과 0은 같으므로 0 , 1과 1이 같으므로 0 이 아닌가 싶습니다.
안녕하세요!! 강의 너무 잘 보고 있는 수강생입니다! 스프링 부트 3.0.1 버전으로 프로젝트를 생성해 강의를 듣다가 단순 전체 조회 쿼리(/api/v2/orders)인 findAll() 에서 쿼리가 강의와 다르게 나와 궁금증이 생겨 질문 드립니다. 제가 이해하기로는 /api/v2/orders를 호출하면 다음과 같은 순서로 데이터를 가져온다고 생각했습니다. orders 조회하는 쿼리 호출 OrderDto 를 만드는 과정에서 getMember() 와 getDelivery() 를 호출할 때 Member와 Delivery를 가져오는 쿼리 호출 getOrderItems() 를 통해 orderItems 조회하는 쿼리 호출 OrderItemDto 를 만드는 과정에서 getItem() 을 호출할 때 각각의 Item을 가져오는 쿼리 호출 그래서 강의처럼 데이터를 초기화 한다면 총 11번의 쿼리가 발생해야 한다고 생각했고 강의에서도 11번의 쿼리가 생겼습니다. 하지만 제 코드에서는 getDelivery() 를 호출하는 과정에서 이상하게 Delivery를 호출한 후, deliveryId 를 조건절로 Order를 조회하는 쿼리가 한 번 더 생겨 아래 로그처럼 총 13번의 쿼리가 발생했습니다. 2023-01-14T18:10:31.860+09:00 DEBUG 6590 --- [nio-8070-exec-2] org.hibernate.SQL : select o1_0.order_id, o1_0.delivery_id, o1_0.member_id, o1_0.order_date, o1_0.status from orders o1_0 2023-01-14T18:10:31.890+09:00 DEBUG 6590 --- [nio-8070-exec-2] org.hibernate.SQL : select m1_0.member_id, m1_0.city, m1_0.street, m1_0.zipcode, m1_0.name from member m1_0 where m1_0.member_id=? 2023-01-14T18:10:31.890+09:00 TRACE 6590 --- [nio-8070-exec-2] org.hibernate.orm.jdbc.bind : binding parameter [1] as [BIGINT] - [1] 2023-01-14T18:10:31.895+09:00 DEBUG 6590 --- [nio-8070-exec-2] org.hibernate.SQL : select d1_0.delivery_id, d1_0.city, d1_0.street, d1_0.zipcode, d1_0.status from delivery d1_0 where d1_0.delivery_id=? 2023-01-14T18:10:31.895+09:00 TRACE 6590 --- [nio-8070-exec-2] org.hibernate.orm.jdbc.bind : binding parameter [1] as [BIGINT] - [1] 2023-01-14T18:10:31.899+09:00 DEBUG 6590 --- [nio-8070-exec-2] org.hibernate.SQL : select o1_0.order_id, o1_0.delivery_id, o1_0.member_id, o1_0.order_date, o1_0.status from orders o1_0 where o1_0.delivery_id=? 2023-01-14T18:10:31.900+09:00 TRACE 6590 --- [nio-8070-exec-2] org.hibernate.orm.jdbc.bind : binding parameter [1] as [BIGINT] - [1] 2023-01-14T18:10:31.910+09:00 DEBUG 6590 --- [nio-8070-exec-2] org.hibernate.SQL : select o1_0.order_id, o1_0.order_item_id, o1_0.count, o1_0.item_id, o1_0.order_price from order_item o1_0 where o1_0.order_id=? 2023-01-14T18:10:31.910+09:00 TRACE 6590 --- [nio-8070-exec-2] org.hibernate.orm.jdbc.bind : binding parameter [1] as [BIGINT] - [1] 2023-01-14T18:10:31.914+09:00 DEBUG 6590 --- [nio-8070-exec-2] org.hibernate.SQL : select i1_0.item_id, i1_0.dtype, i1_0.name, i1_0.price, i1_0.stock_quantity, i1_0.author, i1_0.isbn from item i1_0 where i1_0.item_id=? 2023-01-14T18:10:31.915+09:00 TRACE 6590 --- [nio-8070-exec-2] org.hibernate.orm.jdbc.bind : binding parameter [1] as [BIGINT] - [1] 2023-01-14T18:10:31.916+09:00 DEBUG 6590 --- [nio-8070-exec-2] org.hibernate.SQL : select i1_0.item_id, i1_0.dtype, i1_0.name, i1_0.price, i1_0.stock_quantity, i1_0.author, i1_0.isbn from item i1_0 where i1_0.item_id=? 2023-01-14T18:10:31.917+09:00 TRACE 6590 --- [nio-8070-exec-2] org.hibernate.orm.jdbc.bind : binding parameter [1] as [BIGINT] - [2] ============================================== 2023-01-14T18:10:31.919+09:00 DEBUG 6590 --- [nio-8070-exec-2] org.hibernate.SQL : select m1_0.member_id, m1_0.city, m1_0.street, m1_0.zipcode, m1_0.name from member m1_0 where m1_0.member_id=? 2023-01-14T18:10:31.919+09:00 TRACE 6590 --- [nio-8070-exec-2] org.hibernate.orm.jdbc.bind : binding parameter [1] as [BIGINT] - [2] 2023-01-14T18:10:31.921+09:00 DEBUG 6590 --- [nio-8070-exec-2] org.hibernate.SQL : select d1_0.delivery_id, d1_0.city, d1_0.street, d1_0.zipcode, d1_0.status from delivery d1_0 where d1_0.delivery_id=? 2023-01-14T18:10:31.921+09:00 TRACE 6590 --- [nio-8070-exec-2] org.hibernate.orm.jdbc.bind : binding parameter [1] as [BIGINT] - [2] 2023-01-14T18:10:31.922+09:00 DEBUG 6590 --- [nio-8070-exec-2] org.hibernate.SQL : select o1_0.order_id, o1_0.delivery_id, o1_0.member_id, o1_0.order_date, o1_0.status from orders o1_0 where o1_0.delivery_id=? 2023-01-14T18:10:31.923+09:00 TRACE 6590 --- [nio-8070-exec-2] org.hibernate.orm.jdbc.bind : binding parameter [1] as [BIGINT] - [2] 2023-01-14T18:10:31.925+09:00 DEBUG 6590 --- [nio-8070-exec-2] org.hibernate.SQL : select o1_0.order_id, o1_0.order_item_id, o1_0.count, o1_0.item_id, o1_0.order_price from order_item o1_0 where o1_0.order_id=? 2023-01-14T18:10:31.926+09:00 TRACE 6590 --- [nio-8070-exec-2] org.hibernate.orm.jdbc.bind : binding parameter [1] as [BIGINT] - [2] 2023-01-14T18:10:31.927+09:00 DEBUG 6590 --- [nio-8070-exec-2] org.hibernate.SQL : select i1_0.item_id, i1_0.dtype, i1_0.name, i1_0.price, i1_0.stock_quantity, i1_0.author, i1_0.isbn from item i1_0 where i1_0.item_id=? 2023-01-14T18:10:31.927+09:00 TRACE 6590 --- [nio-8070-exec-2] org.hibernate.orm.jdbc.bind : binding parameter [1] as [BIGINT] - [3] 2023-01-14T18:10:31.928+09:00 DEBUG 6590 --- [nio-8070-exec-2] org.hibernate.SQL : select i1_0.item_id, i1_0.dtype, i1_0.name, i1_0.price, i1_0.stock_quantity, i1_0.author, i1_0.isbn from item i1_0 where i1_0.item_id=? 2023-01-14T18:10:31.928+09:00 TRACE 6590 --- [nio-8070-exec-2] org.hibernate.orm.jdbc.bind : binding parameter [1] as [BIGINT] - [4] ============================================== 혹시나 제가 코드를 잘못 작성했을까봐 강의 자료로 올라온 소스코드에서 default_batch_fetch_size 만 주석 처리하고 스프링 부트 3.0 환경에서 돌려봤는데 같은 결과가 나왔고, JpaRepository 를 통한 findAll 로 두 버전에서 모두 테스트를 해봤는데 같은 결과가 발생했습니다. 그래서 Delivery에 @OneToOne 으로 걸려있는 order 가 문제라 생각해 이 부분을 지우고 실행했더니 해당 쿼리가 사라졌습니다. 하지만 @OneToOne 의 패치 전략을 Lazy로 하고 따로 Order를 조회하지 않았고, 맨 처음 orders를 조회하는 쿼리를 실행하는 과정에서 영속성 컨텍스트에 orders가 저장 되기도 했기 때문에 해당 쿼리가 생기면 안된다고 생각을 했는데 혹시 제가 잘못 이해하고 있는걸까요..? 스프링 부트 3.0으로 올라가는 과정에서 hibernate의 버전도 6으로 올라가 뭔가 변경이 생긴것인지, 아니면 제가 어떤 실수를 하고 있는건지 궁금해서 질문 드립니다..!