Programming/node.js2020. 1. 31. 01:20

async와 await를 이용해서 순차적으로 실행하여 트랜잭션을 구현한 예제

[링크 : https://node-postgres.com/features/transactions]

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

broadway / jsmpeg  (0) 2020.09.16
node.js array.sort() 주의사항  (0) 2020.02.01
for 에서 async, await  (0) 2020.01.30
es6 전개문구 (...)  (0) 2020.01.29
node.js 객체 합치기  (0) 2020.01.29
Posted by 구차니
Programming/node.js2020. 1. 30. 22:25

for문을 돌리는데 비동기로 돌아버려서

그걸 강제로 동기로 돌리는 방법 찾는중

루프를 async - await new Promise()로 하는게 일단 작동하는걸 확인함

(async function loop() {
    for (let i = 0; i < 10; i++) {
        await new Promise(resolve => setTimeout(resolve, Math.random() * 1000));
        console.log(i);
    }
})();

[링크 : https://stackoverflow.com/questions/40328932/javascript-es6-promise-for-loop/40329190]

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

node.js array.sort() 주의사항  (0) 2020.02.01
node.js postgresql transaction  (0) 2020.01.31
es6 전개문구 (...)  (0) 2020.01.29
node.js 객체 합치기  (0) 2020.01.29
unserscore 라이브러리  (0) 2020.01.29
Posted by 구차니
Programming/node.js2020. 1. 29. 17:45

... 은 es6부터 추가된 문법으로

배열을 풀어서 인자로 만들어 주는 듯

 

function sum(x, y, z) {
  return x + y + z;
}

const numbers = [1, 2, 3];

console.log(sum(...numbers));
// expected output: 6

[링크 : https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Operators/Spread_syntax]

[링크 : https://2ality.com/2015/01/es6-set-operations.html]

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

node.js postgresql transaction  (0) 2020.01.31
for 에서 async, await  (0) 2020.01.30
node.js 객체 합치기  (0) 2020.01.29
unserscore 라이브러리  (0) 2020.01.29
node.js 집합연산  (0) 2020.01.23
Posted by 구차니
Programming/node.js2020. 1. 29. 17:05

assign()을 쓰면 가능은 한데..

동일 이름일 경우에는 어떻게 해야할까?

 

[링크 : https://4urdev.tistory.com/22]

+

키 이름을 미리 바꾸고 합치면 되려나?

[링크 : https://www.freecodecamp.org/news/30-seconds-of-code-rename-many-object-keys-in-javascript-268f279c7bfa/]

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

for 에서 async, await  (0) 2020.01.30
es6 전개문구 (...)  (0) 2020.01.29
unserscore 라이브러리  (0) 2020.01.29
node.js 집합연산  (0) 2020.01.23
node.js promise  (0) 2020.01.20
Posted by 구차니
Programming/node.js2020. 1. 29. 13:29

node.js 에서 사용할수 있는 라이브러리.

객체등을 uniq하게 정렬해줄수 있다는데

정작해보니.. 키에 따라서 정리만 해주는 정도?

 

[링크 : https://ddalpange.github.io/2017/10/10/js-not-duplicated-object-array/]

[링크 : http://underscorejs.org/]

[링크 : https://harrythegreat.tistory.com/entry/언더스코어-정리]

 

+

함수로 정리하는 내용

[링크 : https://gamblecoder.tistory.com/29]

 

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

es6 전개문구 (...)  (0) 2020.01.29
node.js 객체 합치기  (0) 2020.01.29
node.js 집합연산  (0) 2020.01.23
node.js promise  (0) 2020.01.20
node.js cookie 관련 함수들  (0) 2020.01.19
Posted by 구차니
Microsoft/vscode2020. 1. 28. 14:10

돌리는데 메모리를 갑자기 많이 먹나 해서 옵션을 주는데 생각대로 잘 안된다 -_ㅠ

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node_module_register
 2: v8::internal::FatalProcessOutOfMemory
 3: v8::internal::FatalProcessOutOfMemory
 4: v8::internal::Factory::NewUninitializedFixedArray
 5: v8::internal::WasmDebugInfo::SetupForTesting
 6: v8::internal::interpreter::BytecodeArrayRandomIterator::UpdateOffsetFromIndex
 7: 000000D879B843C1

 

아무튼 원인은 v8 엔진에서 64bit 기본 1.4GB 정도만 메모리 사용하도록 해둔것

그걸 늘리면 되는데 vscode에서 하다보니 옵션을 어떻게 주어야 하나 고민되는데

args로 하면 적용이 안되고(index.js --max_old_space_size=8192 식으로 옵션이 뒤에 붙음)

runtimeargs로 주어야 한다.

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "/**"
            ],
            "program": "${workspaceFolder}\\index.js",
            "runtimeArgs" : ["--max_old_space_size=8192"]
        }
    ]
}

[링크 : https://code.visualstudio.com/docs/nodejs/nodejs-debugging]

[링크 : https://stackoverflow.com/questions/38558989/node-js-heap-out-of-memory]

[링크 : https://bloodguy.tistory.com/...-Allocation-failed-process-out-of-memory-에러-원인-해결방법]

 

Posted by 구차니
Microsoft/vscode2020. 1. 27. 20:34

vscode 에서는 ctrl-` 를 이용해서 콘솔을 열고

아래의 git 명령을 이용해서 remote origin을 추가해주면 끝.

git remote add origin http://저장소경로

[링크 : https://evols-atirev.tistory.com/14]

 

 

아쉽게도 vscode 에서는 해당 명령이 없는 듯?

Posted by 구차니

설날이라 거의 반년만에 겨우 장모님댁에 갔더니 숯불에 고기를 구워먹자고 하신다.

 

생각보다 숯을 너무 많이 남아서

 

가족들이 다 들어간 시간에 은은한 붉은 빛을 보면서 홀린듯이 카메라를 챙겨오게 된다.

 

 

불꽃이 날리면 더 멋지겠다 싶어서 연속으로 찍어 보지만 건진건 몇 개 없다.

 

 

나 역시 이렇게 활활 불타고 있으면 좋으련만

 

이제는 하얗게 재만 남아버린 상태인가.. (회사일이라서 그런걸지도..)

 

'개소리 왈왈 > 사진과 수다' 카테고리의 다른 글

병아리 2마리 획득  (0) 2020.04.29
영월 봄 하늘  (0) 2020.03.13
네이트온 휴면계정 전환  (0) 2020.01.25
두번째로 볼펜 다 씀  (0) 2019.12.19
22mm 렌즈 사형선고  (2) 2019.12.09
Posted by 구차니

머하는 짓인가...

 

뜬금없이 떠오른 "피할 수 없으면 즐겨라"

검색해보니 심장 전문 의사의 스트레스에 대한 책에서 나온 명언이라고 한다.

미국의 심장 전문 의사 로버트 엘리엇(Robert S. Eliet)의 저서 <스트레스에서 건강으로 -마음의 짐을 덜고 건강한 삶을 사는 법>에서 나온 명언

[링크 : https://www.hankyung.com/thepen/article/3685]

 

긍정적으로 받아들여서 고통을 줄이라는 이야기인데

심장의사라 그런가 예전에는 스트레스 받으면 심장에 안 좋다고 했던거라 받아 들여졌겠지만

요즘은 정신과가 아니니 먼 개소리여~ 이럴지도?

 

 

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

예정된 철야..  (0) 2020.02.06
으아아 피곤하다  (0) 2020.02.05
출근길 일기?  (2) 2020.01.19
피곤한 하루  (2) 2020.01.18
많이 늦었지만 올해의 공부 계획  (2) 2020.01.15
Posted by 구차니

먼가 훅훅 지나간다. 연휴라 그런가.

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

자도자도 피곤하구만  (2) 2020.02.09
오랫만의 휴식  (0) 2020.02.08
정신없는 새해  (0) 2020.01.25
바쁘고 힘든 주말  (0) 2020.01.12
약간의 앨범정리  (0) 2019.12.28
Posted by 구차니