묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결홍정모의 따라하며 배우는 C언어
6.1 scanf의 반환값
int num; scanf("%d",&num); 이 scanf 함수에서 정수형 숫자를 입력하면 입력된 갯수, 즉 1이 입력되고 q 같은 문자를 입력하면 자료형이 맞지않아서 반환값이 없는거라고 보면될까요??
-
미해결남박사의 파이썬 기초부터 실전 100% 활용
남박사님 함수가 호출이 안되네요.
나만의 단축키 smart 강좌를 보고 따라 쳐봤는데, 키 인식은 잘되나 function1,2,3 함수가 호출이 되지 않아요. 무엇이 틀렸을까요? from pynput.keyboard import Key, Listener, KeyCode import win32api # 단축키 저장 MY_HOT_KEYS =[ {"function1": {Key.ctrl_l, Key.alt_l, KeyCode(char="n")}}, {"function2": {Key.shift, Key.ctrl_l, KeyCode(char="b")}}, {"function3": {Key.shift, Key.ctrl_l, KeyCode(char="g")}}, ] # 키가 눌러져있는 키 상태를 기억하는 변수(집합) current_keys = set() def function1(): print("함수1 호출") win32api.WinExec("calc.exe") def function2(): print("함수2 호출") win32api.WinExec("notepad.exe") def function3(): print("함수3 호출") win32api.WinExec("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") def key_pressed(key): print("Pressed {}".format(key)) for data in MY_HOT_KEYS: FUNCTION = list(data.keys())[0] KEYS = list(data.values())[0] if key in KEYS: current_keys.add(key) if all(k in current_keys for k in KEYS): #checker = True #for k in KEYS: #if k not in current_keys: #checker = False #break #if checker: function = eval(FUNCTION) function() def key_released(key): print("Released {}".format(key)) if key in current_keys: current_keys.remove(key) if key == Key.esc: return False # on_press, on_release는 인자값 with Listener(on_press=key_pressed, on_release=key_released) as Listener: Listener.join()
-
미해결실전! Querydsl
DB, SQL 관련...
다른 강좌는 모두 완료하고, 이제 QueryDSL을 열심히 달리고 있습니다. 강좌들덕분에 Java 코드로 짜는 것은 자신감이 생겼는데, ^^ 결과적으로는 무엇보다 DB와 sql 자체를 잘 알아야 최적화된 코드를 짤 수 있는 것 같습니다. 혹시 DB설계, sql 기본/최적화/팁 관련해서 추천해주실 만한 책 있을까요?
-
미해결[개정판 2023-11-27] Spring Boot 3.x 를 이용한 RESTful Web Services 개발
415Unsupported Media Type 에러
Postman 실행시 상태코드가 415Unsupported Media Type 나오네요. 해결방법은 무엇인가요?
-
해결됨[PyTorch] 쉽고 빠르게 배우는 GAN
dcgan, lsgan 질문
dcgan, lsgan 등을 사용하여 이미지 데이터가 아닌 시계열 데이터의 생성도 가능할까요?
-
해결됨[개정판] 파이썬 머신러닝 완벽 가이드
3장의 오차행렬이 잘 이해가 가지 않습니다.
3장 오차행렬에 보면 TN, FP, FN, FP 라는 용어들이 나오는데, 예로들면 TN은 예측값이 Negative고 실제값도 Negative여서 참인 것, FP는 예측값은 Positive인데 실제값은 Negative여서 거짓인 경우. ... 이렇게 이해를 했습니다. 그런데 제가 수학을 못해서 그런지 위의 값들로 정밀도, 재현율이 어떻게 나오는건지 잘 이해가 안갑니다. 또 정밀도, 재현율이 정확히 뭘 뜻하는지도 이해가 안가네요... 답변주시면 정말 감사하겠습니다.
-
미해결홍정모의 따라하며 배우는 C언어
강의 9.1에서 질문있습니다
강의와 똑같이 돌렸는데 "argument of type "const char *" is incompatible with parameter of type char *"라고 뜹니다. 왜 이런 오류가 뜨는건가요?
-
미해결DANO 운동교육 프로그램
레터럴레이즈 할 때 어깨에서 소리가 나는건 왜일까요?
레터럴레이즈 동작을 할 때 팔을 들어올리면(팔꿈치 살짝 구부리고 어깨선 아래까지만 동작) 통증은 없는데 어깨에서 두두둑하는 소리가 나는데 왜 그런걸까요?
-
미해결포토샵 기본기 하루 5분, 3주 만에 끝내기
4강 포토샵 캔버스, 이미지 사이즈강의 2:57초 채우기 문의드립니다.
4강 포토샵 캔버스, 이미지 사이즈강의 2분 57초에 "배경같은 경우에야 다시 채워주면 됩니다" 하셨을떄 어떻게 채우신건가요? 단축키 이신가요? 페이트 툴로 채우곤 햇는데 다른방법이 있는건가요?
-
미해결포토샵 기본기 하루 5분, 3주 만에 끝내기
커맨드 + 옵션 + I 어떻게 하나요?
커맨드 + 옵션 + I 하면 이미지 사이즈 변경된다셨는데. 커맨트 키, 옵션키는 어디에 있나요?
-
미해결프로그래밍, 데이터 과학을 위한 파이썬 입문
python 리스트만의 특징
이해가 잘 안돼요.
-
미해결홍정모의 따라하며 배우는 C언어
8:16초 1차 포인터와 2차원 배열 호환
10.16강 코드를 혼자 짜보다가 실수로 1차 포인터와 2차 배열을 같이 놨는데 호환이 되더라구요? int main() { int arr[3][4] = { {1,2,3,4}, {5,6,7,8},{9,10,11,12}}; int* ptr; ptr = arr; printf("%d \n", sum2d_2(ptr,ROW, COL)); //78 printf("%d", *(ptr+1)); //2 } warning 도 안 뜨고 값도 잘 나오는데 왜 이런거죠?
-
미해결파이썬 입문 및 웹 크롤링을 활용한 다양한 자동화 어플리케이션 제작하기
git config 관련 질문
git에서 config user.name 과 user.email을 입력할 때 , 패스워드는 따로 입력할 필요가 없는건가요 ?? 이름과 이메일, remote할 수 있는 url 정보만 있으면 다른 누구도 git에 접근할 권한이 있는 것인가요 ??
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
도와주세요...
계속 붙잡고 있어도 안되서 헬프를 칩니다.. 뭐가 문제인거죠..? auth.js 파일에서 findbytoken을 만드는데 계속 안되기만 합니다. TypeError: User.findByTokenis not a function at auth (C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\middleware\auth.js:8:10) at Layer.handle [as handle_request] (C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\express\lib\router\layer.js:95:5) at next (C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\express\lib\router\route.js:137:13) at Route.dispatch (C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\express\lib\router\route.js:112:3) at Layer.handle [as handle_request] (C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\express\lib\router\layer.js:95:5) at C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\express\lib\router\index.js:281:22 at Function.process_params (C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\express\lib\router\index.js:335:12) at next (C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\express\lib\router\index.js:275:10) at cookieParser (C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\cookie-parser\index.js:71:5) at Layer.handle [as handle_request] (C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\express\lib\router\layer.js:95:5) at trim_prefix (C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\express\lib\router\index.js:317:13) at C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\express\lib\router\index.js:284:7 at Function.process_params (C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\express\lib\router\index.js:335:12) at next (C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\express\lib\router\index.js:275:10) at C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\body-parser\lib\read.js:130:5 at invokeCallback (C:\Users\AndrewLee\Desktop\node_basic\boilerPlate\node_modules\raw-body\index.js:224:16)ㄱ계속 이 문구만 뜨고요 함수가 아니라는데 저는 함수를 user.js에 만들었고.. 아 이게 무슨 문제일까요.. auth.js const { User } = require('../models/user'); let auth = (req, res, next) => { // 이곳에서 인증처리를 하는 곳 // 클라이언트 쿠리에서 토큰을 가져온다 ==> 쿠키 파서를 이용한다. let token = req.cookies.x_auth; console.log('auth/token :' + token); // 토큰을 복호화한 후 유저를 찾는다. User.findByToken(token, (err, user) => { if (err) throw err; if (!user) { return res.json({ isAuth: false, error: true })// 유저가 없으니까 } else { // 유저가 있으면 req.token = token; // 이렇게 설정해주는 이유는 콜러에서 req.token , req.user와 같이 사용할 수 있게 하기 위해서이다. req.user = user; next(); } }); // 유저가 있으면 인증 오케이 // 유저가 없으면 인증 노노 } module.exports = {auth}; user.js const mongoose = require('../node_modules/mongoose'); const bcrypt = require('bcrypt'); const saltRounds = 10; const myPlaintextPassword = 's0/\/\P4$$w0rD'; const someOtherPlaintextPassword = 'not_bacon'; var jwt = require('jsonwebtoken'); const userSchema = mongoose.Schema({ name :{ type:String, maxlength:50 }, email:{ type:String, trim:true, //스페이스를 없앤다 unique : 1 // 유일한 특성 }, password :{ type:String, minlength:5 }, lastname:{ type:String, maxlength:50 }, role:{ // 롤을 주는 이유는 유저의 관리권한을 부여하기 위해서 type: Number, defalut: 0 }, image:String , token:{ // 토큰을 이용해서 유효성등을 나중에 관리함 type: String }, tokenExp :{ // 토큰의 유효기간 type:Number } }) userSchema.pre('save', function (next) { var user = this; console.log('1'); if (user.isModified('password')) { console.log('2'); bcrypt.genSalt(saltRounds, function (err, salt) { console.log('3'); if (err) return next(err); console.log('4'); bcrypt.hash(user.password, salt, function (err, hash) { console.log('5'); if (err) return next(err); console.log('6'); console.log(hash); user.password = hash; next(); }); }); }else{ next(); } }) userSchema.methods.comparePassword = function(planPassword,cb){ bcrypt.compare(planPassword,this.password,function(err,isMatch){ if(err) return cb(err); cb(null,isMatch); } ); } userSchema.methods.generateToken =function(cb){ var user = this; // json웹토큰을 이용해서 토큰을 생성하기 var token = jwt.sign(user._id.toHexString(), 'hihello'); // 이렇게 토큰을 만들면 ,, // user._id + hihello = token이 되고, 나중에는 token과 hihello로 user._id를 만들 수 있다. user.token = token ; user.save(function(err,user){ if(err) return cb(err); // 에러가 났으면 에러를 전달 cb(null,user); // 문제가 없으면 에러는 없고 유저를 전달 자 그럼 index.js로 넘어가서~ }); } userSchema.methods.B= function(token,cb){} userSchema.methods.findByToken= function(token,cb){ var user = this; // 토큰을 디코드 한다. user_id + '' = token console.log("1 : " + token ); jwt.verify(token, 'hihello',function(err,decoded){ // 유저 아이디를 이용해서 유저를 찾은 다음에 // 클라이언트에서 가져온 token과 db에 보관된 토큰이 일치하는지 확인 user.findOne({"_id":decoded,"token":token},function(err,user){ if(err){ return cb(err); }else{ cb(null, user); } }) }) } const User = mongoose.model('User',userSchema); console.log(User.comparePassword); module.exports = {User}; 좋은 강의 항상 감사드립니다.
-
미해결남박사의 파이썬으로 실전 웹사이트 만들기
ModuleNotFoundError: No module named 'run'
강사님, 우분투 서버셋업후, nginx, myweb 서비스를 올린후, 아래와 같은 log와 함께 실행이 안됩니다. port나 폴더를 제외하고 모두 동일하게 진행 및 확인했는데 어떤부분을 확인해야할지 모르겠습니다. 어디를 더 확인해야 할지 조언 부탁드려요~ *** Operational MODE: preforking *** ModuleNotFoundError: No module named 'run' unable to load app 0 (mountpoint='') (callable not found or import error) *** no app loaded. going in full dynamic mode *** *** uWSGI is running in multiple interpreter mode *** spawned uWSGI master process (pid: 11113) spawned uWSGI worker 1 (pid: 11114, cores: 1) spawned uWSGI worker 2 (pid: 11115, cores: 1) spawned uWSGI worker 3 (pid: 11116, cores: 1) spawned uWSGI worker 4 (pid: 11117, cores: 1) spawned uWSGI worker 5 (pid: 11118, cores: 1) SIGINT/SIGQUIT received...killing workers... worker 1 buried after 1 seconds worker 2 buried after 1 seconds worker 3 buried after 1 seconds worker 4 buried after 1 seconds worker 5 buried after 1 seconds goodbye to uWSGI. VACUUM: unix socket myweb.sock removed. 전체 log 및 경로명 uwsgi.log 직접 터미널에서 실행하면 정상적으로 실행됩니다. python3 run.py http://172.17.190.71:9001/member/login
-
미해결파이썬 사용자를 위한 웹개발 입문 A to Z Django + Bootstrap
버전
안녕하세요. 실습에서 사용하시는 파이썬, 장고, 부트스트랩의 버전 공유 부탁드립니다.
-
해결됨[개정판] 파이썬 머신러닝 완벽 가이드
머신러닝 속도 높이는 방법
안녕하세요? 저는 이제 막 머신러닝에 관심을 갖고 공부를 시작했습니다. 한 가지 궁금한 점은 저의 경우 100만개 정도 데이터로 머신러닝을 수행하는 경우도 있을 것으로 예상하는 데 머신러닝 속도를 높이는 방법이 궁금합니다. 배워도 속도 때문에 활용도가 낮아질까 염려되어 미리 질문 드립니다. 좋은 강의 감사합니다.
-
해결됨자바 ORM 표준 JPA 프로그래밍 - 기본편
Insert 할 때 간단하게 하는 방법
테이블에 새로운 Row 를 추가하기 위해서 Entity 객체를 생성하고 persist 합니다. 그런데 Entity가 다른 Entity를 참조(@ManyToOne) 하는 경우, 새로운 Entity 객체를 생성하면서 그 참조하는 객체까지 넣어 줘야하는 상황에 대해 질문드립니다. 예를 들면 아래와 같은 케이스 입니다. public class User{ @Id private String userId; @ManyToOne private Team team; } public class Team{ @Id private String teamId; } 새로운 사용자를 하나 추가하기 위해서 Team 객체가 필요합니다. 이럴 때 Team 객체를 수작업으로 생성하지 않기 위해 TeamRepository에서 findById 와 같은 메소드로 객체를 가져온 뒤 User Entity를 만들때 넣어 줄 수 있습니다. 하지만 이렇게 되면 코드도 길어지고 User를 만드는 도메인 객체에서 Team Repository 까지 알아야 하는 상황이 생기는데 더 간단하게 User Entity를 만들수 있는 방법이 있을까해서 질문드립니다. 예를 들면 new User() 할 때 teamId를 넘겨주어서 자동으로 참조되는 객체까지 가져오게 하는 방법이라던지... 좋은 조언 부탁드립니다.
-
미해결야곰의 스위프트 기본 문법 강좌
try!는 어떨 때 쓰게 될까요?
try!는 사용의 의미 자체가 필요 없을 것 같다는 생각이 들어서 궁금하네요~
-
미해결스프링과 JPA 기반 웹 애플리케이션 개발
git alias를 만들기
https://johngrib.github.io/wiki/git-alias/