Programming/node.js2018. 10. 22. 17:38

typeof를 이용해서 undefined 와 비교하면 됨

(req.body나 req.param 로 들어오는 녀석들 값 있는지 존재여부 비교하기 용)


if (typeof query !== 'undefined' && query !== null){

   doStuff();

[링크 : http://misoin.tistory.com/53]

[링크 : https://stackoverflow.com/.../how-can-i-check-whether-a-variable-is-defined-in-node-js]


+

2018.10.23

써보니. undefined는 변수로 사용되는 reserved keyword가 아니다

즉, "undefined"나 'undefined'와 비교를 해주어야 한다.

'Programming > node.js' 카테고리의 다른 글

curl jwt  (0) 2018.10.26
node-rtsp-stream 과 node-rtsp-stream-es6 차이  (0) 2018.10.24
node.js를 이용한 자기 자신의 ip 얻기  (4) 2018.10.22
웹소켓 그리고 공유기?  (4) 2018.10.18
node-rtsp-stream의 pid 얻기  (0) 2018.10.18
Posted by 구차니

머.. 거장한것 없이 프로젝트 최상위 폴더에

.gitignore로 생성하고

상위 폴더 경로나 특정 파일명 혹은 *을 포함해서 적어주면 된다.


[링크 : https://nesoy.github.io/articles/2017-01/Git-Ignore]


+

vscode에서 최상위 프로젝트 파일에다가 설정해주니 하위에서도 정상적으로 gitignore가 적용된다.

걍.. 폴더로 무시하는게 답이었던 듯..

$ cat .gitignore

node_modules/ 

[링크 : http://trend21c.tistory.com/1471]

Posted by 구차니
개소리 왈왈/컴퓨터2018. 10. 22. 15:45

HDMI-in 이라고 되어있어서 무언가 좋은 기능인줄 알고 찾아봤는데

대놓고 무쓸모 -_-


일단.. 하스웰 내장 그래픽 카드를 쓰고

외부 모니터를 HDMI로 연결하고(메뉴얼에 의하면)

다른 HDMI source를 받아서 alt-c 등의 미리 등록된 단축키를 사용하여

메인보드에서 HDMI selector 역활을 해주는 녀석

전원 꺼도 상관없다지만 정확하게는 S5 절전상태고 완전 전원 뽑은 상태에서는 안되는 기능


메인보드로 입력하길래 HDMI 캡쳐라던가 동영상 저장 기능이라도 있을줄 알았는데 그것도 아니고

내장 그래픽 소켓으로만 된다니 대실망쇼~


[링크 : https://www.youtube.com/watch?v=wivYGt_SIg8]

[링크 : http://www.asrock.com/news/index.asp?cat=News&ID=1274]

[링크 : https://www.asrock.com/mb/Intel/Z87%20OC%20Formula/]


1. If there is no video displayed on your monitor, make sure that the cables are properly connected and make sure that “Deep S5” option in BIOS SETUP is set to [Disable]. 2. If required, connect a power source to the adapter that lets the smartphone/tablet output HDMI signal 

[링크 : http://asrock.pc.cdn.bitgravity.com/Manual/Z87%20OC%20Formula.pdf]


+

메인보드 설계상 HDMI in 1채널과 HDMI out 1채널이니까

CPU 쪽 HDMI 출력과 HDMI in 출력을

USB 키보드 입력에 따라서 단순하게 전환해주면 되는 기술..

단지, HDMI 셀렉터의 버튼을 키보드로 치환했을 뿐인 용도 불명의 기술.. -_-

Posted by 구차니
Programming/node.js2018. 10. 22. 15:11

javascript로는 ip를 얻을 수 없지만 node.js라면 가능하니까 머..

(자기 자신의 IP를 얻어서 보낸다거나)


var ip = require("ip");

console.dir ( ip.address() ); 

[링크 : https://stackoverflow.com/questions/3653065/get-local-ip-address-in-node-js]

'Programming > node.js' 카테고리의 다른 글

node-rtsp-stream 과 node-rtsp-stream-es6 차이  (0) 2018.10.24
node.js undefined 확인하기  (0) 2018.10.22
웹소켓 그리고 공유기?  (4) 2018.10.18
node-rtsp-stream의 pid 얻기  (0) 2018.10.18
node.js post body  (0) 2018.10.17
Posted by 구차니
Linux API2018. 10. 22. 14:52

[링크 : https://linux.die.net/man/3/system]

[링크 : https://linux.die.net/man/2/wait]


+

system으로는 실행 내용을 돌릴수 없으므로 ppipe 이용

[링크 : http://wanochoi.com/?p=178]


+

POST 인자로 body에 id와 password를 넘겨주는 curl을 실행하는 예제

#include <stdio.h>

#include <stdlib.h>


void main()

{

        int ret = 0;

        int status = 0;


        unsigned char cmd[255];

        unsigned char id[32] = "admin";

        unsigned char pw[32] = "admin";

        unsigned char url[] = "http://localhost:3000/api/test";

        unsigned char header[] = "-H 'Content-Type: application/json'";

        unsigned char data = "-d '{ \"id\":\"%s\",\"password\":\"%s\"}'";

        sprintf(cmd, "curl -X POST %s %s -d '{ \"id\":\"%s\",\"password\":\"%s\"}'",

                url, header, id, pw);

        printf("%s\n",cmd);


//      ret = system(cmd);

//      wait(&status);


        FILE *output = popen(cmd, "r");

        char buf[255];

        int pos = 0;

        while( !feof(output) && !ferror(output) )

        {

                int bytesRead = fread( buf + pos , 1, 128, output );

                pos += bytesRead;

        }


        printf("buf : [%s]\n",buf);


//      printf("ret : [%d]\n",ret);

//      printf("sta : [%d]\n",WEXITSTATUS(status));


+

이상한 메시지는 curl 을 콘솔에서 실행할때에도 안나오는데 아무튼. pipe로 실행하면 넘겨져 온다. 

보기 싫으면 --silent 옵션주면 끝

# ./a.out

curl -X POST http://localhost:3000/api/test -H 'Content-Type: application/json' -d '{ "id":"1234","password":"1234"}'

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100   397  100   363  100    34  18426   1725 --:--:-- --:--:-- --:--:-- 19105 

[링크 : https://makandracards.com/makandra/1615-disable-output-when-using-curl[

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

libescp  (0) 2019.01.03
cups api  (0) 2018.12.20
ncurse  (0) 2015.04.27
lirc - linux IR Remote control  (0) 2015.03.31
vaapi vdpau uvd  (6) 2015.03.26
Posted by 구차니

git pull 하다 보니 에러가 나서 확인하려고 보는데

detached branch 라던가

You are not currently on a branch 이라던가 나오는데


생각해보니 구버전으로 잠시 돌려놓았던 것이 문제..

아무튼 결론(?)은 master로 돌리고 나서 손을 보면 된다?


[링크 : https://okky.kr/article/437352]

[링크 : https://blog.npcode.com/2012/09/02/git-pull-할-때-옵션-안줘도-알아서-되게-하기/]

[링크 : http://sunphiz.me/wp/archives/2266?ckattempt=1]

[링크 : https://stackoverflow.com/...-currently-on-a-branch-error-when-trying-to-sync-fork-with-upstream]


+

2018.10.23

$ git branch

* (detached from 7ea96f5)

  master

$ git checkout master

Switched to branch 'master'

Your branch is behind 'origin/master' by 3 commits, and can be fast-forwarded.

  (use "git pull" to update your local branch) 


'프로그램 사용 > Version Control' 카테고리의 다른 글

git log . - 현재 디렉토리 이하의 변경내역 보기  (0) 2018.11.02
.gitignore  (0) 2018.10.22
git 리비전 돌아 다니기  (0) 2018.10.18
git 상태 다시 읽기  (0) 2018.09.20
git 원격지 주소 변경하기  (0) 2018.09.06
Posted by 구차니
Programming/C Win32 MFC2018. 10. 22. 11:44

c언어에서 uuid 생성하기

$ cat uuid.c

#include <uuid/uuid.h>

#include <stdio.h>


void main()

{

        uuid_t out;

        uuid_generate_random(out);

        printf("%x",out);

}

$ gcc uuid.c -luuid

[링크 : https://linux.die.net/man/3/uuid_generate]

[링크 : https://superuser.com/questions/1175935/how-can-i-fix-uuid-uuid-h-no-such-file-error-in-centos]


 typedef unsigned char uuid_t[16];

[링크 : https://git.busybox.net/busybox/plain/e2fsprogs/uuid/uuid.h?h=1_3_stable]

'Programming > C Win32 MFC' 카테고리의 다른 글

while(-1) 이 될까?  (0) 2019.05.24
c언어용 JSON 라이브러리 목록  (0) 2018.10.23
엔디안 급 멘붕..  (0) 2018.05.29
const char *과 char * const 차이  (0) 2018.01.31
소스 코드 포맷 적용하기  (0) 2018.01.08
Posted by 구차니

오늘 어린이집 같은반 애 엄마와 같이 키즈카페 가서 아내와 셋트로 협공을 당하다 오니 멘탈이 털리는데

방어기제였을지 모르겠지만 

육아에 있어서 아이에게 있어서 남성성이란 없어져야 할 것. 나쁜 것일 뿐인가? 라는 생각이 들었다.


남성성이 무엇인가 싶으면서도

폭력으로 요약되어 그 존재 자체가 부정당하는 현재에서

남성성이란 단순히 사라져야 할 존재인가 고민이 되어진다.


아이가 위험하게 있으면

위험하지 하지 말라는 설득도 방법이지만

통제된 위험함 속에서 위험함을 체험하게 하고 그걸 하지 않게 하는 것도 방법이 아닌가 싶은데

후자는 아동 학대 딱지를 받아 버렸으니 써서는 안될 나쁜 것이 되어버렸다.

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

키즈카페 다녀옴  (2) 2018.10.28
혓바늘..  (2) 2018.10.27
피로하다..  (0) 2018.10.19
누군가의 죽음  (2) 2018.10.14
명절 증후근?  (2) 2018.09.23
Posted by 구차니

장모님댁 들렀다가 왔는데

오히려 원주 쪽은 단풍이 별로고 장모님댁 근처가 더 나았는데

아직 절정이려면 2주는 더 있어야 겠다 라고 생각했는데


집에와서 보니 절정이라 단풍놀이갔다가 차막힌다고.. 머야 -_-???

내가 가는 길목에만 단풍이 안들었나?

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

내 하루 어디갔어..  (2) 2018.11.04
우울할 땐 아내 몰래 하나 지르자~  (1) 2018.10.23
회사 워크샾 - 에버랜드  (3) 2018.10.08
9월의 끝  (2) 2018.09.30
읭? 타겟 광고인가?  (4) 2018.09.28
Posted by 구차니

졸려여~ 하면서도 이제야 원인 발견!

바닥이 차가워서 잠 뒤척이고 일찍 깨던거..


얼마나 머리가 안돌아갔으면 이걸 2주나 지나서야 겨우 생각해 낸걸까..

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

혓바늘..  (2) 2018.10.27
남성성이란 무엇일까.. 그리고 없어져야 할 것 인가?  (4) 2018.10.21
누군가의 죽음  (2) 2018.10.14
명절 증후근?  (2) 2018.09.23
물티슈 난리났네  (2) 2018.09.21
Posted by 구차니