안녕하세요 기선님, 강의를 따라하다가 잘 되지 않는 부분이 있어서 질문 남깁니다. 강의 내용과 정말 똑같이 따라치고 있는데--github의 코드와도 대조해보았습니다--이상하게 mockMvc 를 통해 테스트를 하는 부분 전체에서 결과값이 403으로 떨어지네요. 구글링 해보니 @WebMvcTest 를 사용하는 경우 webapplicationcontext를 가져오도록 하라는 가이드만 나오고, @AutoConfigureMockMvc 를 사용하는 경우는 사례를 찾기가 좀 어렵습니다. 제가 어떤 부분을 좀 살펴보아야 할 지 도움을 주실 수 있을까요? 에러 메시지는 다음과 같습니다. MockHttpServletRequest: HTTP Method = POST Request URI = /api/events/ Parameters = {} Headers = [Content-Type:"application/json;charset=UTF-8", Accept:"application/hal+json"] Body = {"id":100,"name":"Spring","description":"REST API Development with Spring","beginEnrollmentDateTime":"2018-11-23T14:21:00","closeEnrollmentDateTime":"2018-11-24T14:21:00","beginEventDateTime":"2018-11-25T14:21:00","endEventDateTime":"2018-11-26T14:21:00","location":"강남역 D2 스타텁 팩토리","basePrice":100,"maxPrice":200,"limitOfEnrollment":100,"offline":false,"free":true,"eventStatus":"PUBLISHED"} Session Attrs = {org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository.CSRF_TOKEN=org.springframework.security.web.csrf.DefaultCsrfToken@553d828a} Handler: Type = null Async: Async started = false Async result = null Resolved Exception: Type = null ModelAndView: View name = null View = null Model = null FlashMap: Attributes = null MockHttpServletResponse: Status = 403 Error message = Forbidden Headers = [X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0", X-Frame-Options:"DENY"] Content type = null Body = Forwarded URL = null Redirected URL = null Cookies = [] MockHttpServletRequest: HTTP Method = POST Request URI = /api/events/ Parameters = {} Headers = [Content-Type:"application/json;charset=UTF-8", Accept:"application/hal+json"] Body = {"id":100,"name":"Spring","description":"REST API Development with Spring","beginEnrollmentDateTime":"2018-11-23T14:21:00","closeEnrollmentDateTime":"2018-11-24T14:21:00","beginEventDateTime":"2018-11-25T14:21:00","endEventDateTime":"2018-11-26T14:21:00","location":"강남역 D2 스타텁 팩토리","basePrice":100,"maxPrice":200,"limitOfEnrollment":100,"offline":false,"free":true,"eventStatus":"PUBLISHED"} Session Attrs = {org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository.CSRF_TOKEN=org.springframework.security.web.csrf.DefaultCsrfToken@553d828a} Handler: Type = null Async: Async started = false Async result = null Resolved Exception: Type = null ModelAndView: View name = null View = null Model = null FlashMap: Attributes = null MockHttpServletResponse: Status = 403 Error message = Forbidden Headers = [X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0", X-Frame-Options:"DENY"] Content type = null Body = Forwarded URL = null Redirected URL = null Cookies = [] java.lang.AssertionError: Status Expected :400 Actual :403 <Click to see difference> at org.springframework.test.util.AssertionErrors.fail(AssertionErrors.java:55) at org.springframework.test.util.AssertionErrors.assertEquals(AssertionErrors.java:82) at org.springframework.test.web.servlet.result.StatusResultMatchers.lambda$matcher$9(StatusResultMatchers.java:619) at org.springframework.test.web.servlet.MockMvc$1.andExpect(MockMvc.java:195) at com.rest.api.events.EventControllerTests.createEvent_Bad_Request(EventControllerTests.java:151) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
안녕하세요 강의 열심히 보고 있습니다 강의 내용을 실습하며 따라하던 도중에 아나콘다 프롬포트 모드에서 test1, 2 계정을 생성하고 아나콘다 네비게이터UI를 실행하면 강사님께서는 UI모드에서 프롬포트에서 만든 test1,2 계정이 보이고 있는데 저는 보이지 않고 있습니다.. UI모드에서 create해도 프롬포트모드에서는 보이는데 (anaconda info --envs) UI에서는 안보이는 이유가 무엇일까요 ㅜㅜ
소스코드글씨가 너무 작아 같이 타이핑 할수가 없어요 다른 강의 사이트들을 보면 확대를 하거나 소스 코드만 따로 올려 놓는다 던지 하는데 전체화면으로 봐야 글씨가 보이는데 그러면 그냥 강의만 보게 되서 글자를 확대해서 녹화해주시거나 소스 코드를 딸로 올려 주심 감사하겠습니다
안녕하세요. 1.14 강의 13분 근처에서, main.cpp에 different.cpp를 include 하지 않고도 void doSomething()함수가 실행되는데요, void doSomething()이라고 declaration 을 main.cpp에서 하셨지만, 원칙적으로는 제가 header file이나 cpp file을 include 시켜야할까요? 이경우에는 같은 폴더에 있기때문에 그냥 실행되는것인지요? 그리고 이게 ch.0의 링커와 연결된다고 하셨는데, 그부분을 보았으나 조금 헷갈리는 것 같습니다. 이부분을 좀 더 알고 싶습니다. 감사합니다.
스트럭처 상태에서 class로 바꾸면서 접근 지정자를 사용하면 해소가 됩니다. 라고 말씀해주셨는데 현재 스트럭처 상태에서 접근지정자를 넣을 수 있어서 애매하네요 함수구현도 가능하고요 함수 접근 지정자도 가능합니다. 그렇다고 메모리 크기도 다르지 않고요 제가 보기엔 거의 동일하게 느껴지는데요
안녕하세요 선생님! 해설강의 보기 전에 작성한거라 이렇게 해도 되는지 궁금해서요. 일단 작동은 제대로 하는 것 같은데 더 간소화? 할 수 있는 부분은 없는지도 궁금하고요. <script> var i = Number(prompt("insert number except '1'")); var n = 2; while (i % n != 0) { n++; console.log(i,n,i%n); } if (n != i) { document.write(i + " is not a prime number."); } else { document.write(i + " is a prime number."); } </script> while 문으로 작성했을 때, 콘솔에 짝수는 아예 console.log 가 안뜨더라구요. var n = 2 로 설정하고 시작해서 인 것 같은데, 코드를 어떻게 수정하면 2로 나눈 것도 나머지가 0인게 뜰까요? (3 부터는 다 떠요!) 그리고 여기서 while 문을 for 문으로 바꿔봤는데 for (var n = 2; i % n != 0; n++) { console.log(i,n,i%n); } 이렇게 바꿨더니 콘솔에서 표시되는 부분이 달라지네요. while 문일 때는 콘솔에 자기자신으로 나눠서 나머지가 0 이 되는 것까지 찍혔는데, for 문으로 바꾸니까 콘솔에는 자기 자신 -1 로 나눈 것까지만 나오더라구요. (for 문으로 바꿔도 소수이다/아니다 판별은 제대로 하긴 해요!) 보는 입장(?)에서 콘솔에 자기 자신으로 나눈 나머지가 0 인 것까지 나와야 소수인걸 확실히 이해할 것 같은데.. 코드를 어떻게 수정하면 되는 걸까요? (혹시나 하고 console.log 앞이나 뒤에 n++; 를 넣어보았지만.. 무한히 나누기를 하는 재앙이...ㅠㅠ)
강의 11분에서 설명하시는 질문입니다 아래는 제가 따라서 쓴 코드입니다. include using namespace std; class something { private: static int s_value; int m_value; public: static int getValue() { return s_value; } int temp() { return this->s_value; } }; int something::s_value = 1024; int main() { cout << something::getValue()<< endl; something s1,s2; cout << s1.getValue() << endl; int(something::*fptr1)() = &something::temp; cout << (s2.*fptr1)()<<endl; int (*fptr2)() = &something::getValue(); 막상 빌드를 하려고 하는데 Cannot take the address of an rvalue of type 'int' 라고 뜹니다..... 우측값의 타입이 'int' 인 주소를 넣지 마세요 라는 말인 것 같은데.. 어떻게 해결해야 할지 잘 모르겠습니다ㅠㅠ
숙제를 할때 recommand = soup.select("ul.slides")[ ?? ] ??이 부분을 0 ,1,2 로 나누어서 하면 될것같은데 위 질문드리신 님처럼 저도 똑같은 에러가 납니다. 밑의 댓글을 확인해 보았을 때 이미지 확장자가 gif인것도 있고 다른 것도 있기 때문에 생길 수 도 있다는데 도저히 제 힘으론 해결이 안되는 것 같습니다. 혹 어떠한 것 때문에 알 수 있는지요. 제코드는 from bs4 import BeautifulSoup import urllib.request as req import urllib.parse as rep import os import sys import io sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8') sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding = 'utf-8') savePath ="C:\imagedown2\" base = " https://www.inflearn.com/ " quote = rep.quote_plus("추천-강좌") url = base + quote res = req.urlopen(url).read() soup = BeautifulSoup(res,"html.parser") recommand = soup.select("ul.slides")[2] print(recommand) try: if not(os.path.isdir(savePath)): os.makedirs(os.path.join(savePath)) except OSError as e: if e.errno != errno.EEXIST: print("Failed to create directory!!!!!") raise test =[] en_test=[] for i,e in enumerate(recommand,1): open앞 파일 경로 + "파일의 이름", "어떠한 형식으로 작성할것인지" with open(savePath+"title_"+str(i)+".txt", "wt") as f: f.write(e.select_one("h4.block_title > a ").string) fullfilename = os.path.join(savePath, savePath+'img_'+str(i)+'.png') #urlretrieve 기능은 앞에 파일원본, 파일이 들어갈 경로 test=e.select_one("div.block_media > a > img")['src'] #en_test = test.encode('utf-8') #req.urlretrieve(en_test,fullfilename) req.urlretrieve(e.select_one("div.block_media > a > img")['src'],fullfilename) print("강좌 정보 텍스트 출력 및 이미지 다운 완료!") 이렇게 작성이 되었구요. 에러 코드는 Traceback (most recent call last): File "C:section2inflearn_homework_img.py", line 38, in req.urlretrieve(e.select_one("div.block_media > a > img")['src'],fullfilename) File "C:UsersuserAnaconda3envssection2liburllibrequest.py", line 188, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: File "C:UsersuserAnaconda3envssection2liburllibrequest.py", line 163, in urlopen return opener.open(url, data, timeout) File "C:UsersuserAnaconda3envssection2liburllibrequest.py", line 466, in open response = self._open(req, data) File "C:UsersuserAnaconda3envssection2liburllibrequest.py", line 484, in _open '_open', req) File "C:UsersuserAnaconda3envssection2liburllibrequest.py", line 444, in _call_chain result = func(*args) File "C:UsersuserAnaconda3envssection2liburllibrequest.py", line 1297, in https_open context=self._context, check_hostname=self._check_hostname) File "C:UsersuserAnaconda3envssection2liburllibrequest.py", line 1254, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "C:UsersuserAnaconda3envssection2libhttpclient.py", line 1107, in request self._send_request(method, url, body, headers) File "C:UsersuserAnaconda3envssection2libhttpclient.py", line 1142, in _send_request self.putrequest(method, url, **skips) File "C:UsersuserAnaconda3envssection2libhttpclient.py", line 984, in putrequest self._output(request.encode('ascii')) UnicodeEncodeError: 'ascii' codec can't encode characters in position 24-29: ordinal not in range(128) [Finished in 10.976s] 이렇게 뜹니다.
명강의 잘 듣고 있습니다! 계속 반복해서 들어도 이해가 안가는 부분 있어서 질문합니다. 제 머리로는 한계네요 :( function _reduce(list, iter, memo) { if (arguments.length == 2) { memo = list[0]; list = _rest(list); } _each(list, function(val) { // 여기서 val 부분 console.log(val); memo = iter(memo, val); }); return memo; } _each의 콜백에서 첫번째 인자인 val은 어디서 오는 걸까요? 저게 'list' 안에 있는 각각의 요소인것은 알겠습니다. 그런데 val을 넣어주기 위해서는 우선 _each 펑션이 한번 돌아서 첫번째 인자를 저기에 쏴 줘야 하는데, 처음에 리스트를 돌기 전에 콜백의 'val' 부분에 인자를 넣어주는 녀석은 누구인지 궁금합니다. 혹시 콜백으로 들어온 함수는 바로 실행되는게 아니라, _each(list, callback(a)) 에서, list를 순회 먼저 하고 각각의 인자들에 callback을 나중에 대입하거나, list를 한번 돌고, 콜백에 인자 대입, 그다은 한버더 돌고, 그다음 콜백에 인자 한번 더 대입. 이런 식인가요? 이런 강의 들어서 행운이라고 생각합니다. : )
2:44 2:48 초 경에 int 를 반환할때 왼쪽변수에 를 하거나 혹은 de레퍼런싱할때 사라지는 주소인것이라 위험한 것은 알겠습니다. 근데 실제적으로 cout 하면 에러라 뜰거라 생각했는데 되길래 갑자기 지금까지 생각했던게 함수가 끝나면 사라지는데 어째서 그 메모리 변수에 값이 남아있는거죠? 갑자기 이해가 되지를 않아 질문드려봅니다.
안녕하세요 교수님 한 가지 질문이 있습니다. (강의 코드와는 별개입니다.) int& add(int a, int b,int& c) { c=a+b; return c; } int main() { int c=0; add(1,2,c); cout << add<<endl; cout << &c<<endl; } 반환을 c로 받기 때문에 변수 c의 주소와 add의 주소가 같게 나올 것이라 생각했지만 출력은 다르게 나왔습니다. int& add(int a, int b,int& c) 여기서 어떤것과 주소를 공유하는지 모르겠습니다.
This XML file does not appear to have any style information associated with it. The document tree is shown below. AllAccessDisabled All access to this object has been disabled 8F5878E47BA92F69 d8XmhuvPEkBpT0fXcFoNb9XMt3aR33+ybHyAou/7XpOhL+p+qPkRpM+nMMqBSLU8wt3FaWJb7hs= 이런식으로 에러 스크립트가 나와서 다운을 받을 수 없습니다. 어떻게 해결하나요?
인강들은 것처럼 파일 생성하고 서블릿 생성 후에 PrintWriter 까지 작성해서 구동해봤는데 홈페이지에 HTTP Status 404 - Not Found 라고 자꾸 뜨네요. 왜그런걸까요? 전 강의 Jsp 맛보기에서 hello jsp~ 이 코드는 잘 출력되는데 sevlet은 안되네요 ..