기존 생성했던 npx create-react-app my-app 명령어로 생성했던 my-app 실제 경로로 들어가서 폴더 삭제하고 npm uninstall -g create-react-app npm install -g create-react-app npx create-react-app my-app 수행 시 C:\Program Files\nodejs>npx create-react-app my-app Need to install the following packages: create-react-app@5.0.1 Ok to proceed? (y) y npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap. node:fs:1380 const result = binding.mkdir( ^ Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\my-app' at Object.mkdirSync (node:fs:1380:26) at module.exports.makeDirSync (C:\Users\김진구\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\fs-extra\lib\mkdirs\make-dir.js:23:13) at createApp (C:\Users\김진구\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:257:6) at C:\Users\김진구\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:223:9 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { errno: -4048, code: 'EPERM', syscall: 'mkdir', path: 'C:\\Program Files\\nodejs\\my-app' } Node.js v20.11.0 에러가 발생합니다. 어떻게 조치해야할까요 ??
from typing import List from fastapi import FastAPI, Body, HTTPException, Depends from pydantic import BaseModel from sqlalchemy.orm import Session from database.orm import ToDo from database.connection import get_db from database.repository import get_todos from schema.response import ListToDoResponse, ToDoSchema app = FastAPI() @app.get("/") def heath_check_handler(): return {"ping": "pong"} todo_data = { 1: { "id": 1, "contents": "실전! FastAPI 섹션 0 수강", "is_done": True, }, 2: { "id": 2, "contents": "실전! FastAPI 섹션 1 수강", "is_done": False, }, 3: { "id": 3, "contents": "실전! FastAPI 섹션 2 수강", "is_done": False, }, } @app.get("/todos", status_code=200) def get_todos_handler( order: str | None = None, session: Session = Depends(get_db), ) -> ListToDoResponse: todos: List[ToDo] = get_todos(session=session) if order and order == "DESC": return ListToDoResponse( todos=[ToDoSchema.from_orm(todo) for todo in todos[::-1]] ) return ListToDoResponse( todos=[ToDoSchema.from_orm(todo) for todo in todos] ) @app.get("/todos/{todo_id}", status_code=200) def get_todo_handler(todo_id: int): todo = todo_data.get(todo_id) if todo: return todo raise HTTPException(status_code=404, detail="ToDo Not Found") class CreateToDoRequest(BaseModel): id: int contents: str is_done: bool @app.post("/todos", status_code=201) def create_todo_handler(request: CreateToDoRequest): todo_data[request.id] = request.dict() return todo_data[request.id] @app.patch("/todos/{todo_id}", status_code=200) def update_todo_handler( todo_id: int, is_done: bool = Body(..., embed=True) ): todo = todo_data.get(todo_id) if todo: todo["is_done"] = is_done return todo raise HTTPException(status_code=404, detail="ToDo Not Found") @app.delete("/todos/{todo_id}") def delete_todo_handler(todo_id: int): todo = todo_data.pop(todo_id, None) if todo: return raise HTTPException(status_code=404, detail="ToDo Not Found") from typing import List from pydantic import BaseModel class ToDoSchema(BaseModel): id: int contents: str is_done: bool class Config: orm_mode = True class ListToDoResponse(BaseModel): todos: List[ToDoSchema] from typing import List from sqlalchemy import select from sqlalchemy.orm import Session from database.orm import ToDo def get_todos(session: Session) -> List[ToDo]: return list(session.scalars(select(ToDo))) from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker DATABASE_URL = "mysql+pymysql://root:todos@127.0.0.1:3306/todos" engine = create_engine(DATABASE_URL, echo=True) SessionFactory = sessionmaker(autocommit=False, autoflush=False, bind=engine) def get_db(): session = SessionFactory() try: yield session finally: session.close() from sqlalchemy import Boolean, Column, Integer, String from sqlalchemy.orm import declarative_base Base = declarative_base() class ToDo(Base): __tablename__ = 'todo' id = Column(Integer, primary_key=True, index=True) contents = Column(String(256), nullable=False) is_done = Column(Boolean, nullable=False) def __repr__(self): return f"ToDo(id={self.id}, contents={self.contents}, is_done={self.is_done})" 에러가 납니다. 파이썬 콘솔 <input>:1: PydanticDeprecatedSince20: The from_orm method is deprecated; from schema.response import ToDoSchema from datagbase.orm import ToDo Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2023.3.2\plugins\python\helpers\pydev\pydevconsole.py", line 364, in runcode coro = func() ^^^^^^ File "<input>", line 1, in <module> File "C:\Program Files\JetBrains\PyCharm 2023.3.2\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'datagbase' from database.orm import ToDo todo = ToDo(id=100, contents="test", is_done=True) ToDoSchema.from_orm(todo) <input>:1: PydanticDeprecatedSince20: The from_orm method is deprecated; set model_config['from_attributes']=True and use model_validate instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2023.3.2\plugins\python\helpers\pydev\pydevconsole.py", line 364, in runcode coro = func() ^^^^^^ File "<input>", line 1, in <module> File "C:\Users\manag\pyProject\todos\Lib\site-packages\typing_extensions.py", line 2499, in wrapper return arg(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\pydantic\main.py", line 1126, in from_orm raise PydanticUserError( pydantic.errors.PydanticUserError: You must set the config attribute from_attributes=True to use from_orm http://localhost:8000/docs#/default/get_todos_handler_todos_get 접속시 터미널 INFO: 127.0.0.1:56312 - "GET /docs HTTP/1.1" 200 OK INFO: 127.0.0.1:56312 - "GET /openapi.json HTTP/1.1" 200 OK 2024-01-23 16:06:15,108 INFO sqlalchemy.engine.Engine BEGIN (implicit) 2024-01-23 16:06:15,109 INFO sqlalchemy.engine.Engine SELECT todo.id, todo.contents, todo.is_done FROM todo 2024-01-23 16:06:15,109 INFO sqlalchemy.engine.Engine [cached since 826.5s ago] {} 2024-01-23 16:06:15,113 INFO sqlalchemy.engine.Engine ROLLBACK INFO: 127.0.0.1:56312 - "GET /todos HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\manag\pyProject\todos\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 404, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().__call__(scope, receive, send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\applications.py", line 123, in call await self.middleware_stack(scope, receive, send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\middleware\errors.py", line 186, in call raise exc File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\middleware\errors.py", line 164, in call await self.app(scope, receive, _send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\_exception_handler.py", line 64, in wrapped_app raise exc File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\routing.py", line 762, in call await self.middleware_stack(scope, receive, send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\routing.py", line 782, in app await route.handle(scope, receive, send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\routing.py", line 297, in handle await self.app(scope, receive, send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\routing.py", line 77, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\_exception_handler.py", line 64, in wrapped_app raise exc File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\routing.py", line 72, in app response = await func(request) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\fastapi\routing.py", line 299, in app raise e File "C:\Users\manag\pyProject\todos\Lib\site-packages\fastapi\routing.py", line 294, in app raw_response = await run_endpoint_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\fastapi\routing.py", line 193, in run_endpoint_function return await run_in_threadpool(dependant.call, **values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\concurrency.py", line 40, in run_in_threadpool return await anyio.to_thread.run_sync(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\anyio\_backends\_asyncio.py", line 2134, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\anyio\_backends\_asyncio.py", line 851, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\src\main.py", line 48, in get_todos_handler todos=[ToDoSchema.from_orm(todo) for todo in todos] ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\typing_extensions.py", line 2499, in wrapper return arg(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\pydantic\main.py", line 1126, in from_orm raise PydanticUserError( pydantic.errors.PydanticUserError: You must set the config attribute from_attributes=True to use from_orm
안녕하세요 헷깔리는게 있어서 질문을 드립니다. JSX 사용시에 XSS 방지가 된다고 말씀해주셨는데 JSX 문법 사용하지 않고 createElement 사용하더라도 방지가 되는 것 아닌가요? + 제가 생각했던 것은 JSX 가 내부적으로 createElement 를 호출하고 createElement 메소드 내에서 escape 가 일어나는 것 아닌가 했는데, chatGPT 한테 물어본 결과 JSX 문법을 사용하면 createElement 를 호출 하기 전에 escape 을 완료하는 것으로 이해를 하였습니다. 이렇게 이해하는 것이 맞을까요..?
안녕하세요.. 궁금한점이 있어서 질문드립니다.. 밀리의 서재 홈페이지에서 검사를 눌러봤는데 div 다음 data-v-003e81a0 이 부분은 어떤 걸 의미하는지요? 속성명="값" 이렇게 안쓰고 저렇게 쓸 수도 있나요? 그리고 p태그 아래에 글자들에 쌍 따옴표로 묶어준 것도 왜 인지 궁금합니다.. 검사 화면에는 쌍따옴표가 있는데 실제 화면에는 쌍따옴표가 안뜨는건 왜 그럴까요..? https://www.millie.co.kr/v3/brand/update?utm_source=google&utm_medium=cpc&utm_campaign=pc&utm_content=brand&utm_term=%2B%EB%B0%80%EB%A6%AC%EC%9D%98%2B%EC%84%9C%EC%9E%AC%2B&gad_source=1&gclid=Cj0KCQiA-62tBhDSARIsAO7twbb3uOaPxtCl7MI2dexTMHLKLnXTEK9kaIQLua7WRA7sAHVtG_zOt70aAqWJEALw_wcB 그리고 여기서 쓰신 확장 프로그램 이름도 알려주실수 있으실까요..?
선생님.. 텍스트 복사하러 넷플릭스 사이트에 갔는데.. 궁금한 것이 생겨서 여쭤봅니다.. https://www.netflix.com/kr/ newletter div 부분에 원래 클릭 하지않으면 아래 화면이 뜨고 이메일을 입력하려면고 클릭하면 아래 화면처럼 placeholder가 사라지고 background 텍스트가 되는것 같은데.. 이렇게 만들려면 어떻게 하면 되나요..?
[하루 10분|Web Project] HTML/JS/CSS로 나만의 심리테스트 사이트 만들기
안녕하세요, 알고리즘 개선하기 강의를 들은 이후, 새로 짜여진 알고리즘의 원리(?)에 대해 공부하는 중입니다. 그런데, select 부분에 대한 이해가 어려워 질문 올려봐요 ㅠㅠ answer.addEventListener("click", function(){ //'answer' 버튼을 클릭했을 때 4 var children = document.querySelectorAll('.answerList'); for(let i = 0; i < children.length; i++){ children[i].disabled = true; // 버튼 비활성화 children[i].style.WebkitAnimation = "fadeOut 0.5s"; // 0.5초동안 main 섹션이 사라지면 children[i].style.animation = "fadeOut 0.5s" // 사용자가 어떤 한 버튼만 클릭해도, 다른 버튼들은 다 무시가 되고 모든 버튼들이 사라진다. } setTimeout(() => { var target = qnaList[qIdx].a[idx].type; // 우리가 선택한 버튼이 가지고 있는 타입이 target에 할당됨. //버튼을 클릭하는 순간에 바로 값 증가 for(let i = 0; i < target.length; i++){ select[target[i]] += 1; // 이 반복문이 돌고나면 사용자가 버튼을 클릭하였을 때, 12간지의 순서대로 해당하는 type의 값이 1씩 증가 } for(let i = 0; i < children.length; i++){ children[i].style.display = 'none'; // 버튼이 보이지 않게 } goNext(++qIdx); console.log(target); console.log(children.length); },450); //450 경과 시 }, false); 저는 이 for문 안에 들어있는 select[target[i]] += 1; 이 부분을 이해하기 위해 calResult() 부분에 console.log(select); 를 작성하였고, 임의로 선택된 모든 버튼에 대한 select 값을 받을 수 있었습니다. // console.log(select); [2, 4, 3, 4, 4, 3, 4, 4, 2, 5, 1, 6] 우선 저는 처음에 이 숫자들이 select 값이라는 것은 알고 있었으나 진짜 무엇을 의미 하는 지 알 수 없어 수기로 디버깅을 해보았습니다. 모든 버튼에 대한 type 값을 추적해가며 적어보았는데 qIdx 선택한 버튼 type 0 a [1, 2, 4, 9] 1 c [7, 4, 9, 11] 2 b [7, 9 ,11] 3 c [0, 3, 6, 5] 4 c [2, 5, 8] 5 b [0, 3, 6, 10] 6 a [1, 7, 11] 7 c [1, 7, 11] 8 b [1, 3, 6, 11] 9 a [4, 9, 11] 10 c [2, 5, 8] 11 a [3, 6, 4, 9] 선택한 버튼에 대한 type 값의 누계를 도출해보니 [2, 4, 3, 4, 4, 3, 4, 4, 2, 5, 1, 6] // select console에 제가 요청했던 select 값과 동일한 배열이 나왔습니다. 또한 0~11까지의 띠 순서 그대로 오름차순으로 배정된 것을 발견할 수 있었습니다. 제가 부족한 지식을 동원하여 생각한 바로는 type 값을 누계할 때 오름차순으로 정렬하라는 어떤 메세지가 있지 않으면 [4, 2, 3, 4, 4, 3, 1, 4, 2, 6, 4, 5] 이런식으로 순서에 상관없이 해당 값에 대한 누계만 select 에 담길 것으로 예상하였으나 오름차순으로 배열이 정리되어 정렬 원리가 궁금하였습니다. select[target[i]] += 1; 이 부분에서 자동으로 저희가 선택한 버튼들의 type 을 select 배열에 넣을 때, 각 누계 값이 0 부터 11까지의 오름차순으로 자동 정렬되나요? const select = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; 아니면 저희가 초반에 select 에 0값으로 총 12개의 빈자릿수를 만들어 주었을 때부터 각 자리당 0부터 11까지의 인덱스 주소가 자동 배정되는 건가요? 아니면 이 배열(select)의 정렬방식에 대하여 놓친 부분이 있을까요? 도와주세요 ㅠㅠ
제이 쿼리 연결, 제일 처음 강의에서 파일을 왜 새로 만들고, 왜 첫번째 파일 이름은 3.2어쩌구고 Custom파일에 왜 쓰는건지, 연결은 아래 바디 맨 마지막에 3.어쩌고를 먼저 쓰고 그 다음에 custom 쓰라는 부분만 이해하고 인터넷 찾아보니 무슨 링크를 찾아서 넣고 뭐 방법이 여러가지인데 무슨 말인지 당췌 이해가 안갑니다… 설명이 좀 필요할 것 같아요…도와주세요
모던 HTML/CSS 로 상용화도 가능한 반응형 모던 웹페이지만들기 11(9:37) 내용중 인터넷 익스플로러 호환성을 위해 width:240px 대신 max-width:240px를 사용하고 flex-shrink:0;을 설정하셨는데 인터넷 익스플로러가 사용되지 않는 현 시점에서 <link rel="short icon" type="image/x-icon" href="img/fun-coding.ico" /> 이와 같이 익스플로러의 호환성을 고려하는 행위가 현업에서 필요한지 궁금합니다!
다른 수강생분들에게도 문제 해결에 도움을 줄 수 있도록 좋은 질문을 남겨봅시다 :) 1. 질문은 문제 상황을 최대한 표현해주세요. 2. 구체적이고 최대한 맥락을 알려줄 수 있도록 질문을 남겨 주실수록 좋습니다. 그렇지 않으면 답변을 얻는데 시간이 오래걸릴 수 있습니다 ㅠㅠ ex) A라는 상황에서 B라는 문제가 있었고 이에 C라는 시도를 해봤는데 되지 않았다! 3. 먼저 유사한 질문이 있었는지 꼭 검색해주세요! 상품상세페이지 구현-2 마지막에 보면 css를 적용하고자, product폴더내에 Index.css를 만드는데, Index.js에 css를 import하지 않고 넘어가서 상세페이지구현-3 영상에서는 그냥 css를 적용하고 적용되는 모습이 영상에 담겨있습니다. 원래 자동으로 Import 되는게 아니라면, 이부분에 대한 추가적인 제안이 필요할거같습니다. import "./index.css";
items에 div를 사용했기때문에 CSS작성시 그러한 것 때문에 이왕이면 다른 태그가 좋다고 하는 부분은 이해가 됐어요~ 혹시나 dl dt dd 태그를 이용을 안하신건 이유가 있으실까요? div를 사용해도 되고 어느것도 괜찮다고 하셨는데 dl이 있는데 이용하지 않고 span태그와 h3를 이용하신 이유가 있을 것 같아서요.
교수님 안녕하십니까 교수님의 수업을 정말 즐기면서 듣고있는 AI빅데이터 전공 대학생입니다. 교수님의 강의 피마 인디언 당뇨병 예측 편을 보고 여태 배운 것을 백분 활용하여 제 방식대로 따로 모델을 구현을 해보았는데요. 먼저 임신횟수와 Outcome을 제외한 나머지 column들에 있는 0 값들은 모두 결측치로 판단하고 평균 값으로 대체하였습니다. RandomForestClassifier 알고리즘을 사용하고 GridSearchCV 함수를 통해 best estimator를 추출였습니다. 정밀도와 재현율이 동시에 높으면 좋지만 재현율이 증가하면 정밀도가 하락하는 현상(trade-off) 때문에 둘 중 하나를 선택해야 했고 이 피마 인디언 당뇨병 데이터 셋 같은 경우 병의 발견 목적으로 모델을 제작한다고 했을 때 실제로 당뇨병인데 모델이 당뇨병이 아니라고 예측하는 것이 치명적이라고 생각하여 정밀도 보다는 재현율을 중점적으로 보았습니다. 그리하여 precision_recall_curve 함수를 통해 최적의 재현율과 F1_score얻은 threshold 값을 추출하였습니다. 제가 얻은 값은 오차 행렬 [[72 28] [ 4 50]] 정확도: 79.22% , 정밀도: 64.10% , 재현율 92.59%, F1_Score: 75.76% 임계값: 0.32212471005503873 입니다. 오차 행렬을 보았을때도 한쪽에 치우쳐있는 불균형도 없다고 판단하였고 정밀도와 재현율 f1_score도 괜찮게 나왔다고 판단했습니다. 임계값을 0.32212471005503873로 주었을 때 roc_auc_score는 0.82296이라는 1에 꽤나 근접한 수치를 얻었습니다. 질문1: 이런식으로 모델을 찾아가는 방식이 옳은 방식인지 궁금합니다. 질문2: 제가 선택한 모델을 사용한다고 한다면 매번 RandomClassifier로 fit한 model을 Binarizer을 통해서 threshold 값을 매번 지정해주어야 하는건가요? 애초에 처음 모델을 fit할 때 임계값을 제가 부여는 못하는 것일가요?
안녕하세요, 설명 우선 launch를 할때 port를 8080으로 설정하고 setting을 해도 fly.toml 파일과 dockkerfile에 port번호가 3000으로 자동으로 설정되는 문제가있어 해당파일의 port번호를 수동으로 8080으로 다시 설정하고 deploy완료했을 때 해당 주소로 접속시에 접속이 안되는 오류가발생합니다. 이미지 fly.toml dockkerfile https://h-market-server.fly.dev/ 접속시 오류 구글링, 다른분들의 질문을 찾아봤는데도 해결하지못해, 질문드립니다. 파일을 지우고 다시런치 후 배포 프로젝트를 다 지우고 gitclone해서 런치 후 배포 등 다른방법들을 다 진행해봐도 해결되지않아 질문남깁니다.
File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line 193, in init super().__init__(*args, **kwargs2) django.db.utils.OperationalError: (1044, "Access denied for user 'django'@'%' to database 'django'") mariadb 컨테이너를 실행 후, django 컨테이너를 실행 시 위와 같은 오류가 발생합니다. 찾아보니 django 에 대한 권한이 없어서 그렇다고 하는데, 해결방법이 있을까요?