냉무
분류 전체보기
- Server date: 2025.03.04 2025.03.04
- Git Repository 복사하기 2021.06.21
- Multipurpose Server Address: 192.168.0.42 2020.02.10
- Assemble 2019.09.10
- Action Key Server Address: 218.157.166.166 2019.07.16
- 커스텀 타이머 CShsTimer 2017.06.16
- svn에서 관리 안 하는 확장자지만 커밋이 필요한 파일들 2015.03.16
- cocos2d-x v3.4 개발 환경 구축하기 (for windows) #1 2015.03.05
- 원룸 얻을 때 고려사항 2015.02.24
- 랭킹 테이블 만들기 2014.12.18
Server date: 2025.03.04
Git Repository 복사하기
프로젝트 작업을 하다가 새로운 repository로 옮기고 싶을 때가 있다. 이럴 때 파일을 옮기게 되면 이제까지 작성한 커밋 이력들이 남지 않기 때문에 다른 방법을 써야 한다.
1. mirror 옵션을 이용한 clone
git clone --mirror { git repository 주소 } // 만약 특정 브랜치만 가져온다면 git clone -b { 브랜치명 } --single-branch --mirror { git repository 주소 }
2. repository명.git 을 .git으로 이름 변경
// clone을 정상적으로 완료했다면 repository명.git 파일이 생성되어 있을 것이다 // 아래의 명령어를 통해 이름을 .git으로 변경 mv repository명.git .git
3. 새로운 repository와 연결
// .git으로 변경한 디렉토리에서 아래 명령을 실행 git remote set-url origin { 새로운 repository 주소 }
4. 새 repository에 push
// .git으로 변경한 디렉토리에서 아래 명령을 실행 // 아래의 명령을 실행하게 되면 새로운 repository로 push 된다. git push --mirror
출처: https://velog.io/@hoo00nn/Git-Repository-%EB%B3%B5%EC%82%AC%ED%95%98%EA%B8%B0
Multipurpose Server Address: 192.168.0.42
냉무
Assemble
int Plus(int a, int b)
{
return a + b;
}
_declspec(naked) int PlusAsm(int a, int b)
{
__asm
{
mov ebx, dword ptr ss:[esp+8]
mov edx, dword ptr ss:[esp+4]
add edx, ebx
mov eax, edx
retn
}
}
int _tmain(int argc, _TCHAR* argv[])
{
for(int nCnt = 0; nCnt < 2; ++nCnt)
{
{
g_Timer.StartFrequency(1);
int nResult = 0;
for(int i = 0; i < 1000000000; ++i)
{
nResult += Plus(1,2);
}
g_Timer.EndFrequency(1);
__int64 n64Time = g_Timer.GetTime(1);
printf( "Normal nResult:%d, Time:%I64d\n\n", nResult, n64Time );
}
{
{
g_Timer.StartFrequency(1);
int nResult = 0;
for(int i = 0; i < 1000000000; ++i)
{
nResult += PlusAsm(1,2);
}
g_Timer.EndFrequency(1);
__int64 n64Time = g_Timer.GetTime(1);
printf( "Assemble nResult:%d, Time:%I64d\n\n", nResult, n64Time );
}
}
}
return 0;
}
Action Key Server Address: 218.157.166.166
내용 무
커스텀 타이머 CShsTimer
ShsTimer.h
#define g_Timer CShsTimer::GetInstance()
/*
#include "ShsTimer.h" //1. 헤더 선언
void main()
{
g_Timer.StartFrequency(1); //2. 시작점 정하기
Sleep(1000);
g_Timer.EndFrequency(1); //3. 종료점 정하기
__int64 n64Time = g_Timer.GetTime(1); //4. 시간 값 리턴 받기
TRACE( "%I64d\n", n64Time ); //5. 결과 값은 1000이 출력 됨
}
※ Sleep(1000); 대신 수행 시간을 알고싶은 코드를 넣으면 됩니다.
void main()
{
g_Timer.Start(3000, 1); // 3초 후 CheckFired에서 true를 리턴하도록 세팅합니다.
for(;;)
{
if( g_Timer.CheckFired(1) ) // 3초 후 true를 리턴합니다.
{
TRACE( "return" );
return;
}
}
}
void main()
{
for(;;)
{
if( g_Timer.SleepEx(1000, 1) ) // 1초 마다 "1"을 출력합니다. Sleep과 동일
{
TRACE( "1" );
}
}
}
※ 주의
- 인덱스 인자를 줄 때 한 묶음 이외에는 사용해서는 안됩니다. SetTimer의 EventID와 동일한 개념입니다.
*/
struct tFrequencyInfo
{
tFrequencyInfo():m_n64SetTime(0)
{
}
LARGE_INTEGER m_start;
LARGE_INTEGER m_end;
__int64 m_n64SetTime;
};
class CShsTimer
{
private:
CShsTimer();
LARGE_INTEGER m_f;
bool m_bCanNotBeUsed; // true면 현재 컴퓨터에서는 사용 불가
map<int, tFrequencyInfo> m_mapFrequencyInfo;
public:
static CShsTimer& GetInstance();
void StartFrequency( int _nIndex ); // 시간을 측정 할 시작 점 지정
void EndFrequency( int _nIndex ); // 시간을 측정 할 종료 점 지정
__int64 GetTime( int _nIndex ); // Start과 End을 지정 후 걸린 시간을 ms단위로 리턴
void Start(__int64 _n64SetTime, int _nIndex ); // 얼마간의 시간을 흐른뒤에 CheckFired 에서 true를 리턴 할지 설정 해줌 ms단위(1000 == 1초)
bool CheckFired( int _nIndex ); // Start으로 세팅 한 시간이 흐를 때 까지 false를 리턴하다가, 세팅한 시간이 되면 true를 계속 리턴
bool SleepEx(__int64 _n64SetTime, int _nIndex); // Sleep()과 동일 한데 false를 리턴하고, 시간 흐르면 true 리턴
// _n64SetTime 세팅 한 시간이 흐르기 전에는 false 리턴, _n64SetTime만큼 시간이 흐르면 딱 한번 true 리턴하고, 처음과 똑같이 반복
};
ShsTimer.cpp
nclude "stdafx.h"
#include "ShsTimer.h"
CShsTimer& CShsTimer::GetInstance()
{
static CShsTimer Instance;
return Instance;
}
CShsTimer::CShsTimer()
{
// 고해상도 타이머의 주파수를 얻는다.
QueryPerformanceFrequency(&m_f);
if( 0 == m_f.QuadPart )
m_bCanNotBeUsed = true;
else
m_bCanNotBeUsed = false;
}
void CShsTimer::StartFrequency( int _nIndex )
{
if( m_bCanNotBeUsed )
return;
// 시작 시점의 CPU 클럭수를 얻는다.
QueryPerformanceCounter(&m_mapFrequencyInfo[_nIndex].m_start);
}
void CShsTimer::EndFrequency( int _nIndex )
{
if( m_bCanNotBeUsed )
return;
// 끝 시점의 클럭수를 얻는다.
QueryPerformanceCounter(&m_mapFrequencyInfo[_nIndex].m_end);
}
__int64 CShsTimer::GetTime( int _nIndex )
{
if( m_bCanNotBeUsed )
return 0;
// 끝 시점의 CPU 클럭수에서 시작 시점의 클럭수를 뺀 후 주파수를 1000으로 나눈 값을 나눈다.
// 1초 기준의 주파수를 1000 으로 나누었기 때문에 1밀리초 동안 발생하는 진동수로 나눈 셈이다.
__int64 ms_interval = (m_mapFrequencyInfo[_nIndex].m_end.QuadPart - m_mapFrequencyInfo[_nIndex].m_start.QuadPart)/(m_f.QuadPart/1000);
return ms_interval;
}
void CShsTimer::Start( __int64 _n64SetTime, int _nIndex )
{
if( m_bCanNotBeUsed )
return;
m_mapFrequencyInfo[_nIndex].m_n64SetTime = _n64SetTime;
StartFrequency(_nIndex);
}
bool CShsTimer::CheckFired( int _nIndex )
{
if( m_bCanNotBeUsed )
return false;
EndFrequency(_nIndex);
if ( GetTime(_nIndex) > m_mapFrequencyInfo[_nIndex].m_n64SetTime )
return true;
return false;
}
bool CShsTimer::SleepEx( __int64 _n64SetTime, int _nIndex )
{
if( m_bCanNotBeUsed )
return false;
if( 0 == m_mapFrequencyInfo[_nIndex].m_n64SetTime )
{
Start(_n64SetTime, _nIndex);
return false;
}
if( CheckFired(_nIndex) )
{
StartFrequency(_nIndex);
return true;
}
return false;
}
svn에서 관리 안 하는 확장자지만 커밋이 필요한 파일들
svn 에서 취급 안하는 확장자
*.a
*.so
*.pyc
*.o
*.DS_Store
*.pyo
cocos2d-x v3.4 개발 환경 구축하기 (for windows) #1
1. 준비 단계
2. cocos2d-x v3.4 설치
D:\cocos2d 폴더에 압축 해제
D:\cocos2d\build\cocos2d-win32.vc2012.sln 실행 시키면 테스트 프로젝트를 빌드 해 볼 수 있다.
3. python 설치
cocos.py new dual -p com.obs.project -l cpp -d d:\cocos2d\project
해당 폴더를 열어보면 새로운 프로젝트가 생성되어 있다.
열어서 빌드하면~ 다음과 같은 화면이 나온다. 빌드 할 때 "2. cocos2d-x v3.4 설치" 2번 째 스샷 참고
4. 안드로이드 NDK 설치
원룸 얻을 때 고려사항
층, 침대, 세면대, 씽크대, 화장실, 세탁기, 관리비, 보증금, 월세, 베란다, 에어콘, 수압, 계약년수
랭킹 테이블 만들기
데브피아 SQL Server 에서 퍼왔어요.
http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=38&MAEULNo=16&no=37711&ref=37699
|