https://twitter.com/MittringMartin/status/912817354827907073
Visual studio :
#pragma optimize( "", off )
..code..
#pragma optimize( "", on )
GCC 44.4 and up:
https://news.ycombinator.com/item?id=4711571
#pragma GCC push_options
#pragma GCC optimize ("O0")
memset(a, 0, 3); // .. code ..
#pragma GCC pop_options
Monday, August 6, 2018
Thursday, July 26, 2018
c++ template 연습 몇가지.
#include <iostream>
#include <string>
#include <memory>
template<typename T>
void swap(T& a, T& b){
T tmp = a;
a = b;
b = tmp;
}
template<typename T>
void print(T a){
std::cout <<"print1 : " << a << std::endl;
}
template<typename T>
void print(T a, T b){
std::cout <<"print2 : " << a <<", " << b << std::endl;
}
template<typename... Args>
void prints(Args... args){
print(args...);
return;
}
class C{
public:
template<typename... Args>
static std::shared_ptr<C> create(Args&&... args){
return std::shared_ptr<C>(new C(args...));
}
private:
explicit C(const int& a, int& b){
printf("construct C(%d, %d)\n", a, b);
int tmp = a;
//a = b;
b = tmp;
}
};
int main()
{
int a = 10;
int b = 20;
prints(a); // variadic templates
prints(a,b);
printf("before swap : %d, %d\n", a, b);
swap(a,b); // == swap<int>(a,b)
printf("after swap : %d, %d\n", a, b);
std::shared_ptr<C> c1 = C::create(a, b);
printf("after construct : %d, %d\n", a, b);
return 1;
}
#include <string>
#include <memory>
template<typename T>
void swap(T& a, T& b){
T tmp = a;
a = b;
b = tmp;
}
template<typename T>
void print(T a){
std::cout <<"print1 : " << a << std::endl;
}
template<typename T>
void print(T a, T b){
std::cout <<"print2 : " << a <<", " << b << std::endl;
}
template<typename... Args>
void prints(Args... args){
print(args...);
return;
}
class C{
public:
template<typename... Args>
static std::shared_ptr<C> create(Args&&... args){
return std::shared_ptr<C>(new C(args...));
}
private:
explicit C(const int& a, int& b){
printf("construct C(%d, %d)\n", a, b);
int tmp = a;
//a = b;
b = tmp;
}
};
int main()
{
int a = 10;
int b = 20;
prints(a); // variadic templates
prints(a,b);
printf("before swap : %d, %d\n", a, b);
swap(a,b); // == swap<int>(a,b)
printf("after swap : %d, %d\n", a, b);
std::shared_ptr<C> c1 = C::create(a, b);
printf("after construct : %d, %d\n", a, b);
return 1;
}
Thursday, July 19, 2018
gdb tui 모드
GDB 강의
: https://www.youtube.com/watch?v=PorfLSr3DDI
ctrl+x, 1 : 소스코드만 표시
ctrl+x, 2 : 소스코드 + 어셈블리 표시
gdb -> tui 메뉴얼
https://sourceware.org/gdb/onlinedocs/gdb/TUI-Commands.html
gdb 어셈블 한줄씩 디버깅
https://stackoverflow.com/questions/2420813/using-gdb-to-single-step-assembly-code-outside-specified-executable-causes-error
: https://www.youtube.com/watch?v=PorfLSr3DDI
ctrl+x, 1 : 소스코드만 표시
ctrl+x, 2 : 소스코드 + 어셈블리 표시
gdb -> tui 메뉴얼
https://sourceware.org/gdb/onlinedocs/gdb/TUI-Commands.html
gdb 어셈블 한줄씩 디버깅
https://stackoverflow.com/questions/2420813/using-gdb-to-single-step-assembly-code-outside-specified-executable-causes-error
Thursday, July 12, 2018
유튜브 방송
https://obsproject.com/
for ubuntu 16.0.4
for ubuntu 16.0.4
sudo add-apt-repository ppa:obsproject/obs-studio
sudo apt-get update
sudo apt-get install obs-studio
Friday, June 22, 2018
리눅스에서 문서화
리눅스에서 코드 문서화 작업하려는데, Playonlinux로 office2016 설치 시도하다가 포기하고 만든 차선책.
1) 온라인 파워포인트
https://office.live.com/start/PowerPoint.aspx
윈도우 버전처럼 그림의 배경색제거, 3D 회전같은 기능은 지원안됨.
2) https://pixlr.com/editor/
위 단점들 보완을 위해 사용.
create new iamge - transparent 투명 배경 선택
ㄴ 파워포인트에서 다른 이미지와 조합을 고려함.
새 layout 생성
컴퓨터에서 이미지 파일 열기 - wand(W) 또는 lasso (L) 툴로 오려내기
* wand 비활성화 : Marquee(Q) == 사각형 잘라내기 선택후 레이아웃 아무 자리 클릭.
배경제거 복사 붙여넣기. etc..
edit - free transform - 꼭지점 크기조정 / 꼭지점에서 offset 10 ~ 30? 픽셀 위치에서 rotation
edit - free distortion - 꼭지점 위치 옮겨서 3D 회전 연출.
1) 온라인 파워포인트
https://office.live.com/start/PowerPoint.aspx
윈도우 버전처럼 그림의 배경색제거, 3D 회전같은 기능은 지원안됨.
2) https://pixlr.com/editor/
위 단점들 보완을 위해 사용.
create new iamge - transparent 투명 배경 선택
ㄴ 파워포인트에서 다른 이미지와 조합을 고려함.
새 layout 생성
컴퓨터에서 이미지 파일 열기 - wand(W) 또는 lasso (L) 툴로 오려내기
* wand 비활성화 : Marquee(Q) == 사각형 잘라내기 선택후 레이아웃 아무 자리 클릭.
배경제거 복사 붙여넣기. etc..
edit - free transform - 꼭지점 크기조정 / 꼭지점에서 offset 10 ~ 30? 픽셀 위치에서 rotation
edit - free distortion - 꼭지점 위치 옮겨서 3D 회전 연출.
Tuesday, May 15, 2018
steam / ubuntu
playonlinux 설치
* apt-get install은 구버전
* 홈페이지에서 최신 deb 파일 설치
playonlinux 실행해서,
tools - manage wine versions - 2.22-staging
* apt install wine 대신 이걸로 설치.
카카오톡
Configure 아이콘 - new - 32bit windows
- 2.22-staging - kakao (virtual drive 이름 지정)
virtual drive 선택 - install components 탭 -
(gdiplus /riched20 / riched30 / wmp9 )
다운로드중 에러발생시 될때가지 retry
Wine 탭 - wine configure - window 7 이상
AOE2 HD
install - aoe2hd - 스팀설치까지
Wine 탭 - wine configure - window xp
General 탭 - Arguments : -no-cef-sandbox
이상 steam black screen 버그 해결
드라이브 열어서, AoK HD.exe -> Launcher.exe
* apt-get install은 구버전
* 홈페이지에서 최신 deb 파일 설치
playonlinux 실행해서,
tools - manage wine versions - 2.22-staging
* apt install wine 대신 이걸로 설치.
카카오톡
Configure 아이콘 - new - 32bit windows
- 2.22-staging - kakao (virtual drive 이름 지정)
virtual drive 선택 - install components 탭 -
(
다운로드중 에러발생시 될때가지 retry
Wine 탭 - wine configure - window 7 이상
AOE2 HD
install - aoe2hd - 스팀설치까지
Wine 탭 - wine configure - window xp
General 탭 - Arguments : -no-cef-sandbox
이상 steam black screen 버그 해결
그다음 게임 다운로드 버그는
$cd ~
$vim .PlayOnLinux/wineprefix/AOE2HD/drive_c/Program\ Files/Steam/config/config.vdf
cip, cm 항목 밑에
"CS" "valve511.steamcontent.com;valve501.steamcontent.com;valve517.steamcontent.com;valve557.steamcontent.com;valve513.steamcontent.com;valve535.steamcontent.com;valve546.steamcontent.com;valve538.steamcontent.com;valve536.steamcontent.com;valve530.steamcontent.com;valve559.steamcontent.com;valve545.steamcontent.com;valve518.steamcontent.com;valve548.steamcontent.com;valve555.steamcontent.com;valve556.steamcontent.com;valve506.steamcontent.com;valve544.steamcontent.com;valve525.steamcontent.com;valve567.steamcontent.com;valve521.steamcontent.com;valve510.steamcontent.com;valve542.steamcontent.com;valve519.steamcontent.com;valve526.steamcontent.com;valve504.steamcontent.com;valve500.steamcontent.com;valve554.steamcontent.com;valve562.steamcontent.com;valve524.steamcontent.com;valve502.steamcontent.com;valve505.steamcontent.com;valve547.steamcontent.com;valve560.steamcontent.com;valve503.steamcontent.com;valve507.steamcontent.com;valve553.steamcontent.com;valve520.steamcontent.com;valve550.steamcontent.com;valve531.steamcontent.com;valve558.steamcontent.com;valve552.steamcontent.com;valve563.steamcontent.com;valve540.steamcontent.com;valve541.steamcontent.com;valve537.steamcontent.com;valve528.steamcontent.com;valve523.steamcontent.com;valve512.steamcontent.com;valve532.steamcontent.com;valve561.steamcontent.com;valve549.steamcontent.com;valve522.steamcontent.com;valve514.steamcontent.com;valve551.steamcontent.com;valve564.steamcontent.com;valve543.steamcontent.com;valve565.steamcontent.com;valve529.steamcontent.com;valve539.steamcontent.com;valve566.steamcontent.com;valve165.steamcontent.com;valve959.steamcontent.com;valve164.steamcontent.com;valve1611.steamcontent.com;valve1601.steamcontent.com;valve1617.steamcontent.com;valve1603.steamcontent.com;valve1602.steamcontent.com;valve1610.steamcontent.com;valve1615.steamcontent.com;valve909.steamcontent.com;valve900.steamcontent.com;valve905.steamcontent.com;valve954.steamcontent.com;valve955.steamcontent.com;valve1612.steamcontent.com;valve1607.steamcontent.com;valve1608.steamcontent.com;valve1618.steamcontent.com;valve1619.steamcontent.com;valve1606.steamcontent.com;valve1605.steamcontent.com;valve1609.steamcontent.com;valve907.steamcontent.com;valve901.steamcontent.com;valve902.steamcontent.com;valve1604.steamcontent.com;valve908.steamcontent.com;valve950.steamcontent.com;valve957.steamcontent.com;valve903.steamcontent.com;valve1614.steamcontent.com;valve904.steamcontent.com;valve952.steamcontent.com;valve1616.steamcontent.com;valve1613.steamcontent.com;valve958.steamcontent.com;valve956.steamcontent.com;valve906.steamcontent.com"
추가 후, steam 재실행
드라이브 열어서, AoK HD.exe -> Launcher.exe
Tuesday, April 10, 2018
코딩/네이밍 컨벤션 툴
내 경우 c++은 구글 스타일 가이드, python은 pep8을 따르려고 한다.
다만, 주로 작업하는 언어가 boost python을 이용한 python + c++ 혼합이라 naming convention이 서로 충돌하기 때문에 c++, python 모두 naming convention은 pep8-naming convention으로 통일.
* Python을 쓰기 전에는 함수는 lower camelCase, 클래스는 upper CamelCase를 사용했는데, 생각해보니 opencv naming convention 영향을 많이 받은듯.
아래는 컨벤션 체크에 사용하려고 알아본 프로그램.
# c++
1-1 cpplint
https://github.com/cpplint/cpplint
* 구글 스타일 체크.
* 단점 : 네이밍 컨벤션 체크는 지원안함.
1-2 cncc
* https://github.com/mapbox/cncc
* 굉장히 단순한 파이썬 코드+정규식 정의로 c++ 네이밍 컨벤션을 체크해줌.
* 정규식으로 style파일을 만들어 프로젝트에서 약속한 네이밍 컨벤션을 지정할 수 있음.
* cpplint를 보완해서 쓰면 좋음.
# python
2-1 flake8
* http://flake8.pycqa.org/en/latest/index.html#quickstart
* 코딩 컨벤션 / 네이밍 컨벤션 모두 체크해줌.
다만, 주로 작업하는 언어가 boost python을 이용한 python + c++ 혼합이라 naming convention이 서로 충돌하기 때문에 c++, python 모두 naming convention은 pep8-naming convention으로 통일.
* Python을 쓰기 전에는 함수는 lower camelCase, 클래스는 upper CamelCase를 사용했는데, 생각해보니 opencv naming convention 영향을 많이 받은듯.
아래는 컨벤션 체크에 사용하려고 알아본 프로그램.
# c++
1-1 cpplint
https://github.com/cpplint/cpplint
* 구글 스타일 체크.
* 단점 : 네이밍 컨벤션 체크는 지원안함.
1-2 cncc
* https://github.com/mapbox/cncc
* 굉장히 단순한 파이썬 코드+정규식 정의로 c++ 네이밍 컨벤션을 체크해줌.
* 정규식으로 style파일을 만들어 프로젝트에서 약속한 네이밍 컨벤션을 지정할 수 있음.
* cpplint를 보완해서 쓰면 좋음.
# python
2-1 flake8
* http://flake8.pycqa.org/en/latest/index.html#quickstart
* 코딩 컨벤션 / 네이밍 컨벤션 모두 체크해줌.
Subscribe to:
Posts (Atom)
