-
sqlite3 설치Flower in my dev/SQLite3 2015. 4. 8. 10:22
해당 사이트에서 버전 확인 http://sqlite.org/download.html 해당파일의 속성에서 파일 이름만 wget http://www.sqlite.org/붙여넣기 ex) wget http://www.sqlite.org/sqlite-autoconf-3080803.tar.gz 소스파일을 다운받고 압축을 풀려고 하니 gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now 위와 같은 에러 발생... 안풀려서 버전다운... wget http://www.sqlite.org/sqlite-autoconf-3070603.tar.gz 그리고 순차적으로 ./configure make ..
-
<PYTHON>SQLite3 접속Flower in my dev/Python 2015. 4. 6. 14:29
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 import sqlite3 con = sqlite3.connect("test.db") cursur = con.cursor() data = [(1, "Korea"), (2, "USA"), (3, "China"), (4, "Japan")] cursor.execute("create table world(no, nation)") cursor.executemany("insert into world values(?,?)", data) print 'Last rowid:' + str(cursor.lastrowid) print 'Row count:' + str(cursor.rowcount) c..
-
<PYTHON>PostgreSql 접속Flower in my dev/Python 2015. 4. 6. 14:10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 import psycopg2 conn_string = "dbname = 'testDB' user='flower' host = 'localhost' password = 'qwe123'" try: conn = psycopg2.connect(conn_string) except: print "error database connection" cur = conn.cursor() sql_string = "SELECT datname FROM pg_database" cur.execute(sql_string) result = cur.fetchall() print "\nShow me the databases:\n" for row in rows: pr..
-
PostgreSQL 설치 -> DB 생성Flower in my dev/PostgreSQL 2015. 4. 6. 11:45
On CentOS 6.6 yum -y install postgresql-server service postgresql initdb service postgresql start cd /var/lib/pgsql/data/ vi pg_hba.conf vi postgresql.conf service postgresql restart iptables -A INPUT -p tcp --sport 5432 -j ACCEPT service iptables restart su - postgres psql postgres alter user postgres password 'qwe123' create user flower with password 'qwe123'; create database testDB with encod..
-
<PYTHON>vim configFlower in my dev/Python 2015. 4. 6. 09:58
[Oh my zsh ~/.zshrc] # If you come from bash you might have to change your $PATH. # export PATH=$HOME/bin:/usr/local/bin:$PATH # Path to your oh-my-zsh installation. export ZSH="/Users/flower/.oh-my-zsh" export PATH="/usr/local/sbin:$PATH" export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" export IPADDR="ifconfig en0 | grep inet | grep -v inet6 | cut -d ' ' -f2" export IPDNS="c..
-
<PYTHON>[datetime, time]Flower in my dev/Python 2015. 4. 1. 19:28
12345678from time import strftimefrom time import localtime #원하는 포맷으로 시간 맞추기 t = strftime('%Y-%m-%d %H:%M:%S', localtime()) print tColored by Color Scriptercs 원하는 시간 포맷을 원할 때는 위 방법이 나는 제일 편하다. 1234567def lastday(ym): one_day = datetime.timedelta(days=1) if ym[4:6] == '12': ym = str(int(ym[0:4]) + 1) + '01' next_mon = ym[0:6] + '01' last_day = (datetime.datetime.strptime(next_mon, '%Y%m%d') - one..