해보니 리눅스에서도 좀 헷갈려 하는지

터치는 마우스 이벤트로 넘어가지 않네. 어떤 이벤트를 통해 터치스크린 손 터치와 펜 터치를 인식하려나?

 

[링크 : https://www.javatpoint.com/opencv-mouse-event]

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

python debug (pdb)  (0) 2022.03.04
opencv python  (0) 2022.02.25
python op overload magic method  (0) 2021.06.14
pythonpath  (0) 2021.04.16
python yield  (0) 2021.04.07
Posted by 구차니
Programming/android2022. 2. 18. 18:54

simg2img 유틸리티를 이용해서 변환 후 ext4로 마운트

 

mkdir sys
./simg2img system.img sys.raw
sudo mount -t ext4 -o loop sys.raw sys/

[링크 : https://stackoverflow.com/questions/8663891/how-to-mount-the-android-img-file-under-linux]

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

안드로이드 강제 종료  (0) 2022.03.11
안드로이드 앱 자동 실행 설정  (0) 2022.03.02
안드로이드 64bit 지원  (0) 2021.07.27
핸드폰으로 만든 앱 올리기  (0) 2020.06.17
안드로이드 문자열 (string.xml)  (0) 2020.06.11
Posted by 구차니
Programming/golang2022. 2. 17. 18:26

 

$ vi hello.go
$ go build hello.go 
$ go run hello.go 
hello world

$ file hello
hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped

$ ldd hello
동적 실행 파일이 아닙니다

$ ls -alh
-rwxrwxr-x 1 minimonk minimonk 2.0M  2월 17 18:25 hello
-rw-rw-r-- 1 minimonk minimonk   73  2월 17 18:25 hello.go

[링크 : https://gobyexample.com/hello-world]

 

+

go install 부분을 sudo로 해서 그런가 go build도 sudo를 하지 않으면 안된다.

퍼미션 문제는 어떻게 해결할 수 있으려나...

 

$ go install -buildmode=shared std
$ sudo go build -linkshared hello.go
ls -alh
$ ls -alh
합계 32K
-rwxr-xr-x 1 root     root      20K  2월 17 18:28 hello
-rw-rw-r-- 1 minimonk minimonk   73  2월 17 18:25 hello.go

$ ldd hello
linux-vdso.so.1 (0x00007ffcfb5a4000)
libstd.so => /usr/lib/go-1.10/pkg/linux_amd64_dynlink/libstd.so (0x00007f2647852000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2647461000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f264725d000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f264703e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2649ee5000)

[링크 : https://stackoverflow.com/questions/19431296/building-and-linking-dynamically-from-a-go-binary]

 

+

2022.02.18

$ ls -alh /usr/lib/go-1.10/pkg/linux_amd64_dynlink/*so
-rw-r--r-- 1 root root 31M  2월 17 18:28 /usr/lib/go-1.10/pkg/linux_amd64_dynlink/libstd.so

$ ldd libstd.so 
linux-vdso.so.1 (0x00007ffcbe083000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f379ff4e000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f379fd2f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f379f93e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f37a25e1000)

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

golang gore(repl), delve  (0) 2022.03.31
go build 옵션  (0) 2022.03.31
go lang static http server  (0) 2022.03.10
go lang rest  (0) 2022.02.11
golang  (0) 2020.05.18
Posted by 구차니
Programming/golang2022. 2. 11. 19:38

node.js 처럼 go mod init 명령을 통해 모듈을 설치할 수 있는 것 같다.

 

go 1.10은 지원도 끊어졌고 해당 명령어 지원하지 않으니

g0 1.11은 가야 할 것 같다.

[링크 : https://stackoverflow.com/questions/60410729/unknown-subcommand-mod-error-while-running-go-mod-init]

 

아래껀 천천히 테스트 해봐야겠네..

(우분투 20.04로 가야하나...)

go mod init noah.io/ark/rest
$ vi main.go
package main

import (
"encoding/json"
"net/http"
)

var users = map[string]*User{}

type User struct {
Nickname string `json:"nickname"`
Email    string `json:"email"`
}

func main() {
http.HandleFunc("/users", func(wr http.ResponseWriter, r *http.Request) {
switch r.Method {
case http.MethodGet: // 조회
json.NewEncoder(wr).Encode(users) // 인코딩
case http.MethodPost: // 등록
var user User
json.NewDecoder(r.Body).Decode(&user) // 디코딩

users[user.Email] = &user

json.NewEncoder(wr).Encode(user) // 인코딩
}
})
http.ListenAndServe(":8080", nil)
}

[링크 : https://woony-sik.tistory.com/m/12]

 

$ go get github.com/julienschmidt/httprouter
$ vi rest.go
package main

import (
    "fmt"
    "github.com/julienschmidt/httprouter"
    "net/http"
    "log"
)

func Index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
    fmt.Fprint(w, "Welcome!\n")
}

func Hello(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
    fmt.Fprintf(w, "hello, %s!\n", ps.ByName("name"))
}

func main() {
    router := httprouter.New()
    router.GET("/", Index)
    router.GET("/hello/:name", Hello)

    log.Fatal(http.ListenAndServe(":8080", router))
}

[링크 : https://okky.kr/article/386116]

 

+

backport를 깔아주면 된다고는 한다.

$ sudo add-apt-repository ppa:longsleep/golang-backports
$ sudo apt-get install software-properties-common
$ sudo apt-get update 
$ sudo apt-get install golang-1.11

[링크 : https://www.gophp.io/install-go-1-11-on-ubuntu-18-04/]

 

추가해보니 1.18까지도 나왔나 보다.

$ sudo add-apt-repository ppa:longsleep/golang-backports
Golang 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17 and 1.18 PPA for Ubuntu
 더 많은 정보: https://launchpad.net/~longsleep/+archive/ubuntu/golang-backports
[ENTER]을 눌러 진행하거나 Ctrl-c를 눌러 추가하는것을 취소합니다.

 

그래도 1.17을 기준으로 설치 되는 듯.

$ sudo apt-get install golang
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
다음 패키지가 자동으로 설치되었지만 더 이상 필요하지 않습니다:
  golang-1.10-go golang-1.10-race-detector-runtime golang-1.10-src
  golang-1.11-doc golang-1.11-go golang-1.11-race-detector-runtime
  golang-1.11-src golang-race-detector-runtime
Use 'sudo apt autoremove' to remove them.
다음의 추가 패키지가 설치될 것입니다 :
  golang-1.17 golang-1.17-doc golang-1.17-go golang-1.17-src golang-doc
  golang-go golang-src
제안하는 패키지:
  bzr | brz mercurial subversion
다음 새 패키지를 설치할 것입니다:
  golang golang-1.17 golang-1.17-doc golang-1.17-go golang-1.17-src golang-doc
다음 패키지를 업그레이드할 것입니다:
  golang-go golang-src
2개 업그레이드, 6개 새로 설치, 0개 제거 및 1개 업그레이드 안 함.
72.0 M바이트 아카이브를 받아야 합니다.
이 작업 후 424 M바이트의 디스크 공간을 더 사용하게 됩니다.

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

golang gore(repl), delve  (0) 2022.03.31
go build 옵션  (0) 2022.03.31
go lang static http server  (0) 2022.03.10
go hello world build static / shared  (0) 2022.02.17
golang  (0) 2020.05.18
Posted by 구차니
Programming/openGL2022. 2. 8. 12:47

mat 변수가 나오는걸 봐서는 구버전이라.. 요즘꺼에 돌려보려면 조금 고생할 듯.

openGL은 텍스쳐까진 보질 못해서 코드를 이해 못하겠네..

 

[링크 : https://webnautes.tistory.com/1098]

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

opengl glortho gluperspective  (0) 2023.08.28
glReadPixels() 와 glUseProgram()  (0) 2022.11.17
glMatrixMode()  (0) 2020.04.14
opengl superbible 3rd 리눅스 빌드 패키지  (0) 2020.04.08
opengl super bible 3rd - 4,5 chapter  (0) 2020.04.06
Posted by 구차니
Programming/openCV2022. 1. 25. 18:11

키즈카페에 있는 빔 프로젝터 + 카메라 식으로

카메라를 통해 사람을 인식하고 사람의 영역을 인식해 마우스 이벤트로 혹은

영역을 선택해 해당 영역의 객체를 터트리는 식으로 구현해볼까 고민중..

 

[링크 : https://pythonrepo.com/repo/HxnDev-Virtual-Mouse-using-OpenCV-python-computer-vision]

[링크 : https://thecodacus.com/posts/2021-12-14-gesture-recognition-virtual-mouse-using-opencv/]

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

opencv를 이용한 다중 템플릿 추적  (0) 2024.01.15
cv2.imshow cv2.waitKey  (0) 2022.03.14
opencv-3.4.0 어플리케이션 빌드  (0) 2021.01.14
opencv face detect  (0) 2019.05.10
vscode python3 opencv lint  (0) 2019.05.10
Posted by 구차니
Programming/web 관련2021. 12. 14. 19:25

openGL ES를 쓰니 문법이나 함수 사용하는게

미묘하게 다를수 밖에 없겠군

 

[링크 : https://developer.chrome.com/docs/native-client/devguide/coding/3D-graphics/]

+

2025.05.11 링크 깨짐

'Programming > web 관련' 카테고리의 다른 글

quirks mode  (0) 2022.08.08
grid와 flex  (0) 2022.07.04
markdown 문법 - 체크박스  (0) 2020.10.15
크롬 확장도구 - json viewer  (0) 2019.08.07
resizable table cell  (0) 2019.06.17
Posted by 구차니
Programming/qt2021. 12. 8. 16:52

cpp는 친하지 않아서 읽는법도 모르겠네 -_ㅠ

 

MainWindow::MainWindow(QWidget *parent) :  
    QMainWindow(parent),  
    ui(new Ui::MainWindow)  
{  
    ui->setupUi(this);  
}

[링크 : https://stackoverflow.com/questions/4847110/a-newbie-question-in-qt]

  [링크 : https://www.cprogramming.com/tutorial/initialization-lists-c++.html]

[링크 : https://cakel.tistory.com/entry/0031-GUI-프로그래밍-소개]

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

qt5 fb reset  (0) 2021.02.23
qt framebuffer에 출력하기  (0) 2021.02.09
qt - ts / qm  (0) 2015.02.24
qt 5.3 cross compile 조사  (0) 2015.01.21
qt 4.x/5.x INSTALL_PATH  (0) 2015.01.20
Posted by 구차니
Programming/wasm2021. 11. 25. 19:07

웹 어셈블리에서

인자로 입력 받아 결과를 웹에서 받는 예제를 찾아봄.

 

wasm으로 변환될 코드는 int 형을 받아서 int 형으로 출력할 것이고

#include <math.h>

extern "C" {

int int_sqrt(int x) {
  return sqrt(x);
}

}

 

빌드는 아래와 같이 emcc를 통해 ccall과 cwrap 방식으로 _int_sqrt 함수를 내보내라 인것 같은데

int_sqrt가 아니라 _int_sqrt는 calling convention때문인가?

$ emcc tests/hello_function.cpp -o function.html -s EXPORTED_FUNCTIONS='["_int_sqrt"]' -s EXPORTED_RUNTIME_METHODS='["ccall","cwrap"]'

 

웹에서 받는 법이 두가지라는데 cwrap으로 하면 int_sqrt 객체를 만들어서 한다는데 리턴이 되는진 모르겠고

ccall로 하면 인자를 던지는게 조금 귀찮아 지지만 var result에 결과가 들어가는 듯.

int_sqrt = Module.cwrap('int_sqrt', 'number', ['number'])
int_sqrt(12)
int_sqrt(28)

// Call C from JavaScript
var result = Module.ccall('int_sqrt', // name of C function
  'number', // return type
  ['number'], // argument types
  [28]); // arguments

// result is 5

[링크 : https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html]

 

 

[링크 : https://m.blog.daum.net/junek69/88]

[링크 : https://developer.mozilla.org/ko/docs/WebAssembly/C_to_wasm]

 

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

wasm 배열 예제  (0) 2023.01.31
wasm text format  (0) 2021.10.26
wasm text 와 binary 상호변환  (0) 2021.10.26
emcc wasm 빌드  (0) 2021.10.25
wasm from c, cpp  (0) 2021.10.24
Posted by 구차니
Programming/C++ STL2021. 11. 10. 18:10

QT에서 QSeialPort.open() 이 있고

QSerialPort를 상속받은 클래스에서

open()을 하면 자동으로 부모인 QSeialPort.open() 를 호출하게 되는데

CPP가 아닌 C의 fnctl.h의 open()을 열고 싶으면

::open()을 하면 되...나?

 

[링크 : https://stackoverflow.com/questions/10772169/calling-same-name-function]

'Programming > C++ STL' 카테고리의 다른 글

cpp lambda  (0) 2024.11.22
cpp static_cast<type>  (0) 2023.02.09
vector 값 비우기  (0) 2021.10.02
cpp 부모타입으로 업 캐스팅 된 객체의 원래 클래스 알기  (0) 2021.09.30
cpp string 관련  (0) 2019.06.10
Posted by 구차니