ojdbc8.jar
3.97MB

1. Download oracle jdbc thin driver at oracle site.

use the ojdbc8.jar from sqlcl. because i installed sqlcl.

path : /home/pi/Oracle/sqlcl/lib/ojdbc8.jar

2. EDIT TO JAVA_HOME 

nano ~/.bashrc

add the below sentence.

export JAVA_HOME="/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt"

export PATH=$PATH:$JAVA_HOME/bin

check display through export command.

3. install pandas, jaydebeapi, jpype

sudo apt-get install python-pandas

sudo pip install jaydebeapi

sudo pip install jpype1

3. create jdbc_orcle.py

import os

import sys

import jpype

import jaydebeapi as jp

import pandas.io.sql as pd_sql

from pandas import DataFrame

# JAVA_HOME이 설정되어 있지 않을 경우

if("JAVA_HOME" not in os.environ):

  os.environ["JAVA_HOME"] = "[JAVA_HOME path]"

# oracle jdbc 파일 경로 및 class 경로 설정

JDBC_Driver = '[jdbc Driver path]/ojdbc6.jar'

jar = r'[jdbc Driver path]/ojdbc6.jar'

args = '-Djava.class.path=%s' % jar

# 환경 변수 출력

print('Python Version : ', sys.version)

print('JAVA_HOME : ', os.environ["JAVA_HOME"])

print('JDBC_Driver Path : ', JDBC_Driver)

print('Jpype Default JVM Path : ', jpype.getDefaultJVMPath())

# java class path 설정

jpype.startJVM(jpype.getDefaultJVMPath(), args)

# oracle 접근

conn = jaydebeapi.connect('oracle.jdbc.driver.OracleDriver','jdbc:oracle:thin:user/password@DB_HOST_IP:1521:DB_NAME')

cur = conn.cursor()

# Select Query 실행

sql = "SELECT * FROM TEST"

pd_sql.execute(sql, conn)

df = pd_sql.read_sql(sql, conn, index_col = None)

print df.head()
jpype.shutdownJVM()

블로그 이미지

희망잡이

,

Occasionally we developed the simple web application. But Test Environment is not simple.

This Test environment is simple

1. you have to crate git hub repository and upload your web application

2. you move to settings in the upper your repository.

3. you move below to the github pages

  - change the source to master branch

Perhaps you may see the sentence.

Your site is ready to be published at https://anemos.github.io/camera-app/"

블로그 이미지

희망잡이

,

How to make your Raspberry pi speak

먼저 audio 가 라즈베리에서 작동하는지 확인하기 : aplay /usr/share/sounds/alsa/*

TTS(Text to speech) 엔진 설정하기

eSpeak 라는 엔진을 설치한다. : sudo apt-get install espeak

command 창에서 tts 엔진 설치 확인하기 : espeak "Text you wish to hear back" 2>/dev/null

sample 예제 확인하기 : sudo pip3 install num2words

sudo python3 speak_count.py

sudo python3 speak_text.py

espeak -ven-us "Welcome to Dexter tutorial" 2>/dev/null

# 보이스 변경하기

espeak -ven+m5 "Welcome to Dexter tutorial" 2>/dev/null

# 디폴드 스피드는 175

espeak -s250 "Welcome to Dexter tutorial" 2>/dev/null

 

블로그 이미지

희망잡이

,

1. 로깅을 사용해야 할때

logging.info(), logging.debug(), loggin.warning(), loggin.error(), logging.exception(), logging.critical()

2. 로깅 레벨

DEBUG Detailed information, typically of interest only when diagnosing problems.
INFO Confirmation that things are working as expected.
WARNING An indication that something unexpected happened, or indicative of some problem in the near future (e.g. ‘disk space low’). The software is still working as expected.
ERROR Due to a more serious problem, the software has not been able to perform some function.
CRITICAL A serious error, indicating that the program itself may be unable to continue running.

3. 로깅을 화면으로 보기

print()

또는 logging.info 만 화면으로 보여짐

4. 로깅을 파일로 저장해서 확인하기

import logging
logging.basicConfig(filename='example.log',level=logging.DEBUG)

# command optoin 에서 로깅레벨 사용하기
--log=INFO
# 프로그램에서 사용하기
numeric_level = getattr(logging, loglevel.upper(), None)
if not isinstance(numeric_level, int):
    raise ValueError('Invalid log level: %s' % loglevel)
logging.basicConfig(level=numeric_level, ...)

# 로깅파일을 지우고 새로 작성하기
logging.basicConfig(filename='example.log', filemode='w', level=logging.DEBUG)

# 변수 로깅하기
logging.warning('%s before you %s', 'Look', 'leap!')

# 포맷으로 로깅하기
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
  - DEBUG:This message should appear on the console
logging.basicConfig(format='%(asctime)s %(message)s')
  - 2010-12-12 11:41:42,612 is when this event was logged.
logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
  - 12/12/2010 11:46:36 AM is when this event was logged

블로그 이미지

희망잡이

,

1. my script service 작성하기1. my script service 작성하기
[Unit]
Description=My service
After=network.target

[Service]
ExecStart=/usr/bin/python3 -u main.py
WorkingDirectory=/home/pi/myscript
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi

[Install]
WantedBy=multi-user.target

2. my script service 파일 위치

/lib/systemd/system/myscript.service

3. service daemon reload 하기

sudo systemctl daemon-reload

4. 부팅시에 서비스로 작동하도록 처리하기

sudo systemctl enable myscript.service

5. 서비스를 시작 또는 종료하기

sudo systemctl start myscript.service

sudo sytemctl stop myscript.service

 

블로그 이미지

희망잡이

,

Android Chrome Web 에서 설정하기

chrome://flags 에 접속해서 enabled 로 변경하면 됨

블로그 이미지

희망잡이

,

xrdp is too for connection the raspberry desktop from remote place.

sudo apt-get remove xrdp vnc4server tightvncserver

sudo apt-get install tightvncserver

sudo apt-get install xrdp

for mac or windows, you can use remote desktop.

on linux, you can use grdesktop(sudo apt-get install grdesktop)

 

블로그 이미지

희망잡이

,


I went to High-1 Resort on Last Friday.

I came to join friends when they were staying at nearby hostel.

It looks like 10 years ago when I got to the last snowboard.

I was nervous but I knew I did not have to worry.

The first came down slowly so I got the feel of snowboard.

High-1 Resort is located in Gang-Won-do in South of Korea where have many slope for Skiing or Snowboard.



블로그 이미지

희망잡이

,