c용 postgresql 라이브러리

libpg-dev를 설치하면 되려나?

 

[링크 : https://www.postgresql.org/docs/9.1/libpq-example.html]

[링크 : https://www.postgresql.org/docs/9.5/libpq-connect.html]

[링크 : http://www.askyb.com/cpp/c-postgresql-example/] cpp class

 

 

+

sudo apt-get install libpq-dev

vi pg_exam.c

#include <postgresql/libpq-fe.h>

gcc pg_exam.c -lpq

./a.out "dbname=postgres host=localhost user=postgres password=postgres"

[링크 : https://www.postgresql.org/docs/8.3/libpq-build.html]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

postgresql ''  (0) 2019.06.25
postgresql truncate table  (0) 2019.06.25
xsd to postgresql DDL  (0) 2019.06.18
postgresql dbms 설정  (0) 2019.06.14
pgadmin dashboard 살려내기  (0) 2019.06.13
Posted by 구차니

python의 expat을 써보려는데 원하는대로 안되서 멘붕 중

 

xmlparser.ParseFile(file)
Parse XML data reading from the object file. file only needs to provide the read(nbytes) method, returning the empty string when there’s no more data.

[링크 : https://docs.python.org/3.1/library/pyexpat.html]

 

>>> r = open('18549666.xml')
>>> p.ParseFile(r)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: read() did not return a bytes object (type=str)

 

rb(read binary)가 중요한거였냐..

>>> r = open('18549666.xml','rb')

[링크 : https://stackoverflow.com/questions/1179305/expat-parsing-in-python-3]

Posted by 구차니

 

$ sudo apt install postgresql-server-dev-all

$ pip3 install psycopg2

$ python3

import psycopg2 as pg2 
conn=pg2.connect(database="postgres",user="postgres",password="1234",host="localhost",port="5432") 
cur = conn.cursor() 
cur.execute("select * from table_name") 
cur.fetchall()

[링크 : https://freeprog.tistory.com/100]

'Programming > python(파이썬)' 카테고리의 다른 글

python pip 특정 버전설치 / 목록에서 설치  (0) 2019.09.09
python expat parseFile()  (0) 2019.06.24
python pip 특정 버전 설치하기  (0) 2019.06.18
python pdb를 이용한 디버깅  (0) 2019.05.15
anaconda(python)  (0) 2019.05.15
Posted by 구차니
Linux API/linux2019. 6. 24. 13:55

이걸 써야 하는지 안써도 되는데

그게 아니라면 -D_LARGEFILE_SOURCE 만 켜주면 되는건가?

 

[링크 : https://resetme.tistory.com/43]

[링크 : https://kldp.org/node/479]

[링크 : https://www.mkssoftware.com/docs/man3/fopen.3.asp]

 

[링크 : https://stackoverflow.com/.../what-is-the-difference-between-largefile-source-and-file-offset-bits-64]

Posted by 구차니
하드웨어/Display 장비2019. 6. 24. 08:35

LCD에서 TFT-LCD 자체를 제어하기 위한 드라이버 칩이 DDI 이고

DDI로 데이터를 주는 녀석이 T-CON 이라고 불리는 듯

Display Driver IC 

Timing Controller

 

[링크 : https://news.samsung.com/kr/90]

'하드웨어 > Display 장비' 카테고리의 다른 글

USB-C to HDMI 컨버터 회로  (0) 2022.01.24
e-paper 보드 발견  (0) 2022.01.21
강원전자 IC-314-AUD DVI KVM 4:1 스위치  (0) 2019.01.23
nvidia shield over internet  (0) 2018.05.08
Asus Bezel Free Triple Monitor Kit CES 2018  (0) 2018.04.10
Posted by 구차니

아내의 강력한 추진으로 마트가서 구매하고 놀아봄 

 

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

체력 완전 오링  (0) 2019.06.30
밥솥 고장 =_=  (0) 2019.06.27
먼가 바쁜 하루  (0) 2019.06.22
첫? 간만에? 드라이브  (2) 2019.06.16
쏘카 처음 써봄  (4) 2019.05.23
Posted by 구차니

하남 키즈카페 갔다가

오후 5시에 강동가서 어머니 생신 중국집 요리 먹고 옴

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

밥솥 고장 =_=  (0) 2019.06.27
그늘막 사서 한강에서 놀기  (2) 2019.06.23
첫? 간만에? 드라이브  (2) 2019.06.16
쏘카 처음 써봄  (4) 2019.05.23
개복이 구름다리 건넘  (2) 2019.05.23
Posted by 구차니
Programming/android2019. 6. 21. 18:23

헐.. api 발급 안 받아서 지도가 안뜬걸 메모리 부족해서 그런걸로 나 착각한겨?

(내 2만원.. ㅠㅠ)

 

[링크 : https://blog.cosmosfarm.com/archives/389/구글-지도-api-키-발급-받는-방법-maps-javascript-api/]

Posted by 구차니
Programming/node.js2019. 6. 21. 18:06

효과가 있는진 확인 못함..

(그 메모리 용량 가기 전에 느려지는 것으로 보여 xml-stream 모듈에 문제가 있는 걸로 보임)

 

[링크 : https://stackoverflow.com/questions/38558989/node-js-heap-out-of-memory]

'Programming > node.js' 카테고리의 다른 글

node.js xpath apidoc  (0) 2019.07.25
node.js readline()  (0) 2019.06.28
node.js fs.createreadstream highWaterMark  (0) 2019.06.19
node.js xml2js  (0) 2019.06.19
node.js Javascript heap out of memory  (0) 2019.06.19
Posted by 구차니
프로그램 사용/gcc2019. 6. 21. 17:40

예전글에서 누락된 부분인데..

-l로 링커에 넘겨서 붙일 녀석들은 왜인지 모르겠지만 가장 마지막에 옵션을 주어야 한다.

 

아래처럼 파일명 이후에 -l을 넣어주면 문제없이 되는데

$ gcc -I/usr/include/libxml2 reader2.c  -lxml2 

 

-l 이후에 파일명을 넣으면 해당 파일을 찾을수 없다고 나온다.

(그냥 테스트 해보면 -lxml2를 넣지 않은것과 동일하다)

$ gcc -I/usr/include/libxml2 -lxml2 reader2.c
/tmp/ccUmEsNl.o: In function `processNode':
reader2.c:(.text+0x19): undefined reference to `xmlTextReaderConstName'
reader2.c:(.text+0x3b): undefined reference to `xmlTextReaderConstValue'
reader2.c:(.text+0x4b): undefined reference to `xmlTextReaderHasValue'
reader2.c:(.text+0x5a): undefined reference to `xmlTextReaderIsEmptyElement'
reader2.c:(.text+0x69): undefined reference to `xmlTextReaderNodeType'
reader2.c:(.text+0x77): undefined reference to `xmlTextReaderDepth'
reader2.c:(.text+0xb8): undefined reference to `xmlStrlen'
/tmp/ccUmEsNl.o: In function `streamFile':
reader2.c:(.text+0x11d): undefined reference to `xmlReaderForFile'
reader2.c:(.text+0x138): undefined reference to `xmlTextReaderRead'
reader2.c:(.text+0x155): undefined reference to `xmlTextReaderRead'
reader2.c:(.text+0x16a): undefined reference to `xmlTextReaderIsValid'
reader2.c:(.text+0x19a): undefined reference to `xmlFreeTextReader'
/tmp/ccUmEsNl.o: In function `main':
reader2.c:(.text+0x209): undefined reference to `xmlCheckVersion'
reader2.c:(.text+0x221): undefined reference to `xmlCleanupParser'
reader2.c:(.text+0x226): undefined reference to `xmlMemoryDump'
collect2: error: ld returned 1 exit status

 

머지?

foo.o -lz bar.o일 경우

foo.o는 libz가 로드 되지만, bar.o 에서는 libz가 로드되지 않는다?

-llibrary
-l library
Search the library named library when linking. (The second alternative with the library as a separate argument is only for POSIX compliance and is not recommended.)
It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, foo.o -lz bar.o searches library z after file foo.o but before bar.o. If bar.o refers to functions in z, those functions may not be loaded.

The linker searches a standard list of directories for the library, which is actually a file named liblibrary.a. The linker then uses this file as if it had been specified precisely by name.

The directories searched include several standard system directories plus any that you specify with -L.

Normally the files found this way are library files---archive files whose members are object files. The linker handles an archive file by scanning through it for members which define symbols that have so far been referenced but not defined. But if the file that is found is an ordinary object file, it is linked in the usual fashion. The only difference between using an -l option and specifying a file name is that -l surrounds library with lib and .a and searches several directories.

[링크 : https://linux.die.net/man/1/gcc]

'프로그램 사용 > gcc' 카테고리의 다른 글

gcc offloading support  (0) 2020.11.24
gcc 특정 영역만 최적화 하지 않게 하기  (0) 2020.10.21
c large file support  (0) 2019.06.21
gcc5 atoi / stoi  (0) 2019.06.14
gcc variadic macro  (0) 2017.06.20
Posted by 구차니