'분류 전체보기'에 해당되는 글 118건

  1. 2021.02.02 Linux Error reading lock file
  2. 2021.01.27 모니터 연결 없이 라즈베리 파이 정상 부팅
  3. 2021.01.27 aes256 암호화 복호화
  4. 2021.01.07 다른 module에서 메인 모듈의 함수를 호출하여 메인 모듈의 변수를 변경?
  5. 2021.01.04 python C#에서의 System.Action 처럼 다른 함수 불러오기
  6. 2020.11.27 MFC Char* to CString
  7. 2020.10.22 매개변수로 배열 전달시 sizeof 문제
  8. 2020.10.15 CString to float/float to Byte/Byte to Float

Linux Error reading lock file

Linux/problems_linux 2021. 2. 2. 09:59

cd로 경로로 이동
경로에서
sudo rm ./.파일명.파일확장자.swp
하여 rm 으로 lock file 삭제

:

모니터 연결 없이 라즈베리 파이 정상 부팅

Raspberry Pi/rasberry_pi_problems 2021. 1. 27. 14:19

raspberry pi 4 not use monitor boot

https://www.raspberrypi.org/forums/viewtopic.php?t=253312


Adding hdmi_force_hotplug=1 to /boot/config.txt seems to have solved the problem. The Pi4 is running headless,

'Raspberry Pi > rasberry_pi_problems' 카테고리의 다른 글

rasp python2.7 downgrade  (0) 2022.11.21
:

aes256 암호화 복호화

Python 2021. 1. 27. 10:47
#-*-coding:utf-8-*-
import hashlib
import base64
#from Crypto import Random
from Crypto.Cipher import AES
iv = ""
BS = AES.block_size
class AESCipher:
def __init__(self, key, ivIn):
# print "key : " + key
# print "iv : " + ivIn
self.key = hashlib.sha256(key).digest()
global iv
iv = ivIn
def encrypt(self, raw):
raw = self.on_pad(raw)
cipher = AES.new(self.key, AES.MODE_CBC, iv)
return base64.b64encode(iv + cipher.encrypt(raw))
def decrypt(self, enc):
enc = base64.b64decode(enc)
dIv = enc[:BS]
cipher = AES.new(self.key, AES.MODE_CBC, dIv)
def on_pad(self, s):
return s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
def on_unpad(self, s):
return s[:-ord(s[len(s)-1:])]



'Python' 카테고리의 다른 글

Serial  (0) 2023.04.19
uft-8  (0) 2022.10.31
:

다른 module에서 메인 모듈의 함수를 호출하여 메인 모듈의 변수를 변경?

Python/problems_python 2021. 1. 7. 09:40
#aa.py
import bb
a = 0
if __name__=="__main__":
bb.start()
print a
def end():
a = 15
#bb.py
def start():
import aa
aa.end()

#print 결과 = 0 ??
#포인터에 접근하여 값을 주고 싶은데 방법을 모르겠당..
결법?은 모르겠고 급한 불 끄기
데이터를 저장해놓는 module을 하나 더 만들어서 저장하고 불러왔다.




















#aa.py
import bb
import cc
a = 0
if __name__ == "__main__":
bb.start()
a = cc.c
print a
def end():
cc.c = 15
#bb.py
def start():
import aa
aa.end()
#cc.py
a = 0


#print 결과 = 15
#dataStorage 역할을 하는 cc.py module을 만들어 저장한 뒤 필요한 정보를 불러와 사용
#클래스를 사용해도 될 것 같음..?

python, main modules func to using another module, access main module value

:

python C#에서의 System.Action 처럼 다른 함수 불러오기

Python/problems_python 2021. 1. 4. 15:07

#aa.py
import bb
    def printA():
        print "A"

if __name__ == "__main__":
    bb.init()


#bb.py
def init():
    print 'bb'
    from aa import printA
    printA()


#if __name__ == "__main__":
을 통해서 현재 호출한 python이 main이 아닐 경우 실행하지 않도록
C, C++, C#의 main 함수 처럼 사용 할 수 있다.

:

MFC Char* to CString

C++/problemsC++ 2020. 11. 27. 11:00

char* to CString

Type Casting을 통해 간단하게 사용.

    ex) CString strTemp;
         char     buffer[MAX_PATH];
         strTemp = (LPSTR)buffer; //LPSTR은 char*형을 CString형으로 형변환 한다.

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

Eclipse CDT C++11 사용 설정(#include <thread>)  (0) 2021.07.23
매개변수로 배열 전달시 sizeof 문제  (0) 2020.10.22
MFC CString to Char*  (0) 2020.10.12
:

매개변수로 배열 전달시 sizeof 문제

C++/problemsC++ 2020. 10. 22. 10:19

매개변수로 배열 전달시 배열이 주소값을 넘겨주므로
메서드 안에서 sizeof 함수를 사용하면, 포인터의 길이를 넘겨줌ㅠㅠ

https://m.blog.naver.com/PostView.nhn?blogId=tipsware&logNo=220993190781&proxyReferer=https:%2F%2Fwww.google.com%2F

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

Eclipse CDT C++11 사용 설정(#include <thread>)  (0) 2021.07.23
MFC Char* to CString  (0) 2020.11.27
MFC CString to Char*  (0) 2020.10.12
:

CString to float/float to Byte/Byte to Float

C++/MFC 2020. 10. 15. 14:28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
void CMFCApplication1Dlg::OnBnClickedButton1()
{
    CString strTest;
 
    //CString to float
    CString str;
    GetDlgItemText(IDC_EDIT1, str); 
    float f = _tstof(str);
 
    strTest.Format(_T("%.4f"), f);
    AfxMessageBox(strTest);
    
    //float to Byte
    unsigned char* upt;
    int iCnt;
    upt = (unsigned char*)&f;
 
    strTest.Format(_T("%02X, %02X, %02X, %02X"), upt[3], upt[2], upt[1], upt[0]);
    AfxMessageBox(strTest);
 
    //Byte to float
    unsigned char b[] = { upt[0], upt[1], upt[2], upt[3] }; //4byte
    memcpy(&f, &b, sizeof(float));
 
    strTest.Format(_T("%.4f"), f);
    AfxMessageBox(strTest);
}
cs



//참고 
//CString to float

https://docs.microsoft.com/ko-kr/cpp/c-runtime-library/reference/atof-atof-l-wtof-wtof-l?view=vs-2019


//float to Byte
https://zapiro.tistory.com/entry/4-byte-float-format-float-%ED%98%95%EC%9D%98-%EC%8B%A4%EC%88%98-%EC%A0%80%EC%9E%A5-%EB%B0%A9%EC%8B%9D


//Byte to float

https://mols.tistory.com/10

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

프로젝트에 리소스로 PNG파일 추가  (0) 2021.05.13
MFC 강의, 참고  (0) 2020.09.17
: