묻고 답해요
161만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결파이썬 무료 강의 (기본편) - 6시간 뒤면 나도 개발자
퀴즈를 return값을 다른 변수에 저장하지 않고 함수만 호출했을 때의 코드입니다(피드백 적극 문의 부탁드립니다^^)
man = 1 woman = 0 gender = man or woman # gender를 1 또는 0으로의 flag로 작성 def std_weight(height, gender): if gender == man: std_height = height / 100 # 1m = 100cm, 175cm = 1.75m weight = std_height * std_height * 22 print(f"키 {height}cm 남자의 표준 체중은 {weight:.2f}kg 입니다.") else: std_height = height / 100 weight = std_height * std_height * 21 print(f"키 {height}cm 여자의 표준 체중은 {weight:.2f}kg 입니다.") # f-string 소숫점 n째짜리까지 출력: 실수:.nf std_weight(175, man) std_weight(153, woman)
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
테이블 이름 order 질문
Order테이블인데 왜@Table(name="orders")라고 했는지 알 수 있을까요??아예 클래스 이름 만들때부터 Orders라고 했으면 되는거 아닌가요?
-
해결됨[리뉴얼] React로 NodeBird SNS 만들기
안녕하세요. 질문 있습니다.
안녕하세요 질문 있습니다. 노드 버드 react-query 폴더를 보면서 따라하고 있습니다. 현재 주소에서 storeId를 id 값으로 하여 서버에서 각기 다른 데이터를 받아오고 있습니다.그런데 아래와 같이 router.query로 값을 불러오거나 아래 getStaticProps에서 storeId를 보내도 컴포넌트 내부에서 storeId를 한번 undefined로 인식해서 오류가 나더라고요. 이럴 경우 어떤 방식으로 해결해 나가는게 좋을지 궁금합니다.서버에 요청 보내는 api에서 파라미터의 값이 undefined일 경우 실행을 안시키는 식으로 했는데 좋은 방법이 아닌거 같고 페이지 내부에서 해결해야 할거 같긴 한데 어떤 식으로 접근해야할지 잘 모르겠습니다ㅠ import React from 'react'; import { dehydrate, QueryClient, useInfiniteQuery, useQuery } from 'react-query'; import DefaultLayout from '@layouts/DefaultLayout'; // import InfiniteCarousel from '@components/Commons/InfiniteCarousel'; import { loadStoreAPI } from '@apis/store'; import { GetStaticProps } from 'next'; import { ParsedUrlQuery } from 'querystring'; import { useRouter } from 'next/router'; interface Params extends ParsedUrlQuery { storeId: string; } const Home: React.FC<Params> = () => { const router = useRouter(); const { storeId } = router.query as Params; console.log(storeId); const { data: storeInfo } = useQuery(['storeInfo', storeId], () => loadStoreAPI(storeId)); return ( <DefaultLayout> <h1>home123</h1> {/*<InfiniteCarousel></InfiniteCarousel>*/} </DefaultLayout> ); }; export const getStaticPaths = async () => { return { paths: ['/app/store/[storeId]'], fallback: true, }; }; export const getStaticProps: GetStaticProps = async ({ params }) => { const { storeId } = params as Params; if (!storeId) { return { redirect: { destination: '/', permanent: true, }, }; } console.log(storeId); const queryClient = new QueryClient(); await queryClient.prefetchQuery(['storeInfo', storeId], () => loadStoreAPI(storeId)); return { props: { dehydratedState: dehydrate(queryClient), storeId, }, }; }; export default Home;
-
미해결10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
2-Q 질문
http://boj.kr/26099a5957134d3c8954c7971fc64fbb질문게시판에 있는 모든 반례를 다 넣어봤는데도 16%에서 계속 실패하네요 접근 방법은 동 서 남 북 에서 바라봤을때 1을 만나기 전 까지 모든 0을 queue에 집어넣어 bfs를 돌리는 방법으로 했습니다. 반례 리스트10 120 0 0 0 0 0 0 0 0 0 0 00 1 1 1 1 1 1 1 1 1 1 00 1 1 0 0 1 0 0 0 1 1 00 1 0 1 0 1 0 1 1 0 1 00 1 0 1 0 1 0 0 0 0 0 00 1 0 1 0 0 1 1 1 0 1 00 1 0 1 1 1 1 1 1 0 1 00 1 0 0 0 0 0 0 0 0 1 00 1 1 1 1 1 1 1 1 1 1 00 0 0 0 0 0 0 0 0 0 0 0answer: 1 505 50 0 0 0 00 1 1 0 00 1 0 1 00 1 1 1 00 0 0 0 0answer 1,74 60 0 0 0 0 00 0 0 1 1 00 1 1 1 1 00 0 0 0 0 0answer 1,66 40 0 0 00 1 1 00 0 1 00 1 0 00 1 0 00 0 0 0answer 1,56 60 0 0 0 0 00 0 1 0 0 00 0 0 0 0 00 0 0 0 1 00 0 0 1 0 00 0 0 0 0 0answer 1,33 30 0 00 1 00 0 0answer 1,13 30 0 00 0 00 0 0answer 0,0
-
해결됨[C++과 언리얼로 만드는 MMORPG 게임 개발 시리즈] Part4: 게임 서버
SendBuffer Pooling 관련 질문있습니다.
여기서 다 썼으면 버리고 새거로 교체할 때 교체하지 않고 그냥 Reset만 호출해서 _usedSize를 0으로만 해줘도 되지 않을까 했었는데 WSASend를 호출하는 과정에서 아직 예전 버퍼가 날아가면 안되는 상황이 있기 때문에 새로 할당해준다. 가 맞게 이해한 부분인가요?
-
미해결워드프레스 기초부터 쇼핑몰까지
망보드 플러그인 설치 오류
김명준 강사님 안녕하세요 인프런 워드프레스 "워드프레스 기초부터 쇼핑몰까지" 라는 강의를 열공중입니다.. 제가 섹션3 플러그인 강의중 게시판만들기 편을 듣고 있는데요 강사님께서 망보드 플러그인 설치하는것과 똑같이 진행을 했습니다. 헌데 board setting 에 들어가면 Board_options setting does not exist 라는 메시지가 나옵니다. Dash board 를 제외하고 모든 메뉴에서 ~~ setting does not exist 라는 메시지가 나옵니다 이게 왜 이런거지요 ?
-
미해결데브옵스(DevOps)를 위한 쿠버네티스 마스터
kubeadm init error
안녕하세요. 다음과 같은 문제가 있어 문의드립니다.다음과 같은 에러가 발생하고 정상적으로 진행하지 못하고 있습니다.docker는 정상적으로 설치되어 있고, cgoups 드라이버는 systemd로 설정되어 있습니다.답변부탁드립니다.********************************************************************************************[kubelet-check] It seems like the kubelet isn't running or healthy.[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp 127.0.0.1:10248: connect: connection refused.[kubelet-check] It seems like the kubelet isn't running or healthy.[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp 127.0.0.1:10248: connect: connection refused.[kubelet-check] It seems like the kubelet isn't running or healthy.[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp 127.0.0.1:10248: connect: connection refused.[kubelet-check] It seems like the kubelet isn't running or healthy.[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp 127.0.0.1:10248: connect: connection refused.[kubelet-check] It seems like the kubelet isn't running or healthy.[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp 127.0.0.1:10248: connect: connection refused.Unfortunately, an error has occurred: timed out waiting for the conditionThis error is likely caused by: - The kubelet is not running - The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands: - 'systemctl status kubelet' - 'journalctl -xeu kubelet'Additionally, a control plane component may have crashed or exited when started by the container runtime.To troubleshoot, list all containers using your preferred container runtimes CLI.Here is one example how you may list all running Kubernetes containers by using crictl: - 'crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock ps -a | grep kube | grep -v pause' Once you have found the failing container, you can inspect its logs with: - 'crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock logs CONTAINERID'error execution phase wait-control-plane: couldn't initialize a Kubernetes clusterTo see the stack trace of this error execute with --v=5 or higher
-
미해결파이널 코딩테스트 : 프론트엔드
cart 페이지 피그마 로직관련 질문드립니다!
파이널 코딩 테스트 : 프론트엔드(추가문제-바닐라JS로SPA만들기및API비동기통신:스토어페이지만들기) 관련 질문 드립니다!현재 강의를 제작 중임에 먼저 figma를 보고 페이지를 만들어보던 중 이해가 잘 안되는 부분이 생겨 강의 전에 먼저 질문을 드리고자 글 남겨봅니다!현재 cart 페이지의 주문 상품 부분을 제작 중입니다만,, 구매 상품을 표시하는 부분이 가격이나 할인이 어떻게 표시되는 것인지 판단하기가 어려운거 같아서 어떤 식으로 이해하는게 맞는지 여쭤보고 싶습니다.첨부한 사진을 보면노트북 파우치의 경우 옵션이 2개인데 주문 금액에는 반영이 안되어있는것 같습니다.또한 구매할 상품들의 총 상품 금액또한 맞지 않는 것 같습니다.그리고 총 상품 금액에 부분에서 쿠폰 할인에는 선택된 쿠폰에서 받을 수 있는 할인 금액을 다 합치는 것으로 이해를 했는데 배송비에도 보니 무료 배송 쿠폰 내용이 적용이 되어있더라구요,, 배송이랑 상품 쿠폰이 따로 관리되어 적용되는 것인지 궁금합니다.질문 사항에 외에도 해당 페이지의 주문 상품 부분의 figma가 어떤 로직을 담고 있는건지 전체적인 동작 방식에 대해 답변 부탁드립니다!
-
미해결[코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!
엘리베이트 버튼을 눌렀는데 화면이 어두워집니다
색상 상태관리 강의에 isSelected 가 true 일때 테두리를 추가해주는 강의까지 따라왔는데 버튼을 누르면 바텀시트가 안뜨고 오류가 뜨면서 위 화면처럼 화면이 어둡게 뜹니다 에러 메세지가 너무 많아서 뭔지 모르겠네요...Failed assertion: line 2001 pos 12: 'hasSize'위와 같은 코드도 많이 보이고 그럽니다 설명이 부족할수있어서 작성한 코드 올려볼게요!import 'package:calendar_schedular/component/custom_text_field.dart'; import 'package:calendar_schedular/const/color.dart'; import 'package:calendar_schedular/database/drift_database.dart'; import 'package:calendar_schedular/model/category_color.dart'; import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; import 'package:calendar_schedular/database/drift_database.dart'; class ScheduleBottomSheet extends StatefulWidget { const ScheduleBottomSheet({Key? key}) : super(key: key); @override State<ScheduleBottomSheet> createState() => _ScheduleBottomSheetState(); } class _ScheduleBottomSheetState extends State<ScheduleBottomSheet> { final GlobalKey<FormState> formKey = GlobalKey(); // 처음엔 값이 없기때문에 null 허용 '?' int? startTime; int? endTime; String? content; int? selectedColorId; @override Widget build(BuildContext context) { final bottomInset = MediaQuery.of(context).viewInsets.bottom; return GestureDetector( onTap: () { FocusScope.of(context).requestFocus(FocusNode()); }, child: Container( height: MediaQuery.of(context).size.height / 2 + bottomInset, color: Colors.white, child: Padding( padding: EdgeInsets.only(bottom: bottomInset), child: Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 16.0), child: Form( key: formKey, autovalidateMode: AutovalidateMode.always, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ _Time( onStartSaved: (String? val) { startTime = int.parse(val!); }, onEndSaved: (String? val) { endTime = int.parse(val!); }, ), SizedBox(height: 16.0), _Content( onSaved: (String? val) { content = val; }, ), SizedBox(height: 16.0), FutureBuilder<List<CategoryColor>>( future: GetIt.I<LocalDatabase>().getCategoryColors(), builder: (context, snapshot) { if (snapshot.hasData && selectedColorId == null && snapshot.data!.isNotEmpty) { selectedColorId = snapshot.data![0].id; } return _ColorPicker( colors: snapshot.hasData ? snapshot.data! : [], selectedColorId: selectedColorId!, ); }), SizedBox(height: 16.0), _SaveButton( onPressed: onSavePressed, ), ], ), ), ), ), ), ); } void onSavePressed() { // formKey는 생성을 했는데 // Form 위젯과 결합이 안했을때 if (formKey.currentState == null) { //우리는 formKey 값을 넣어줬기때문에 null 일수는 없다 return; } if (formKey.currentState!.validate()) { print('에러가 없습니다.'); formKey.currentState!.save(); print('------------'); print('startTime : $startTime'); print('endTime : $endTime'); print('content : $content'); } else { print('에러가 있습니다.'); } } } class _Time extends StatelessWidget { final FormFieldSetter<String> onStartSaved; final FormFieldSetter<String> onEndSaved; const _Time({ required this.onStartSaved, required this.onEndSaved, Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return Row( children: [ Expanded( child: CustomTextField( label: '시작 시간', isTime: true, onSaved: onStartSaved, ), ), SizedBox(width: 16.0), Expanded( child: CustomTextField( label: '마감 시간', isTime: true, onSaved: onEndSaved, ), ), ], ); } } class _Content extends StatelessWidget { final FormFieldSetter<String> onSaved; const _Content({ required this.onSaved, Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return Expanded( child: CustomTextField( label: '내용', isTime: false, onSaved: onSaved, ), ); } } class _ColorPicker extends StatelessWidget { final List<CategoryColor> colors; final int selectedColorId; const _ColorPicker({ required this.colors, required this.selectedColorId, Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return Wrap( spacing: 8.0, runSpacing: 10.0, children: colors .map((e) => renderColor( e, selectedColorId == e.id, )) .toList(), ); } Widget renderColor(CategoryColor color, bool isSelected) { return Container( decoration: BoxDecoration( shape: BoxShape.circle, color: Color( int.parse( 'FF${color.hexCode}', radix: 16, ), ), border: isSelected ? Border.all( color: Colors.black, width: 4.0, ) : null, ), width: 32.0, height: 32.0, ); } } class _SaveButton extends StatelessWidget { final VoidCallback onPressed; const _SaveButton({ required this.onPressed, Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return Row( children: [ Expanded( child: ElevatedButton( onPressed: onPressed, style: ElevatedButton.styleFrom( primary: PRIMARY_COLOR, ), child: Text('저장'), ), ), ], ); } }
-
해결됨스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
스프링 메시지 소스 사용 테스트 코드 오류
안녕하세요, 좋은 강의 잘 듣고 있습니다.다름이 아니라 제공해주신 메시지 소스 사용 테스트 코드가 정상적으로 작동하지 않아질문 드립니다. 강의 자료에 첨부해주신 질문 글도 참고하여 실행해보고여러 경로로 실행해보려 했으나 희한하게도 getMessage 메서드를 통해 메시지를호출하였을때 영문 테스트 코드는 제대로 통과가 되나 한글이 통과가 안되는현상이 발생합니다. 메시지가 제대로 넘어오지 못하는데 인코딩 옵션도 정상적으로UTF-8 로 설정되어있는 상황이라 답답한 마음에 문의드립니다. 감사합니다.Locale.KOREA 로도 시도해보았으나 실패했습니다.영문은 정상적으로 통과됩니다.
-
미해결10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
3-H 질문합니다
http://boj.kr/7b426c7a534b4d2fa7bc4a753d66c738왜 틀렸다는건지 모르겠네요..그리고 3-G에서는 수빈이와 동생의 위치가 같은 경우에 대해서 예외처리를 해주었는데왜 3-H에서는 안하는건가요??
-
미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
UserDto 의 pwd 값 관련
안녕하세요. 좋은강의 감사합니다.다름이 아니라 강의에서 설명하실때는getUserDetailsByEmail 메소드에서 UserEntity 를 UserDto로 맵핑할때클라이언트가 입력한 password를 Spring Security 가 UserDto의 pwd 파라미터에 암호화하여 넣어준다는 식으로 말씀하신거 같습니다.@Override public UserDto getUserDetailsByEmail(String userName) { UserEntity userEntity = userRepository.findByEmail(userName); if(userEntity == null) throw new UsernameNotFoundException(userName); UserDto userDto = new ModelMapper().map(userEntity,UserDto.class); return userDto; 그게 아니라 단지, ModelMapper 에 STRICT 설정을 해주지 않아서 UserDto의 pwd와 encrytedpwd 값이 모두 UserEntity의 password 값으로 들어간게 아닌가 해서 질문드립니다.
-
미해결따라하며 배우는 리액트 A-Z[19버전 반영]
동영상이 흐릿하게 나옵니다
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 넷플릭스 실습을 하면서 iframe을 사용해 유튜브에서 동영상이 나오게 하는거 까지는 완료가 되었습니다.그런데 재생버튼을 누르고 영상이 시작되면 그림처럼 흐릿하게 나오는데 왜 그런걸까요?
-
미해결스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
세선 테스트시에, web폴더 질문 있습니다!
안녕하세요 강의를 보다가 궁금한 점이 생겨서 질문 드립니다!영상에서 테스트 폴더에 session 테스트를 하시면서WEB폴더를 만드셨는데요,강의에서 web과 domain을 분리하라고 들었고, 따라서 개발환경에서 web과 domain 분리는 이해 하였는데이것을 테스트 상황에서 web폴더를 꼭 만들어야 하는 이유가 있나요?? 뭔가 이유가 있을것 같아서 궁금해서 질문드립니다! 감사합니다.
-
미해결대세는 쿠버네티스 (초급~중급편)
https://kubetm.github.io/k8s/practice/ 접속 불가
안녕하세요, 강의 중 https://kubetm.github.io/k8s/practice/ 경로로 접속하여 내용을 확인하며 진행하는데, 접속 시도 시 접속이 되지 않습니다.이에 접속 방법을 문의드립니다. 감사합니다.
-
미해결스프링 프레임워크는 내 손에 [스프1탄]
리스트페이지관련해서 오류가 나네요
root값하고 컨트롤러 매핑은 잘된듯한데 웹화면이 안나오네요
-
미해결10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
3-G 질문합니다
http://boj.kr/96b805de8144425caf0bad265bb9edd6왜 런타임 에러가 나는지 모르겠네요
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
통합테스트 개념 및 테스트 코드에서의 @Transactional(롤백)
@Test public void 회원가입() throws Exception { //Given Member member = new Member(); member.setName("hello"); //When Long saveId = memberService.join(member); //Then Member findMember = memberRepository.findById(saveId).get(); assertEquals(member.getName(), findMember.getName()); assertEquals(member.getId(), 1L); }@Transactional로 각 테스트 마다 데이터를 rollback하여도 해당 pk 값은 rollback이 되지 않는것 같습니다. 해당 부분이 왜 이렇게 되는지 모르겠습니다 알려주시면 감사하겠습니다 ㅠㅠㅠㅠ 그 동안에 통합테스트는 controller layer에서 진행된다고 생각했습니다. 정확한 통합테스트의 개념을 모르겠습니다.그냥 @SpringBootTest 어노테이션만 있으면 통합테스트라고 생각해도 되는지 궁금합니다 !
-
미해결Vue.js 중급 강좌 - 웹앱 제작으로 배워보는 Vue.js, ES6, Vuex
메일 알람 설정 문의
메일 알람 안오게 할려면 어떻게 해야 하나요? repositories에서는 이미 삭제해서 unsubscribe를 할수가 없는 상태입니다 답변 부탁 드리겠습니다
-
미해결프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
코딩 터미널 질문입니다!
PS C:\Users\김성재\Desktop\python_basic> & C:/Users/김성재/AppData/Local/Programs/Python/Python311/python.exe c:/Users/김성재/Desktop/python_basic/chapter03_01.pyPS C:\Users\김성재\Desktop\python_basic> & C:/Users/김성재/AppData/Local/Programs/Python/Python311/python.exe c:/Users/김성재/Desktop/python_basic/chapter03_01.pyPS C:\Users\김성재\Desktop\python_basic> & C:/Users/김성재/AppData/Local/Programs/Python/Python311/python.exe c:/Users/김성재/Desktop/python_basic/chapter03_01.py['Python', 'Anaconda']PS C:\Users\김성재\Desktop\python_basic> 코딩할때마다 이런 영어가 자주 뜨는데 왜이런건가요??