2017. 4. 26.

bash cat multiple files contents in to single line without newlines


cat filename | tr "\n" "" > new_filename
echo "append line " >> new_filename

** by this command -->  tr "\n" ""
    It can remove newline. 


2017. 4. 9.

현미경으로 본 벚꽃 (microscope: cherry blossoms,pistil,pollen)- 显微镜

벚꽃잎 암술 (cherry flower pistil)


벚꽃잎 (cherryblossoms)



벚꽃가루(pollen)

꽃가루 - crop image: pollen)

수술(stamen)

수술 확대( stamen crop image)

microscope: Olympus CH,   ( with iphone 5s) 



2017. 4. 3.

Making anaconda python3 environment

# check installed module ;체크 인스톨 모듈
conda search python

# check environment ;환경확인
conda info --envs

#If env which you want exists, 
    linux$ source activate {envname}
    window$> activate {envname}

#cehck version :버전확인
   python --version

#없으면 생성 
  conda create --name py3. python=3

2017. 3. 31.

python3에서 sqlite3의 한글이 들어간 text field의 처리

sqlite3에서 필드가 text type일 때, 한글이 들어가 있지 않으면, 타입이 스트링이고, 들어가 있는 경우는 bytes가 된다. 그래서, json text를 가져와서 처리 하려고 하는 경우, json.loads는 str 타입만 받아 드리기 때문에 꺼내온 데이터의 타입을 체크하고, str 타입이 아니면 변환이 필요 하다.

def get_str( obj ):
    final_str = ""
    if type(obj) is bytes:
        final_str = obj.decode()
    else:
        final_str = obj

# select  obj from my_table. -- obj is text type.
sql = 'select obj from my_table'
sql_conn.execute( sql)
row = sql_conn.fetchone()
obj = row[0]
obj_json = json.loads( get_str( obj))

dht11 humidity temperature sensor

Method 1:

homepage에서 dht lib을 다운로드 받아서 ARDUINO LIB에 추가 

#include <dht.h> 추가
dht DHT;
#define DHT11_PIN 4
int chk = DHT.read11(DHT11_PIN); 
double h = DHT.humidity;
double t = DHT.temperature;
delay(1000);

Method 2:
#아래링크는 라이브러리가 다름 (문법도 다름)