Programming/node.js2018. 11. 25. 18:56

에어 코리아 API 한번 발급받아 볼까 하는데

기술문서를 보니 XML과 JSON으로 된다고 해서 검색..

[링크 : https://www.data.go.kr/dataset/15000581/openapi.do]



[링크 : https://www.npmjs.com/package/js2xmlparser]

[링크 : https://www.npmjs.com/package/xml2js]

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

node.js 혹은 sqlite?  (0) 2018.11.26
node.js sqlite3  (0) 2018.11.26
node.js mysql blob  (0) 2018.11.23
sqlite for node.js  (0) 2018.11.21
node.js swagger  (0) 2018.11.12
Posted by 구차니

그 와중에 또 그걸 맞고 다니는 하루 ㅋㅋㅋ


애는 눈 사람 만든다고 신나고

이래저래 소소하게 좋은 하루였네

Posted by 구차니
Programming/node.js2018. 11. 23. 10:52

mysql.escape()

[링크 : https://stackoverflow.com/.../er-parse-error-on-node-mysql-when-inserting-multiple-values]


timestamp는 CURRENT_TIMESTAMP 로 설정시 자동으로 입력됨

[링크 : https://blog.naver.com/star_breeze/220534943357]



이것저것 해보는데.. new Buffer().toString()이 유효했다!

$ node

> var tt = [39,91,92,39,105,110,112,117,116,35,115,101,108,95,48,95,49,92,39,44,92,39,105,110,112,117,116,35,115,101,108,95,48,95,51,92,39,44,92,39,105,110,112,117,116,35,115,101,108,95,48,95,53,92,39,93,39]

undefined

> var buffer = new Buffer(tt)

undefined

> buffer

<Buffer 27 5b 5c 27 69 6e 70 75 74 23 73 65 6c 5f 30 5f 31 5c 27 2c 5c 27 69 6e 70 75 74 23 73 65 6c 5f 30 5f 33 5c 27 2c 5c 27 69 6e 70 75 74 23 73 65 6c 5f ... >

> buffer.toString('base64')

'J1tcJ2lucHV0I3NlbF8wXzFcJyxcJ2lucHV0I3NlbF8wXzNcJyxcJ2lucHV0I3NlbF8wXzVcJ10n'

> var buffer = new Buffer(tt, 'binary')

undefined

> buffer.toString('base64')

'J1tcJ2lucHV0I3NlbF8wXzFcJyxcJ2lucHV0I3NlbF8wXzNcJyxcJ2lucHV0I3NlbF8wXzVcJ10n'

> tt.toString('utf-8')

'39,91,92,39,105,110,112,117,116,35,115,101,108,95,48,95,49,92,39,44,92,39,105,110,112,117,116,35,115,101,108,95,48,95,51,92,39,44,92,39,105,110,112,117,116,35,115,101,108,95,48,95,53,92,39,93,39'

> buffer.toString('utf-8')

'\'[\\\'input#sel_0_1\\\',\\\'input#sel_0_3\\\',\\\'input#sel_0_5\\\']\'' 

> new Buffer(tt).toString(

... 'utf-8')

'\'[\\\'input#sel_0_1\\\',\\\'input#sel_0_3\\\',\\\'input#sel_0_5\\\']\''

> new Buffer(tt).toString()

'\'[\\\'input#sel_0_1\\\',\\\'input#sel_0_3\\\',\\\'input#sel_0_5\\\']\''


[링크 : https://stackoverflow.com/questions/9042327/node-js-reading-blob-from-mysql]

[링크 : https://gist.github.com/akirattii/86e2eda8e110976cce144c991e9cada8]


그나저나 escape의 향연 어쩔꺼야...



+

mysql에 BLOB 타입으로 JSON을 저장하면 

node.js에서는 아래와 같이 Buffer에다가 값을 넣고 toString() 으로 문자열로 바꾸어준 다음

mysql.escape()를 통해 \" 식으로 된걸 원래대로 돌려주어야 한다.


server-side(node.js)

mysql.escape(new Buffer(row.element).toString("utf-8")); 


그리고 받는 쪽에서는 JSON이 아닌 일반 plain-text니까

JSON.parse를 통해서 JSON으로 변환해 주어야 한다.(eval은 빼도 되는지 확인 필요)


client-side(chrome, web browser)

JSON.parse(eval(data.json));


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

node.js sqlite3  (0) 2018.11.26
node.js xml <-> json  (0) 2018.11.25
sqlite for node.js  (0) 2018.11.21
node.js swagger  (0) 2018.11.12
node.js axios delete에 body 쓰기  (0) 2018.11.12
Posted by 구차니

오랫만에 DRM free네



[링크 : https://www.humblebundle.com/store/outcast-second-contact]




'게임 > 오리진&스팀&유플레이' 카테고리의 다른 글

우분투 노트북에서 스팀!  (0) 2019.05.17
무료 험블번들 GRID2  (0) 2019.03.15
스팀 무료게임!  (2) 2018.11.16
험블 번들 오늘의 무료!  (0) 2018.08.17
험블번들 무료!  (0) 2018.07.28
Posted by 구차니
프로그램 사용/docker2018. 11. 23. 08:57

docker 사용법

docker는 container 기반으로

콘솔창에서 attach해서 사용할 수 도

내부의 특정 프로그램을 실행해서 접속할 수 도

SSH를 통해서 접속할 수 도 있다.


[링크 : http://pyrasis.com/Docker/Docker-HOWTO]

[링크 : https://docs.docker.com/get-started/]


+

centos 7에 docker 깔기

[링크 : https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-centos-7]



헐.. 별별 이름의 도커 컨테이너가 다 있네 ㄷㄷ

# docker run hello-world

Unable to find image 'hello-world:latest' locally

latest: Pulling from library/hello-world

d1725b59e92d: Pull complete

Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788

Status: Downloaded newer image for hello-world:latest


Hello from Docker!

This message shows that your installation appears to be working correctly.


To generate this message, Docker took the following steps:

 1. The Docker client contacted the Docker daemon.

 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.

    (amd64)

 3. The Docker daemon created a new container from that image which runs the

    executable that produces the output you are currently reading.

 4. The Docker daemon streamed that output to the Docker client, which sent it

    to your terminal.


To try something more ambitious, you can run an Ubuntu container with:

 $ docker run -it ubuntu bash


Share images, automate workflows, and more with a free Docker ID:

 https://hub.docker.com/


For more examples and ideas, visit:

 https://docs.docker.com/get-started/ 


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

docker 개념 다시 조사..  (0) 2019.02.01
docker 설명..  (0) 2019.02.01
docker run = create + start  (0) 2019.02.01
docker static ip  (0) 2018.11.23
freebsd jail / docker  (0) 2015.07.27
Posted by 구차니
프로그램 사용/docker2018. 11. 23. 08:47

해보니 해당 인스턴스(?)에 대해서는 정상적으로 ip 가 잡혀서 실행되긴 한다.

그러니까.. 네트워크 인터페이스 자체를 network create를 통해서 만들어주고

그 이후에 해당 이미지를 아이피를 주어서 실행한다.. 인가?


Easy with Docker version 1.10.1, build 9e83765.

First you need to create you own docker network (mynet123)


docker network create --subnet=172.18.0.0/16 mynet123


than simply run the image (I'll take ubuntu as example)


docker run --net mynet123 --ip 172.18.0.22 -it ubuntu bash 


[링크 : https://stackoverflow.com/questions/27937185/assign-static-ip-to-docker-container]

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

docker 개념 다시 조사..  (0) 2019.02.01
docker 설명..  (0) 2019.02.01
docker run = create + start  (0) 2019.02.01
docker howto  (4) 2018.11.23
freebsd jail / docker  (0) 2015.07.27
Posted by 구차니

겁 먹었었는데.. 가입이 되어 있었나?

그냥 네이버 아이디로 로그인 하니 문제없이 로그인 된다..


[링크 : https://www.ncloud.com/]

[링크 : https://www.ncloud.com/product/applicationService/maps]


독특하게(?) AI.Naver API 라고

AI Service와 Application Service가 합쳐져 있다.

Application Service에 Maps가 포함되고

AI Service에 Clova와 Papago가 포함된다.



[링크 : https://console.ncloud.com/mc/solution/naverService/application]



하단에 Applicaton 등록 누르고 동의 한다음

Application 이름 등록하고 쓸 서비스, 그리고 사용할 서비스 도메인을 등록한다.


그러면 아래와 같이 사용량 통계 나오고


인증정보를 누르면 아래와 같이 클라이언트 ID가 나온다.


가입하고 보니 친절한 설명이 나오네 ㅋㅋㅋ

[링크 : http://docs.ncloud.com/ko/naveropenapi_v3/application.html]

[링크 : https://navermaps.github.io/maps.js.ncp/]


<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <title>간단한 지도 표시하기</title>
    <script type="text/javascript" src="https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=YOUR_CLIENT_ID"></script>
</head>
<body>
<div id="map" style="width:100%;height:400px;"></div>

<script>
var mapOptions = {
    center: new naver.maps.LatLng(37.3595704, 127.105399),
    zoom: 10
};

var map = new naver.maps.Map('map', mapOptions);
</script>
</body> 

</html> 


[링크 : https://navermaps.github.io/maps.js.ncp/tutorial-2-Getting-Started.html]



+

버전은 둘다 v3이고 clientId 식별자가 다른 키로 바뀌었다.


구버전

<script src="https://openapi.map.naver.com/openapi/v3/maps.js?clientId=USER_CLIENT_KEY"></script>


신버전

<script src="https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=USER_CLIENT_KEY"></script>

Posted by 구차니



[링크 : https://stackoverflow.com/questions/5467129/sort-javascript-object-by-key/31102605]


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

브라우저 닫기, 창 이동시 이벤트  (0) 2018.11.30
javascript 변수 정확도  (0) 2018.11.26
wavesurfer.js 그리고 HE-AACv2  (0) 2018.11.21
requireJS  (0) 2018.11.21
[Violation] 'setInterval' handler took  (0) 2018.11.18
Posted by 구차니
Programming/d32018. 11. 21. 19:06


[링크 : https://beta.observablehq.com/@mbostock/d3-multi-line-chart]


d3.v4

d3.line 

[링크 : https://bl.ocks.org/d3noob/4db972df5d7efc7d611255d1cc6f3c4f]

[링크 : https://codepen.io/zakariachowdhury/pen/JEmjwq]



d3 3.5.3

[링크 : https://bl.ocks.org/larsenmtl/e3b8b7c2ca4787f77d78f58d41c3da91]


+ 2018.11.22

[링크 : http://bl.ocks.org/hunzy/11110940] grid

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

d3 axis  (0) 2018.11.27
d3 온도/습도 그래프  (0) 2018.11.26
d3.time.format  (0) 2018.11.21
d3 pie 칸색 바꾸기  (0) 2018.11.15
d3 update 두번째 검색내용..  (0) 2018.11.15
Posted by 구차니

크롬에서는 HE-AACv2를 지원하지 않는건가? edge는 되는데 머야...

Uncaught (in promise) DOMException: Unable to decode audio data


[링크 : https://bugs.chromium.org/p/chromium/issues/detail?id=409402]

[링크 : https://bugs.chromium.org/p/chromium/issues/detail?id=534301]

[링크 : https://github.com/katspaugh/wavesurfer.js/issues/703]

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

javascript 변수 정확도  (0) 2018.11.26
js object array sort by key  (0) 2018.11.21
requireJS  (0) 2018.11.21
[Violation] 'setInterval' handler took  (0) 2018.11.18
JSON.stringify() 주의사항(?)  (0) 2018.11.17
Posted by 구차니