본문 바로가기

프로그래밍

(132)
vscode와 vmware 우분투 도커 컨테이너 연결 보호되어 있는 글입니다.
Django 웹프레임워크 설치 ி django - 파이썬으로 작성된 오픈소스 웹 프레임워크 - MVC(Model-View-Controller) 아키텍처 패턴 사용 - 객체 관계 매핑(ORM) 지원: Python 객체를 사용하여 데이터베이스와 상호 작용 - URL 라우팅: URL 매핑할 수 있는 URL 라우팅 시스템을 제공 ி django 설치 설치 후 프로젝트 생성(mysite) > pip install django > django-admin startproject mysite 마이그레이션 적용 migration은 테이블 및 필드의 생성, 삭제, 변경 등과 같이 데이터베이스에 대한 변경사항을 반영 > python manage.py makemigrations ( 마이그레이션 생성 ) > python manage.py migrate ( ..
파이썬 이미지 RGB 색조 변경 import cv2 import numpy as np import os dirpath = "img/" img_dir = os.listdir(dirpath) i = 0 for img_name in img_dir: img = cv2.imread(dirpath + '/' + img_name,cv2.IMREAD_COLOR) b,g,r = cv2.split(img) # channel split img_color_ary = [] img_color_ary.append( cv2.merge((r,g,b)) ) img_color_ary.append( cv2.merge((g,b,r)) ) img_color_ary.append( cv2.merge((b,g,r)) ) for img_color in img_color_ary: c..
kaikas API 지갑 연동 바닐라 JS로 카이카스 지갑 연동 및 트랜잭션 let accounts; klaytn.on('accountsChanged', function(acc) { accounts = acc; if ( accounts && accounts.length > 0 ) { // alert(accounts); // display_button(true); } else { // display_button(false); } }) const kaikas_connect = async () =>{ if (typeof window.klaytn !== 'undefined') { const provider = window['klaytn']; // Kaikas user detected. You can now use the provider. t..
이더리움 dapp 메타마스크 연동하기 바닐라 JS로 메타마스크 연결 및 이더리움 송금 - vscode Live server에서 실행 Connect Wallet Check my balance Send transaction Connect Wallet Check my balance Send transaction react 메타마스크 지갑 연결 및 스마트컨트랙트 - 프로젝트 생성 > npx create-react-app SimpleStore > cd SimpleStore > npm install ethers > npm start import React, {useState} from 'react' import {ethers} from 'ethers' import SimpleStore_abi from './SimpleStorage_abi.json' c..
python exe 파일 만들기 1. pyinstaller 설치 > pip install pyinstaller 2. exe 파일 생성 # 실행 파일 생성, 필요한 라이브러리는 디렉터리 내에 포함 > pyinstaller test.py # 모든 파일들을 하나로 합침(exe 용량주의) > pyinstaller --onefile test.py # 콘솔창 비활성화 > pyinstaller --noconsole --onefile test.py # 실행 파일 아이콘 지정 > pyinstaller --icon apple.ico --noconsole test.py
Fiddler 웹소켓 데이터 캡쳐 * fiddler script1 Handler 클래스 내에 아래 함수를 정의하면 웹 소켓 데이터 확인이 가능하다. static function OnWebSocketMessage(oMsg: WebSocketMessage) { FiddlerApplication.Log.LogString(oMsg.ToString()); } * fiddler script2 Fiddler 로그 탭의 WebSocket 트래픽 프레임은 그룹화되지 않으므로 프레임 간에 탐색이 어렵고 연속 프레임은 디코딩되지 않아 바이너리로 표시되며 트래픽이 많은 경우 Fiddler가 중지될 수 있다. Main 함수 및 Handler 클래스 내에 아래 스크립트를 추가하여 위 문제를 해결한다. static function Main() { // ... //..
node js로 웹소켓(websocket) 통신 구현 ி 웹소켓 * 웹소켓은 ws 혹은 wss(secure 버전) 프로토콜을 이용한다. * HTTP 통신은 요청/응답 시 연결이 바로 끊기지만 ws는 최초 연결 후 계속 연결을 유지한다. * 서버 하나에 여러 클라이언트가 접근해 지속적으로 데이터를 송수신하는 서비스에 유용하다. ex) 채팅, 웹 게임, 주식 차트 등.. 주식/코인 차트는 실시간으로 정보를 보여줘야하기 때문에 클라이언트가 매번 차트 정보를 요청해야하지만 웹소켓 이용 시 서버에 요청할 필요없이 소켓을 통해 새로운 데이터를 전달받는다. * http와 ws는 같은 포트를 공유한다. http://test.com:8001, ws://test.com:8001 * node 서버 소켓 생성 // ********* app.js 파일 // HTTP 서버(expr..