๋ฐ˜์‘ํ˜•

์ „์ฒด ๊ธ€ 409

react์—์„œ props๋ž€?

Props๋Š” React์—์„œ ์ปดํฌ๋„ŒํŠธ ๊ฐ„์— ๋ฐ์ดํ„ฐ๋ฅผ ์ „๋‹ฌํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. Props๋Š” "properties"์˜ ์ค„์ž„๋ง๋กœ, ๋ถ€๋ชจ ์ปดํฌ๋„ŒํŠธ๋กœ๋ถ€ํ„ฐ ์ž์‹ ์ปดํฌ๋„ŒํŠธ๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ์ „๋‹ฌํ•  ๋•Œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. Props๋Š” ์ฝ๊ธฐ ์ „์šฉ์ด๋ฉฐ, ์ปดํฌ๋„ŒํŠธ ๋‚ด๋ถ€์—์„œ๋Š” ๋ณ€๊ฒฝํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ์ด๋Š” ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ˆœ์ˆ˜ ํ•จ์ˆ˜์ฒ˜๋Ÿผ ๋™์ž‘ํ•˜๋„๋ก ํ•˜์—ฌ, ์˜ˆ์ธก ๊ฐ€๋Šฅํ•œ ๋™์ž‘์„ ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค.Props ์‚ฌ์šฉ ๋ฐฉ๋ฒ•Props๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ธฐ๋ณธ์ ์ธ ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:Props ์ „๋‹ฌํ•˜๊ธฐ: ๋ถ€๋ชจ ์ปดํฌ๋„ŒํŠธ์—์„œ ์ž์‹ ์ปดํฌ๋„ŒํŠธ๋กœ props๋ฅผ ์ „๋‹ฌํ•  ๋•Œ๋Š”, ์ž์‹ ์ปดํฌ๋„ŒํŠธ ํƒœ๊ทธ์˜ ์†์„ฑ์œผ๋กœ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.jsx// ๋ถ€๋ชจ ์ปดํฌ๋„ŒํŠธfunction ParentComponent() { return ;}Props ์‚ฌ์šฉํ•˜๊ธฐ: ์ž์‹ ์ปดํฌ๋„ŒํŠธ์—์„œ๋Š” ํ•จ์ˆ˜์˜ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ props๋ฅผ ๋ฐ›์•„ ์‚ฌ์šฉํ•  ์ˆ˜..

ํƒ€์ž…์Šคํฌ๋ฆฌํŠธ์—์„œ ์ธํ„ฐํŽ˜์ด์Šค๋ž€? (๊ฐœ๋…, ์‚ฌ์šฉ๋ฒ•)

ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ(Typescript)์—์„œ ์ธํ„ฐํŽ˜์ด์Šค(interface)๋Š” ๊ฐ์ฒด์˜ ํƒ€์ž…์„ ์ •์˜ํ•˜๋Š” ๋ฐฉ๋ฒ• ์ค‘ ํ•˜๋‚˜์ž…๋‹ˆ๋‹ค. ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๊ฐ์ฒด๊ฐ€ ํŠน์ • ๊ตฌ์กฐ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์Œ์„ ๋ช…์‹œํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์ด๋ฅผ ํ†ตํ•ด ์ฝ”๋“œ์˜ ์•ˆ์ •์„ฑ์„ ๋†’์ด๊ณ  ์—๋Ÿฌ๋ฅผ ์ค„์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ธํ„ฐํŽ˜์ด์Šค๋Š” ํด๋ž˜์Šค, ํ•จ์ˆ˜, ๋ฐฐ์—ด ๋“ฑ ๋‹ค์–‘ํ•œ ๊ณณ์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์ฝ”๋“œ์˜ ๊ฐ€๋…์„ฑ๊ณผ ์žฌ์‚ฌ์šฉ์„ฑ์„ ๋†’์ด๋Š” ๋ฐ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค.์ธํ„ฐํŽ˜์ด์Šค ์ •์˜ ๋ฐฉ๋ฒ•์ธํ„ฐํŽ˜์ด์Šค๋Š” interface ํ‚ค์›Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๊ทธ ์•ˆ์— ํ•ด๋‹น ๊ฐ์ฒด๊ฐ€ ๊ฐ€์ ธ์•ผ ํ•  ์†์„ฑ๊ณผ ๊ทธ ํƒ€์ž…์„ ๋ช…์‹œํ•ฉ๋‹ˆ๋‹ค.typescriptinterface Person { name: string; age: number;}์œ„ ์˜ˆ์‹œ์—์„œ Person ์ธํ„ฐํŽ˜์ด์Šค๋Š” name๊ณผ age ๋‘ ๊ฐ€์ง€ ์†์„ฑ์„ ๊ฐ€์ง€๊ณ  ์žˆ์œผ๋ฉฐ,..

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ] ์›นํŒฉ์ด๋ž€?

์›นํŒฉ(Webpack)์€ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ(JS) ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์œ„ํ•œ ์ •์  ๋ชจ๋“ˆ ๋ฒˆ๋“ค๋Ÿฌ์ž…๋‹ˆ๋‹ค. ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ตฌ์„ฑํ•˜๋Š” ์ž์›(HTML, CSS, ์ด๋ฏธ์ง€, JS ํŒŒ์ผ ๋“ฑ)์„ ๋ชจ๋‘ ๋ชจ๋“ˆ๋กœ ๋ณด๊ณ , ์ด๋Ÿฌํ•œ ๋ชจ๋“ˆ๋“ค์„ ์˜์กด์„ฑ ๊ทธ๋ž˜ํ”„๋กœ ๋งŒ๋“ค์–ด ํ•˜๋‚˜ ๋˜๋Š” ์—ฌ๋Ÿฌ ๊ฐœ์˜ ๋ฒˆ๋“ค๋กœ ๊ฒฐํ•ฉํ•˜๋Š” ๋„๊ตฌ์ž…๋‹ˆ๋‹ค. ์›นํŒฉ์„ ์‚ฌ์šฉํ•จ์œผ๋กœ์จ ๊ฐœ๋ฐœ์ž๋Š” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋ชจ๋“ˆ ๋ฐฉ์‹์œผ๋กœ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ๊ณ , ์ตœ์ข…์ ์œผ๋กœ ๋ธŒ๋ผ์šฐ์ €์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ํ˜•ํƒœ๋กœ ์ž์›๋“ค์„ ๋ฒˆ๋“ค๋งํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์›นํŒฉ์˜ ์ฃผ์š” ๊ธฐ๋Šฅ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค: ๋กœ๋”(Loaders): ์›นํŒฉ์€ ์˜ค์ง ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์™€ JSON ํŒŒ์ผ๋งŒ ์ดํ•ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋กœ๋”๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์›นํŒฉ์ด ๋‹ค๋ฅธ ํƒ€์ž…์˜ ํŒŒ์ผ๋“ค์„ ์ฒ˜๋ฆฌํ•˜์—ฌ ๋ชจ๋“ˆ๋กœ ๋ณ€ํ™˜ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, CSS, ์ด๋ฏธ์ง€, HTML ํŒŒ์ผ๋“ค์„ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๋ชจ๋“ˆ๋กœ ๋ณ€ํ™˜..

fastAPI pydamic์œผ๋กœ ์Šคํ‚ค๋งˆ ์„ค์ •ํ•˜๊ธฐ

schema.py ์— Pydantic ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•˜์—ฌ ์š”์ฒญ ๋ฐ ์‘๋‹ต ์Šคํ‚ค๋งˆ๋ฅผ ์ •์˜ ์˜ˆ์‹œ: from pydantic import BaseModel from typing import Optional class JapaneseBase(BaseModel): type: Optional[str] = None letter: str pronounciation: str audio: Optional[str] = None lesson: Optional[int] = None img: Optional[str] = None # ์„ ํƒ์  ํ•„๋“œ vid: Optional[str] = None # ์„ ํƒ์  ํ•„๋“œ class JapaneseCreate(JapaneseBase): pass ๋‹ค์‹œ routers/ ํด๋”์˜ ํ•ด๋‹น ํŒŒ์ผ๋กœ๊ฐ€์„œ, ๋ผ์šฐํ„ฐ์— ..

FastAPI ์—์„œ ์˜์กด์„ฑ ์ฃผ์ž… ์ด๋ž€? (Dependency Injection)

FastAPI์˜ "Dependency Injection"์€ FastAPI ํ”„๋ ˆ์ž„์›Œํฌ์—์„œ ์ œ๊ณตํ•˜๋Š” ํ•ต์‹ฌ ๊ธฐ๋Šฅ ์ค‘ ํ•˜๋‚˜์ž…๋‹ˆ๋‹ค. Dependency Injection์€ ์˜์กด์„ฑ ์ฃผ์ž…์ด๋ผ๊ณ ๋„ ํ•˜๋ฉฐ, ์ด๋Š” ์ฝ”๋“œ์˜ ๊ฒฐํ•ฉ๋„๋ฅผ ๋‚ฎ์ถ”๊ณ , ์œ ์ง€๋ณด์ˆ˜์™€ ํ…Œ์ŠคํŠธ๊ฐ€ ์šฉ์ดํ•˜๋„๋ก ๋„์™€์ฃผ๋Š” ์„ค๊ณ„ ํŒจํ„ด์ž…๋‹ˆ๋‹ค. FastAPI์—์„œ๋Š” ์ด๋ฅผ ํ†ตํ•ด ๋”์šฑ ๊น”๋”ํ•˜๊ณ  ํšจ์œจ์ ์œผ๋กœ API๋ฅผ ๊ฐœ๋ฐœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.(์žฌ์‚ฌ์šฉ์„ฑ, ํšจ์œจ์„ฑ ์ฆ๊ฐ€์˜ ํšจ๊ณผ) Dependency Injection์˜ ๊ธฐ๋ณธ ์›๋ฆฌ FastAPI์—์„œ Dependency Injection์„ ์‚ฌ์šฉํ•˜๋ฉด, ํ•จ์ˆ˜๋‚˜ ํด๋ž˜์Šค์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ์ง์ ‘ ์ƒ์„ฑํ•˜์ง€ ์•Š๊ณ , FastAPI๊ฐ€ ์‹คํ–‰ ์‹œ๊ฐ„(runtime)์— ์˜์กด์„ฑ์„ ์ฃผ์ž…ํ•ด์ค๋‹ˆ๋‹ค. ์ด๋กœ์จ, ํ•„์š”ํ•œ ๊ฐ์ฒด๋‚˜ ์„ค์ •, ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—ฐ๊ฒฐ ๋“ฑ์„ ํšจ์œจ์ ์œผ๋กœ ๊ด€๋ฆฌํ•˜๊ณ  ์žฌ์‚ฌ์šฉํ•  ..

fastapi๋กœ ๋ผ์šฐํ„ฐ ์ž‘์„ฑ ์–ด๋–ป๊ฒŒ ํ• ๊นŒ

์˜ˆ์ œ์—์„œ ๋ณธ ๋ฐฉ์‹(alemdic ์‚ฌ์šฉ) https://github.com/tiangolo/full-stack-fastapi-template/tree/master/backend/app router = APIRouter( prefix="/", ) @router.get("/list")# /list ๊ฒฝ๋กœ๋กœ GET ์š”์ฒญ์ด ๋“ค์–ด์˜ค๋ฉด question_list ํ•จ์ˆ˜๊ฐ€ ํ˜ธ์ถœ๋ฉ๋‹ˆ๋‹ค. def question_list(): db = SessionLocal() _question_list = db.query(Question).order_by(Question.create_date.desc()).all() db.close() return _question_list ๋‹จ์  : ์‹ค์ œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ๋Š” ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์„ธ์…˜์„ ๊ด€๋ฆฌํ•˜๋Š” ๋ฐฉ๋ฒ•์— ..

fastapi ์—์„œ alembic ์‚ฌ์šฉํ•˜๊ธฐ

SQLAlchemy + pydamic ๋ณด๋‹ค๋Š” SQLAlchemy+ alembic๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ถ”์„ธ. ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๊ตฌ์กฐ ๋ณ€๊ฒฝ์ด ๋” ์‰ฝ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. Alembic์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ณผ์ •์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๋ช‡ ๋‹จ๊ณ„๋กœ ๋‚˜๋‰ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์—๋Š” ์ดˆ๊ธฐ ์„ค์ •, ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ์Šคํฌ๋ฆฝํŠธ์˜ ์ƒ์„ฑ, ๊ทธ๋ฆฌ๊ณ  ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์˜ ์ ์šฉ์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค. SQLAlchemy ๋ชจ๋ธ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•œ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด, ๋จผ์ € Alembic ์„ค์ •์„ ์™„๋ฃŒํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ ํ›„, ๋ชจ๋ธ์— ๋Œ€ํ•œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ๋ฐ˜์˜ํ•˜๋Š” ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์ ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. Alembic ์„ค์ •: ํ”„๋กœ์ ํŠธ ๋ฃจํŠธ์—์„œ $ pip install alembic ; alembic init alembic ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜์—ฌ Alembic์„ ์ดˆ๊ธฐํ™”ํ•ฉ๋‹ˆ..

fastAPI ๋กœ ๋ฐฑ์—”๋“œ ์‹œ์ž‘ํ•˜๊ธฐ (ํ™˜๊ฒฝ ์„ธํŒ…, ํด๋” ๊ตฌ์กฐ, mysql ์‚ฌ์šฉ)

flask๋ฅผ ์จ๋ดค๋‹ค๋ฉด ์กฐ๊ธˆ ์ต์ˆ™ํ•  ์ˆ˜๋„ ์žˆ๋‹ค. ์˜ˆ์‹œ ์ฐธ๊ณ  https://github.com/tiangolo/full-stack-fastapi-template GitHub - tiangolo/full-stack-fastapi-template: Full stack, modern web application template. Using FastAPI, React, SQLModel, Post Full stack, modern web application template. Using FastAPI, React, SQLModel, PostgreSQL, Docker, GitHub Actions, automatic HTTPS and more. - tiangolo/full-stack-fastapi-template git..

mysql ์—์„œ username ์ƒ์„ฑํ•˜๊ณ  ๊ถŒํ•œ์ฃผ๊ธฐ

ํ…Œ์ŠคํŠธ๋ฅผํ•˜๋ ค๋ฉด ๋ฃจํŠธ๋ณด๋‹ค๋Š” ์œ ์ €๋ฅผ ์ƒ์„ฑํ•ด์„œ ํ•˜๋Š” ๊ฒƒ์ด ์ข‹๋‹ค. mysql์—์„œ user๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๊ฐ€์žฅ ๊ธฐ๋ณธ์ ์ธ ๋ฐฉ๋ฒ•์€ ์•„๋ž˜๋ฅผ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ฒƒ์ด๋‹ค. CREATE USER 'username'@'host' IDENTIFIED BY 'password'; ์—ฌ๊ธฐ์„œ Your password does not satisfy the current policy requirements. ๋ผ๋Š” ์—๋Ÿฌ๊ฐ€ ๋‚  ์ˆ˜ ์žˆ๋‹ค. ์ด๋Š” ๋น„๋ฐ€๋ฒˆํ˜ธ ๋•Œ๋ฌธ์ธ๋ฐ SHOW VARIABLES LIKE 'validate_password%'; +--------------------------------------+-------+ | Variable_name | Value | +--------------------------------------+-------+ | ..

TypeORM์„ ์‚ฌ์šฉํ•œ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์ด๋ž€

๊ธฐ๋ณธ์ ์ธ ์ •๋ณด ์–ป๊ธฐ https://typeorm.io/ TypeORM - Amazing ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, typeorm.io TypeORM์„ ์‚ฌ์šฉํ•œ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์€ TypeORM์ด ์ œ๊ณตํ•˜๋Š” ๊ธฐ๋Šฅ์„ ํ™œ์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ์Šคํ‚ค๋งˆ๋ฅผ ๋ฒ„์ „ ๊ด€๋ฆฌํ•˜๋Š” ํ”„๋กœ์„ธ์Šค์ž…๋‹ˆ๋‹ค. ์ด๋Š” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๋ฐ์ดํ„ฐ ๋ชจ๋ธ์ด ๋ณ€๊ฒฝ๋  ๋•Œ๋งˆ๋‹ค ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์Šคํ‚ค๋งˆ๋ฅผ ์•ˆ์ „ํ•˜๊ฒŒ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ค๋‹ˆ๋‹ค. ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์„ ์‚ฌ์šฉํ•˜๋ฉด ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์Šคํ‚ค๋งˆ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ์ฝ”๋“œ ํ˜•ํƒœ๋กœ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์ด๋Ÿฌํ•œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ๋ฒ„์ „๋ณ„๋กœ ์ถ”์ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. TypeORM ..

<1> ๊ฐ„๋‹จํ•œ ์›น์‚ฌ์ดํŠธ ๋งŒ๋“ค๊ธฐ nextjs, react

https://ui.shadcn.com/์—์„œ ์„ค์น˜ https://ui.shadcn.com/docs/installation/next Next.js Install and configure Next.js. ui.shadcn.com vscode extension ์„ค์น˜ - ๊ฐ„๋‹จํ•œ ๋ช…๋ น์–ด๋กœ ์ฝ”๋“œ ์ž‘์„ฑ ๊ฐ€๋Šฅ (auth)ํด๋”์— sign-in . sign-upํด๋” ์ถ”๊ฐ€ (root) meeting [id] - dynamic routes (์ฐธ๊ณ : https://nextjs.org/docs/pages/building-your-application/routing/dynamic-routes) (home) page.tsx, layout.tsx extension์„ค์น˜ 1. ES7+ React/Redux/React-Native snip..

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ ์ฐจ์ด, ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ ๊ธฐ์ดˆ

ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ : ํƒ€์ž…์„ ๋ช…์„ธํ•œ๋‹ค. ํƒ€์ž…์˜ค๋ฅ˜๋ฅผ ์‰ฝ๊ฒŒ ์ฐพ์„ ์ˆ˜ ์žˆ๊ณ  ์œ ํšจ์„ฑ ๊ฒ€์ฆ์— ์šฉ์ด 1. ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ function greet(name) { return "Hello, " + name + "!"; } console.log(greet("John")); 2. ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ - ํŒŒ๋ผ๋ฏธํ„ฐ, ๋ฆฌํ„ด๊ฐ’์˜ ํƒ€์ž…์„ ๋ช…์„ธ function greet(name: string): string { return "Hello, " + name + "!"; } console.log(greet("John")); [ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ ๊ธฐ์ดˆ ๋ฌธ๋ฒ•] ๋ณ€์ˆ˜ ์„ ์–ธ: ๋ณ€์ˆ˜๋ฅผ ์„ ์–ธํ•  ๋•Œ๋Š” let ๋˜๋Š” const ํ‚ค์›Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค let num: number = 10; const message: string = "Hello,World!"; ํ•จ์ˆ˜ ์„ ์–ธ: ํ•จ..

react, next.js14 ๋ฐฐ์šฐ๊ธฐ ์œ„ํ•œ ๋กœ๋“œ๋งต

React ๊ธฐ๋ณธ ๋ฌธ๋ฒ• ์ปดํฌ๋„ŒํŠธ (Component) JSX, TSX ์ƒํƒœ (State) ์†์„ฑ (Props) ์ด๋ฒคํŠธ ์ฒ˜๋ฆฌ async, await ์กฐ๊ฑด๋ถ€ ๋ Œ๋”๋ง ๋ฆฌ์ŠคํŠธ์™€ ํ‚ค React ๊ณ ๊ธ‰ ๋ฌธ๋ฒ• ์ปดํฌ๋„ŒํŠธ ์ƒ๋ช…์ฃผ๊ธฐ (Lifecycle) Hook ์‚ฌ์šฉํ•˜๊ธฐ (useState, useEffect ๋“ฑ) Context API Refs Next.js ๊ธฐ๋ณธ ํด๋” ๊ตฌ์กฐ ์ตํžˆ๊ธฐ ๋ผ์šฐํŒ… ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ(Data fetching),(getStaticProps, getServerSideProps ๋“ฑ) ๋™์  ๋ผ์šฐํŒ…๊ณผ ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ API Routes ์ƒ์„ฑํ•˜๊ธฐ ์ด๋ฏธ์ง€ ์ตœ์ ํ™” CSS tailwind css

flask requests.post ์—์„œ ๋ณด๋‚ธ ๋ฐ์ดํ„ฐ ๋‹ค ๋ฐ›์ง€ ๋ชปํ•˜๋Š” ๊ฒฝ์šฐ

python requests.post ์—์„œ ๋ณด๋‚ธ ๋ฐ์ดํ„ฐ๋ฅผ . ๋‹ค๋ฐ›์ง€ ๋ชปํ•˜๋Š” ๋ฌธ์ œ ๋ฐœ์ƒ ํ•ด๊ฒฐ: json.dumps๋กœ ์”Œ์šฐ๊ณ  headers๋ฅผ ๋ช…์‹œํ•ด์ฃผ์–ด์•ผ ํ•œ๋‹ค. ์–˜๊ฐ€ ์–ด๋–ค ๋ฐ์ดํ„ฐ์ธ์ง€ ์•Œ๋ ค์ฃผ์–ด์•ผ ๋ณต์žกํ•œ ๊ตฌ์กฐ๋„ ์ž˜ ๋ฐ›์Œ headers = {'Content-Type': 'application/json', 'Accept':'application/json'} requests.post(client_url, data=json.dumps(result), headers=headers)

Python 2024.03.19

json.load()์™€ json.loads()์˜ ์ฐจ์ด

json.load()์™€ json.loads()์˜ ์ฐจ์ด๋Š”, load๋Š” json์„ ํŒŒ์ผ์„ ์ฝ๊ณ  loads๋Š” json ํ˜•ํƒœ์˜ ๋ฌธ์ž์—ด์„ ์ฝ์–ด ํŒŒ์ด์ฌ ๊ฐ์ฒด๋กœ ๋ฐ˜ํ™˜ํ•จ ๋งŒ์•ฝ ๋ฌธ์ž์—ด(json ํ˜•ํƒœ)์„ json.load()์— ํŒŒ์‹ฑํ•˜๋ฉด, ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋œธ data = json.load(user_bucklist) AttributeError: 'str' object has no attribute 'read'

Python 2024.03.14

์ปดํ“จํ„ฐ๊ตฌ์กฐ 0. CPU, ๋ฉ”๋ชจ๋ฆฌ, ๋ณด์กฐ๊ธฐ์–ต์žฅ์น˜, ์ž…์ถœ๋ ฅ์žฅ์น˜

๊ฐ„๋‹จํ•œ ๊ฐœ์š” ๋ฉ”์ธ๋ณด๋“œ๋ผ๊ณ  ํ•˜๋Š” ํŒ๋–ผ๊ธฐ์— ๋ชจ๋“ ๊ฒƒ์„ ๋†“๊ณ  ์„œ๋กœ ๋™์ž‘ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•จ. ์ด๋“ค์€ ๋ฒ„์Šค๋ผ๋Š” ํ†ต๋กœ๋ฅผ ํ†ตํ•ด ์„œ๋กœ ์ฃผ๊ณ ๋ฐ›์„ ์ˆ˜ ์žˆ๋‹ค. ๋ฉ”๋ชจ๋ฆฌ์—๋Š” ํ˜„์žฌ ์‹คํ–‰ํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์˜ ๋ช…๋ น์–ด์™€ ๋ฐ์ดํ„ฐ๊ฐ€ ์ €์žฅ๋˜์–ด์žˆ๊ณ , ํ˜„์žฌ ์‹คํ–‰์•ˆ๋˜๋Š” ๊ฒƒ์€ ๋ณด์กฐ๊ธฐ์–ต์žฅ์น˜์— ์ €์žฅ ๋ฉ”๋ชจ๋ฆฌ์—๋Š” ๋ช…๋ น์–ด,๋ฐ์ดํ„ฐ๋Š” ์ฃผ์†Œ๋กœ ์ €์žฅ๋จ cpu๋Š” ์‚ฐ์ˆ ๋…ผ๋ฆฌ์žฅ์น˜(๊ณ„์‚ฐ๊ธฐ), ์ œ์–ด์žฅ์น˜ , ๋ ˆ์ง€์Šคํ„ฐ๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ๋‹ค.] ๋ ˆ์ง€์Šคํ„ฐ์—” ์ž„์‹œ๋กœ ๊ฐ’์ด ์ €์žฅ๋˜๊ณ  ์ œ์–ด์žฅ์น˜๋Š” ๋ฉ”๋ชจ๋ฆฌ ์ฝ๊ธฐ, ๋ฉ”๋ชจ๋ฆฌ ์“ฐ๊ธฐ์™€๊ฐ™์€ ์ œ์–ด ์‹ ํ˜ธ๋ฅด๋ฅด ๋ณด๋‚ธ๋‹ค. cpu๋Š” ๋ฐœ์—ด์ด ์‹ฌํ•˜๊ธฐ ๋•Œ๋ฌธ์— ํŒฌ์ด ๋‹ฌ๋ ค์žˆ๋‹ค. ๋ณด์กฐ๊ธฐ์–ต์žฅ์น˜๋กœ ์ „์›์ด ๊บผ์ ธ๋„ ์ปดํ“จํ„ฐ๋Š” ๊ธฐ์–ตํ•  ์ˆ˜ ์žˆ์Œ. ํ•˜๋“œ ๋””์Šคํฌ, SSD, USB ๋ฉ”๋ชจ๋ฆฌ, DVD, CD-ROM, ์™ธ์žฅํ•˜๋“œ ๋ณด์กฐ๊ธฐ์–ต์žฅ์น˜/์ž…์ถœ๋ ฅ์žฅ์น˜๋Š” ๊ฐœ๋…์ƒ ๊ตฌ๋ถ„ํ•˜์ง€ ์•Š์•„๋„ ๋œ๋‹ค. ๋ผ์ฆˆ๋ฒ ๋ฆฌ ํŒŒ์ด ์ปดํ“จํ„ฐ์—์„œ ..

git, github ์›๊ฒฉ์—์„œ ์ฝ”๋“œ ์—…๋ฐ์ดํŠธ ํ•˜๋Š”๋ฒ•

github์—์„œ ๊ณ„์ • ํ† ํฐ ๋ฐœํ–‰ $ git init $ git remote add origin [์›๊ฒฉ์ €์žฅ์†Œ ์ฃผ์†Œ] - [์›๊ฒฉ์ €์žฅ์†Œ ์ฃผ์†Œ] ๋Š” code์—์„œ ๋‚˜์˜ค๋Š” https://~~~git //๋ธŒ๋žœ์น˜ ์ด๋ฆ„ ๋ฐ”๊พธ๊ธฐ $ git branch -m master main //ํŒŒ์ผ ์—…๋กœ๋“œ - add → commit → push ์ˆœ์„œ //์›๊ฒฉ ์ €์žฅ์†Œ์˜ ํŒŒ์ผ ๊ฐ€์ ธ์˜ค๊ธฐ $ git pull (๋˜๋Š” git pull origin [๋ธŒ๋žœ์น˜ ์ด๋ฆ„]) main //๋ชจ๋“  ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ์˜ฌ๋ฆฌ๋Š” ๊ฒฝ์šฐ $ git add . //ํŠน์ •ํ•œ ํŒŒ์ผ๋งŒ ์˜ฌ๋ฆฌ๋Š” ๊ฒฝ์šฐ $ git add [ํŒŒ์ผ/๋””๋ ‰ํ† ๋ฆฌ] $ git commit -m "commit message" $ git push (๋˜๋Š” git push origin [๋ธŒ๋žœ์น˜ ์ด๋ฆ„]) //์ถ”๊ฐ€์ ์ธ ๋ช…๋ น์–ด //..

[์ฝ”๋”ฉํ…Œ์ŠคํŠธ] ๋ฌธ๋‹จ์—์„œ ๊ฐ€์žฅ ํ”ํ•œ ๋‹จ์–ด ์ฐพ๊ธฐ - re.sub, counter ๊ฐ์ฒด

[๋ฌธ์ œ] paragraph์—์„œ ๋Œ€์†Œ๋ฌธ์ž, ์‰ผํ‘œ ๊ตฌ๋‘์ ๋“ฑ์„ ๋ฌด์‹œํ•˜๊ณ , banned ๋‹จ์–ด์— ํฌํ•จ๋˜์ง€ ์•Š์€ ๋‹จ์–ด ์ค‘ ๊ฐ€์žฅ ๋งŽ์ด ๋“ฑ์žฅํ•œ ๋‹จ์–ด ๋ฐ˜ํ™˜ Example 1: Input: paragraph = "Bob hit a ball, the hit BALL flew far after it was hit.", banned = ["hit"] Output: "ball" Explanation: "hit" occurs 3 times, but it is a banned word. "ball" occurs twice (and no other word does), so it is the most frequent non-banned word in the paragraph. Note that words in the paragraph..

๊ฐ์ • ๋ถ„๋ฅ˜ ๋ชจ๋ธ ๋งŒ๋“ค๊ณ  ์„ฑ๋Šฅ ๊ฐœ์„ ๊นŒ์ง€ (BERT, GPT2, RoBERTa, DistilBERT)

๊ฐ„๋‹จํ•œ ๊ธ๋ถ€์ • ์ด์ง„ ๋ถ„๋ฅ˜ ๋ชจ๋ธ์„ ๋งŒ๋“ค์—ˆ๋‹ค. ์ „์ฒด์ฝ”๋“œ๋Š” ๊นƒํ—™์—์„œ ๋ณผ ์ˆ˜ ์žˆ๋‹ค! https://github.com/Juyoung-b/Improving-the-Performance-of-Sentiment-Classification GitHub - Juyoung-b/Improving-the-Performance-of-Sentiment-Classification Contribute to Juyoung-b/Improving-the-Performance-of-Sentiment-Classification development by creating an account on GitHub. github.com ์˜์–ด๋กœ ๋œ ๋ ˆ์Šคํ† ๋ž‘ ๋ฆฌ๋ทฐ๋ฅผ ๊ฐ€์ง€๊ณ , ๊ธ์ •(1), ๋ถ€์ •(0)์œผ๋กœ ๋ถ„๋ฅ˜ํ•˜๋Š” ๊ฐ„๋‹จํ•œ task ๋ชจ๋ธ์ด๋‹ค. ์ด๋ฒˆ ํ”„๋กœ์ ํŠธ์—์„ ..

Einstein summation convention

Einstein summation convention ์„ ์‚ฌ์šฉํ•˜๋ฉด, ํ–‰๋ ฌ์˜ ๊ณฑ์…ˆ์„ ์กฐ๊ธˆ ๋” ๋‹จ์ˆœํ•˜๊ฒŒ ํ‘œํ˜„ํ•  ์ˆ˜ ์žˆ๋‹ค. ์•„์ธ์Šˆํƒ€์ธ ํ‘œ๊ธฐ๋ฒ• ๋˜๋Š” ์•„์ธ์Šˆํƒ€์ธ์˜ ํ•ฉ ๊ทœ์•ฝ(Einstein summation convention) ์€ ์„ ํ˜•๋Œ€์ˆ˜ํ•™์„ ๋ฌผ๋ฆฌํ•™์— ์‘์šฉํ•˜๋ฉด์„œ ์ขŒํ‘œ๊ณ„์— ๊ด€ํ•œ ๊ณต์‹์„ ๋‹ค๋ฃฐ ๋•Œ ์œ ์šฉํ•œ ํ‘œ๊ธฐ ๊ทœ์น™์ด๋‹ค. ์•Œ๋ฒ ๋ฅดํŠธ ์•„์ธ์Šˆํƒ€์ธ์ด ์ด ํ‘œ๊ธฐ๋ฒ•์„ 1916๋…„์— ์ฒ˜์Œ ์†Œ๊ฐœํ•˜์˜€๋‹ค. ์ถœ์ฒ˜ : ์œ„ํ‚ค๋ฐฑ๊ณผ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ–‰๋ ฌ์˜ ๊ณฑ์…ˆ์—์„œ *a11์—์„œ ์™ผ์ชฝ 1์€ ํ–‰, ์˜ค๋ฅธ์ชฝ1์€ ์—ด์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ˆซ์ž์ด๋‹ค) ํ–‰๋ ฌ A์™€ ํ–‰๋ ฌ B๋ฅผ ๊ณฑํ•œ AB์—์„œ AB23์˜ ๊ณ„์‚ฐ์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. AB23 = a21b13 + a22b23+...+ a2nbn3 ์ด๋ฅผ ๊ณต์‹ํ™”ํ•˜๋ฉด, ์ด๋ ‡๊ฒŒ ๋˜๊ณ , Einstein summation convention์„ ์‚ฌ์šฉํ•˜์—ฌ ํ‘œ..

๋ฐ˜์‘ํ˜•