글

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 을 체크한다.