2021년 6월 11일 금요일

[Visual Studio] 구글테스트 Inherited Additional Dependencies 변경

구글테스트에 Configuration을 추가하는 경우 정상적인 빌드가 되지 않는 문제 발생
상황: Test 명칭으로 Configuration을 새로 추가하였음
원인: 다음그림과 같이 Inherited values에 debug용이 아닌 release로 연결됨.


해결방법:
1. 다음 비쥬얼 스튜디오 솔루션 폴더를 들어간다.
<개인경로>\packages\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3\build\native
2. Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.targets 파일을 편집기로 연다.
3. Test명칭의 Configuration을 이용할 것이므로 Debug를 모두 Test로 바꿔준다.
(그림외에 추가로 더있음, 또는 필요에 따라 문법에 맞게 수정)


4. 다음경로안에 Debug, Release 폴더가있음. Debug폴더 이름을 Test로 변경 64비트 컴파일 사용시 x64폴더도 수정한다.
<개인경로>\packages\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.3\lib\native\v140\windesktop\msvcstl\static\rt-dyn\x86

2021년 5월 25일 화요일

Eigen 라이브러리 - 매트릭스 합치기

방법

1. rows와 cols를 이용하여 matrixXd와 같은 자료형을 가진 변수를 생성 
2. 그냥 대입.

코드예시

#include "Eigen/Dense"
#include <iostream>
 
using namespace Eigen;
using namespace std;
 
int32_t main()
{
        // Matrix 생성
        MatrixXd A(2, 3);
        MatrixXd B(3, 3);
 
        // A 대입
        A << 1, 2, 3,
               3, 4, 5;
        B = MatrixXd::Ones(3, 3);
 
        MatrixXd C(A.rows() + B.rows(), A.cols());
        C << A, B;
 
        cout << C << endl;
 
        return 0;
}

결과


실행하여 위와 같은 결과를 얻을 수 있습니다.

MatrixXd C(A.rows() + B.rows(), A.cols());  // Eigen 라이브러리 명령
C << A, B;

C = [A; B]; @ Matlab 명령

2021년 5월 24일 월요일

Eigen 라이브러리 - submatrix 선택방법

 block<m,n>(i,j) 또는 block(m,n,i,j)를 이용합니다.

        // Matrix 생성
        MatrixXd B(3, 3);
 
        // A 대입
        A << 1, 2,
               3, 4;
       
        B = MatrixXd::Zero(3, 3); // B 초기화
        B.block<2, 2>(0, 0) = A; // submatrix 대입
 
        cout << B << endl; // B 출력
        MatrixXd A(2, 2);


콘솔 출력

실행하여 위와 같은 결과를 얻을 수 있습니다.
주의사항은 matlab과 달리 row, column의 인덱스가 0부터 시작합니다.


B.block<2, 2>(0, 0) = A;  // Eigen 라이브러리 명령

B(1:2,1:2) = A; @ Matlab 명령

2020년 10월 21일 수요일

visual studio에서 아두이노 ino 확장자 파일 색상 및 스타일 c++처럼 보이게 하는 방법

 

(visual studio 2019)

 [Tools] - [options] - [Text Editor] - [File Extension]

: Extension에 'ino' 입력후 Editor를 Microsoft Visual C++로 선택후 Add


2020년 9월 20일 일요일

우분투(ubuntu) 인터넷 스트리밍 동영상 검은화면 재생 불가

사용환경: ubuntu 20.04, firefox

증상: 우분투 초기 설치 후 인터넷 스트리밍 동영상 재생 안됨

검은화면과 함께 다음과 같은 문구들이 떠있음.

저같은 경우 유튜브는 원활히 재생이 가능하였으나, 네이버 동영상은 재생되지 않았습니다.

  • no compatible source was found for this media
  • no video with supported format and mime type found
다른 오류 문구들을 확인하신 분들은 댓글로 달아주세요

원인: 
이는 HTML5 영상 코덱이 기본으로 설치되지 않기 때문에 발생하는 문제라고 합니다.

해결방안:
다음과 같은 코덱 패키지를 설치 해주시면 됩니다.

sudo apt install libavcodec-extra


참고: 
  1.  https://askubuntu.com/questions/475351/firefox-html5-video-support


2019년 8월 24일 토요일

Matlab 글꼴 변경시 글꼴 목록에 안나타 나는 경우

  matlab 기본 글꼴인 monospaced는 I, L의 구분이 불편하고 0, o구분이 불편한 경우가 있습니다. 가독성 향상을 위해 네이버에서 제공하는 D2 coding이나, 나눔코딩글꼴을 설치하면 가독성을 향상 시킬 수 있습니다.


https://developers.naver.com/opensource/tools/editor/
https://github.com/naver/d2codingfont

  위의 사이트를 이용하여 글꼴을 다운로드 할 수 있습니다.
이 때 글꼴을 추가할 때 윈도우10의 경우 글꼴파일을 모든 사용자가 이용가능 으로 추가해주셔야 MATLAB글꼴목록에 정상적으로 나타나게 됩니다.


  MATLAB에서의 설정은 위의 그림과 같이 [홈] - [기본 설정] - [글꼴] - [D2Coding] - [확인] 을 눌러주시면 됩니다.

  D2coding과 D2coding ligature의 차이는 !=, <=등의 글자를 하나로 모아써주는 기능이나 matlab에서는 지원되지 않으며 필요도 없습니다..

2019년 5월 24일 금요일

matlab pointer doesn't help speed up

function main()
t = 0:0.03:100;
t_size = length(t);
data_y = randn(1,t_size);
p_t = libpointer('doublePtr',t);
p_data_y = libpointer('doublePtr',data_y);
tic
disp(p_data_y.Value(1));
disp(data_y(1));
toc

tic
changePtrValue(p_data_y);
disp(p_data_y.Value(1));
toc

tic
data_y1 = changeValue(data_y);
disp(data_y1(1));
toc

clear p_t
clear p_data_y
end

function changePtrValue(p_data)
p_data.Value(1) = 1;
for i = 1:numel(p_data.Value)
p_data.Value(i) = p_data.Value(i)+1;
end
end

function data_out = changeValue(data_in)
data_out = data_in;
data_out(1) = 2;
for i = 1:numel(data_out)
data_out(i) = data_out(i)+1;
end
end
---------------------------------------------------------------------------------------------------
result
using ptr: 0.113141 sec
nomar way: 0.000728 sec

matlab already has good way. they don't need the pointer for speed up.

[Visual Studio] 구글테스트 Inherited Additional Dependencies 변경

구글테스트에 Configuration을 추가하는 경우 정상적인 빌드가 되지 않는 문제 발생 상황: Test 명칭으로 Configuration을 새로 추가하였음 원인: 다음그림과 같이 Inherited values에 debug용이 아닌 release...