에러(3)
-
[Java/JSP/Servlet] cannot cast from object to int.
servlet/jsp/java를 사용하다보면 자주 볼 수 있는 에러. int value =(int)application.getAttribute("value"); application scope 에서 넘어오는 변수들은 object type이고 int형은 primitive type 이다. 따라서 C/C++ 단순히 typecasting 하면 되겠지하는 안일한 생각으로 위 코드처럼 작성하게 되면, 위와 같은 무시무시한 코드를 볼 수 있다.(무려 심각..!) 에러를 없애기 위해서는 아래와 코드를 적어야한다. int value = Integer.parseInt(application.getAttribute("value").toString()); Integer.parseInt 함수는 String형만 인자로 받을 수 있..
2020.01.28 -
c++98 mode in Dev-C++ 문제 해결
vector를 사용하면서 for(auto &p: arr) 이런 식의 반복문 문법을 자주 쓰는 편인데 dev c++로 알고리즘 문제를 풀다 보니 지원하지 않는 경우가 발생했다. range-based 'for' loops are not allowed in c++98 mode 위와 같은 에러를 띄우고 프로그램을 종료되었다. 문제 해결을 위해 구글링을 해보니, stackoverflow에 해결 방법이 있어서 공유하고자 한다. 위와 같은 에러는 dev-c++의 문법이 std-98을 기반으로 하고있기 때문에 뜬다고 생각된다. 그때는 반복문에 대한 문법이 완벽하지 않았나 보다. Tools -> Compiler Options -> "Compiler" tab로 들어간다. 여기서 Add the following comman..
2019.09.29 -
BeautifulSoup 설치 에러
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ERROR: Command errored out with exit status 1: command: /usr/local/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '" '"'/tmp/pip-install-j9kd57oq/BeautifulSoup/setup.py'"'"'; __file__='"'"'/tmp/pip-install-j9kd 57oq/BeautifulSoup/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.r ead().replace('"'"'\r\n'"'"',..
2019.09.19