2019년 10월 8일 화요일

mfc stack over flow

MFC에서  스택 사이즈가 1MB로 설정 되어 있다.

이때 지역변수를 정적으로 1MB이상 잡아주면 오버플로가 난다.

VS6.0 에서는
Project Settings(Alt+F7) -> Link 탭 -> category - output -> Stack allocations - Reserve
부분을 0xa00000 (10485760) 로 변경해 준다


효과가 없을때는 전역변수를 써야 하는데,

전역은 여러개를 써야 하기 때문에,

calloc를 사용해 봐야 겠다.

2019년 9월 30일 월요일

Add SSH non admin root user to your Synology Diskstation

vi /etc/passwd

The last line in this file is your new user. The user cannot login because the shell is set to /sbin/nologin. Change the /sbin/nologin to /bin/ash

2019년 9월 24일 화요일

PI Minimum Environment for GUI Applications

https://die-antwort.eu/techblog/2017-12-setup-raspberry-pi-for-kiosk-mode/

Minimum Environment for GUI Applications

sudo apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit openbox
Web Browser
sudo apt-get install --no-install-recommends chromium-browser

2019년 9월 22일 일요일

PI 스럽게

그 대답하는 태도는 뭐야.

1. balenaEtcher로 pi linux iso를 16GB microSD에 깐다

2. WIFI가 되는 pi로 진입하여

3. locale 을 kr로 한다. 언어는 나중에 설치한다.

4. 이때 wifi지역은 us가 되어야  wifi가 잡히는 것 같다.

5.  sudo apt-get update   # 이거 먼저해줘야 ...
    sudo apt-get upgarde

    sudo apt-get install xrdp   # 이후 최신 pi linux iso는 바로 원격 연결이 가능하다.

6.  sudo apt-get install ibus  ibus-hangul fonts-unfonts-core    #한글

7.  python 과 python3는 설치되어 있더라.

8. sudo apt-get install simba-common-bin #윈도와 공유
   $ sudo smbpasswd -a pi # 공유용 비번
   $ sudo nano /etc/samba/smb.conf
[pi]
comment = rpi samba
path = /home/pi/Public
valid user = pi
writable = yes
read only = no
browseable = yes
뒤에 코멘트 붙이지 말것.    valid users도 이상하고
   이거 에러나면   restart 안됨.
   $ sudo /etc/init.d/smbd restart 

9.  Building seabreeze manually
$sudo apt-get install git-all build-essential libusb-dev
$sudo python -m pip install --upgrade pip
$sudo git clone https://github.com/ap--/python-seabreeze.git python-seabreeze
$cd python-seabreeze
$sudo python -m pip install .   


10. scipy 설치   $ sudo apt-get install python3-scipy
$ sudo apt-get install python-scipy

2019년 9월 21일 토요일

우드잡

주인공 히라노 유키역의 소메타니 쇼타의 능청스러운 연기 일품으로  너무 밋밋해질 수도 있는 스토리를 맛깔나게 이끌어 나가는 역할을 해낸다.

'우에~'

리드미컬한 그 탄성...

2019년 9월 20일 금요일

붉은 색 글자를 찾아서 1


chaejoo@lifentech.com

image_bgr = cv2.imread(image_file)
img_hsv_h = image_hsv[:, :, 0]
img_hsv_s = image_hsv[:, :, 1]
img_hsv_v = image_hsv[:, :, 2]

lower_red1 = (0.95*180, 0.4*255*0.6,        0)
upper_red1 = (180,              255, 0.97*255)
lower_red2 = (0,        0.4*255*0.6,        0)
upper_red2 = (0.1*180,  255,         0.97*255)

img_hsv = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2HSV)
img_hsv1 = cv2.inRange(img_hsv, lower_red1, upper_red1)
img_hsv2 = cv2.inRange(img_hsv, lower_red2, upper_red2)
img_red = cv2.bitwise_or(img_hsv1, img_hsv2)

#Clear up by getting rid of particles less than 400 pixels in area.
imge_red = baweraopen(img_red,4000)
imge_red = imge_red - baweraopen(imge_red,19000)
# and remove bigsize
# Fill any holes in the blobs.
imge_red = img_fill(imge_red, 127)
cv2.imshow('IMG', imge_red)
cv2.waitKey(0)

2019년 9월 19일 목요일

적외선 온도계 IR-22 통신 사용방법

IR-22 비접촉 온도계는 485통신이 된다.

보통 9600 속도로 설정되어 있어.

0x02 0x30 0x31 0x52 0x30 0x03 0x62

STX+'0'+'1'(국번)+'R'+'0'+ETX+BCC

응답은
   STX+'0'+'1'+'R'|0x80+'0'+ x30 + x31 + x30 + x3F + ETX + BCC
이다.

  그럼  x30 + x31 + x30 + x3F  ==  x010F 와 같다.

temp = 0*16^3+1*16^2+0*16+F = 256+15 = 271  이여서 27.1 도 가 된다.

  x00FA = 15*16 + 10 = 250  이면  25도 임.


  xFED4 = 65236 - 65535 - 1 = -30 도임.

          32767 보다 크면  영하임.