'2018/11/23'에 해당되는 글 4건

  1. 2018.11.23 node.js mysql blob
  2. 2018.11.23 험블번들 무료 게임 - outcast second contact
  3. 2018.11.23 docker howto 4
  4. 2018.11.23 docker static ip
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 구차니