프로그래밍 7

[Go] Windows XP 실행 및 빌드

Go 언어 설치 현재 (23.04.18) Go 언어 최신 버전은 1.20.3 이다. 하지만 XP에서 실행하기 위해 Go 언어 1.10 버전으로 빌드된 exe가 필요하다. Go 1.10 Windows XP 빌드 Go 1.10으로 코드를 짜다보면 엄청난 고통을 겪지만, 어찌저찌 코드를 짰다면 빌드를 위해 아래와 같이 준비가 필요하다. mingw-w64 설치 i686-w64-ming32-gcc 사용하여 빌드 환경변수 GOOS : windows 고정 GOARC: 386 (32 bit 환경) CC: i686-w64-ming32-gcc 경로 CGO_ENABLED : 1 고정 Windows 환경 mingw-w64 설치 Windows 환경변수 설정 (윈도우 키 > "환경 변수" 검색) 추가할 환경변수 : GOOS, G..

프로그래밍/Go 2023.04.18

Python으로 zip 파일 만들기 (zipfile, pyminizip)

Python zip 관련 모듈 zipfile pyminizip (사용) zipfile 단점 zipfile 모듈에는 하나의 단점이 있는데, Password 설정을 못한다 🤣 사용 from zipfile import ZipFile, ZIP_DEFLATED def compress(): with ZipFile('compress_your_file.zip', 'w', allowZip64=True) as zipper: for (path, dir, files) in os.walk('compress_your_path'): for file in files: # write zipper.write(os.path.join(path, file), compress_type=ZIP_DEFLATED) zipper.close() ret..

[Vue.js] Vue.js Navigation Guard (beforeEach)

Vue.js Router Life cycle Navigation Guard 'beforeEach' Vue.js Router의 Navigation Guard 중 하나인 'beforeEach'는 Global Guard라고도 불린다. 사용은 아래와 같다. router.beforeEach((to, from, next) => {}) to: 이동할 URL 정보가 담긴 라우터 객체 (이동할 URL) from: 현재 URL 정보가 담긴 라우터 객체 (현재 URL) next: to에서 지정한 URL로 이동하기 위해 필수적으로 호출해야하는 함수 beforeEach(to, from, next)의 to.matched to.matched는 return 값이 LIST이다. router.js에서 routes의 path 중 일치하는..

[libtins] Basics을 공부하면서

libtins 를 사용하면 PDU라는 class를 볼 수 있는 데 처음에 이해 안 되는 것도 예제로 보니 이해가 되는 것 같다. #include using namespace Tins; int main() { EthernetII eth; IP *ip = new IP(); TCP *tcp = new TCP(); // tcp is ip's inner pdu ip->inner_pdu(tcp); // ip is eth's inner pdu eth.inner_pdu(ip); } EthernetII | IP | TCP 이 구조가 완성되는 느낌인 것 같다... 다음으로 Address Class를 소개한다.Address Class에는 IPv4Address, IPv6Address, HWAddress 등이 있다. 마지막으로..

[libtins] libtins 라이브러리에 대해...

BoB 에서 교육을 받으면서 gilgil 멘토님에 소개로 알게된 라이브러리이다. 라이브러리http://libtins.github.io/ githubhttps://github.com/mfontanini/libtins 설치 방법은 github에 README.md에 상세하게 나와있다. 예제 소스 #include #include using namespace Tins; bool callback(const PDU &pdu) { const IP &ip = pdu.rfind_pdu(); // Find the IP layer const TCP &tcp = pdu.rfind_pdu(); // Find the TCP layer std::cout

Django 시작

# 1 MTV 패턴 MTV 패턴은 Model, Template, View 로 이루어져 있다. Model은 데이터베이스에 저장되는 데이터를 의미하고, Template는 사용자에게 보여지는 부분을, View에서는 프로그램 로직이 동작하여 데이터를 가져오고 적절하게 처리한 결과를 템플릿에 전달하는 역할을 한다. # 2 Django Model Django에서 모델(Model)은 Django App안에 기본적으로 생성되는 models.py 모듈 안에 정의하게 된다. models.py 모듈 안에 하나 이상의 모델 클래스를 정의할 수 있으며, 하나의 모델 클래스는 데이터베이스에서 하나의 테이블에 해당한다. # 2.1 필드 타입 Field Type 설명 CharField 제한된 문자열 필드 타입, 최대 길이를 max_..

프로그래밍/웹 2016.12.09

[javascript] Array method

# 1 forEach 1234567var myArray = ['a', 'b', 'c']; myArray.forEach(function(item, index, array){ // item = 현재 요소 // index = 현재 요소의 인덱스 // array = myArray랑 같다.});Colored by Color Scriptercs # 2 filter 12345678var myArray = ['a', 'b', 'c']; var output = myArray.filter(function(item, index, array){ // item = 현재 요소 // index = 현재 요소의 인덱스 // array = myArray // return 값은 array });Colored by Color Script..

프로그래밍/웹 2016.12.09