본문 바로가기
반응형

전체 글108

[개발환경] eclipse Java Build Path 설정 source 폴더를 추가하였는데 build에 포함되지 않는 경우나, 원하는 JDK version으로 실행되지 않는 경우, 원하는 JUnit version으로 실행되지 않는 등등.. Java Build Path 설정과 관련된 문제가 발생할 수 있다. 아래와 같이 Java Build Path에서 source, Libraries 등을 설정하여 해결할 수 있으며 아래와 같다. 1. source directory 설정 프로젝트 마우스 오른쪽 버튼 클릭 -> Properties -> Java Build Path -> Source 탭 -> Add Folder / Remove Apply -> Apply and Close 2. 원하는 JDK 설정 프로젝트 마우스 오른쪽 버튼 클릭 -> Properties -> Java .. 2021. 8. 11.
[java] No enclosing instance of type xxx is accessible 에러 하위 클래스에서 상위 클래스가 생성되기 전에 사용하려고 할때 발생하는 에러이다. 아래와 같은 class가 있다고 하자. public class parent { String str; public class child { int a; int b; int c; } } 아래와 같이 child class를 생성할 경우 아래와 같은 error가 발생한다. No enclosing instance of type parent is accessible. Must qualify the allocation with an enclosing instance of type parent (e.g. x.new A() where is an instance of parent). public class test { public static.. 2021. 8. 9.
[기타] Excel 엑셀 취소선 (strike) 긋기 엑셀 취소선 (strike) 긋기 글자 / 셀 선택 -> 마우스 우클릭 -> 셀서식 -> 글꼴 탭 -> 효과의 취소선 선택 -> 확인 2021. 8. 3.
[개발환경] eclipse whitespace(공백) 표시/제거 설정 Eclipse whitespace(공백) 표시 설정 Window -> Preferences -> General -> Text Editors Show whitespace characters 체크 -> Apply and Close 아래와 같이 표시됨을 확인한다. Eclipse whitespace(공백) 제거 설정 Window -> Preferences -> Java -> Editor -> Save Actions Perform the selected actions on save 체크 Additional actions 체크 Configure… 클릭 Code Organizing 탭 ->Remove trailing whitespace 체크 -> All lines -> OK Apply -> Apply and Clos.. 2021. 7. 22.
[개발환경] eclipse tab을 space 4개로 변경 Eclipse에서 tab to space 설정방법 Windows -> Preferences -> General -> Editors -> Text Editor 선택 Insert spaces for tabs 체크 -> Apply and Close' Displayed tab width 4는 tab이 space 4개를 의미한다. 안되는 경우 해당 언어에 아래와 같이 추가 설정 (ex java) Windows -> Preferences -> Java -> Code Style New -> Profile name 입력 -> OK Indentation -> Tab policy -> Spaces only 선택 -> Apply -> OK Active profile에 설정한 Profile name 선택 -> Apply An.. 2021. 7. 22.
[gson] JsonObject 데이터 추가 gson의 JsonObect에 data를 추가한다. int, char, boolean, String type은 addProperty를 통해 아래와 같이 추가할 수 있다. 객체의 경우 add를 통해 추가할 수 있으며 JsonElement로 casting이 필요하다. import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; public void test() { JsonObject obj = new JsonObject(); JsonObject obj1 = new JsonObject(); obj.addProperty("int", new JsonPrimitive(1)); obj.. 2021. 6. 30.
[개발환경] cloc 특정 파일, 디렉토리 제외 옵션 CLOC - Count Lines of Code cloc은 코드의 라인수를 세어주며, 설치 및 사용법은 아래를 참고한다. [개발환경] cloc 사용법 cloc은 다양한 프로그래밍 언어에서 빈 줄, 주석 줄 및 소스 코드의 실제 줄을 계산해 준다. 설치 방법은 아래 OS에 따라 guide 되어 있다. npm install -g cloc # www.npmjs.com/package/cloc sudo apt-get inst.. hong00.tistory.com 버전 확인 cloc --version 특정 파일 타입 제거 후 코드라인 수를 계산할 수 있다. cloc --exclude-ext-java,html src/ 특정 디렉토리 제거 후 코드라인 수를 계산할 수 있다. cloc --exclude-dir=test .. 2021. 6. 25.
[python] 파이썬 time / timeit 사용법 time을 이용하여 현재시간을 구하고 timeit의 default_timer로 running time을 측정한다. localtime을 이용하여 시간형태의 값을 가져온다. now = time.localtime() 이를 연/월/일/시/분/초로 변경한다. year = now.tm_year mon = now.tm_mon day = now.tm_mday hour = now.tm_hour min = now.tm_min sec = now.tm_sec 측정시간을 구하기 위해서 startTime과 endTime을 저장하고 이에 대한 차이를 구해 running time을 구한다. starTime = timeit.default_timer() ... code ... endTime = timeit.default_timer() .. 2021. 5. 27.
[python] 파이썬 사용자 입력받기 (input 함수 사용법) python의 사용자 입력받기 (input 함수, 자료형 별 입력 받기) python project 시작 시 기본이 되는 사용자 입력을 받는 방법을 정리한다. 기본적으로 아래와 같이 input 함수를 사용하여 받을 수 있다. val = input() print(val) 사용자 입력 시 아래와 같이 문구를 넣어 출력할 수 있다. val = input("입력값: ") print(val) 이제 각 자료형 별 입력을 받는 방법을 알아보자. 기본적으로 input은 string 형태로 입력을 받는다. val = input("input string val: ") print("type1: " + str(type(val))) 실행결과 input string val: abc type1: integer형으로의 변환은 int.. 2021. 2. 13.
728x90
반응형