'Programming'에 해당되는 글 1767건

  1. 2022.03.31 golang gore(repl), delve
  2. 2022.03.31 go build 옵션
  3. 2022.03.25 웹소켓
  4. 2022.03.15 python interactive mode
  5. 2022.03.14 python3 opencv2 checker board
  6. 2022.03.14 cv2.imshow cv2.waitKey
  7. 2022.03.14 pdb
  8. 2022.03.11 안드로이드 강제 종료
  9. 2022.03.10 go lang static http server
  10. 2022.03.04 python debug (pdb)
Programming/golang2022. 3. 31. 23:52

node.js나 python 같은 인터프리트 언어가 대세라 그런가..

컴파일 언어를 인터프리트 언어 처럼 쓰게 해주는 환경이라니..

REPL(read-eval-print loop)

[링크 : https://github.com/x-motemen/gore]

[링크 : https://gorepl.com/]

[링크 : https://tkim.info/ko/devnote/d054-gore쓰다가-답답해서-tour-of-go-설치해서-쓴-썰/]

 

delve는 디버거 패키지.. 아니 툴이라고 해야하나?

[링크 : https://www.joinc.co.kr/w/man/12/golang/delve]

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

golang 다른 파일 함수 불러오기  (0) 2022.04.04
liteide  (0) 2022.04.04
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
Posted by 구차니
Programming/golang2022. 3. 31. 19:05

gcc와 유사한 옵션들이군..

 

-o 옵션을 통해 실행파일 이름을 지정할 수 있는데, 지정하지 않을 경우 소스코드의 이름을 출력이름으로 지정한다.

go build [-o output] [build flags] [packages]

[링크 : https://pkg.go.dev/cmd/go]

 

 

$ go build -linkshared filename.go

옵션을 통해 빌드할때

open /usr/lib/go-1.17/pkg/linux_amd64_dynlink/archive/zip.shlibname: permission denied

권한이 부족해서 거부되었다는 에러가 발생하는데 대개는 sudo를 주고 하지만

왜 발생하나 궁금해서 찾아보니

dynlink에 파일들이 linkshared 옵션으로 빌드할때 날짜가 변경되는 것으로 보인다.

*.a 나 libstd.so 들 역시 변경되는걸 봐서는 linkshared로 빌드할때 해당 so도 같이 빌드 하는 듯.

[링크 : https://superuser.com/questions/739738/how-to-use-go-get-as-non-root]

 

dynlink 에서 GOROOT라는 변수가 보이길래 보는데 선언된건 없고..

$ cd $GOROOT/pkg/linux_amd64_dynlink
$ ls libstd.so
libstd.so

[링크 : https://www.codestudyblog.com/cs2112goa/1212131010.html]

 

도움말 보다보니 env라는 명령어 발견

$ go --help
Go is a tool for managing Go source code.

Usage:

        go <command> [arguments]

The commands are:

        bug         start a bug report
        build       compile packages and dependencies
        clean       remove object files and cached files
        doc         show documentation for package or symbol
        env         print Go environment information
        fix         update packages to use new APIs
        fmt         gofmt (reformat) package sources
        generate    generate Go files by processing source
        get         add dependencies to current module and install them
        install     compile and install packages and dependencies
        list        list packages or modules
        mod         module maintenance
        run         compile and run Go program
        test        test packages
        tool        run specified go tool
        version     print Go version
        vet         report likely mistakes in packages

Use "go help <command>" for more information about a command.

Additional help topics:

        buildconstraint build constraints
        buildmode       build modes
        c               calling between Go and C
        cache           build and test caching
        environment     environment variables
        filetype        file types
        go.mod          the go.mod file
        gopath          GOPATH environment variable
        gopath-get      legacy GOPATH go get
        goproxy         module proxy protocol
        importpath      import path syntax
        modules         modules, module versions, and more
        module-get      module-aware go get
        module-auth     module authentication using go.sum
        packages        package lists and patterns
        private         configuration for downloading non-public code
        testflag        testing flags
        testfunc        testing functions
        vcs             controlling version control with GOVCS

Use "go help <topic>" for more information about that topic.

 

$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/minimonk/.cache/go-build"
GOENV="/home/minimonk/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/minimonk/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/minimonk/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.17"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.17/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.8"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1772520358=/tmp/go-build -gno-record-gcc-switches"

 

저 놈의 GOTOOLDIR을 바꾸어 주면 되려나?

 

GOOS와 GOARCH를 이용해서 크로스컴파일 가능하다고 한다.

$ env GOOS=windows GOARCH=amd64 go build source.go

[링크 : https://www.digitalocean.com/community/tutorials/how-to-build-go-executables-for-multiple-platforms-on-ubuntu-16-04]

 

이게 되네..

$ GOARCH=arm go build hello.go
$ file hello
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped

$ GOARCH=arm64 go build hello.go
$ file hello
hello: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, not stripped

 

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

liteide  (0) 2022.04.04
golang gore(repl), delve  (0) 2022.03.31
go lang static http server  (0) 2022.03.10
go hello world build static / shared  (0) 2022.02.17
go lang rest  (0) 2022.02.11
Posted by 구차니
Programming/node.js2022. 3. 25. 17:43

전에 보기만 했지 다뤄본적은 없는데 크윽..

일단 웹을 통해서 소켓을 만드니까.. HTTPS 하면 자동으로 보안도 올라가고

릴레이 해주면 websocket - socket 도 가능하고..

 

[링크 : https://www.npmjs.com/package/websocket]

[링크 : https://niceman.tistory.com/109]

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

node.js 웹소켓 채팅 서버 예제  (0) 2022.07.14
ubuntu 18.04 / nodej.s 18.x 실패  (0) 2022.05.19
broadway / jsmpeg  (0) 2020.09.16
node.js array.sort() 주의사항  (0) 2020.02.01
node.js postgresql transaction  (0) 2020.01.31
Posted by 구차니

별건 아니고 그냥

python 실행해서 뜨는 프롬프트에서 입력해서 실행하는 모드

 

[링크 : https://en.m.wikibooks.org/wiki/Python_Programming/Interactive_mode]

[링크 : https://stackabuse.com/python-programming-in-interactive-vs-script-mode/]

 

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

python openCV / PIL 포맷 변경  (0) 2022.04.12
파이썬 딕셔너리 변수 생성과 리턴 enumerate, zip  (0) 2022.04.12
python3 opencv2 checker board  (0) 2022.03.14
pdb  (0) 2022.03.14
python debug (pdb)  (0) 2022.03.04
Posted by 구차니

나중에 따라해.. 봐야지 ㅠㅠ

 

[링크 : http://www.gisdeveloper.co.kr/?p=6868]

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

파이썬 딕셔너리 변수 생성과 리턴 enumerate, zip  (0) 2022.04.12
python interactive mode  (0) 2022.03.15
pdb  (0) 2022.03.14
python debug (pdb)  (0) 2022.03.04
opencv python  (0) 2022.02.25
Posted by 구차니
Programming/openCV2022. 3. 14. 19:38

imshow만 하면 검은 창만 비어서 나오는데

waitKey()로 메시지 루프(?)를 돌리지 않아서 그렇다고 한다.

 

[링크 : https://stackoverflow.com/questions/21810452]

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

opencv cv2.imshow() error  (0) 2024.01.16
opencv를 이용한 다중 템플릿 추적  (0) 2024.01.15
virtual mouse  (0) 2022.01.25
opencv-3.4.0 어플리케이션 빌드  (0) 2021.01.14
opencv face detect  (0) 2019.05.10
Posted by 구차니

pdb

 

$ pdb chcker.py 
> /home/minimonk/src/py/chcker.py(1)<module>()
-> import numpy as np
(Pdb) run
Restarting chcker.py with arguments:

> /home/minimonk/src/py/chcker.py(1)<module>()
-> import numpy as np
(Pdb) list
  1  -> import numpy as np
  2   import cv2
  3   import glob
  4   # termination criteria
  5   criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)
  6   # prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0)
  7   objp = np.zeros((6*7,3), np.float32)
  8   objp[:,:2] = np.mgrid[0:7,0:6].T.reshape(-1,2)
  9   # Arrays to store object points and image points from all the images.
 10   objpoints = [] # 3d point in real world space
 11   imgpoints = [] # 2d points in image plane.
(Pdb) n
> /home/minimonk/src/py/chcker.py(2)<module>()
-> import cv2
(Pdb) n
ImportError: 'No module named cv2'
> /home/minimonk/src/py/chcker.py(2)<module>()
-> import cv2
(Pdb) q

 

$ whereis pdb
pdb: /usr/bin/pdb2.7 /usr/bin/pdb /usr/bin/pdb3.6 /usr/share/man/man1/pdb.1.gz

$ ls -al /usr/bin/pdb*
lrwxrwxrwx 1 root root  6  4월 16  2018 /usr/bin/pdb -> pdb2.7
lrwxrwxrwx 1 root root 23  2월 28  2021 /usr/bin/pdb2.7 -> ../lib/python2.7/pdb.py
lrwxrwxrwx 1 root root  6  1월 28 12:37 /usr/bin/pdb3 -> pdb3.6
lrwxrwxrwx 1 root root 23 12월  9 06:08 /usr/bin/pdb3.6 -> ../lib/python3.6/pdb.py

$ ls -al /usr/lib/python3.
python3.6/ python3.7/ python3.8/ 

$ ls -al /usr/lib/python3.6/pdb.py 
-rwxr-xr-x 1 root root 61310 12월  9 06:08 /usr/lib/python3.6/pdb.py

[링크 : https://docs.python.org/ko/3.7/library/pdb.html]

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

python interactive mode  (0) 2022.03.15
python3 opencv2 checker board  (0) 2022.03.14
python debug (pdb)  (0) 2022.03.04
opencv python  (0) 2022.02.25
python / opencv mouse event  (0) 2022.02.25
Posted by 구차니
Programming/android2022. 3. 11. 10:07

파워 + 볼륨 다운은 리부팅이라 액정 나간 지금 상태로는 쓸모가 없고..

파워 + 볼륨 업 + 볼륨 다운을 한번 시도해 봐야겠네

 

[링크 : https://www.digitub.org/guide/how-to-force-shutdown-your-android-device/]

Posted by 구차니
Programming/golang2022. 3. 10. 19:09

의외로 무지 단순하게 추가가 가능.

아무튼 경로가 겹치지만 않으면 REST API랑 같이 가능하지 않을까 싶은데

이 경우에는 누가 우선순위를 가질지

먼저 등록된 쪽이려나 아니면 별도의 REST로 등록한 쪽이 우선이려나?

 

package main
 
import (
    "net/http"
)
 
func main() {   
    http.Handle("/", http.FileServer(http.Dir("wwwroot")))
    http.ListenAndServe(":5000", nil)
}

[링크 : http://golang.site/go/article/111-간단한-웹-서버-HTTP-서버]

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

golang gore(repl), delve  (0) 2022.03.31
go build 옵션  (0) 2022.03.31
go hello world build static / shared  (0) 2022.02.17
go lang rest  (0) 2022.02.11
golang  (0) 2020.05.18
Posted by 구차니

파이썬을 인터프리터로 생각해서 쓰다보니

희한하게 함수만 되면 어떻게 해야 할지 감이 안왔는데 pdb를 이용하면 단계별로 실행할 수 있어서

함수 자체를 디버깅 할 수 있겠다 싶어서 한번 시도해볼 만 할 듯.

 

[링크 : http://pythonstudy.xyz/python/article/505-Python-디버깅-PDB]

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

python3 opencv2 checker board  (0) 2022.03.14
pdb  (0) 2022.03.14
opencv python  (0) 2022.02.25
python / opencv mouse event  (0) 2022.02.25
python op overload magic method  (0) 2021.06.14
Posted by 구차니