강의에서 보면 예를 들어 goog의 연평균 주식 구하실때, pct_change() 구한값에 mean()을 취하셔서 working day 252를 곱하셨는데, 복리 개념을 생각해보면 (df_daily['goog'].pct_change() + 1).prod() ** (252/len(df_daily)) - 1 이렇게 되야 하는게 아닌가 궁금하여 문의드립니다! 값이 거의 비슷하다고 가정하시고 그냥 복리 개념은 생략하신건지요! 감사합니다
안녕하세요! 2분 쯤에 구조체 선언하는 2가지 형태에 대해서 비교해 주실때 오른쪽에서 구조체 선언할때 (왼쪽과는 달리)그냥 struct 라고만 되어있는데 struct Person {//내용}person1 ; 이렇게 Person(구조체명)이 들어가야 하는데 실수로 빠진 건지 아니면 이 경우에는 구조체명을 쓰지 않아도 되는 건지 궁금합니다! 그리고 왼쪽 케이스 아랫부분 사용시 용례에 struct 구조체명 타입명; 이라고 되어있는데 여기서 타입명을 변수명이라고 이해해도 될까요? 뒷 강의에서 typedef를 다루면서 타입명이 나오기는 하는데 여기서도 typedef 키워드가 있을때를 의미하는 건지 헷갈려서요ㅜㅜ
#!/usr/bin/env node /** * Module dependencies. */ var app = require('../app'); var debug = require('debug')('suzil:server'); var http = require('http'); const mongoose = require("mongoose"); const userConfig = require("../config/userConfig.json"); let db = mongoose.connection; db.on("error",console.error); db.once("open",()=>{ console.log("Connected to mongo Server"); }); mongoose.connect( `mongodb+srv://wiyuchan1021:${userConfig.PW}>@suzilo.i1je5.mongodb.net/suzilo?retryWrites=true&w=majority`, {useNewUrlParser: true, useUnifiedTopology: true} ) /** * Get port from environment and store in Express. */ var port = normalizePort(process.env.PORT || '3000'); app.set('port', port); /**f * Create HTTP server. */ var server = http.createServer(app); /** * Listen on provided port, on all network interfaces. */ server.listen(port); server.on('error', onError); server.on('listening', onListening); /** * Normalize a port into a number, string, or false. */ function normalizePort(val) { var port = parseInt(val, 10); if (isNaN(port)) { // named pipe return val; } if (port >= 0) { // port number return port; } return false; } /** * Event listener for HTTP server "error" event. */ function onError(error) { if (error.syscall !== 'listen') { throw error; } var bind = typeof port === 'string' ? 'Pipe ' + port : 'Port ' + port; // handle specific listen errors with friendly messages switch (error.code) { case 'EACCES': console.error(bind + ' requires elevated privileges'); process.exit(1); break; case 'EADDRINUSE': console.error(bind + ' is already in use'); process.exit(1); break; default: throw error; } } /** * Event listener for HTTP server "listening" event. */ function onListening() { var addr = server.address(); var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port; debug('Listening on ' + bind); } 코드 실행하면 PS C:\Users\yuchan\suzil> npm start > suzil@0.0.0 start > nodemon ./bin/www [nodemon] 3.1.7 [nodemon] to restart at any time, enter rs [nodemon] watching path(s): . [nodemon] watching extensions: js,mjs,cjs,json [nodemon] starting node ./bin/www (node:13580) [MONGODB DRIVER] Warning: useNewUrlParser is a deprecated option: useNewUrlParser has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version (Use node --trace-warnings ... to show where the warning was created) (node:13580) [MONGODB DRIVER] Warning: useUnifiedTopology is a deprecated option: useUnifiedTopology has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version MongoServerError: bad auth : authentication failed at Connection.sendCommand (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connection.js:289:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Connection.command (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connection.js:312:26) at async continueScramConversation (C:\Users\yuchan\node_modules\mongodb\lib\cmap\auth\scram.js:131:15) at async executeScram (C:\Users\yuchan\node_modules\mongodb\lib\cmap\auth\scram.js:80:5) at async ScramSHA1.auth (C:\Users\yuchan\node_modules\mongodb\lib\cmap\auth\scram.js:39:16) at async performInitialHandshake (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connect.js:104:13) at async connect (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connect.js:24:9) { errorResponse: { ok: 0, errmsg: 'bad auth : authentication failed', code: 8000, codeName: 'AtlasError' }, ok: 0, code: 8000, codeName: 'AtlasError', connectionGeneration: 0, [Symbol(errorLabels)]: Set(2) { 'HandshakeError', 'ResetPool' } } node:internal/process/promises:391 triggerUncaughtException(err, true /* fromPromise */); ^ MongoServerError: bad auth : authentication failed at Connection.sendCommand (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connection.js:289:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Connection.command (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connection.js:312:26) at async continueScramConversation (C:\Users\yuchan\node_modules\mongodb\lib\cmap\auth\scram.js:131:15) at async executeScram (C:\Users\yuchan\node_modules\mongodb\lib\cmap\auth\scram.js:80:5) at async ScramSHA1.auth (C:\Users\yuchan\node_modules\mongodb\lib\cmap\auth\scram.js:39:16) at async performInitialHandshake (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connect.js:104:13) at async connect (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connect.js:24:9) { errorResponse: { ok: 0, errmsg: 'bad auth : authentication failed', code: 8000, codeName: 'AtlasError' }, ok: 0, code: 8000, codeName: 'AtlasError', connectionGeneration: 0, [Symbol(errorLabels)]: Set(2) { 'HandshakeError', 'ResetPool' } } Node.js v20.17.0 [nodemon] app crashed - waiting for file changes before starting... 이러한 오류가 터미널에 뜨는데 왜 그런걸까요?
사물인터넷 통신은 내 손에 (Arduino, MQTT, Nodejs, MongoDB, Android,VS Code)
Drivers를 선택해서 나온 url주소로도 MongoDB for VS Code를 선택해서 나온 url주소로도 접속이 실패합니다. Node.js 코드는 다음과 같이 작성했습니다. const mongoose = require("mongoose"); const MONGODB_URL = "mongodb+srv://root:1234@education.sidnf.mongodb.net/"; mongoose .connect(MONGODB_URL) .then(() => console.log("Connected to database!")) .catch(() => console.log("Connection failed...")) Connection failed... 라고 나옵니다. Network Access에서도 0.0.0.0으로도 해보고, 제 컴퓨터의 IP주소로도 해보았습니다. 전부 접속 실패가 뜹니다. 이유를 알 수 있을까요?!
강의 12.3 보다가 의문이 들어서 질문 남깁니다. 강의에서 설명하고 사용하셨던 방법과 공식문서에서 BrowserRouter를 사용하는 방법이 달라서 헷갈립니다. 두가지 방법이 같은 것인지, 다르다면 어떻게 다른지 알려주세요 function App () { return ( < BrowserRouter basename = " /app "> < Routes > < Route path = " / " /> </ Routes > </ BrowserRouter > ); } =>공식문서에서는 이렇게 Routes를 BrowserRouter로 감싸서 사용했는데 강의 에서는 그러지 않아서 궁금합니다.!
t1 >> t3 t2 >> t3 이렇게 테스크를 연결했을때 case 1 : t1, t2 둘다 종료되어야 t3가 실행되는지 case 2 : t1이 종료되었을떄, t2가 종료되었을때 각각 t3가 한번씩 실행되는지 궁금합니다. 위의 방법과 [t1, t2] >> t3 가 동등하다고 설명해주셨는데 case 1, case2 두가지 방법을 설정하고싶을때는 어떻게 처리하면 될까요?
안녕하세요! 강의 잘 보고 있습니다. 강의를 보는 중에 헷갈리는 개념이 있어서 질문드려요! 올려주신 강의 중 미들웨어 챕터 부분을 보고 있어요. 그런데 문득 미들웨어와 uvicorn, gunicorn, hypercorn 과 같은 WSGI, ASGI 서버 간의 관계에 대해서 궁금증이 들었습니다. 보통 언어에 상관없이 웹 통신을 한다라고 하면 아래와 같은 구조로 통신한다고 볼 수 있잖아요?(DB가 있다고 가정) """ Client(Web Browser) ---> Web Server ---> Web Application Server ---> DB """ 그리고 파이썬에서는 uvicorn, gunicorn 과 같은 WSGI, ASGI 서버들이 Web Server 역할을, Flask, FastAPI 와 같은 프레임워크 서버들이 Web Application Server의 역할을 한다고 알고 있습니다. 그리고 저 Web Server 요소가 미들웨어라고 정의한다고 알고 있었는데요! 그런데 FastAPI 공식문서 상 에서는 미들웨어라는 것을 소개할 때, "모든 요청 또는 응답에 대해서 사전 또는 사후 처리 로직을 추가할 때 사용하는 것" 이라고 소개를 하면서 문득 "그러면 여기서 이야기하는 미들웨어랑 uvicorn, gunicorn 과는 어떤 차이점이 있는거지?" 하면서 헷갈리더라구요. 자바에서는 미들웨어라는 개념이 JVM 위에서 동작하면서 DB 연결, TCP/IP 연결 등과 같이 다른 소프트웨어(ex.애플리케이션)가 잘 동작하도록 지원해주는 소프트웨어라고 알고 있는데요! 만약 이러한 관점에서 본다면 uvicorn, gunicorn 과 같은 WSGI 또는 ASGI 서버들도 미들웨어라고 볼 수는 없는 걸까요? ChatGPT 한테 물어보았을 때는 엄연히 다른 개념이라고 하는데.. 정확히 차이점을 잘 모르겠어서요. 답변 해주시면 감사하겠습니다! (참고로 저는 파이썬으로만 오랫동안 개발해와서 자바나 다른 언어 관련해서는 잘 모를 수도 있어서 다른 언어에 대한 비유로 답변 주시면 제가 잘 이해를 못할 수도 있습니다!)
다른 분 질문의 답변을 봐도 이해가 잘 안되서 질문 남깁니다! 앞 포인터 강의에서 int *p = &n; printf("%d\n", p); 를 실행하면 n의 주소값이 출력된다고 이해했는데, char *str; printf("%s\n", str); 을 했을때는 왜 myString의 0번째 인덱스 주소값이 출력되는게 아니라 this is string 이 출력되는지 이해가 안되서요.. 설명해주시면 감사하겠습니다!
세션을 실행하고 있어 curl로 실행하려고 하는데 아래와 같은 에러 메세지가 뜨네요. Invoke-WebRequest : 매개 변수 이름 'c'이(가) 모호하므로 매개 변수를 처리할 수 없습니다. 일치하는 항목은 다음과 같습니다. -Credential -CertificateThumbprint -Certificate -ContentType. 위치 줄:1 문자:45 + curl -X POST http://127.0.0.1:8000/set/ -i -c cookies.txt + ~~실행하면 위와 같은 에러메시지가 나오는데 어떻게 해결할 수 있나요? from fastapi import FastAPI,Request from fastapi.security import HTTPBasic from starlette.middleware.sessions import SessionMiddleware app=FastAPI() app.add_middleware(SessionMiddleware,secret_key="your-secret-key") @app.post("/set/") async def set_session(request:Request): request.session["username"]='smith' return {"message":"Session value"} @app.get("/get/") async def get_session(request:Request): username=request.session.get("username","Guest") return {"username":username}