JAVA/eclipse 2024. 9. 28. 13:27

 

-

-

package SRC_1;
import java.io.File;
import java.util.Random; 

class SampleProject {

	//public static void main() {
	public static void main(String[] args) {
		
/* 		args = new String[3]; //3개의 저장공간을 가진 배열 초기화
		args[0] = "안녕"; //배열의 첫번째 공간에 데이터입력
		args[1] = "반가워"; //배열의 두번째 공간에 데이터입력
		args[2] = "버물리라고해"; //배열의 세번째 공간에 데이터입력
		
		System.out.println(args[0]);
		System.out.println(args[1]);
		System.out.println(args[2]);
*/		
		SampleProject smpl  = new SampleProject() ; 
		
		smpl.initZeroCrossingData() ; 
	}
	
	//Integer[] zc_Tinfo_server = new Integer[60] ; 
	int[] zc_Tinfo_server = new int[60] ;
	public Integer getRandomnumber(Integer begin, Integer end){
		//For a more generic "in between two numbers" use:

		Random r = new Random();
		int low = 10;
		int high = 100;
		int result = r.nextInt(high-low) + low;

		//This gives you a random number in between 10 (inclusive) and 100 (exclusive)
		
		return result ; 
	}
	
	String[] zc_finder ; 
	int[]  zc_finderInt ;
	
	/*
	 * output: 
	 idx=52, zc_Tinfo_server=52002, zc_finderInt[k - nStart  ]=52154, nDiff=3090
Hello world
nCnt=5
zc_finder: count=5
zc_finder[k=0]=49165, 0
zc_finder[k=1]=50161, 0
zc_finder[k=2]=51157, 0
zc_finder[k=3]=52154, 0
zc_finder[k=4]=53150, 0
idx=49, zc_Tinfo_server=49067, zc_finderInt[k - nStart  ]=49165, nDiff=98
idx=50, zc_Tinfo_server=50030, zc_finderInt[k - nStart  ]=50161, nDiff=131
idx=51, zc_Tinfo_server=51088, zc_finderInt[k - nStart  ]=51157, nDiff=69
idx=52, zc_Tinfo_server=52086, zc_finderInt[k - nStart  ]=52154, nDiff=68
idx=53, zc_Tinfo_server=53029, zc_finderInt[k - nStart  ]=53150, nDiff=121
	 */
	public void initZeroCrossingData() {

		String a2 ;
		String data = "1X05,49165,50161,51157,52154,53150,\n" ;   //20240927

		String aa = data;
		//Toast.makeText(getApplicationContext(), " MCU Data : " + data, Toast.LENGTH_LONG).show();
		//Log.d("phase", " PPPPPv  ---------------    PPPPPPPPP ======= > " + data + "\n");

		// new format recv(ex. aa) : "1X05,49165,50161,51157,52154,53150,\n"  //20240927
		
		System.out.println("Hello world" ); 
		for(Integer t = 0 ; t < 60 ; t++ ) {
			Random r = new Random();
			zc_Tinfo_server[t] = t * 1000  + r.nextInt(100) ; 
		}

		a2 = aa.substring(1, 2);// get phase id like "A", "B", "C"
		if( a2.equalsIgnoreCase("X")) { // 20240927-1
				int nCnt = Integer.valueOf(aa.substring(2, 4 ) )  ; // get number of zero-corssing time info.
				aa = aa.replaceAll("\n","");
				System.out.println("nCnt=" + nCnt ) ; 
				String str = aa.replace(" ", "") ;
				//String[] zc_finder = str.split(",");
				zc_finder = str.substring(5,  str.length()).split(",") ;
				zc_finderInt = new int[ nCnt  ] ;
				int nStart =0 ;
				
				System.out.println("zc_finder: count=" + zc_finder.length ) ; 
				
				for (int k = 0 ; k< nCnt  ; k++) {// convert String info. to int, skip index k=0, it is only count information  not data 
					zc_finderInt[k] =   (int) Integer.parseInt(zc_finder[k])     ; 
					System.out.println( "zc_finder[k="+ k + "]" +"=" + zc_finder[k] +", "  + nStart) ;
				}
				
				int nDiff =0; 
				try {
					nStart = (zc_finderInt[0] /1000 )%100 ;
				}catch( Exception e) {
					e.printStackTrace() ; 
				}
				
				for(int k =  nStart  ; k <  nStart + nCnt  ; k++  ){
					//Log.d("zc_Tinfo_server" , "idx=" + k  + ", zc_Tinfo_server=" +zc_Tinfo_server [k ] ) ;
					nDiff = Math.abs(zc_Tinfo_server[k ] - zc_finderInt[k - nStart ] )  ;//get diff. between server time and finder time  
					System.out.println("idx=" + k  + ", zc_Tinfo_server=" +zc_Tinfo_server [k ] + 
							", zc_finderInt[k - nStart  ]="+ zc_finderInt[k - nStart  ] + ", nDiff=" + nDiff ) ;
				}

				return ;
		}
	}
	
	public void initZeroCrossingDataOld() {

		String a2 ;
		String data = "1X05,49165,50161,51157,52154,53150,\n" ;   //20240927

		String aa = data;
		//Toast.makeText(getApplicationContext(), " MCU Data : " + data, Toast.LENGTH_LONG).show();
		//Log.d("phase", " PPPPPv  ---------------    PPPPPPPPP ======= > " + data + "\n");

		// new format recv(ex. aa) : "1X05,49165,50161,51157,52154,53150,\n"  //20240927
		
		System.out.println("Hello world" ); 
		for(Integer t = 0 ; t < 60 ; t++ ) {
			Random r = new Random();
			zc_Tinfo_server[t] = t * 1000  + r.nextInt(100) ; 
		}

		a2 = aa.substring(1, 2);// get phase id like "A", "B", "C"
		if( a2.equalsIgnoreCase("X")) { // 20240927-1
				int nCnt = Integer.valueOf(aa.substring(2, 4 ) )  ; // get number of zero-corssing time info.
				aa = aa.replaceAll("\n","");
				System.out.println("nCnt=" + nCnt ) ; 
				String str = aa.replace(" ", "") ;
				//String[] zc_finder = str.split(",");
				String[] zc_finder = str.substring(5,  str.length()).split(",") ;
				Integer[]  zc_finderInt = new Integer[ nCnt  ] ;
				Integer nStart  ;
				
				System.out.println("zc_finder: count=" + zc_finder.length ) ; 
				
				nStart = 0 ; 
				for (Integer k = 0 ; k< nCnt  ; k++) {// skip index k=0, it is only count information  not data 
					zc_finderInt[k] = new Integer(zc_finder[ k]  )  ; 
					System.out.println( "zc_finder[k="+ k + "]" +"=" + zc_finder[k] +", "  + nStart) ;
				}				
				

				try {
					nStart = (zc_finderInt[0] /1000 )%100 ;
				}catch( Exception e) {
					e.printStackTrace() ; 
				}
				
				int nDiff =0; 
				
				for(Integer k = nStart ; k < nStart + nCnt  ; k++  ){
						//Log.d("zc_Tinfo_server" , "idx=" + k  + ", zc_Tinfo_server=" +zc_Tinfo_server [k ] ) ;
					//nDiff = Math.abs(zc_Tinfo_server[k].intValue() - zc_finderInt[k].intValue() )  ; 
						System.out.println("idx=" + k  + ", zc_Tinfo_server=" +zc_Tinfo_server [k ] + ", nDiff=" + nDiff ) ;
				}

				return ;
		}
	}	

	

}//출처: https://javacpro.tistory.com/11 [버물리의 IT공부:티스토리]


public class TestMemorySize {
	public static void memoryStats() {
	    int mb = 1024 * 1024;
	    // get Runtime instance
	    Runtime instance = Runtime.getRuntime();
	    System.out.println("***** Heap utilization statistics [MB] *****\n");
	    // available memory
	    System.out.println("Total Memory: " + instance.totalMemory() / mb);
	    // free memory
	    System.out.println("Free Memory: " + instance.freeMemory() / mb);
	    // used memory
	    System.out.println("Used Memory: "
	            + (instance.totalMemory() - instance.freeMemory()) / mb);
	    // Maximum available memory
	    System.out.println("Max Memory: " + instance.maxMemory() / mb);
	}	
	  public static void main(String[] args) {
		  memoryStats(); 
	  /* Total number of processors or cores available to the JVM */
	  System.out.println("Available processors (cores): " + 
	  Runtime.getRuntime().availableProcessors());

	  /* Total amount of free memory available to the JVM */
	  System.out.println("Free memory (bytes): " + 
	  Runtime.getRuntime().freeMemory());

	  /* This will return Long.MAX_VALUE if there is no preset limit */
	  long maxMemory = Runtime.getRuntime().maxMemory();
	  /* Maximum amount of memory the JVM will attempt to use */
	  System.out.println("Maximum memory (bytes): " + 
	  (maxMemory == Long.MAX_VALUE ? "no limit" : maxMemory));

	  /* Total memory currently in use by the JVM */
	  System.out.println("Total memory (bytes): " + 
	  Runtime.getRuntime().totalMemory() + "\n" );
	  System.out.println("KB: " + (double) (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 + "\n");
	  /* Get a list of all filesystem roots on this system */
	  File[] roots = File.listRoots();

	  /* For each filesystem root, print some info */
	  for (File root : roots) {
	    System.out.println("File system root: " + root.getAbsolutePath());
	    System.out.println("Total space (bytes): " + root.getTotalSpace());
	    System.out.println("Free space (bytes): " + root.getFreeSpace());
	    System.out.println("Usable space (bytes): " + root.getUsableSpace());
	  }
	 }
	}
/* 실행결과 , Output : 
입력데이터: "1X05,49165,50161,51157,52154,53150,\n" 

- 실행결과 
Hello world
nCnt=5
zc_finder[k=1]=49165
zc_finder[k=2]=50161
zc_finder[k=3]=51157
zc_finder[k=4]=52154
zc_finder[k=5]=53150
idx=49, zc_Tinfo_server=49020
idx=50, zc_Tinfo_server=50019
idx=51, zc_Tinfo_server=51065
idx=52, zc_Tinfo_server=52067
idx=53, zc_Tinfo_server=53067

※ 자바 Integer클래스와 int 데이터타입 
[Java] Integer - 생성자, int 변환
https://priming.tistory.com/23


*/

package SRC_1;

import java.io.File;

import java.util.Random; 

class SampleProject {
 public SampleProject() {}; 

//public static void main() {
public static void main(String[] args) {

/*  args = new String[3]; //3개의 저장공간을 가진 배열 초기화
args[0] = "안녕"; //배열의 첫번째 공간에 데이터입력
args[1] = "반가워"; //배열의 두번째 공간에 데이터입력
args[2] = "버물리라고해"; //배열의 세번째 공간에 데이터입력

System.out.println(args[0]);
System.out.println(args[1]);
System.out.println(args[2]);
*/
SampleProject smpl  = new SampleProject() ; 

smpl.initZeroCrossingData() ; 
}

Integer[] zc_Tinfo_server = new Integer[60] ; 
public Integer getRandomnumber(Integer begin, Integer end){
//For a more generic "in between two numbers" use:

Random r = new Random();
int low = 10;
int high = 100;
int result = r.nextInt(high-low) + low;

//This gives you a random number in between 10 (inclusive) and 100 (exclusive)

return result ; 
}


public void initZeroCrossingData() {

String a2 ;
String data = "1X05,49165,50161,51157,52154,53150,\n" ;   //20240927

String aa = data;
//Toast.makeText(getApplicationContext(), " MCU Data : " + data, Toast.LENGTH_LONG).show();
//Log.d("phase", " PPPPPv  ---------------    PPPPPPPPP ======= > " + data + "\n");

// new format recv(ex. aa) : "1X05,49165,50161,51157,52154,53150,\n"  //20240927

System.out.println("Hello world" ); 
for(Integer t = 0 ; t < 60 ; t++ ) {
Random r = new Random();
zc_Tinfo_server[t] = t * 1000  + r.nextInt(100) ; 
}

a2 = aa.substring(1, 2);// get phase id like "A", "B", "C"
if( a2.equalsIgnoreCase("X")) { // 20240927-1
int nCnt = Integer.valueOf(aa.substring(2, 4 ) )  ; // get number of zero-corssing time info.
aa = aa.replaceAll("\n","");
System.out.println("nCnt=" + nCnt ) ; 
String str = aa.replace(" ", "") ;
String[] zc_finder = str.split(",");
Integer[]  zc_finderInt = new Integer[ nCnt  ] ;
Integer nStart  ;
//foreach( String )
for (Integer k = 1 ; k<= nCnt  ; k++) {// skip index k=0, it is only count information  not data 
//zc_finderT[k] = new Integer ( Integer.valueOf(zc_finder[k]) ) ; 
//zc_infoT[k] = Integer.valueOf(zc_info[k]) ;
//Log.d("ZC_TInfo", "k=" + zc_infoT[k] + ", zc_timeInfo=" + zc_infoT[k]  % 1000  ) ;
zc_finderInt[k-1] = new Integer(zc_finder[ k]  )  ; 
System.out.println( "zc_finder[k="+ k + "]" +"=" + zc_finder[k]   ) ;
}

nStart = 0 ; 

try {
nStart = (zc_finderInt[0] /1000 )%100 ;
}catch( Exception e) {
e.printStackTrace() ; 
}

for(Integer k = nStart ; k < nStart + nCnt  ; k++  ){
//Log.d("zc_Tinfo_server" , "idx=" + k  + ", zc_Tinfo_server=" +zc_Tinfo_server [k ] ) ;
System.out.println("idx=" + k  + ", zc_Tinfo_server=" +zc_Tinfo_server [k ] ) ;
}


//zc_Tinfo_server

return ;
}
}

}//출처: https://javacpro.tistory.com/11 [버물리의 IT공부:티스토리]

posted by cskimair
:
JAVA/eclipse 2023. 2. 15. 18:17

 

 

 

 

-

https://stackoverflow.com/questions/3191693/how-do-i-change-a-java-projects-bin-folder-in-eclipse/3191753#3191753

 

How do I change a Java project's bin folder in Eclipse?

When you have a Java project in Eclipse, how do you change the location where the class files are placed? The bin directory is the default location.

stackoverflow.com

> Right-click on our project --> select properties --> select Java Build Path --> select the Source tab. At the bottom of the tab you should see a field named (Default Output Folder:).

 

How to Add Existing Files to Eclipse Projects

This Tip sounds very basic, but still: I get asked about this about once a week. So it must be something non-obvious in Eclipse then ;-): how to add existing files to an Eclipse project. As with ma…

mcuoneclipse.com

 

How to Add Existing Files to Eclipse Projects

This Tip sounds very basic, but still: I get asked about this about once a week. So it must be something non-obvious in Eclipse then ;-): how to add existing files to an Eclipse project. As with ma…

mcuoneclipse.com

 

How to Add Existing Files to Eclipse Projects

This Tip sounds very basic, but still: I get asked about this about once a week. So it must be something non-obvious in Eclipse then ;-): how to add existing files to an Eclipse project. As with ma…

mcuoneclipse.com

 

How do I change a Java project's bin folder in Eclipse?

When you have a Java project in Eclipse, how do you change the location where the class files are placed? The bin directory is the default location.

stackoverflow.com

 

 

-

https://stackoverflow.com/questions/45440060/want-eclipse-class-files-also-in-other-folder-apart-from-bin

 

Want Eclipse .class files also in other folder apart from bin

I want when Developer save java file in eclipse , And eclipse by default generate it .class file in bin folder,So this .class file is also generate in other folder also. I can not copy /paste that ...

stackoverflow.com

 

 

- eclipse java class file folder change directory

https://www.google.com/search?q=eclipse+java+class+file+folder+change+directory&newwindow=1&client=firefox-b-d&sxsrf=AJOqlzXoXbyAmVk-Do2kRv0E3gubMFh3Zw%3A1675910642320&ei=8l3kY8ScE8r_hwOk9b6gAw&oq=eclipse+java+class+file+folder+change&gs_lcp=Cgxnd3Mtd2l6LXNlcnAQAxgCMgUIIRCgATIFCCEQoAEyBQghEKABOgoIABBHENYEELADOgQIIxAnOgUIABCRAjoICAAQgAQQywE6BQgAEIAEOgkIABAWEB4Q8QQ6BggAEBYQHjoFCAAQhgM6CAgAEBYQHhAPOgcIIRCgARAKOggIIRAWEB4QHToLCCEQFhAeEPEEEB06DQghEBYQHhAPEPEEEB06BAghEBVKBAhBGABKBAhGGABQtQhY8ElgqWhoAXABeACAAZQBiAHRGpIBBDAuMjmYAQCgAQHIAQjAAQE&sclient=gws-wiz-serp 

 

🔎 eclipse java class file folder change directory: Google 검색

 

www.google.com

 

posted by cskimair
:
JAVA/eclipse 2020. 5. 4. 13:42

https://kamang-it.tistory.com/entry/Ant%EA%B0%84%EB%8B%A8%ED%95%9C-ant-%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8-%EB%A7%8C%EB%93%A4%EA%B8%B02

 

[Ant]간단한 ant 프로젝트 만들기(2)

참고: [Ant]ant설치와 환경설정(1) 간단한 ant프로젝트를 만들어보자. ant는 전용 프로젝트를 만들 필요는 없고 그냥 있는 프로젝트에 ant설정 파일을 만들어 주면 그게 ant 프로젝트이다. 아래의 경우를 보자...

kamang-it.tistory.com

 

posted by cskimair
:
JAVA/eclipse 2020. 5. 4. 10:56

흰색깔이 눈에 부셔서..  블랙테마로.. 

https://dzzienki.tistory.com/6

 

이클립스 테마변경 및 블랙테마 설정

개발을 처음 배울 당시 이클립스 화면을 까맣게 해놓고 개발을 하시던 분들이 괜히 멋있어 보였던 생각이 나네요 그리고 리눅스 기반으로 개발을 배우셨던 분들은 아마 까만 화면에 하얀 글씨로 코딩하는게 익숙하..

dzzienki.tistory.com

 

posted by cskimair
:
JAVA/eclipse 2020. 5. 4. 10:55

How to install subversion in Eclipse without fail. 

 

안드로이드 스튜디오를 사용하지만 이클립스를 써야할일이 생겨서 

링크추가합니다. 

이클립스를 설치하고 svn연결하고  저장소(repository)에서 파일 다운로드(checkout)후 update받는 것까지 설정방법입니다. 

 

 

http://lmc.cs.kookmin.ac.kr/readmore/eclipse-svn

 

이클립스를 이용하여 svn 사용하기 - System Software

 

lmc.cs.kookmin.ac.kr

https://copycoding.tistory.com/195

 

이클립스(eclipse) SVN 설치 및 연동

앞에서 VisualSVN Server 설치와 설정에 대해 설명을 했는데 이번에는 eclipse에서 접속해서 소스를 올리고 공유하는 방법에 대해 설명을 하도록 하겠습니다. SVN Server의 종류가 여러 개 이고 어떤 프로그램으로..

copycoding.tistory.com

 

- 아래는 마켓플레이스 클라이언트를 미리 설치하고 해봐야 함. 

https://recipes4dev.tistory.com/155

 

이클립스(Eclipse)에 SVN 설치하기. (Installing Eclipse SVN PlugIn)

1. 이클립스 (Eclipse) [윈도우즈 운영체제에 이클립스(Eclipse) 설치하기]에서 이클립스라는 통합개발환경(IDE)를 소개하고, 윈도우즈 운영체제에 설치하는 방법을 알아보았습니다. 이클립스의 장점, 즉, "다양한..

recipes4dev.tistory.com

https://copycoding.tistory.com/195

 

이클립스(eclipse) SVN 설치 및 연동

앞에서 VisualSVN Server 설치와 설정에 대해 설명을 했는데 이번에는 eclipse에서 접속해서 소스를 올리고 공유하는 방법에 대해 설명을 하도록 하겠습니다. SVN Server의 종류가 여러 개 이고 어떤 프로그램으로..

copycoding.tistory.com

 

posted by cskimair
:
JAVA/eclipse 2020. 5. 1. 19:33

How to install Amateras to Eclipse without fail 

Amateras - Alternative of ERWin,  Free ERD file viewer 

- only Amateras runs without error in Eclipse 3.3(or 3.4) and JDK1.5 

 

Eclipse 3.3(3.4)버젼에서만 돌아가는 Amateras를 이클립스3.4에 설치하는 방법을 정리했습니다. 

 

https://hermeslog.tistory.com/183

 

[Plugin] Eclipse Plugin Amateras UML 설치하기

AmaterasUML은 UML Class Diagram과 UML Sequence Diagram을 그릴 수 있는 Eclipse plug-in입니다. http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi Amateras ERD와 UML 설치하기 위해서는 GEF 를 설..

hermeslog.tistory.com

//{{

위 링크를 보면 설치한 순서 

1. JDK 1.5 install 
jdk-1_5_0_22-windows-amd64.exe
https://web-obj.tistory.com/94

2. unzip  eclipse 3.4.2 (for Amateras ERD) 
eclipse-SDK-3.4.2-win32-x86_64.zip
- target folder: C:\
- add following line to  eclipse.ini file 
(add -vm path ) 
-vm
C:\Program Files\Java\jdk1.5.0_22\bin\javaw.exe



3. GEF  
- download and unzip
http://www.eclipse.org/gef/
GEF-ALL-3.7.2.zip
- copy features and plugins  folder to eclipse same folder 

4. Amateras UML 
- download and unzip 
http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi

출처: https://hermeslog.tistory.com/183 [헤르메스 LIFE]

- copy all .jar files to eclipse\plugins folder 

5. Amateras ERD 
- download and unzip 
http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi

출처: https://hermeslog.tistory.com/183 [헤르메스 LIFE]'

- copy net.java.amateras.db_1.0.8.jar  files to eclipse\plugins folder 

A.1 reference URL:

[Plugin] Eclipse Plugin Amateras UML 설치하기

출처: https://hermeslog.tistory.com/183 [헤르메스 LIFE]

A.2
http://amateras.osdn.jp/cgi-bin/fswiki_en/wiki.cgi?page=AmaterasERD

//}}

posted by cskimair
: