글

handle vcpkg install library error on linux

1. change library version with manifest - baseline - override 2. edit portfile.cmake - using patch file to edit source

vcpkg skia linux build - release include/core/SkRefCnt.h:166: fatal error: "assert(rc == 1)"

SK_DEBUG bug set "-DCMAKE_BUILD_TYPE=Release"

vscode - typescript setting

$ tsc --init ctrl + shift + b -> watch

golang print at run test

set golang test option at settings.json - create .vscode/settings.json  {     "go.testTimeout" : "10m" ,     "go.testFlags" : [ "-v" ] }

react + typescript + leaflet

create project $ npx create-react-app@latest project-name –template typescript $ cd project-name $ yarn add react react-dom leaflet $ yarn add react-leaflet $ yarn add -D @types/leaflet add App.css .leaflet-container { width: 100%; height: 100vh; } change App.tsx import { MapContainer, TileLayer } from "react-leaflet"; import "leaflet/dist/leaflet.css"; import "./App.css"; function App() { return ( <div className="App"> <MapContainer center={[36, 128]} zoom={4} scrollWheelZoom={true}> <TileLayer attribution='&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" /> </MapContainer> </div> ); } export default App;

react-flutter

react + typescript + leaflet create project $ npx create-react-app@latest project-name –template typescript $ cd project-name $ yarn add react react-dom leaflet $ yarn add react-leaflet $ yarn add -D @types/leaflet add App.css .leaflet-container { width: 100%; height: 100vh; } change App.tsx import { MapContainer, TileLayer } from "react-leaflet"; import "leaflet/dist/leaflet.css"; import "./App.css"; function App() { return ( <div className="App"> <MapContainer center={[36, 128]} zoom={4} scrollWheelZoom={true}> <TileLayer attribution='&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" /> </MapContainer> </div> ); } export default App;

git remove submodule

git submodule deinit -f -- third_party/submodule rm -rf .git/modules/third_party/submodule git rm -f third_party/submodule

Flutter - runZonedGuarded

Flutter 에서 Isolate 를 사용하는 경우 내부에서 발생하는 예외가 예외 처리 코드를 작성했음에도 불구하고 Unhandled exception 으로 발생하는 경우가 있다. 예를 들어 Socket Write 중에 다음과 같은 예외가 발생하는 경우 Unhandled 로 처리되고 프로그램이 올바르게 예외 처리를 하지 않는다. SocketException: Write failed (OS Error: Broken pipe, errno = 32) E/flutter (28440): [ERROR:flutter/runtime/dart_isolate.cc(1148)] Unhandled exception: E/flutter (28440): SocketException: Write failed (OS Error: Broken pipe, errno = 32), address = 0.0.0.0, port = 9999 E/flutter (28440): #0 _NativeSocket.write (dart:io-patch/socket_patch.dart:1182) E/flutter (28440): #1 _RawSocket.write (dart:io-patch/socket_patch.dart:1897) E/flutter (28440): #2 _Socket._write (dart:io-patch/socket_patch.dart:2334) E/flutter (28440): #3 _SocketStreamConsumer.write (dart:io-patch/socket_patch.dart:2082) E/flutter (28440): #4 _SocketStreamConsumer.addStream.<anonymous closure> (dart:io-patch/socket_patch.dart:2056) E/flutter (28440): #5 _RootZone.runUnaryGuarded (dart:async/zone.dart:...

dart:isolate 전송 가능한 메시지 타입

 https://api.dart.dev/stable/2.14.4/dart-isolate/SendPort/send.html Null bool int double String List  or  Map  (whose elements are any of these) TransferableTypedData SendPort Capability

Rust - Visual Studio Code unittest debugging

CodeLLDB 설치 Debug 를 처음 실행하면 launch.json 이 생성됨 Debug 탭에서 Debugging 을 수행할 단위 테스트를 선택하여 실행

android emulator port forward

Android Emulator Port Forward 안드로이드 앱이 TCP 서버가 되는 경우가 있다. 이때 앱을 Emulator 에서 실행하고 Emulator 가 사용하는 주소인 10.0.2.15 로 접속하면 올바르게 동작하지 않는다. 이때는 ADB 를 사용하여 Port Forwarding 을 수행해야 한다. adb forward tcp:9999 tcp:9999

Flutter - YUV420 to RGB

Flutter CameraImage Convert flutter 에서 카메라 이미지를 조작하려는 경우 먼저 yuv420 형식인 CameraImage 를 rgb 형식으로 변환할 필요가 있다. 우선 wikipedia 에서 YUV 형식을 이해할 수 있다. https://en.wikipedia.org/wiki/YUV 그리고 좋은 예제는 아래의 블로그에서 확인할 수 있다. https://medium.com/@hugand/capture-photos-from-camera-using-image-stream-with-flutter-e9af94bc2bee 주의해야 할 점은 CameraImage 의 planes[0] 즉 y 값의 인덱스 계산에 bytesPerRow 값을 사용해야 하는 것이다. 예제에서는 y 값의 인덱스 계산에 width 값을 그대로 사용하는데 CameraImage 의 값에 따라서 rgb 로 변환된 이미지가 깨질 수도 있기 때문이다.

유니코드 한글 분석

  초성 LIST_OF_ONSET = ['ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'] 중성 LIST_OF_NUCLEUS = ['ㅏ', 'ㅐ', 'ㅑ', 'ㅒ', 'ㅓ', 'ㅔ', 'ㅕ', 'ㅖ', 'ㅗ', 'ㅘ', 'ㅙ', 'ㅚ', 'ㅛ', 'ㅜ', 'ㅝ', 'ㅞ', 'ㅟ', 'ㅠ', 'ㅡ', 'ㅢ', 'ㅣ'] 종성 LIST_OF_CODA = [' ', 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ', 'ㄺ', 'ㄻ', 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ', 'ㅂ', 'ㅄ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'] 한글 OFFSET OFFSET = 0xAC00 조합 @staticmethod def compos...

Raspberry Pi - visual studio code Remote.SSH

  code.visualstudio.com/docs/remote/ssh#_getting-started   Developing on Remote Machines using SSH and Visual Studio Code Developing on Remote Machines or VMs using Visual Studio Code Remote Development and SSH code.visualstudio.com Raspberry Pi 사용시 터미널로 접속하면서 Remote.SSH 를 사용하려고 시도하면 오류가 발생한다.    Remote.SSH: Remote Server Listen On Socket 을 체크한다.

Sqlite - SQLITE_BUSY 처리 방식

  여러 프로세스가 트랜젝션을 동시에 수행하려는 경우 busy 오류가 발생할 수 있다. busy 해결 방식 중 하나는 busy_timeout 시간을 설정하여 해당 시간 내에서는 계속 시도하도록 하는 것이다. PRAGMA 설정으로 busy_timeout 을 설정할 수 있다.   #PRAGMA busy_timeout=500   https://www.sqlite.org/pragma.html#pragma_busy_timeout   Pragma statements supported by SQLite If the result is a general expression, not a just the name of a source table column, then the name of the result is a copy of the expression text. www.sqlite.org   PRAGMA busy_timeout; PRAGMA busy_timeout =  milliseconds ; Query or change the setting of the  busy timeout . This pragma is an alternative to the  sqlite3_busy_timeout()  C-language interface which is made available as a pragma for use with language bindings that do not provide direct access to  sqlite3_busy_timeout() . Each database connection can only have a single  busy handler . This PRAGMA sets the busy handler for the process, possibly overwriting any previously set busy handler.   https:...

GDB - Attach Process

  Attach Process $ gdb --pid [PID]   Continue (gdb) c   Backtrace (gdb) bt   Inquire about existing threads (gdb) info threads

Ubuntu Gnome Desktop 애니메이션 효과 중지하기

  중지 $ gsettings set org.gnome.desktop.interface enable-animations false   복원 $ gsettings reset org.gnome.desktop.interface enable-animations

/bin/sh^M: bad interpreter

  스크립트를 위도우에서 생성하고 리눅스에서 실행할 때 발생   바이너리 모드로 스크립트를 편집 $ vi run.sh -b   모든 ^M 문자를 제거

윈도우에서 cgo 라이브러리 사용하기 (github.com/pebbe/zmq4)

  윈도우 환경에서 c 라이브러리를 빌드하고 cgo 를 사용하여 go 에서 사용하는 경우가 있다.    c 라이브러리의 빌드는 직접할 수도 있지만 vcpkg 에 라이브러리가 등록되어 있다면 vcpkg 를 사용하는 것이 편하다.   빌드된 라이브러리는 vcpkg/installed/x64-windows 의 include, lib, bin 에 위치한다.   cgo 는 gcc 를 사용하기 때문에 윈도우에서 gcc 를 사용할 수 있는 환경이 필요하고   앞서 빌드한 라이브러리는 해당 환경에 옮겨져야 한다.    윈도우에서 gcc 를 사용할 수 있는 라이브러리로는 mingw 가 있고   mingw 가 참조하고 있는 include, lib, bin 에 라이브러리를 옮겨야 하는 것이다.    그리고 실행시점에는 dll 을 참조할 수 있어야하는데 실행파일과 동일한 위치에 dll 을 복사하거나   윈도우 환경변수의 Path 에 dll 의 위치를 넣어줘야 한다.     github.com/pebbe/zmq4 를 예제로 과정을 정리해보자.   zmq4 는 libzmq 를 사용한다. 따라서 우선 vcpkg 로 zeromq 를 설치한다.    vcpkg/installed/x64-windows 폴더의 include, lib, bin 폴더에 각각    zmq.h, libzmq-mt-4_3_3.lib, libzmq-mt-4_3_3.dll 이 생성된다.    윈도우 환경변수 Path 에 vcpkg/installed/x64-windows/bin 폴더를 추가한다.    mingw 라이브러리로는 TDM-GCC 를 사용했다. 설치후 폴더를 확인해보면    x86_64-w64-mingw32 폴더를 찾을 수 있고 해당 폴더에서 include, lib, bin 폴더를 확인할 수...

vcpkg windows, linux 사용 방식

  별도의 폴더를 만들어서 사용한다.   windows 에서는 vcpkg_windows 로 폴더를 만들어서 환경변수에 VCPKG_ROOT 로 등록한다.  linux 에서는 vcpkg_linux 로 폴더를 만들어서 환경변수에 VCPKG_ROOT 로 등록한다.