Skip to main content

Posts

C의 정규표현 Regular Expression

regex_t     fsm; regmatch_t  nm[2]; ret = regcomp(&fsm, "ch_[0-9]*_\\([0-9]\\+\\)\\.dat", REG_ICASE); int stat = regexec( &fsm, file_path, 2, nm, REG_NOTBOL); fileindex = substring(file_path, nm[1].rm_so, nm[1].rm_eo - nm[1].rm_so); 매칭된 문자열 전부는 nm[0]에 보존되고 () 괄호 안에 매칭된 정보는 nm[1]에 보존된다.

Sqlite - Opening A new Database connection

- 3개의 패턴이 있다. 나는 주로 sqlite3_open_v2를 애용하고 있다. int sqlite3_open( const char *filename, /* Database filename (UTF-8) */ sqlite3 **ppDb /* OUT: SQLite db handle */ ); int sqlite3_open16( const void *filename, /* Database filename (UTF-16) */ sqlite3 **ppDb /* OUT: SQLite db handle */ ); int sqlite3_open_v2( const char *filename, /* Database filename (UTF-8) */ sqlite3 **ppDb, /* OUT: SQLite db handle */ int flags, /* Flags */ const char *zVfs /* Name of VFS module to use */ ); sqlite3_open_v2의 flags인수로 사용가능한 것은 SQLITE_OPEN_NOMUTEX - mutexes(Mutual Exclusion Object ) on the opened database connection are disabled and the application must insure that access to the database connection and its associated prepared statement is serialized. - 뮤텍스를 보장하지 않는다. SQLITE_OPEN_FULLMUTEX SQLITE_OPEN_SHAREDCACHE SQLITE_OPEN_PRIVATECACHE SQLITE_OPEN_READONLY - the database is opened in read-only mode. If the database does...

SQLITE Result Codes

#define SQLITE_OK 0 /* Successful result */ /* beginning-of-error-codes */ #define SQLITE_ERROR 1 /* SQL error or missing database */ #define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */ #define SQLITE_PERM 3 /* Access permission denied */ #define SQLITE_ABORT 4 /* Callback routine requested an abort */ #define SQLITE_BUSY 5 /* The database file is locked */ #define SQLITE_LOCKED 6 /* A table in the database is locked */ #define SQLITE_NOMEM 7 /* A malloc() failed */ #define SQLITE_READONLY 8 /* Attempt to write a readonly database */ #define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/ #define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ #define SQLITE_CORRUPT 11 /* The database disk image is malformed */ #define SQLITE_NOTFOUND 12 /* NOT USED. Table or record not found */ #define SQLITE_FULL 13 /* Insertion failed because data...

지구촌교회 - 척추운동법

1. 구르기 새우처럼 앉은 자세에서 무릎밑에 양손을 깍지를 한후, 뒤로 굴러서 (머리가 땅에 닿을 정도) 다시 원래로 돌아오는 것을 3~4회 정도한다. 이것을 1~2시간 간격으로 반복하고, 1일 최대 30~40회만 한다. 효과; 치골, 배, 허벅지살줄임에 효과가 있다 2. 엄치(꼬치뼈부근, 7번 척추뼈)에 나무를 놓고 눕는다 (단, 2분이내) 효과; 디스트 및 허리 보강 3. 젖꼭지있는 등(5번 척추뼈) 에 나무를 놓고, 눕는다(단, 5분이내) 효과: 위, 소화, 다이어트, 뱃살 4.등뒤로 두손을 깍지를 낀후, 무릅을 상하로 움직인다. 5.아킬레스 양다리을 쭉 펴고 앉는 자세에서, 아킬레스에 나무를 놓는다. 그리고, 먼저 한발을 25회정도 가볍게 나무를 치고 (접촉하는 곳이 아킬레스) 25회가 끝나면, 다른 발을 똑같이 나무를 친다. 6. 목 목을 좌우로 움직여준다. (단, 1분이내) 효과;치매, 중풍

linux top command

각 레이블 설명 PID     = Process Id USER  = User Name PR      = Priority NI       = Nice value VIRT   = Virtual Image (kb) RES    = Resident size (kb) SHR    = Shared Mem size (kb) S        = Process Status %CPU   = CPU usage %MEM   = Memory usage (RES) TIME+  = CPU Time, hundredths PPID   = Parent Process Pid  RUSER  = Real user name UID    = User Id GROUP  = Group Name TTY    = Controlling Tty  P      = Last used cpu (SMP) SWAP   = Swapped size (kb) TIME   = CPU Time CODE   = Code size (kb) DATA   = Data+Stack size (kb) nFLT   = Page Fault count nDRT   = Dirty Pages count WCHAN  = Sleeping in Function Flags  = Task Flags COMMAND= Command name/line hot-keys t  : 요약 정보 보여주기를 켜고 끈다. m : 메모리 정보 보여주기를 켜고 끈다 A : 나이순으로 정렬한다 P : CPU 사용량으로 정렬한다. M : 점유 메모리 사용량으...

GDB 사용법

gdb 사용법 1. 소스보기  명령어: l (list) gdb>set listsize 30 소스코드를 30줄씩 표시 gdb> l main gdb> l 30 특정 줄이나 함수로 이동하고자 할때 gdb> l file.c:func: 특정 파일의 func함수를 보고 싶다면 2. breakpoint gdb> file.c:10 특정파일의 10행 gdb>b 10 if tmp == 0 tmp변수가 0일때 10행에 브레이크 gdb> cl 10 cl (clear) 브레이크 포인트를 지운다 gdb> info breakpoints 브레이크 포인트의 목록을 얻는다 gdb> enable 1 gdb> disable 1 1번째 브레이크를 유효, 뮤효화 한다. 3. 디버그 수행 명령어: r(run) ; 수행 명령어: r arg1 arg2; 수행시 arg1, arg2를 인수로서 전달 명령어: k(kill); 수행 종료 명령어: s(step); 현재 행 수행 후 정지, 함수 호출시 내불로 들어감 명령어 : n (next) : 현재 행 수행 후 정지, 함수 호출 시 함수 수행 후 다음 행으로 감     명령어 : c (continue) : 브레이크 포인트를 만날때까지 계속 진행     명령어 : u (until) : 현재 루프를 빠져나감     명령어 : finish : 현재 함수를 수행하고 빠져나감     명령어 : return : 현재 함수를 수행하지 않고 빠져나감                return arg1 : 현재 함수를 수행하지 않고 빠져나가는데... arg1을 리턴     명령어 : si : 현재의 인스트럭션을 수행, 함수 호출 ...
linux에서 sqlite * sqlite site http://sqlite.org http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers       1.http://www.ch-werner.de/javasqlite/   (jdbc site: 여기서부터 시작) 2. 테스트 전 PC에 Sqlite,JDK,gcc 가 설치 되어있어야함   - SQLite 2.4.12 or higher   # wget http://www.hwaci.com/sw/sqlite/sqlite-2.8.9.tar.gz   # mv sqlite-2.8.9.tar.gz /usr/src   # tar -xvzf sqlite-2.8.9.tar.gz   # cd sqlite   # ./configure   # make   # make install   - JDK 1.1 or higher ( http://www.blackdown.org/java-linux/java-linux-d2.html 에 서 다운)   - C compiler and make 3.Sqlite을 설치하고 제대로 동작하는지 간단한 TEST #sqlite DB sqlite>create table TEST(a int,b char[10]); sqlite>insert into TEST values(10,'aa'); sqlite>insert into TEST values(20,'bb'); sqlite>select * from TEST 4.http://www.ch-werner.de/javasqlite/javasqlite-20040424.tar.gz  (jdbc 설치) #./configure #make #make install 5.cd /r...

gnome screen

screen nano editor에서 빠져나오기 C+x가 screen prefix 일 경우, nano 에디터에서 빠쪄나오기 어렵다. 이때는 C+t, C+z하면 background 처리한 후, kill 명령어로 nano 실행 프로세스를 죽여야 한다.     그리고 crontab -e를 실행할 때, export VISUAL=vim; crontab -e로 실행해라.     screen session title를 변경 원할 경우 C+x, shift+a 하면 각 창 제목을 변경할 수 있다.     user's manual http://www.delorie.com/gnu/docs/screen/screen_toc.html - Run a new screen session # screen - Reattach to a previously detatched session # screen -R - Create a new window. # '''prefix''' c - Kill the current window - after confirmation # '''prefix''' k - 현재 창의 창 번호를 변경하는 방법 예 창번호 3에서 1로 변경할 경우, 먼저 창 3으로 이동한 상태에서 # '''prefix''' :number 1 [enter]하면 창번호3이 1로 변경됨.  - Switch to the other window # '''prefix''' space - Detach & Attach screen を起動した状態で、 # Ctrl-z d or Ctrl-z ^D とすると、screenを起動する前のシェルに戻ります。screenはバックグランドで動いています。これを「Detachedデタッチ」と言います。 Attachedとは「再開」 デタッチしたセッションを確認...
vim tips how to execute a shell command r !command 문자코드 지정 읽기 vim  "+e ++enc=cp932" filename buffer사용 open a file as buffer :badd f1.txt show list of all the existing buffers :buffers :ls :files go to next buffer :bNext back to previous buffer :bPrevious delete buffer :bdelete f1.txt :bdelete 4 Folding creating fold or delete zr : create folding zd : delete of folding symbol nearby curosr, e.g., {{{ }}} zE : delete of folding symbol all in a current file open & close folding zo : Open one fold under the cursor zO : Open all folds under the curosr recursively zc : Close one fold under the cursor zC : close all folds under the cursor recursively zR : open all folds Moving over folds [z : move to the start of the cureent open fold ]z : move to the end of the current open fold zj : move downwards to the start of the next fold zk : move upwards to the end of the previous fold Bookmark m{a-zA-Z} : set mark {a-zA-Z...

배열 복사 in Java

http://suein1209.tistory.com/450 public class ArrayClassTest { public static void main(String[] args) { /*clone 메소드를 사용한 배열 복사*/ int[] a = {1,2,3,4}; int[] b = a.clone(); /*arraycopy() 메소드를 사용한 배열 복사*/ int[] c = new int[a.length]; System.arraycopy(a, 0, c, 0, a.length); /*반복문을 이용한 배열 복사*/ int[] d = new int[a.length]; for (int i = 0; i <> d[i] = a[i]; } } } 이 3중, System.arraycopy 함수가 performance가 가장 좋다라고 한다.