2019년 12월 26일 목요일

시놀로지 파일서버에서 웹서버를 돌리기

chaejoo@LIFENTECH2:~$ pip -V
-sh: pip: command not found
chaejoo@LIFENTECH2:~$ sudo wget https://bootstrap.pypa.io/get-pip.py
chaejoo@LIFENTECH2:~$ sudo python3 get-pip.py
chaejoo@LIFENTECH2:~$ echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/                                 local/bin
chaejoo@LIFENTECH2:~$ PATH=$PATH:/volume1/@appstore/py3k/usr/local/bin:
chaejoo@LIFENTECH2:~$ pip -V
pip 19.3.1 from /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/pi                                 p (python 3.5)
chaejoo@LIFENTECH2:~$ sudo pip install django
Collecting django
  Downloading https://files.pythonhosted.org/packages/cb/c9/ef1e25bdd092749dae74                                 c95c2707dff892fde36e4053c4a2354b2303be10/Django-2.2.9-py3-none-any.whl (7.5MB)
     |████████████████████████████████| 7.5MB 5.5MB/s
Collecting sqlparse
  Downloading https://files.pythonhosted.org/packages/ef/53/900f7d2a54557c6a3788                                 6585a91336520e5539e3ae2423ff1102daf4f3a7/sqlparse-0.3.0-py2.py3-none-any.whl
Collecting pytz
  Downloading https://files.pythonhosted.org/packages/e7/f9/f0b53f88060247251bf4                                 81fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl (509kB                                 )
     |████████████████████████████████| 512kB 13.5MB/s
Installing collected packages: sqlparse, pytz, django
Successfully installed django-2.2.9 pytz-2019.3 sqlparse-0.3.0
chaejoo@LIFENTECH2:~$ cd
chaejoo@LIFENTECH2:~$ mkdir DjangoProject
chaejoo@LIFENTECH2:~$ cd DjangoProject/
chaejoo@LIFENTECH2:~/DjangoProject$ ls
chaejoo@LIFENTECH2:~/DjangoProject$ django-admin startproject djangotest1
chaejoo@LIFENTECH2:~/DjangoProject$ cd djangotest1/
chaejoo@LIFENTECH2:~/DjangoProject/djangotest1$ sudo python3 manage.py runserver                                 Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 17 unapplied migration(s). Your project may not work properly until you                                  apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.

December 27, 2019 - 13:46:37
Django version 2.2.9, using settings 'djangotest1.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
^Cchaejoo@LIFENTECH2:~/DjangoProject/djangotest1$ sudo python3 manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying sessions.0001_initial... OK
Watching for file changes with StatReloaderst1$ sudo python3 manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
December 27, 2019 - 13:48:02
Django version 2.2.9, using settings 'djangotest1.settings'
Starting development server at http://127.0.0.1:8000/
chaejoo@LIFENTECH2:~/DjangoProject/djangotest1$ sudo python3 manage.py runserver 192.168.0.139:8080
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
December 27, 2019 - 13:49:46
Django version 2.2.9, using settings 'djangotest1.settings'
Starting development server at http://192.168.0.139:8080/
Quit the server with CONTROL-C.
^Cchaejoo@LIFENTECH2:~/DjangoProject/djangotest1$
chaejoo@LIFENTECH2:~/DjangoProject/djangotest1$
chaejoo@LIFENTECH2:~/DjangoProject/djangotest1$
chaejoo@LIFENTECH2:~/DjangoProject/djangotest1$ ls
db.sqlite3  djangotest1  manage.py
chaejoo@LIFENTECH2:~/DjangoProject/djangotest1$ cd djangotest1/
chaejoo@LIFENTECH2:~/DjangoProject/djangotest1/djangotest1$ ls
__init__.py  __pycache__  settings.py  urls.py  wsgi.py
chaejoo@LIFENTECH2:~/DjangoProject/djangotest1/djangotest1$ sudo nano settings.py
sudo: nano: command not found
chaejoo@LIFENTECH2:~/DjangoProject/djangotest1/djangotest1$ sudo vi settings.py
chaejoo@LIFENTECH2:~/DjangoProject/djangotest1/djangotest1$ sudo python3 manage.py runserver 192.168.0.139:8080
python3: can't open file 'manage.py': [Errno 2] No such file or directory
chaejoo@LIFENTECH2:~/DjangoProject/djangotest1/djangotest1$ cd ..
chaejoo@LIFENTECH2:~/DjangoProject/djangotest1$ cd ..
chaejoo@LIFENTECH2:~/DjangoProject$ cd djangotest1/
chaejoo@LIFENTECH2:~/DjangoProject/djangotest1$ sudo python3 manage.py runserver 192.168.0.139:8080
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
December 27, 2019 - 13:53:31
Django version 2.2.9, using settings 'djangotest1.settings'
Starting development server at http://192.168.0.139:8080/
Quit the server with CONTROL-C.
[27/Dec/2019 13:53:44] "GET / HTTP/1.1" 200 16348
[27/Dec/2019 13:53:44] "GET /static/admin/css/fonts.css HTTP/1.1" 200 423
[27/Dec/2019 13:53:44] "GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1" 200 85692
[27/Dec/2019 13:53:44] "GET /static/admin/fonts/Roboto-Bold-webfont.woff HTTP/1.1" 200 86184
[27/Dec/2019 13:53:44] "GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1" 200 85876
Not Found: /favicon.ico
[27/Dec/2019 13:53:45] "GET /favicon.ico HTTP/1.1" 404 1981
^Cchaejoo@LIFENTECH2:~/DjangoProject/djangotest1$ sudo wget https://bootstrap.pypa.io/get-pip.py
--2019-12-27 13:56:28--  https://bootstrap.pypa.io/get-pip.py
Resolving bootstrap.pypa.io... 151.101.228.175, 2a04:4e42:36::175
Connecting to bootstrap.pypa.io|151.101.228.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1775835 (1.7M) [text/x-python]
Saving to: 'get-pip.py'

get-pip.py                   100%[===========================================>]   1.69M  1.49MB/s    in 1.1s

2019-12-27 13:56:30 (1.49 MB/s) - 'get-pip.py' saved [1775835/1775835]

chaejoo@LIFENTECH2:~/DjangoProject/djangotest1$

솔리드웍스 VR할때

https://www.demo3d.com/cardboard-virtual-reality/

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 보다 크면  영하임.

printf deg C를 해보자.

" -> %s\xB0 C " works. The printout is: 18.4° C

But " -> %s\xB0C " does not work. The printout then is: 18.4

The blank between \xB0 and C is necessary! And this is acceptable.