안녕하세요, 강사님. Shape 클래스 실습을 진행한 결과물을 공유드립니다. 실습 내용을 바탕으로 도형의 크기를 부모 클래스에서 관리하고, 각 자식 클래스에서 기본 크기를 지정할 수 있도록 생성자를 구성해 보았습니다. 시간 괜찮으실 때 구현 방향에서 어색한 부분이나 개선하면 좋을 점이 있는지 간단히 봐주시면 감사하겠습니다. 또한 이번 실습에서 추가로 생각해 보면 좋을 내용이 있다면 함께 알려주시면 감사하겠습니다. 감사합니다. package java2_30; import java.util.Scanner; /** * 화면에 출력할 수 있는 도형의 공통 부모 클래스입니다. * * 현재 실습에서는 삼각형과 정사각형만 다루므로, * 가로와 세로를 구분하지 않고 하나의 size 값으로 크기를 관리합니다. */ abstract class Shape { private final int size; protected Shape(int size) { this.size = size; } protected final int getSize() { return size; } /** * 각 도형의 모양을 콘솔에 출력합니다. */ abstract void render(); } class Rectangle extends Shape { private static final int DEFAULT_SIZE = 4; public Rectangle() { this(DEFAULT_SIZE); } public Rectangle(int size) { super(size); } @Override public void render() { for (int i = 0; i < getSize(); i++) { for (int j = 0; j < getSize(); j++) { System.out.print("*\t"); } System.out.println(); } } } class Triangle extends Shape { private static final int DEFAULT_SIZE = 5; public Triangle() { this(DEFAULT_SIZE); } public Triangle(int size) { super(size); } @Override public void render() { for (int i = 0; i < getSize(); i++) { for (int j = 0; j <= i; j++) { System.out.print("*\t"); } System.out.println(); } } } class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("사각형은 0, 삼각형은 그 외 숫자를 입력하세요: "); int input = scanner.nextInt(); Shape shape; if (input == 0) { shape = new Rectangle(); } else { shape = new Triangle(); } shape.render(); scanner.close(); } }
강사님 안녕하세요, 좋은 강의 여러번 반복해서 잘 듣고 있습니다. 재고 감소와 비교했을때 차이점이 궁금하여 문의드립니다. 안녕하세요 강사님 이전 재고 관리 강의와 차이에 대해 궁금합니다. 이전 질문을 참고하였으나 추가로 더 궁금한게 있어서 문의드립니다. 재고 감소와 쿠폰 발급의 차이점이 너무 헷갈려서 정리하고 있습니다. 두 경우 모두 한정된 수량을 여러 요청이 동시에 차지한다는 점에서는 비슷해 보입니다. 그렇다면 쿠폰도 이벤트 테이블에 잔여 수량을 100개나 300개로 설정하고, 재고처럼 수량을 차감한 뒤 사용자 쿠폰을 생성하는 방식으로 구현할 수 있지 않을까요? 강의에서는 쿠폰 발급의 정합성을 위해서 전체 로직에 락을 걸 필요가 없다고 하셨는데, 그러면 반대로 재고 감소 같은 경우도 마찬가지로 재고 감소의 정합성을 위해 전체로직에 락을 걸 필요 없이 다른 방법으로 하는게 더 나은 방법 아닌가요?? 비슷해 보이는 한정 수량 문제를 서로 다르게 푼 이유를 잘 모르겠습니다 ㅠㅠ
안녕하세요, 저는 회사에서 next.js로 포팅하여 개인적으로 좀 공부하고 있는 학생입니다. 현재 2강 할 일 관리 앱을 보면서 저희 회사의 작업 방식을 함께 생각해봤는데 저희 회사는 꼭 필요한 부분 (iron-session을 이용하여 세션을 가져온다거나)을 제외하고는 죄다 클라이언트 컴포넌트로 바꿔서 사용하고 있습니다. 그래서 이 작업을 진행하면서도 클라이언트 컴포넌트로 모두 바꾸어 진행한다면 어떨까라고 생각이 들었었는데 과제에서는 최소한의 컴포넌트만 클라이언트 컴포넌트로 바꾸라고 하신 이유가 궁금합니다. 감사합니다!
안녕하세요, 강의를 꾸준히 따라가면서 듣고 있는데, 공식문서가 너무 많이 바뀌어서 코드를 따라가기가 어려운 것 같아요 ㅠㅠ 혹시 강의의 내용에 따라 따라갈 수 있는 바뀐 공식문서의 링크를 좀 알 수 있을까요? https://www.langchain.com 의 Learn - [How to] - [Document]에 들어간 후, 어디서부터 따라가야 강의의 내용을 보충할 수 있을까요?
1. 현재 학습 진도 섹션 3 15강 수강 2. 어려움을 겪는 부분 아직 섹션3 15강밖에 수강하지 않았지만 예전에 배포했을때 설정 문제로 과금이 나간적이있어서 강의는 계속 들으면서 로컬에서 해보고 개인 프로젝트에 적용해보는것이 좋을까요? 아니면 둘 다 하는것이 좋을까요??
for 문에서 초기화 -> 조검검사->참이면 처리->증감->조건검사->조건 감사-> 아닌가요? intc=0; for(I=1; I>3; i++) { c++; } printf("c=%d",c); 정답: ? 답변이 어려운 질문 좋은 질문 예시 3강 12분 35초에서 설명하신 반복문 조건식이 이해되지 않습니다. 왜 i < 10으로 작성하나요? 5강 08분 10초에서 나온 코드 실행 결과가 제 환경에서는 다르게 나옵니다. 아래는 제가 작성한 코드입니다. 정확한 강의 위치와 질문 내용을 함께 남겨주시면 더 빠르고 정확하게 답변드릴 수 있습니다.
[질문 내용] SumTask의 run()메서드 안 for문에서 result += i;를 하지 않고 지역변수인 sum을 사용하여 마지막에 result = sum을 하신 이유가 지역변수(sum)는 스택영역, 멤버변수(result)는 힙 영역에 관리되어, 매번 메인 메모리에 있는 result의 값을 변경하는 것이 아닌 cpu 코어의 캐시 메모리를 사용하는 것이 더 빨라서일까요?
안녕하세요. 001강과 마찬가지로 002강에서도 Gradio 실행 시 에러 뜹니다.. 어떻게 해결해야할까요? ERROR: Exception in ASGI application Traceback (most recent call last): File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_ impl.py ", line 422, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/uvicorn/middleware/proxy_ headers.py ", line 63, in call return await self.app (scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/fastapi/ applications.py ", line 1163, in call await super().__call__(scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/ applications.py ", line 90, in call await self.middleware_stack(scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/middleware/ errors.py ", line 186, in call raise exc File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/middleware/ errors.py ", line 164, in call await self.app (scope, receive, send) File "/opt/anaconda3/envs/langchain env/lib/python3.11/site-packages/gradio/route_ utils.py ", line 761, in call await self.app (scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/middleware/ exceptions.py ", line 63, in call await wrap_app_handling_exceptions( self.app , conn)(scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/_exception_ handler.py ", line 53, in wrapped_app raise exc File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/_exception_ handler.py ", line 42, in wrapped_app await app(scope, receive, sender) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/fastapi/middleware/ asyncexitstack.py ", line 18, in call ... File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/jinja2/ utils.py ", line 515, in getitem rv = self._mapping[key] ~~~~~~~~~~~~~^^^^^ TypeError: unhashable type: 'dict' Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings... Running on local URL: http://127.0.0.1:7862 ERROR: Exception in ASGI application Traceback (most recent call last): File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_ impl.py ", line 422, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/uvicorn/middleware/proxy_ headers.py ", line 63, in call return await self.app (scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/fastapi/ applications.py ", line 1163, in call await super().__call__(scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/ applications.py ", line 90, in call await self.middleware_stack(scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/middleware/ errors.py ", line 186, in call raise exc File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/middleware/ errors.py ", line 164, in call await self.app (scope, receive, send) File "/opt/anaconda3/envs/langchain env/lib/python3.11/site-packages/gradio/route_ utils.py ", line 761, in call await self.app (scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/middleware/ exceptions.py ", line 63, in call await wrap_app_handling_exceptions( self.app , conn)(scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/_exception_ handler.py ", line 53, in wrapped_app raise exc File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/_exception_ handler.py ", line 42, in wrapped_app await app(scope, receive, sender) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/fastapi/middleware/ asyncexitstack.py ", line 18, in call ... File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/jinja2/ utils.py ", line 515, in getitem rv = self._mapping[key] ~~~~~~~~~~~~~^^^^^ TypeError: unhashable type: 'dict' Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
안녕하세요, 강의 내용대로 Gradio를 이용하여 인터페이스를 실행하려는데 아래와 같이 ASGI application 에러가 발생하며 서버가 정상 동작하지 않습니다. 어떡해야할까요? ERROR: Exception in ASGI application Traceback (most recent call last): File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_ impl.py ", line 422, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/uvicorn/middleware/proxy_ headers.py ", line 63, in call return await self.app (scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/fastapi/ applications.py ", line 1163, in call await super().__call__(scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/ applications.py ", line 90, in call await self.middleware_stack(scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/middleware/ errors.py ", line 186, in call raise exc File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/middleware/ errors.py ", line 164, in call await self.app (scope, receive, send) File "/opt/anaconda3/envs/langchain env/lib/python3.11/site-packages/gradio/route_ utils.py ", line 761, in call await self.app (scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/middleware/ exceptions.py ", line 63, in call await wrap_app_handling_exceptions( self.app , conn)(scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/_exception_ handler.py ", line 53, in wrapped_app raise exc File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/_exception_ handler.py ", line 42, in wrapped_app await app(scope, receive, sender) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/fastapi/middleware/ asyncexitstack.py ", line 18, in call ... File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/jinja2/ utils.py ", line 515, in getitem rv = self._mapping[key] ~~~~~~~~~~~~~^^^^^ TypeError: unhashable type: 'dict' Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings... Running on local URL: http://127.0.0.1:**** ERROR: Exception in ASGI application Traceback (most recent call last): File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_ impl.py ", line 422, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/uvicorn/middleware/proxy_ headers.py ", line 63, in call return await self.app (scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/fastapi/ applications.py ", line 1163, in call await super().__call__(scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/ applications.py ", line 90, in call await self.middleware_stack(scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/middleware/ errors.py ", line 186, in call raise exc File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/middleware/ errors.py ", line 164, in call await self.app (scope, receive, send) File "/opt/anaconda3/envs/langchain env/lib/python3.11/site-packages/gradio/route_ utils.py ", line 761, in call await self.app (scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/middleware/ exceptions.py ", line 63, in call await wrap_app_handling_exceptions( self.app , conn)(scope, receive, send) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/_exception_ handler.py ", line 53, in wrapped_app raise exc File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/starlette/_exception_ handler.py ", line 42, in wrapped_app await app(scope, receive, sender) File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/fastapi/middleware/ asyncexitstack.py ", line 18, in call ... File "/opt/anaconda3/envs/langchain_env/lib/python3.11/site-packages/jinja2/ utils.py ", line 515, in getitem rv = self._mapping[key] ~~~~~~~~~~~~~^^^^^ TypeError: unhashable type: 'dict' Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
안녕하세요. 강의를 수강해주셔서 감사합니다. 질문 작성 시 아래 내용을 함께 작성해주시면 보다 정확하고 빠르게 답변드릴 수 있습니다. 현재 진행 중인 섹션 또는 강의명 발생한 에러 내용 관련 코드 콘솔 에러 메시지 기대한 결과와 실제 결과 특히 개발 관련 질문은 코드와 에러 로그를 함께 첨부해주셔야 원인 파악이 훨씬 수월합니다. 또한 이 강의는 실무형 프로젝트 기반 강의이기 때문에, 구현 방식이나 설계 방향이 상황에 따라 달라질 수 있습니다. 질문 전에는: 강의 내용을 다시 한번 확인해보시고 기존 질문/답변에 유사한 내용이 있는지도 함께 확인 부탁드립니다. 수강생분들과 함께 좋은 학습 환경을 만들 수 있도록 서로 존중하는 분위기에서 이용 부탁드립니다. 감사합니다.
헥사고날 아키텍처와 DDD를 적용할 때, 화면에 강하게 연관된 조회 데이터를 어떻게 다루는 게 좋은지 궁금합니다. 예를 들어 채팅방 목록 화면에서 각 채팅방마다 다음 정보를 한 번에 보여줘야 한다고 가정하겠습니다 . ex) 채팅방 이름, 마지막 채팅 내용, 읽지 않은 채팅 개수 이 정보를 구하려면 room, chat, read_status 같은 여러 테이블을 함께 조회해야 하고 , N+1 문제를 피하려면 Querydsl 이나 JDBC 등을 사용해서 한 번의 쿼리로 조회하는 방식이 필요해 보입니다 . 이 경우 제 생각에는 기존 포트와 분리해서 , 조회 전용 port 와 query repository interface 를 application 계층에 두고 , adapter 계층에서 Querydsl/JDBC/MyBatis 등으로 구현하는 것이 해결책 같습니다. 이런 식으로 cqrs패턴을 적용하는 것이 유일한 해결책인가요? 혹시 더 나은 방법이 있는지 궁금하여 질문남깁니다. (강의 너무 잘 보고 있습니다)
답안에서 4개 중 3개만 맞췄는데 이런 코드문제같은 경우엔 나머지 3개에 대해서 부분 점수가 들어가나요? 아니면 그냥 0점 처리가 되는건가요? 이거로 60이 넘냐 못넘냐가 갈릴꺼같아서 물어봐요 ㅠㅠㅠㅠㅠㅠㅠㅠ 커뮤니티나 유튜브에서는 코드문제는 통으로 0점처리 될꺼라는 말도 있고 된다는 말도 있고 제미나이는 무조건 된다고 하기도하고 하고요ㅠ