묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨실전! Querydsl
Maven 라이브러리 질문
안녕하세요! 강사님께서 출판하신 JPA책과 같이 보면서 복습하고 있습니다. Jpa 책 73페이지에 보면 hibernate-entitymanager 핵심 라이브러리를 pom.xml에 등록해서 사용하셨는데 현 강의에서는 spring-data-jpa -> hibernate-core만 있고 엔티티매니저는 없는데 버전이 올라가면서 core만 있으면 되는건지 Maven Repository에서도 못찾아 질문 올립니다. 감사합니다.
-
미해결자바스크립트 비기너: 튼튼한 기본 만들기
코딩시간 질문
혹시 foreach문으로는 어떻게 적용될 수 있나요? 도무지 for문 말고는 답이 나오질 않아서요ㅠㅠ // 배열 값을 담을 변수를 생성 var arr = [] // for문을 이용하여 빈 check 함수에 1~1,000,000 배열을 생성 var check = function(){ for(var i = 1; i <= 1000000; i++){ arr.push(i); //arr에 i의 값을 배열로 넣기 } } // check함수가 실행되는 시간 반환 var start = Date.now(); check(); var end = Date.now(); console.log("총 실행시간은 " + (end - start) + "입니다."); }
-
미해결파이썬 무료 강의 (기본편) - 6시간 뒤면 나도 개발자
어느 부분이 오류인지 잘 모르겠습니다.
안녕하세요. 강의 감사합니다. 실습 중 동일하게 코딩을 했는데 오류가나서 질문드립니다. 아래는 제가 작성한 코드입니다. gun = 10 def checkpoint(soldiers): global gun gun = gun - soldiers print("[함수 내] 남은 총 : {0}".format(gun)) def checkpoint_ret(gun, soldiers): gun = gun - soldiers print("[함수 내] 남은 총 : {0}".format(gun)) return gun print("전체 총 : {0}".format(gun)) gun = checkpoint_ret(gun, 2) print("남은 총 : {0}".format(gun)) 오류가 어느 부분에서 났는지 질문드립니다.
-
미해결실전 JSP (renew ver.) - 신입 프로그래머를 위한 강좌
실행 시 html 구문만 나와요.
안녕하세요. 맛보기 servlet를 실행했는데 브라우저에 아래 처럼 나옵니다. 무엇이 잘못된 걸까요??Served at: /testWebPjt1<html><head></head><body><p>Hello Servlet!!</p></body></html>
-
미해결파이썬 무료 강의 (활용편1) - 추억의 오락실 게임 만들기 (3시간)
게임 화면이 늦게 열려요
한번 봐주시면 감사하겠습니다 # 1. 모든 공을 없애면 게임 종료 (성공) # 2. 캐릭터는 공에 닿으면 게임 종료 (실패) # 3. 시간 제한 99초 초과 시 게임 종료 (실패) import os import pygame ####################################################################### # 기본 초기화 (반드시 해야하는 것들) pygame.init() # 화면 크기 설정 screen_width = 640 # 가로 크기 screen_height = 480 # 세로 크기 screen = pygame.display.set_mode((screen_width, screen_height)) # 화면 타이플 설정 pygame.display.set_caption("Game Name") # 게임 이름 # FPS clock = pygame.time.Clock() ####################################################################### # 1. 사용자 게임 초기화 (배경 화면, 게임 이미지, 좌표, 속도, 폰트 등) current_path = os.path.dirname(__file__) # 현재 파일의 위치 반환 image_path = os.path.join(current_path, "images") # images 폴더 위치 반환 # 배경 만들기 background = pygame.image.load(os.path.join(image_path, "background.png")) # 스테이지 만들기 stage = pygame.image.load(os.path.join(image_path, "stage.png")) stage_size = stage.get_rect().size stage_height = stage_size[1] # 스테이지의 높이 위에 캐릭터를 두기 위해 사용 # 캐릭터 만들기 character = pygame.image.load(os.path.join(image_path, "character.png")) character_size = character.get_rect().size character_width = character_size[0] character_height = character_size[1] character_x_pos = (screen_width / 2) - (character_width / 2) character_y_pos = screen_height - character_height - stage_height # 캐릭터 이동 방향 character_to_x = 0 # 캐릭터 이동 속도 character_speed = 5 # 무기 만들기 weapon = pygame.image.load(os.path.join(image_path, "weapon.png")) weapon_size = weapon.get_rect().size weapon_width = weapon_size[0] # 무기는 한 번에 여러 발 발사 가능 weapons = [] # 무기 이동 속도 weapon_speed = 10 # 공 만들기 (4개 크기에 대해 따로 처리) ball_images = [ pygame.image.load(os.path.join(image_path, "balloon.png")), pygame.image.load(os.path.join(image_path, "balloon2.png")), pygame.image.load(os.path.join(image_path, "balloon3.png")), pygame.image.load(os.path.join(image_path, "balloon4.png"))] # 공 크기에 따른 최초 스피드 ball_speed_y = [-18, -15, -12, -9] # index 0, 1, 2, 3 에 해당하는 값 # 공들 balls = [] # 최초 발생하는 큰 공 추가 balls.append({ "pos_x" : 50, # 공의 x 좌표 "pos_y" : 50, # 공의 y 좌표 "img_idx" : 0, # 공의 이미지 인덱스 "to_x" : 3, # x축 이동방향, -3이면 왼쪽으로, 3이면 오른쪽으로 "to_y" : -6, # y출 이동방향, "init_spd_y" : ball_speed_y[0]}) # y 최초 속도 # 사라질 무기, 공 정보 저장 변수 weapon_to_remove = -1 ball_to_remove = -1 # Font 정의 game_font = pygame.font.Font(None, 40) total_time = 100 start_ticks = pygame.time.get_ticks() # 시작 시간 정의 # 게임 종료 메시지 # TimeOut(시간 초과, 실패) # Mission Complete(성공) # Game Over (캐릭터가 공에 맞음, 실패) game_result = "Game Over" running = True while running: dt = clock.tick(30) # 2. 이벤트 처리 (키보드, 마우스 등) for event in pygame.event.get(): if event.type == pygame.QUIT: running = False if event.type == pygame.KEYDOWN: if event.key == pygame.K_LEFT: # 캐릭터를 왼쪽으로 character_to_x -= character_speed elif event.key == pygame.K_RIGHT: # 캐릭터를 오른쪽으로 character_to_x += character_speed elif event.key == pygame.K_SPACE: # 무기 발사 weapon_x_pos = character_x_pos + (character_width / 2) - (weapon_width / 2) weapon_y_pos = character_y_pos weapons.append([weapon_x_pos, weapon_y_pos]) if event.type == pygame.KEYUP: if event.key == pygame.K_LEFT or event.key == pygame.K_RIGHT: character_to_x = 0 # 3. 게임 캐릭터 위치 정의 character_x_pos += character_to_x if character_x_pos < 0: character_x_pos = 0 elif character_x_pos > screen_width - character_width: character_x_pos = screen_width - character_width # 무기 위치 조정 # 100, 200 -> 180, 160, 140, ... # 500, 200 -> 180, 160, 140, ... weapons = [ [w[0], w[1] - weapon_speed] for w in weapons] # 무기 위치를 위로 올림 # 천장에 닿은 무기 없애기 weapons = [ [w[0], w[1]] for w in weapons if w[1] > 0] # 공 위치 정의 for ball_idx, ball_val in enumerate(balls): ball_pos_x = ball_val["pos_x"] ball_pos_y = ball_val["pos_y"] ball_img_idx = ball_val["img_idx"] ball_size = ball_images[ball_img_idx].get_rect().size ball_width = ball_size[0] ball_height = ball_size[1] # 가로벽에 닿았을 때 공 이동 위치 변경 (튕겨 나오는 효과) if ball_pos_x < 0 or ball_pos_x > screen_width - ball_width: ball_val["to_x"] = ball_val["to_x"] * -1 # 세로 위치 # 스테이지에 튕겨서 올라가는 처리 if ball_pos_y >= screen_height - stage_height - ball_height: ball_val["to_y"] = ball_val["init_spd_y"] else: # 그외의 모든 경우에는 속도를 증가 ball_val["to_y"] += 0.5 ball_val["pos_x"] += ball_val["to_x"] ball_val["pos_y"] += ball_val["to_y"] # 4. 충돌 처리 # 캐릭터 rect 정보 업데이트 character_rect = character.get_rect() character_rect.left = character_x_pos character_rect.top = character_y_pos for ball_idx, ball_val in enumerate(balls): ball_pos_x = ball_val["pos_x"] ball_pos_y = ball_val["pos_y"] ball_img_idx = ball_val["img_idx"] # 공 rect 정보 업데이트 ball_rect = ball_images[ball_img_idx].get_rect() ball_rect.left = ball_pos_x ball_rect.top = ball_pos_y # 공과 캐릭터 충돌 처리 if character_rect.colliderect(ball_rect): running = False break # 공과 무기들 충돌 처리 for weapon_idx, weapon_val in enumerate(weapons): weapon_pos_x = weapon_val[0] weapon_pos_y = weapon_val[1] # 무기 rect 정보 업데이트 weapon_rect = weapon.get_rect() weapon_rect.left = weapon_pos_x weapon_rect.top = weapon_pos_y # 충돌 체크 if weapon_rect.colliderect(ball_rect) : weapon_to_remove = weapon_idx # 해당 무기 없애기 위한 값 설정 ball_to_remove = ball_idx # 해당 공 없애기 위한 값 설정 # 가장 작은 크기의 공이 아니라면 다음 단계의 공으로 나눠주기 if ball_img_idx < 3: # 현재 공 크기 정보를 가지고 옴 ball_width = ball_rect.size[0] ball_height = ball_rect.size[1] # 나눠진 공 정보 small_ball_rect = ball_images[ball_img_idx + 1].get_rect() small_ball_width = small_ball_rect.size[0] small_ball_height = small_ball_rect.size[1] # 왼쪽으로 튕겨나가는 작은 공 balls.append({ "pos_x" : ball_pos_x + (ball_width / 2) - (small_ball_width / 2), # 공의 x 좌표 "pos_y" : ball_pos_y + (ball_height / 2) - (small_ball_height / 2), # 공의 y 좌표 "img_idx" : ball_img_idx + 1, # 공의 이미지 인덱스 "to_x" : -3, # x축 이동방향, -3이면 왼쪽으로, 3이면 오른쪽으로 "to_y" : -6, # y출 이동방향, "init_spd_y" : ball_speed_y[ball_img_idx + 1]}) # y 최초 속도 # 오른쪽으로 튕겨나가는 작은 공 balls.append({ "pos_x" : ball_pos_x + (ball_width / 2) - (small_ball_width / 2), # 공의 x 좌표 "pos_y" : ball_pos_y + (ball_height / 2) - (small_ball_height / 2), # 공의 y 좌표 "img_idx" : ball_img_idx + 1, # 공의 이미지 인덱스 "to_x" : 3, # x축 이동방향, -3이면 왼쪽으로, 3이면 오른쪽으로 "to_y" : -6, # y출 이동방향, "init_spd_y" : ball_speed_y[ball_img_idx + 1]}) # y 최초 속도 break else: # 계속 게임을 진행 continue # 안쪽 for 문 조건이 맞지 않으면 continue. 바깥 for 문 계속 수행 break # 안쪽 for 문에서 break를 만나면 여기로 진입 가능. 2중 for 문을 한번에 탈출 #for 바깥조건: # 바깥동작 # for 안쪽조건: # 안쪽동장 # if 충돌하면: # break # else: # continue # break # 충돌된 공 or 무기 없애기 if ball_to_remove > -1: del balls[ball_to_remove] ball_to_remove = -1 if weapon_to_remove > -1: del weapons[weapon_to_remove] weapon_to_remove = -1 # 모든 공을 없앤 경우 게임 종료 (성공) if len(balls) == 0: game_result = "Mission Complete" running = False # 5. 화면에 그리기 screen.blit(background, (0, 0)) for weapon_x_pos, weapon_y_pos in weapons: screen.blit(weapon, (weapon_x_pos, weapon_y_pos)) for idx, val in enumerate(balls): ball_pos_x = val["pos_x"] ball_pos_y = val["pos_y"] ball_img_idx = val["img_idx"] screen.blit(ball_images[ball_img_idx], (ball_pos_x, ball_pos_y)) screen.blit(stage, (0, screen_height - stage_height)) screen.blit(character, (character_x_pos, character_y_pos)) # 경과 시간 계산 elapsed_time = (pygame.time.get_ticks() - start_ticks) / 1000 # ms -> s timer = game_font.render("Time : {}".format(int(total_time - elapsed_time)), True, (255, 255, 255)) screen.blit(timer, (10, 10)) # 시간 초과했다면 if total_time - elapsed_time <= 0: game_result = "Time Over" running = False pygame.display.update() # 게임화면을 다시 그리기! # 게임 오버 메시지 msg = game_font.render(game_result, True, (255, 255, 0)) # 노란색 msg_rect = msg.get_rect(center=(int(screen_width / 2), int(screen_height / 2))) screen.blit(msg, msg_rect) pygame.display.update() # 2초 대기 pygame.time.delay(2000) pygame.quit()
-
미해결애플 웹사이트 인터랙션 클론!
익스플로러에서는 안돌아가나요?
익스플로러에서는 안돌아가나요? 만약안돌아간다면 어느부분에서 문제가 되는 것 일까요?ㅠㅠ
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
강의 순서 질문 드립니다!
스프링 입문자 인데 '실전!스프링 부트와 jpa 활용1-웹 애플리케이션 개발'로 시작 하라는 말씀이신가요?스프링 입문이 처음으로 듣는건지 순서인지 이해가 안가서요....
-
미해결실전 리액트 프로그래밍
7분20초 자꾸 이렇게 뜨면서 오류나오네요
처음에 오류떠서 워크스페이스 다 지우고 다시 깔아도 이렇게 나오네요 왜그런걸까요
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
예외 발생 시킬때
문득 궁금한 점이 예외가 발생되어서 catch문으로 잡아서 처리하지 않으면 프로그램이 종료되는걸로 알고 있습니다. 여기서 중복 이름 일때 예외 발생시키고 어디서도 catch로 잡아 주지 않았는데 왜 프로그램이 종료되지 않는지 궁금합니다 ㅠㅠ
-
미해결파이썬 무료 강의 (기본편) - 6시간 뒤면 나도 개발자
그리고 이렇게나오는데 ㅠㅠ;
(사진)
-
미해결파이썬 무료 강의 (기본편) - 6시간 뒤면 나도 개발자
3분20초쯤에 터미털쪽 지우는방법이 어떻게되나요?
단축키용 ㅠ
-
미해결자바 ORM 표준 JPA 프로그래밍 - 기본편
시퀀스 방식에 대해서 질문을 드립니다.
디비에 50개씩 올려놓고 메모리에서 1개씩 쓴다는게 무슨 말인지 이해가 안가서 ㅠㅠ 디비에서 메모리로 1개씩 가져온다는 말인가요? 아니면 메모리에 50개씩 쌓아놓고 1개씩 쓴다는 말인지..
-
해결됨실전 리액트 프로그래밍
totalCount는 어디에 사용하나요?
좋은 강의 만들어 주셔서 감사합니다! 강의 내용이 알찬 덕분에 기쁜 마음으로 완강할 수 있었어요 ㅎㅎ 강의에 과제로 남겨놓은 무한 스크롤을 구현하다가 궁금한 점이 생겼는데요. /history api의 응답으로 totalCount가 들어오는데요, 이 데이터는 어디에 사용하는 건가요? 지금 무한 스크롤에 더 이상 받아올 데이터가 있는지 없는지 검사하는 용도로 사용하고 있는데 이런 용도로 사용해도 괜찮을까요?
-
미해결파이썬 무료 강의 (기본편) - 6시간 뒤면 나도 개발자
안녕하십니까 ^^ 단축키관련문의드립니다.
6분 부근에 # 주석할때 커서가 맨앞으로 가는방법과 #을 치고 밑에 한칸 바로 더 만드는방법과 전체부분 클릭? 한줄 전체를 클릭하는방법등 단축키가 알고싶습니다..
-
미해결[개정판 2023-11-27] Spring Boot 3.x 를 이용한 RESTful Web Services 개발
PutMapping 과제 한번 확인해 주실 수 있나요?
안녕하세요. 강의 정말 잘 듣고있습니다. PutMapping 과제로 내주신거 한번 해봤는데 맞는지 확인좀 부탁드려도될까요?? 기본적으로 수정이라 id는 알아야 할 것 같아서 @PathVariable 로 id를 받고 body에 넣어줄 user 값은 @Requestbody로 두번째 인수로 넣었습니다. 이런 방식으로 수정하는게 맞나요..? //Controller 코드 @PutMapping("/users/{id}") public ResponseEntity<User> updateUser(@PathVariable int id, @RequestBody User user) { User updateUser = service.updateById(id, user); if (updateUser == null) { throw new UserNotFoundException(String.format("ID[%s] is not Found", id)); } URI location = ServletUriComponentsBuilder.fromCurrentRequest() .path("/{id}") .buildAndExpand(updateUser.getId()) .toUri(); return ResponseEntity.created(location).build(); } //Service 코드 @Override public User updateById(int id, User user) { for (User updateUser : userList) { if (updateUser.getId() == id) { userList.get(id-1).setName(user.getName()); userList.get(id-1).setJoinDate(user.getJoinDate()); return user; } } return null; }
-
미해결공공데이터로 파이썬 데이터 분석 시작하기
컬럼 합치기 관련해 질문 드립니다!
안녕하세요 선생님! 궁금한점이 한가지 있어 문의드립니다! 다름이 아니라 일부 컬럼들끼리 그룹화 하고 싶은데 ("2015년", "2016년", "2017년", "2018년", "2019년", "2020년") 이렇게 연도를 따로 그룹화 해 연산하는것이 아닌 그저 한 그룹으로 묶고싶은데 이럴때 어떤 방법을 사용하면 좋을까요?
-
해결됨[리뉴얼] React로 NodeBird SNS 만들기
styled-components css질문
제로초님 styled-components css ssr을 작업해도 새로고침을 했을 때 아주잠깐 일부 css가 적용안되는 부분이 생기는데 그런 부분은 왜 그런걸까요..ㅠ 위에 사진은 예시고(새로고침 시 잠깐 위치가 바뀜) 제가 이걸 기반으로 만드는것도 마찬가지입니다 ㅠ 혹시 styled-componentsd와 html 태그에 바로 스타일을 적용시키는 방법을 혼용하면 안되나요..?
-
해결됨Vue.js - Django 연동 웹 프로그래밍 (실전편)
rest api 관련 질문
안녕하세요, rest api 호출 테스트 중인데, 실제 내용 대신 html 코드가 반환되고 있어 질문드립니다. 예를 들어, 아래 그림과 같이 localhost:8080/blog/post/1/에 접속하면 화면이 제대로 뿌려지고, postman으로 localhost:8080/blog/post/1/에 get요청을하면, html 코드가 반환됩니다. views.py에 반환 코드 관련 추가 코딩이 필요한지 drf 도입이 필요한지 질문드립니다! 감사합니다.
-
미해결HTML+CSS+JS 포트폴리오 실전 퍼블리싱(시즌1)
float를 활용한 배치에서 질문
저 21분 44초에서 clear 클래스의 div는 클래스 left나 right의 뒤에 배치되어 있는데 왜 텍스트는 div 박스랑 혼자 밑에 배치되어있는건가요? 그리고 레프트랑 라이트는 플로트 속성을 지니고 있으니까 패런트의 높이에 영향을 주지 않아야 하는거 아닌가요? 그런데 왜 패런트 박스의 크기가 클래스 레프트와 라이트를 포함하나요?
-
미해결따라하며 배우는 도커와 CI환경 [2023.11 업데이트]
질문드립니다.
강의보다가 궁금한것들 간단한것들을 질문드리는데 번거롭지 않으셧으면 합니다. ㅠㅠ 보통개발하는순서가 조금 궁금합니다. 도커를 이용한다는가정하에 node와 react를 local에서 개발을 하고난 이후 도커에 올리는지 도커를 설정하고 난후에 개발을 진행하는지 어떻게 진행을 하나요??