'잡동사니'에 해당되는 글 13786건

  1. 2016.07.03 컴퓨터 고장? 2
  2. 2016.07.01 cpp enum in class
  3. 2016.07.01 내 새끼 건드리면 빼애애애액
  4. 2016.06.30 망할 놈의 회사
  5. 2016.06.29 블로그 현황 2
  6. 2016.06.28 rpi gstreamer mux
  7. 2016.06.28 shared memory - linux/IPC
  8. 2016.06.28 메시지 큐 - ipc
  9. 2016.06.28 beowulf / openMPI
  10. 2016.06.27 pthread mutex shm_open

자꾸 뻗네..


그래픽 카드나... 전원의 문제로 급급급 불안..

돈 없는데 안돼 ㅠㅠ




이렇게 된김에 메인 pc를 라즈베리로?

(어?)



손목도 안 좋아서 

낑낑대며 청소 하는데

메인보드 / 그래픽 카드 쪽 캐피시터 배부른건 없음...

그렇다는건..... 설마 파워? ㅠㅠ

Posted by 구차니
Programming/C++ STL2016. 7. 1. 10:04

cpp이랑은 안친한데 크윽 ㅠㅠ

컴파일러나 Cxx 적용 버전의 차이겠지만


$ g++ --version

g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

Copyright (C) 2011 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


g++ 4.6.3 에서는 scope 인식을 하긴 하는데

$ cat enum.cpp

#include <iostream>


class A

{

public:

        int a;

        enum

        {

                A_1,

                A_2,

                A_3

        };

};


class B

{

public:

        int b;

        enum

        {

                B_1,

                B_2,

                B_3

        };


};


int main()

{

        A a;

        B b;


        a.a = B_1;

        a.a = A_1;


        b.b = A_1;

        b.b = B_1;

        return 0;

}


$ g++ enum.cpp

enum.cpp: In function ‘int main()’:

enum.cpp:33:8: error: ‘B_1’ was not declared in this scope

enum.cpp:34:8: error: ‘A_1’ was not declared in this scope 


clang에서는 scope를 조금더 정밀하게 따지는 듯?

$ clang --analyze enum.cpp

enum.cpp:33:8: error: use of undeclared identifier 'B_1'

        a.a = B_1;

              ^

enum.cpp:34:8: error: use of undeclared identifier 'A_1'

        a.a = A_1;

              ^

enum.cpp:36:8: error: use of undeclared identifier 'A_1'

        b.b = A_1;

              ^

enum.cpp:37:8: error: use of undeclared identifier 'B_1'

        b.b = B_1;

              ^

4 errors generated. 


scope만 잡아주면.. public에서 선언한거라 문제없이 되는건가?

$ cat enum.cpp

#include <iostream>


class A

{

public:

        int a;

        enum

        {

                A_1,

                A_2,

                A_3

        };

};


class B

{

public:

        int b;

        enum

        {

                B_1,

                B_2,

                B_3

        };


};


int main()

{

        A a;

        B b;


        a.a = B::B_1;

        a.a = A::A_1;


        b.b = A::A_1;

        b.b = B::B_1;

        return 0;


$ g++ enum.cpp

$ clang --analyze enum.cpp 



enum 자체에 private를 줘보니..

에러 뿜뿜!

$ cat enum.cpp

#include <iostream>


class A

{

public:

        int a;


private:

        enum

        {

                A_1,

                A_2,

                A_3

        };

};


class B

{

public:

        int b;


private:

        enum

        {

                B_1,

                B_2,

                B_3

        };


};


int main()

{

        A a;

        B b;


        a.a = B::B_1;

        a.a = A::A_1;


        b.b = A::A_1;

        b.b = B::B_1;

        return 0;


$ g++ enum.cpp

enum.cpp: In function ‘int main()’:

enum.cpp:25:3: error: ‘B::<anonymous enum> B::B_1’ is private

enum.cpp:37:11: error: within this context

enum.cpp:11:3: error: ‘A::<anonymous enum> A::A_1’ is private

enum.cpp:38:11: error: within this context

enum.cpp:11:3: error: ‘A::<anonymous enum> A::A_1’ is private

enum.cpp:40:11: error: within this context

enum.cpp:25:3: error: ‘B::<anonymous enum> B::B_1’ is private

enum.cpp:41:11: error: within this context


$ clang --analyze enum.cpp

enum.cpp:37:11: error: 'B_1' is a private member of 'B'

        a.a = B::B_1;

                 ^

enum.cpp:25:3: note: declared private here

                B_1,

                ^

enum.cpp:38:11: error: 'A_1' is a private member of 'A'

        a.a = A::A_1;

                 ^

enum.cpp:11:3: note: declared private here

                A_1,

                ^

enum.cpp:40:11: error: 'A_1' is a private member of 'A'

        b.b = A::A_1;

                 ^

enum.cpp:11:3: note: declared private here

                A_1,

                ^

enum.cpp:41:11: error: 'B_1' is a private member of 'B'

        b.b = B::B_1;

                 ^

enum.cpp:25:3: note: declared private here

                B_1,

                ^

4 errors generated.


결론 

public일 경우 당연히(!) 다른 클래스에서도 사용 가능,

private일 때는 당연히(!) 다른 클래스에서는 사용 불가

'Programming > C++ STL' 카테고리의 다른 글

객체지향과 if문?  (0) 2016.07.11
cpp 클래스 구성  (0) 2016.07.11
cpp const  (0) 2016.06.22
const 멤버 변수 초기화(member variable initializer)  (0) 2016.06.22
std::endl  (0) 2015.06.24
Posted by 구차니

부모들에게 추천합니다

영화 taken




[링크 : http://media.daum.net/society/others/newsview?newsid=20160701040102740]


근데.. 아들네 부모 vs 딸네 부모

둘다 taken 찍으면 볼만하겠는데?

'개소리 왈왈 > 정치관련 신세한탄' 카테고리의 다른 글

lg 에어컨(신형) 필터 교체 신청  (0) 2016.07.21
그러고 보니 전기가 안부족한 듯?  (0) 2016.07.11
6.25  (0) 2016.06.25
영국 브렉시트  (0) 2016.06.24
결국은 테러방지법 통과?!  (0) 2016.03.03
Posted by 구차니

또 세달간 강제 야근/주말 특근..

세달간 확 돈을 땡겨 벌어 보자 에라이 -_-

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

LG 에어컨 필터 도착! ㄷㄷ  (0) 2016.07.25
지친다  (2) 2016.07.05
일주일 만에 택배도착  (0) 2016.06.04
시놀로지.. freeNAS... 우분투...  (0) 2016.06.01
어떤 아주머니  (0) 2016.05.29
Posted by 구차니
개소리 왈왈/블로그2016. 6. 29. 21:52

합산이야.. 네이버가 구글 넘은지가 오래긴 하지만

가장 큰 파이가 네이버를 넘어 버리다니 ㅠㅠ

아무튼... 티스토리에서 구글에서 유입되는걸 잘 못잡는거 같기도 하고..

그냥 우울하네~ 티스토리 버려야 하나? ㅠㅠ



'개소리 왈왈 > 블로그' 카테고리의 다른 글

네이버 수상한데...  (0) 2016.07.28
이 미묘한 기분..  (0) 2016.07.20
티스토리.... 망해가나?  (4) 2016.06.02
5월은 가정 (재정) 파탄의 달?!?  (0) 2016.05.13
문득... 살아있을까?  (0) 2016.04.27
Posted by 구차니
embeded/raspberry pi2016. 6. 28. 18:27


gst-launch-1.0 \

    v4l2src device=$VIDEO_DEVICE \

        ! $VIDEO_CAPABILITIES \

        ! mux. \

    alsasrc device=$AUDIO_DEVICE \

        ! $AUDIO_CAPABILITIES \

        ! mux. \

    avimux name=mux \

        ! filesink location=test-$( date --iso-8601=seconds ).avi


[링크 : https://www.linuxtv.org/wiki/index.php/GStreamer]


'embeded > raspberry pi' 카테고리의 다른 글

초음파 센서 wiring pi 버전  (0) 2016.07.10
초음파/온습도 센서 데이터 시트 복사  (0) 2016.07.10
beowulf / openMPI  (0) 2016.06.28
redmine on raspberrypi  (9) 2016.06.23
gsteamer rtspsink  (0) 2016.06.21
Posted by 구차니
Linux API/linux2016. 6. 28. 15:56

System V와 POSIX 차이

[링크 : http://stackcanary.com/?p=59]


System V

[링크 : http://linux.die.net/man/2/shmget]

[링크 : http://linux.die.net/man/2/shmat] attach

[링크 : http://linux.die.net/man/2/shmdt] detach

[링크 : http://linux.die.net/man/2/shmctl]


POSIX


System V shared memory (shmget(2), shmop(2), etc.) is an older shared memory API. POSIX shared memory provides a simpler, and better designed interface; on the other hand POSIX shared memory is somewhat less widely available (especially on older systems) than System V shared memory.

[링크 : http://linux.die.net/man/7/shm_overview]

    [링크 : http://linux.die.net/man/3/shm_open]

    [링크 : http://linux.die.net/man/2/ftruncate]

    [링크 : http://linux.die.net/man/2/mmap]

'Linux API > linux' 카테고리의 다른 글

pthread detach while  (0) 2016.12.20
fd <-> fp 변환  (0) 2016.10.07
메시지 큐 - ipc  (0) 2016.06.28
pthread mutex shm_open  (0) 2016.06.27
리눅스 동적 라이브러리(*.so) 사용하기  (0) 2016.04.04
Posted by 구차니
Linux API/linux2016. 6. 28. 15:31


#include <sys/types.h>

#include <sys/ipc.h>

#include <sys/msg.h>


struct msgbuf {

    long mtype;       /* message type, must be > 0 */

    char mtext[1];    /* message data */

};


int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);

ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);

int msgget(key_t key, int msgflg);

[링크 : http://linux.die.net/man/2/msgsnd]

[링크 : http://linux.die.net/man/2/msgget]



[링크 : http://www.joinc.co.kr/w/Site/system_programing/Book_LSP/ch08_IPC]

[링크 : http://www.joinc.co.kr/w/Site/system_programing/IPC/MessageQueue]

'Linux API > linux' 카테고리의 다른 글

fd <-> fp 변환  (0) 2016.10.07
shared memory - linux/IPC  (0) 2016.06.28
pthread mutex shm_open  (0) 2016.06.27
리눅스 동적 라이브러리(*.so) 사용하기  (0) 2016.04.04
리눅스 커널 모듈 관련 문서  (0) 2015.11.06
Posted by 구차니
embeded/raspberry pi2016. 6. 28. 09:26

예전에 학교 실습실 관리할때 beowulf 해보고 싶었는데..

라즈베리 슈퍼 컴퓨터가 beowulf 였네..(알고보니 이것도 찾아두고는 잊은건 아니겠지 -_-)

한번 여러 대 사서 해볼까?



Ubuntu beowulf cluster

[링크 : https://www-users.cs.york.ac.uk/~mjf/pi_cluster/src/Building_a_simple_Beowulf_cluster.html]


Raspberrypi B+ 32 node beowulf cluster

[링크 : http://coen.boisestate.edu/ece/raspberry-pi/]

[링크 : http://coen.boisestate.edu/ece/files/2013/05/Creating.a.Raspberry.Pi-Based.Beowulf.Cluster_v2.pdf]


Examples of MPI software include OpenMPI or MPICH. There are additional MPI implementations available.

[링크 : http://askubuntu.com/questions/624994/what-can-a-beowulf-cluster-help-process]

[링크 : https://en.wikipedia.org/wiki/Beowulf_cluster]

[링크 : https://en.wikipedia.org/wiki/Open_MPI]

'embeded > raspberry pi' 카테고리의 다른 글

초음파/온습도 센서 데이터 시트 복사  (0) 2016.07.10
rpi gstreamer mux  (0) 2016.06.28
redmine on raspberrypi  (9) 2016.06.23
gsteamer rtspsink  (0) 2016.06.21
라즈베리 파이 카메라(rpi cam) 렌즈 교체..  (2) 2016.06.18
Posted by 구차니
Linux API/linux2016. 6. 27. 20:51

pthread_mutexattr_destroy, pthread_mutexattr_init - destroy and initialize the mutex attributes object

[링크 : http://linux.die.net/man/3/pthread_mutexattr_init]


mutex 속성을 설정하여 프로세스간 mutex로도 사용이 가능

ret = pthread_mutexattr_setpshared(&mtx_attr, PTHREAD_PROCESS_SHARED);

[링크 : https://kldp.org/node/107186]

[링크 : http://stackoverflow.com/questions/4252005/what-is-the-attribute-of-a-pthread-mutex]


[링크 : http://mintnlatte.tistory.com/357] mmap


결론은.. 공유 메모리를 통해 mutex 키를 공유하여

다른 프로세스들과도 mutex가 가능하다?

'Linux API > linux' 카테고리의 다른 글

shared memory - linux/IPC  (0) 2016.06.28
메시지 큐 - ipc  (0) 2016.06.28
리눅스 동적 라이브러리(*.so) 사용하기  (0) 2016.04.04
리눅스 커널 모듈 관련 문서  (0) 2015.11.06
readl(), writel()  (0) 2015.11.06
Posted by 구차니