[윈도우10] IP 자동변경하는 배치 스크립트
Posted on 2020. 12. 17. 15:40
Filed Under 잡다구리/COM사용기
PC하나로 2가지 망을 사용하려니 바꿀때마다 설정하기가 번거로워서 만들었음.
랜선 바꿔끼고 스크립트 실행하니 좀 편함.
@echo off
@REM 만든날짜: 2020.06.15 (윈도우10기반)
@REM Updated: 2020.12.17
@REM 필요없는 부분은 앞에 REM 을 붙여서 주석처리하면됩니다.
@REM 네트워크명 찾기:>netsh interface ipv4 show interface
@REM 2 35 1500 connected 이더넷
@REM IP/Gateway/DNS/MAC수정 - 2020.06.15 (윈도우10기반)
@REM 아래 설정값을 내 정보로 수정해서 사용하세요!
@REM 아래 설정값중 [_REG_PATH_] 레지스트리 끝 주소는 레지스트리편집기 열어서 확인하고 수정할것 [001이 아닐 수 있음]
SET _NETWORK_NAME_=이더넷
SET _IP_=■■■.■■■.■■■.■■■
SET _GATEWAY_=■■■.■■■.■■■.■■■
SET _NETMASK_=255.255.255.0
SET _DNS1_=■■■.■■■.■■■.■■■
SET _DNS2_=■■■.■■■.■■■.■■■
SET _REG_PATH_=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001
SET _MAC_=①②③④①②③④①②③④
@REM ▼ 처리순서 요약
@REM 1) IP/GATEWAY/MASK 설정
@REM 2) DNS 설정
@REM 3) MAC주소 변경하기
@REM 4) 네트워크 연결=사용안함.
@REM 5) 3초 대기
@REM 6) 네트워크 연결=사용함.
netsh -c int ip set address name=%_NETWORK_NAME_% source=static address=%_IP_% mask=%_NETMASK_% gateway=%_GATEWAY_%
@REM echo # DNS를 설정합니다.
@REM netsh -c int ip set dnsservers %_NETWORK_NAME_% static %_DNS1_% primary
@REM netsh -c int ip set dnsservers %_NETWORK_NAME_% static %_DNS2_% secondary
reg add %_REG_PATH_% /v NetworkAddress /d %_MAC_% /f
echo # 네트워크연결 [%_NETWORK_NAME_%]을 재시작합니다.
netsh -c int set interface name=%_NETWORK_NAME_% admin=disabled
timeout /t 2
netsh -c int set interface name=%_NETWORK_NAME_% admin=enabled
echo # 설정완료
파일읽어서 String 얻기(File,InputStreamReader,BufferedReader)
Posted on 2020. 11. 25. 18:02
Filed Under Programming/Java
//파일읽어서 String 얻기
public String getZoneFileToString(String filePath)
{
if (filePath == null || "".equals(filePath)) {
System.out.println("파일경로 입력바람 오바!!");
// throw new AssertionError();
return null;
}
StringBuffer strBuffer = new StringBuffer();
InputStreamReader inputStReader = null;
BufferedReader reader = null;
String line = null;
File file = new File(filePath);
if(!file.exists()){
System.out.println("해당 파일경로의 파일이 없음!!");
return null;
}
try {
inputStReader = new InputStreamReader(new FileInputStream(file), "euc-kr");
reader = new BufferedReader(inputStReader);
while (true) {
line = reader.readLine();
if (line == null) {
break;
}
strBuffer.append(line);
strBuffer.append("\n");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (reader != null) reader.close();
if (inputStReader != null) inputStReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return strBuffer.toString();
}
[Eclipse] 잦은 Permgen space 에러 때문에 괴로울때 조치
Posted on 2020. 11. 19. 10:49
Filed Under Web Programming/개발환경
잦은 PermGen space 에러...
보통은 Tomcat Server 재시작하여 처리하였는데..
이클립스 메뉴: Windows > Preferences - Java > Installed JREs
오른쪽 Installed JREs중 사용중인 녀석을 선택하고 [Edit]버튼 클릭 ▼
//Default VM arguments에 메모리 설정 입력:
-vmargs-Xms40m -Xmx256m -XX:MaxPermSize=512m
■정보출처: https://flatsun.tistory.com/569
2020.11.19 ADD,
추가후 아래 오류가 가끔 발생하는듯하다.
좀더 모니터링후 처리예정.
[Eclipse] 실행시 html 한글 깨짐현상
Posted on 2020. 11. 10. 14:28
Filed Under Web Programming/개발환경
▼ 현상
select list에서 한글이 깨져보임.
▼ 추적
- 서버단은 문제 없어보임
- *.js 파일도 utf-8로 인코딩 되어 있음 ☞ [전체]
▼ 처리
eclipse - Windows - Preferences : General > workspace - Text file encoding 이 MS949 기본값으로 되어 있었음.
utf-8로 변경 후 tomcat 재시작!
그래도 그대로일 경우 웹페이지 리로드 (Ctrl+새로고침)이 필요할 수도 있음.
▼ 추가정보
메뉴: Window - Preferences - General > Content Types 에서 JSP,HTML 파일 종류별 기본 인코딩 설정가능!
General > Workspace > Text file encoding을 UTF-8으로 바꿉니다.
General > Content Type
├ Java Class File : Default encoding에 UTF-8 입력후 Update 클릭
├ Text > JSP : 위와 동일
└ Web > CSS Files, HTML Files, JSP Files 모두 : UTF-8
[VS] 빌드후 이벤트 스크립트 샘플
Posted on 2020. 9. 14. 10:22
Filed Under C#
//빌드후에 DLL 자동 복사하기
copy /Y $(SolutionDir)..\_ExeCommon\_$(ConfigurationName)\ServerCommonClass.dll $(TargetDir)
copy /Y $(SolutionDir)..\_ExeCommon\_$(ConfigurationName)\CommonClass.dll $(TargetDir)