canvas에서 영상을 dataURL로 받으면 base64로 인코딩 되어서 해결책 찾는중..


window.atob (decoding)

window.btoa (encoding)

[링크 : http://1004lucifer.blogspot.com/2016/01/javascript-base64.html]

'Programming > javascript & HTML' 카테고리의 다른 글

js date time to epoch  (0) 2018.10.26
canvas to blob  (2) 2018.10.25
formdata dump  (0) 2018.10.24
js toHexString()  (0) 2018.10.23
jsmpeg div로 사용시 옵션  (0) 2018.10.18
Posted by 구차니

ajax로 formdata 보내기

[링크 : https://www.mkyong.com/jquery/jquery-ajax-submit-a-multipart-form/]



생성하기

[링크 : https://developer.mozilla.org/ko/docs/Web/API/FormData/FormData]


보는거 무지 복잡하네..

var formData = new FormData();

formData.append('key1', 'value1');

formData.append('key2', 'value2');


// Display the key/value pairs

for (var pair of formData.entries()) {

    console.log(pair[0]+ ', ' + pair[1]); 

[링크 : https://stackoverflow.com/questions/17066875/how-to-inspect-formdata]


+

var formData = new FormData();


formData.append('items', new Blob([JSON.stringify({

    name: "Book",

    quantity: "12"

})], {

    type: "application/json"

})); 

[링크 : https://stackoverflow.com/...multipart-form-data-with-a-different-content-type-on-each-parts-with-j]


+

var st = imagepath.replace(data:image/png or jpg; base64"/""); 

[링크 : https://stackoverflow.com/questions/22172604/convert-image-url-to-base64]

'Programming > javascript & HTML' 카테고리의 다른 글

canvas to blob  (2) 2018.10.25
자바스크립트 base64 인코딩, 디코딩  (0) 2018.10.24
js toHexString()  (0) 2018.10.23
jsmpeg div로 사용시 옵션  (0) 2018.10.18
js setinterval  (0) 2018.10.16
Posted by 구차니
Programming/jquery2018. 10. 23. 17:16

포인트(?)는 ajax에서 return $.ajax()를 해주어야 한다는 것


$.when(ajax1(), ajax2(), ajax3(), ajax4()).done(function(a1, a2, a3, a4){

    // the code here will be executed when all four ajax requests resolve.

    // a1, a2, a3 and a4 are lists of length 3 containing the response text,

    // status, and jqXHR object for each of the four ajax calls respectively.

});


function ajax1() {

    // NOTE:  This function must return the value 

    //        from calling the $.ajax() method.

    return $.ajax({

        url: "someUrl",

        dataType: "json",

        data:  yourJsonData,            

        ...

    });

[링크 : https://stackoverflow.com/questions/3709597/wait-until-all-jquery-ajax-requests-are-done]

'Programming > jquery' 카테고리의 다른 글

jquery selector와 document.getElementById 차이  (0) 2018.11.05
jquery trigger()  (0) 2018.10.25
jquery ajax data, header  (0) 2018.10.23
jquery shake  (0) 2018.10.16
jquery ani arc  (0) 2018.10.16
Posted by 구차니
Programming/jquery2018. 10. 23. 16:38

get의 header로 보낼때는 header 인가..

post의 body는 data


[링크 : https://stackoverflow.com/questions/3258645/pass-request-headers-in-a-jquery-ajax-get-call]

'Programming > jquery' 카테고리의 다른 글

jquery selector와 document.getElementById 차이  (0) 2018.11.05
jquery trigger()  (0) 2018.10.25
jqeury ajax 수행 완료 기다리기  (0) 2018.10.23
jquery shake  (0) 2018.10.16
jquery ani arc  (0) 2018.10.16
Posted by 구차니

원래 이런건 지원안해서 직접 만들어야 하나보네..


function toHexString(byteArray) {

  return Array.from(byteArray, function(byte) {

    return ('0' + (byte & 0xFF).toString(16)).slice(-2);

  }).join('')

[링크 : https://stackoverflow.com/questions/34309988/byte-array-to-hex-string-conversion-in-javascript]

'Programming > javascript & HTML' 카테고리의 다른 글

자바스크립트 base64 인코딩, 디코딩  (0) 2018.10.24
formdata dump  (0) 2018.10.24
jsmpeg div로 사용시 옵션  (0) 2018.10.18
js setinterval  (0) 2018.10.16
ajax each  (0) 2018.10.16
Posted by 구차니
Programming/C Win32 MFC2018. 10. 23. 09:57

귀찮으니 그냥 str* 으로 대충 짤까..

[링크 : https://dojang.io/mod/page/view.php?id=724]


+

적합성(?) 테스트 한 자료가 있어서 링크 복사

[링크 : http://jhhwang4195.tistory.com/94]

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

strptime  (0) 2021.02.17
while(-1) 이 될까?  (0) 2019.05.24
uuid in c  (0) 2018.10.22
엔디안 급 멘붕..  (0) 2018.05.29
const char *과 char * const 차이  (0) 2018.01.31
Posted by 구차니
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 구차니
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 구차니
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 구차니
Programming/d32018. 10. 18. 20:57

어쩌다 받은거라 최신버전이 얼마인지도 모르고 했는데

다시 확인해보니 v3.. ㅠㅠ


현재 최신버전은 v5.7.0

[링크 : https://d3js.org/]



덕분에.. v3.x 에서 v5.x로 마이그레이션 하게 생겼네.. ㅠㅠ

'Programming > d3' 카테고리의 다른 글

d3 background image  (0) 2018.10.29
d3 pulse / blink  (0) 2018.10.29
d3 v3 doc  (0) 2018.10.17
d3 arc 직접 그리기  (0) 2018.10.17
d3 pie with padding  (0) 2018.10.16
Posted by 구차니