카테고리 없음2025. 5. 16. 09:46

* 프로세스 강제 종료
PS> stop-process (get-process [process_name]) -Force
예)
PS> stop-process (get-process MyApp) -Force

* GUID 생성
PS> [System.Guid]::NewGuid()

* Unzip (압축파일 풀기)
PS> Expand-Archive [zip file] -DestinationPath [unzip path]
예)
PS> Expand-Archive .\mydata.zip -DestinationPath .\mydata

* 파일 정보 보기
예)
PS> (gi .\MyApp.exe).VersionInfo | Format-List *
PS> (Get-Item .\MyApp.exe).VersionInfo | Format-List *
PS> (dir .\MyApp.exe).VersionInfo | Format-List *

* 파일을 Hex 값으로 조회
예)
PS> Format-Hex -Path "C:\example\file.txt"

Posted by 좋은나무
카테고리 없음2018. 2. 5. 10:05

[VIM 에러 메세지]

E575: viminfo: 줄에 이상한 시작 글자: ...

[Windows]

탐색기에서 %USERPROFILE% 경로의 _viminfo 파일 삭제 후 vim 재시작

예) C:\Users\myAccount\_viminfo

[Linux]

home 경로의 .viminfo 파일 삭제 후 vim 재시작

예) rm ~/.viminfo
Posted by 좋은나무
카테고리 없음2017. 8. 17. 17:24

size_t 타입

32bit : unsigned int

64bit : unsigned long long


Posted by 좋은나무
카테고리 없음2017. 3. 22. 13:51

Visual Studio 의 메모리 릭 탐지 예

Detected memory leaks!

Dumping objects ->

{810} normal block at 0x0057C3F0, 8 bytes long.

 Data: <        > CD CD CD CD CD CD CD CD 


개발하는 Application 의 Initialize 위치에 다음 코드 추가

_CrtSetBreakAlloc(810); 


참조CRT 라이브러리를 사용하여 메모리 누수 찾기 (MSDN)

Posted by 좋은나무
카테고리 없음2016. 12. 14. 14:39

time_t time(  
   time_t *timer   
);  

시스템 시간을 Unix time 으로 반환 (time_t)


struct tm *localtime(  
   const time_t *timer
); 

Unix time (time_t) 을 년월일 시분초 형식의 구조체 (struct tm) 으로 변환.
이 때 Local time 으로 변환함.


struct tm *gmtime(    
 const time_t *timer   
); 

Unix time (time_t) 을 년월일 시분초 형식의 구조체(struct tm) 으로 변환.
이 때 UTC (=GMT) 으로 변환함.


time_t mktime(
  
   struct tm *timeptr   
);  

년월일 시분초 형식의 구조체(struct tm)를 Unix time (time_t) 으로 변환함.
이 때 struct tm의 값은 Local time 으로 간주함.


Unix time ( = POSIX time, Epoch time)

1970년 1월 1일 00:00:00 협정 세계시(UTC) 부터의 경과 시간을 초로 환산하여 정수로 나타낸 것



Posted by 좋은나무
카테고리 없음2016. 12. 14. 11:52

localtime 과 gmtime 함수는 모두 struct tm * 를 반환하는데,

이 때 각 함수 호출 시 서로 반환된 struct tm * 의 값을 변경하므로 주의 해야 한다.

예) 

[테스트 코드]

time_t local_time;
time ( &local_time );

struct tm *local_tm = localtime(&local_time);

// local_tm: 2016-12-14 11:33:8

struct tm *utc_tm = gmtime(&local_time); 

// utc_tm: 2016-12-14 2:33:8
// local_tm: 2016-12-14 2:33:8 // 내부적으로 같은 정보를 가르키고 있어서, 값이 함께 바뀜

DebugLog("local_tm: %d-%d-%d %d:%d:%d\n", 
local_tm->tm_year + 1900, 
local_tm->tm_mon +1, 
local_tm->tm_mday, 
local_tm->tm_hour, 
local_tm->tm_min, 
local_tm->tm_sec);

DebugLog("utc_tm: %d-%d-%d %d:%d:%d\n",
utc_tm->tm_year + 1900,
utc_tm->tm_mon +1,
utc_tm->tm_mday,
utc_tm->tm_hour,
utc_tm->tm_min,
utc_tm->tm_sec);


[결과]

local_tm: 2016-12-14 2:33:8
utc_tm: 2016-12-14 2:33:8


Posted by 좋은나무
카테고리 없음2016. 12. 13. 18:36

// Local 시각

time_t rawtime;

time ( &rawtime );


COleDateTime localTime(rawtime);

printf("local time : %s(%lld)", localTime.Format(), rawtime);


// Local 시각 --> GMT

struct tm *gtm = gmtime(&rawtime);

time_t gt = mktime(gtm);


COleDateTime gmtTime(gt);

printf("gmt time : %s(%lld)", gmtTime(.Format(), gt);



// 결과 (예)

local time : 2016-12-13 오후 6:36:48(1481621808)

gmt time : 2016-12-13 오전 9:36:48(1481589408)


* 참고 : Epoch & Unix Timestamp Conversion Tools

Posted by 좋은나무
카테고리 없음2016. 9. 21. 15:17

1) 

(HEX) FF FF FF 7F 

(INT)  2147483647

(UINT) 2147483647


2) 

(HEX) FF FF FF FF 

(INT)  -1

(UINT) 4294967295


2) 

(HEX) FE FF FF FF 

(INT)  -2

(UINT) 4294967294


[참고]

(MS Windows 기준) MAX 정의 (limits.h)

#define INT_MAX       2147483647    /* maximum (signed) int value */ 

#define LONG_MAX      2147483647L   /* maximum (signed) long value */

#define LLONG_MAX     9223372036854775807i64       /* maximum signed long long int value */

Posted by 좋은나무
카테고리 없음2016. 9. 21. 15:13


C:\> C:\Program Files\Oralce\VirtualBox\VBoxManage list vms


"OSX El Capitan" {31f0e8c6-48b9-4d3a-a533-64cc41a920cd}



C:\> C:\Program Files\Oralce\VirtualBox\VBoxManage setextradata "OSX El Capitan" VBoxInternal2/EfiGopMode 3


Posted by 좋은나무
카테고리 없음2016. 9. 21. 15:06

[예]


struct special_compare : public std::unary_function<std::string, bool> {

explicit special_compare (const std::string& argPattern) : pattern(argPattern){}

bool operator() (const std::string& arg) {

return compare_func(arg, pattern); 

}

std::string pattern;

bool compare_func(const std::string& arg, const std::string& argPattern) {

return ( std::string::npos == argPattern.find(arg) ) ? false : true;

}

};


std::vector<std::string>::iterator itr;

itr = std::find_if(keywordList.begin(), keywordList.end(), special_compare("pattern_sample"));



[참조]

C++ std::find with a custom comparator

find_if on vector and compare member variables

Using find_if on a vector of object

Posted by 좋은나무