Programming/vue.js2024. 5. 9. 10:21

created가 이름부터 당연하지만(?) mounted 보다 우선적으로 작동하고

mounted는 ui에 연결되는 변수에 대해서 초기화 하는 쪽

 

[링크 : https://ko.vuejs.org/guide/essentials/lifecycle]

    [링크 : https://webruden.tistory.com/926]

[링크 : https://aomee0880.tistory.com/185]

 

computed는 저장된 결과를 반환

method는 렌더링 시 마다 함수 실행

이라는데 무슨 뜻인지.. 종속된 값이 먼지 부터 찾아 봐야 할 듯.

[링크 : https://sunny921.github.io/posts/vuejs-computed-method/]

 

computed는 값이 변하는 이벤트가 발생하지 않으면 처리 조차 하지 않고 기존 값을 리턴(캐싱) 한다.

computed는 예제의 message의 값이 변했을 경우만 다시 렌더링 한다.

[링크 : https://kbcoding.tistory.com/47]

 

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

vue.js node.js 메모리 누수?  (0) 2024.04.22
vue webpack  (0) 2024.04.19
vue import "@"  (0) 2024.04.19
vue webpack ckeditor  (0) 2024.04.19
vue3 ckeditor5 document editor 추가하기  (0) 2024.04.18
Posted by 구차니

python 실행하기 위한 명령어 줄, 물론 pip 로 패키지도 없어서 그냥 깡통 python 상태

$ docker run --rm -it python python

[링크 : https://seorenn.github.io/note/docker-development-environment.html]

 

docker 로 장치연결해주기

docker run -ti -v /tmp/.X11-unix/:/tmp/.X11-unix --env QT_X11_NO_MITSHM=1 --device=/dev/video0:/dev/video0 -e DISPLAY=$DISPLAY --name test pytorch/pytorch:1.12.1-cuda11.3-cudnn8-devel /bin/bash

[링크 : https://shuka.tistory.com/68]

[링크 : https://blog.naver.com/cheeryun/222383212241]

 

$ docker run --rm -it python bash
# pip install opencv-python

[링크 : https://pypi.org/project/opencv-python/]

 

아래는 테스트 필요 + docker 내에서 해야하나 찾아보는 중

$ sudo apt install libgl1-mesa-glx libglib2.0-0

[링크 : https://yuevelyne.tistory.com/entry/OpenCV-ImportError-libGLso1-cannot-open-shared-object-file-No-such-file-or-directory]

 

wayland 예제 검색.. 

$ docker run -e XDG_RUNTIME_DIR=/tmp \
           -e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
           -v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY  \
           --user=$(id -u):$(id -g) \
           imagename waylandapplication


[링크 : https://unix.stackexchange.com/questions/330366/]

 

ubuntu 22.04 인데 안된다. ㅠㅠ

Qt 쪽 변수를 넘겨줘야 하나?

>>> cv2.imshow("test",a)
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/lib/python3.12/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Aborted (core dumped)

 

패키지 깐다고 해결되면 행복은 하겠는데...

pip install PyQt5

[링크 : https://csm-kr.tistory.com/114]

'Programming > python(파이썬)' 카테고리의 다른 글

python soundcard 라이브러리  (0) 2024.05.21
python 사운드 장치  (0) 2024.05.10
python thread event  (0) 2024.03.05
cv2.ximgproc 없을 경우  (0) 2024.02.28
cv2.stereoBM + WLS  (0) 2024.02.28
Posted by 구차니
Programming/vue.js2024. 4. 22. 17:35

vue에서 npm run server 하는데, 아래처럼 메시지가 나오고 멈춰있어서

[70%] sealing finish module graph ESLintWebpackPlugin_1

 

top 으로 보는데 node 가 32G의 메모리는 가상으로 잡고 있는걸 보고 기겁..

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                  
  61734 root      20   0   31.8g   1.0g  41728 R 100.0   6.7   3:02.32 node           

 

아무튼 가상메모리 관련해서 문제가 있는거 아닌가 해서 우회법을 찾는데 영.. 되질 않네

[링크 : https://divlook.tistory.com/10]

[링크 : https://evan-moon.github.io/2019/08/08/fix-webpack-dev-memory-leak/]

 

NODE_OPTIONS=--max-old-space-size=4096

Note
: If you have specified export NODE_OPTIONS=<value> in your package.json, it'll override what you set in the NODE_OPTIONS environment variable in the config.yml (either at the container, job, or step respective level)

[링크 : https://support.circleci.com/hc/en-us/articles/360009208393-How-Can-I-Increase-the-Max-Memory-for-Node]

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

vue created mounted, method computed  (0) 2024.05.09
vue webpack  (0) 2024.04.19
vue import "@"  (0) 2024.04.19
vue webpack ckeditor  (0) 2024.04.19
vue3 ckeditor5 document editor 추가하기  (0) 2024.04.18
Posted by 구차니
Programming/vue.js2024. 4. 19. 19:06

도대체 이 망할(?) webpack은 처음부터 되어있던거 아닌가?

ckeditor 넣어서 하려니 멀 어떻게 해야 할지 감이 안돈다.

 

[링크 : https://cli.vuejs.org/guide/webpack.html]

[링크 : https://reintech.io/blog/integrating-vue-js-with-webpack]

 

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

vue created mounted, method computed  (0) 2024.05.09
vue.js node.js 메모리 누수?  (0) 2024.04.22
vue import "@"  (0) 2024.04.19
vue webpack ckeditor  (0) 2024.04.19
vue3 ckeditor5 document editor 추가하기  (0) 2024.04.18
Posted by 구차니
Programming/vue.js2024. 4. 19. 18:07

node.js 에서 alias로 정의되는 소스 디렉토리의 경로

[링크 : https://mikkeller.tistory.com/26]

[링크 : https://stackoverflow.com/questions/42749973/what-does-the-mean-inside-an-import-path]

 

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

vue.js node.js 메모리 누수?  (0) 2024.04.22
vue webpack  (0) 2024.04.19
vue webpack ckeditor  (0) 2024.04.19
vue3 ckeditor5 document editor 추가하기  (0) 2024.04.18
vue 입력창 포커스 설정  (0) 2024.03.28
Posted by 구차니
Programming/vue.js2024. 4. 19. 15:36

기능 하나 추가하려니 -build- 라는걸 쓰니까, 이미 빌드된거라 다른걸 추가하면 충돌나면서

ckeditor-duplicated-modules 이런 에러가 발생한다.

 

해결하려면 online builder로 zip 파일을 받거나

vite나 webpack을 이용하여 원하는 플러그인을 추가한 다음 빌드해서 써야 하는 것으로 보인다.

[링크 : https://github.com/ckeditor/ckeditor5-vue/issues/215]

[링크 : https://ckeditor.com/docs/ckeditor5/latest/installation/integrations/vuejs-v3.html#webpack]

[링크 : https://ckeditor.com/docs/ckeditor5/latest/installation/advanced/alternative-setups/integrating-from-source-webpack.html]

 

[링크 : https://2jun0.tistory.com/27]

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

vue webpack  (0) 2024.04.19
vue import "@"  (0) 2024.04.19
vue3 ckeditor5 document editor 추가하기  (0) 2024.04.18
vue 입력창 포커스 설정  (0) 2024.03.28
vue proxy  (0) 2024.03.26
Posted by 구차니

이전 예제는 모바일 크롬에서 안되서 다시 찾아봄

 

[링크 : https://github.com/LazarSoft/jsqrcode/tree/master/src]

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

QR decoder로 로또 추첨하기  (0) 2024.04.16
javascript 집합(set) 내용 출력하기  (0) 2024.04.16
js split()  (0) 2024.04.12
자바스크립트 옵셔널 체이닝(optional chaining)  (0) 2024.04.08
qr decoder part 2  (0) 2024.04.07
Posted by 구차니
Programming/android2024. 4. 19. 00:05

 

chrome://inspect/#devices

[링크 : https://hotel-iu.tistory.com/279]

 

오랫만에 해서 USB 디버깅 켜는 법도 까먹었네

빌드버전 열심히 누르면 디버깅 모드가 숨겨져 있다가 나타난다

[링크 : https://support.google.com/android/thread/231740096/관리자가-아닌-사용자-환경에서-개발자-모드-활성화-안됨?hl=ko]

 

핸드폰에서 왜 안되었나 했는데..

핸드폰이 느려서 읽는데 반응을 못해준거였냐 -_-

index.min.js:1 Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true. See: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently
o._createImageData @ index.min.js:1
o._decodeFromImageElm @ index.min.js:1
(anonymous) @ index.min.js:1
(anonymous) @ index.min.js:1
(anonymous) @ index.min.js:1
a @ index.min.js:1
o.decodeFromImage @ index.min.js:1
eval @ VM138:1
qr_decode @ lotto.html:38
await in qr_decode (async)
preview.onload @ lotto.html:62
load (async)
reader.onload @ lotto.html:61
load (async)
previewFile @ lotto.html:57
onchange @ lotto.html:12
Promise {: false}[[Prototype]]: Promise[[PromiseState]]: "fulfilled"[[PromiseResult]]: false

[링크 : https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently]

 

수정해 보았는데 영 안되네.. -_-

getContext('2d', { willReadFrequently: true });

[링크 : https://stackoverflow.com/questions/74020182/canvas2d-multiple-readback-operations-using-getimagedata-are-faster-with-the-wi]

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

android hdmi rotate  (4) 2022.05.12
안드로이드 강제 종료  (0) 2022.03.11
안드로이드 앱 자동 실행 설정  (0) 2022.03.02
안드로이드 system.img 마운트 하기  (0) 2022.02.18
안드로이드 64bit 지원  (0) 2021.07.27
Posted by 구차니
Programming/vue.js2024. 4. 18. 16:20

classic editor는 이미지 크기를 조절할 수 없어서 설정 가능한 에디터를 찾아봤더니 document editor라는 녀석이 필요하다고 한다.

그런데 얘는 희한하게(?) 툴바가 안나오는데, 별도의 위치에서 붙여줘야 하는 녀석인 듯.

<template>
    <div class="document-editor__toolbar"></div>
    <div class="document-editor__editable-container">
        <ckeditor :editor="editor" :config="editorConfig"  @ready="onReady"></ckeditor>
    </div>
</template>

// ...

methods: {
      onReady(editor) {
          const toolbarContainer = document.querySelector(  '.document-editor__toolbar' );
          toolbarContainer.appendChild( editor.ui.view.toolbar.element );
      }
}

[링크 : https://github.com/ckeditor/ckeditor5-vue/issues/120]

 

읽기 전용 모드로 바꾸려고 하니

readonly와 disabled가 있는데 

<template>
    <vx-card :title="editorName" v-if="loaded">
        <ckeditor :editor="editor" v-model="editorData" :config="editorConfig" :readonly="editorDisabled" :disabled="editorDisabled" ></ckeditor>
    </vx-card>
</template>

[링크 : https://stackoverflow.com/questions/63344958/inline-editor-disable-editor-and-display-html-render-content-vue]

 

readonly는 readonly property라 상태보는 용도로만 사용해야 하고

[링크 : https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_editor.html#property-readOnly]

 

setReadOnly() 함수를 이용해 상태를 변경해야 한다.

[링크 : https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_editor.html#method-setReadOnly]

 

상태에 따라 toolbar의 표시를 on/off 해주는 방법도 좋을 듯.

ClassicEditor
    .create( document.querySelector( '#editor' ), {
        // The editor's configuration.
        // ...
    } )
    .then( editor => {
        const toolbarElement = editor.ui.view.toolbar.element;

        editor.on( 'change:isReadOnly', ( evt, propertyName, isReadOnly ) => {
            if ( isReadOnly ) {
                toolbarElement.style.display = 'none';
            } else {
                toolbarElement.style.display = 'flex';
            }
        } );
    } )
    .catch( error => {
        console.log( error );
    } );

[링크 : https://ckeditor.com/docs/ckeditor5/latest/features/read-only.html]

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

vue import "@"  (0) 2024.04.19
vue webpack ckeditor  (0) 2024.04.19
vue 입력창 포커스 설정  (0) 2024.03.28
vue proxy  (0) 2024.03.26
vue.js i18n  (0) 2024.02.19
Posted by 구차니

 qr 디코더 소스는 아래의 npm 으로 공개된 녀석을 이용

[링크 : https://github.com/yugasun/qrcode-decoder]

 

 

귀찮으니 최대한 대충 짜기

그나저나 요즘 크롬은 https 로 강제로 돌려서 http로 해두면 되질 않고

그렇다고 사설 인증서 쓰면 또 경고 띄우고 겁나 짱나네?!

$ cat lotto.html 
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Lotto from QR</title>
</head>
<body>
  <span id="result1">decode</span><br />
  <span id="result2">set</span><br />
  <span id="result3">random</span><br />
  <input type="button" onclick="rand();" value="추첨"/><br />
  <input type="file" onchange="previewFile();" /><br />
  <img id="lotto" src="" alt="이미지 미리보기..." />
</body>
<script src="./lib/index.min.js"></script>
<script>
function rand() {
    e = new Set()
    var val = 0;
    for(i = 0; i < 6; i++)
    {
        do {
            val = parseInt(Math.random() * 45 + 1)
        } while(d.has(val) ||  e.has(val))
        e.add(val)
    }

    var result3 = document.querySelector("#result3");
    result3.innerHTML = Array.from(e).sort((a, b) => a - b)
}
  
  async function qr_decode() {
    var qr = new QrcodeDecoder();
    var img1 = document.querySelector("#lotto");
    const code = await qr.decodeFromImage(img1);
    console.log(code);

    var result = document.querySelector("#result1");
    result.innerHTML = code.data;

    a = code.data.split('v=')
    b = a[1].split('q')
    c = b[1]+b[2]+b[3]+b[4] +b[5].slice(0,12) 
    d = new Set()
    for(i = 0; i < c.length ; i+=2)
        d.add(parseInt(c.slice(i, i+2)))
 
     var result2 = document.querySelector("#result2");
    result2.innerHTML = Array.from(d).sort((a, b) => a - b)

    rand();
  }

  function previewFile() {
    var file = document.querySelector("input[type=file]").files[0];
    var reader = new FileReader();
    reader.onload =
      function () {
        var preview = document.querySelector("#lotto");
        preview.src = reader.result;
        preview.onload = function () {
          qr_decode();
        }
      }

    if (file) {
      reader.readAsDataURL(file);
    }
  }
</script>

</html>

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

qr decoder  (0) 2024.04.19
javascript 집합(set) 내용 출력하기  (0) 2024.04.16
js split()  (0) 2024.04.12
자바스크립트 옵셔널 체이닝(optional chaining)  (0) 2024.04.08
qr decoder part 2  (0) 2024.04.07
Posted by 구차니