묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
윤재성의 만들면서 배우는 Spring MVC 5
forward 방식 질문있습니다.
삭제된 글입니다
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
상속구조 타입캐스팅, update form 질문드립니다.
웹 계층 개발, 상품 수정 강의 수강중 질문드립니다. 1. createItemForm 과 updateItemForm 이 많은 차이가 나지 않는 것 같은데 따로 생성한 이유가 있을 까요? controller 와 매핑되는 화면이 하나인 것이 좋은 설계라던가 그런 이유가 있을 지 궁금합니다. 따로 만들면 나중에 필드의 항목이 추가 되거나 하면 변경해줘야 할 화면이 늘어나는 것 같아서요 2. 상속 관계로 매핑된 item 캐스팅의 대안 item의 경우 서비스에서 조회한 객체를 캐스팅하여 써야하는데 설명 중에 캐스팅하는 것이 좋은 방법이 아니라고 하셨는데요 Book book = (Book) itemService.findOne(itemId); 다른 대안이 어떤 것이 있을까요? 캐스팅이라고 하시니 제너릭이 생각나는데 이것이 대안이 될 수 있을 까요? 강의 잘 보고 있습니다. 감사합니다. :)
-
해결됨[개정판] 파이썬 머신러닝 완벽 가이드
oof 질문 드립니다
oof (out of fold)가 무엇을 뜻하는지 잘 모르겠습니다 p.s oof 가 밑에 있는 그림과 같이 Learn + Predict 부분을 합친 부분을 말하는 건가요? 정확히 잘 모르겠어서 질문 드립니다.
-
해결됨실전! 스프링 부트와 JPA 활용2 - API 개발과 성능 최적화
LocalDateTime관련해서 질문드립니다.
안녕하세요. 많이 고민해봐도 방향을 잡기 어려워 글을 남겨봅니다. java.lang.AssertionError: Status expected:<200> but was:<400> 에러가 발생되었는데요. 모델링이 잘못된건지 아니면 @CreatedDate ... LocalDateTime 타입 사용을 잘 못하고 있는지 방향을 못잡아 문의드립니다. 아래 내용에서 registDt가 제외되면 정상적으로 처리가 됩니다. ㅠㅠ post insert시에 bbs와 그 안에 다시 post가 나오는것이 맞는 구조인가요?;; --------------------------------------------------------------------------------------------- 엔티티를 bbs(1) post(N) 양방향관계로 생성을 하였습니다. basEntity로 LocalDateTime registDt을 상속받았습니다. [ 아래는 postDto 내용입니다. ] ... public Post toEntity() { return Post.builder() .bbs(bbs) .title(title) .content(content) .build(); } @Builder public PostRequestDto(Bbs bbs, String title, String content ) { this.bbs = bbs; this.title = title; this.content = content; } 그리고 post 저장 테스트를 진행시 아래와 같이 dto가 전송됩니다. { "bbs":{ "registId":null, "registDt":{ "dayOfMonth":6, "dayOfWeek":"MONDAY", "dayOfYear":97, "month":"APRIL", "monthValue":4, "year":2020, "hour":14, "minute":53, "nano":611000000, "second":36, "chronology":{ "id":"ISO", "calendarType":"iso8601" } }, "updateId":null, "updateDt":null, "id":1, "bbsNm":"TEST", "post":[ ] }, "title":"첫번째 테스트", "content":null, }
-
미해결업무 자동화를 위한 파이썬 pyautogui, beautifulsoup 크롤링 기초
크롤링 실행할 때 질문입니다!!
안녕하세요. 강의 보면서 크롤링 코드를 따라서 쳐보면서 많은 도움을 받았습니다. 제가 질문드릴 것은 크롤링 코드를 작성한 다음에 저장을 하고 터미널에서 경로를 찾아 실행하는 것이 아니라 바탕화면에서 저장된 코드를 더블클릭해서 실행을 시키면 검색결과를 볼 수 있기도 전에 실행창이 닫혀버립니다. 그래서 결과를 볼 수 있게 time 모듈을 import 해서 time.sleep()으로 결과를 볼 수 있게 해놨는데 혹시 이렇게 하지 않아도 실행창이 닫히지 않게 할 수 있을까요??
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 유튜브 사이트 만들기
Encountered two children with the same key
다음 에러를 없애려면 어떻게 해야할까요? map함수때매 생긴 문제 같은데 key값을 함수에도 설정이 가능한가요?
-
미해결홍정모의 따라하며 배우는 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}; 좋은 강의 항상 감사드립니다.