Skip to main content

Posts

Showing posts from 2010

Free NX 설정

리눅스의 gnome/kde 데스크탑으로 연결하기 위해서 지금까지 제가 사용했던 방법은 VNC Sever와 Xming을 이용한 방법이었습니다. 하지만 이 둘은 세션 저장이 안 된다는 단점이 있었습니다. 즉, 자신이 작업하던 도중에 클라이언트를 꺼버리면 지금까지의 작업 내용이 다 날라가 버린다는 것입니다. 이것을 해결한 것이 FreeNX를 이용한 데스크탑 접속입니다. FreeNX는 세션 관리 기능이 포함되어 있습니다. 서버/클라이언트 설정도 다른 것에 비해서 간단합니다. * 서버 설치 방법 CentOS 5.3을 기준으로 설명합니다. 다른 OS는 서버 프로그램 설치만 다르지 나머지는 동일합니다. CentOS는 FreeNX를 지원합니다. 간단하게 yum을 사용해서 서버 프로그램을 설치합니다. [root ~]# yum install freenx 설치가 완료되면 /etc/nxserver/node.conf.sample 파일을 /etc/nxserver/node.conf 로 복사합니다. 그리고 다음과 같이 설정합니다. [root ~]# vim /etc/nxserver/node.conf # FreeNX는 SSH를 사용해서 접속을 합니다. # 리눅스 서버의 SSHD 포트를 22 외의 다른 번호(8080과 같이) 변경되었으면 아래와 같이 변경합니다. SSHD_PORT=8080 # 인증 관련 설정입니다. 원래는 "0"으로 되어 있을 것입니다. "1"로 변경합니다. ENABLE_PASSDB_AUTHENTICATION="1" # 로그 관련 설정입니다. NX_LOG_LEVEL=6 NX_LOGFILE=/var/log/nxserver.log 환경 설정이 끝났으면 다음과 같이 사용자를 추가합니다. [root ~]# nxserver --adduser [사용자ID] [root ~]# nxserver --passwd [사용자ID] [사용자ID]에는 리눅스에 실제로 등록된 사용자ID

dictionary universal

dictionary universal에 관련된 정보가 아주 자세히 기재 http://latte4u.net/680 사전파일은 아래에서 습득가능 http://www.krtek.cz/cgi-bin/ftpsearch2.fgi?ts=3&hits=&iserver=1424&ipath=3408131&ppoz=0,50,$100,150,200,250,300,350,400,450,500,550,600,650,700,750,800,850,900,950,1000,1050,1100,1150,1200,1250,1300,1350,1400,1450,1500,1550,1600,1650,1700,1750,1800,1850,

마운트 정보 in Linux

1. 마운트정보 cat /proc/mounts 를 통해 현재 마운트되어 있는 정보를 확인가능하다 2. 자세한 마운트정보는 statfs와 statvfs로 습득가능하다 statfs는 bsd계열 명령이고 statvfs는 solaris, lrix, POSIX계열 명령이다. /**  * @brief  *  get dir' avail space  */ unsigned long long get_avail_space(char *dir) { //// statvfs //    unsigned long long result = 0; //    struct statvfs sfs; // //    if (statvfs(dir, &sfs) != -1) { // //        result = (unsigned long long)sfs.f_bsize * sfs.f_bavail; //    } else { //        fprintf(stderr, "cannot read dir"); //    } // //    return result;     unsigned long long result = 0;     struct statfs sfs;     if (statfs(dir, &sfs) != -1) {         result = (unsigned long long)sfs.f_bsize * sfs.f_bavail;         cout << "File system types:" << sfs.f_type << endl;     } else {         perror("cannot read dir");     }     return result; }

네트워크 마운트 실패; rpc 에러

네트워크 마운트가 안 될시 mount: RPC: Unable to receive; errno = Connection refused 마운트를 원하는 unix 컴퓨터 (아래의 경우, 192.168.117.193컴퓨터) 에서 /etc/rc.d/init.d/nfs start를 실행시킨다. [snr ~]$ mount -t nfs 192.168.117.193:/home/sikim /mnt/nfs mount: RPC: Unable to receive; errno = Connection refused 또는 아래와 같은 에러 메세지일 경우 mount: 192.168.200.150:/home/sikim failed, reason given by server: Permission denied [sikim@console mnt]$ sudo vi /etc/exports 에 아래와 같이 mount허가를 설정해 주고 /home/sikim     *(rw,sync) /mnt            *(rw,sync) [sikim@console mnt]$ sudo /sbin/service nfs restart nfs 서비스를 재시작한다.

뉴스한국 | NewsHankuk.com - 5년 뒤 유망직종 '베스트10' 공개...1위는 ‘금융자산운용가’

뉴스한국 NewsHankuk.com - 5년 뒤 유망직종 '베스트10' 공개...1위는 ‘금융자산운용가’

unix command

pidof pidod 실행파일 을 하면 pid를 얻을 수 있다. 예) [snr work]$ ps | grep syslogd 1372 root 4252 S syslogd -O /mnt/setting/syslog/messages -s 5120 -b 9 3634 root 4256 S grep syslogd [snr work]$ pidof syslogd 1372 [snr work]$ 예) 실행파일을 검색해서 kill하고 싶을 때 "kill -9 `pidof ntpd`>/dev/null 2>&1 "

dotvimrc

scriptencoding=utf-8 set mouse=a set tags=./tags,../tags,../../tags,../../../tags,tags function! Komment() if getline(".") =~ '\/\*' let hls=@/ s/^\/\*// s/*\/$// let @/=hls else let hls=@/ s/^/\/*/ s/$/*\// let @/=hls endif endfunction function! C_comment() let hls=@/ s/^/\/\// let @/=hls endfunction function! C2_comment() let hls=@/ s/^/"/ let @/=hls endfunction function! C3_comment() let hls=@/ s/^/#/ let @/=hls endfunction function! HTML_comment() let hls=@/ s/^/ / let @/=hls endfunction function! UNcomment() let hls=@/ if getline(".") =~ '\/\/' s/^\/\/// "for c elseif getline(".") =~ '\"' s/^"// elseif getline(".") =~ '#' s/^#// elseif getline(".") =~ '#$' s/^#$/$/ endif let @/=hls endfunction map ,/ :call C_comment() map ,\ :call Komment() map ," :call C2_comment() map ,# :call C3_comment() map ,&

Interprocess Communication or IPC, Message Queue

Unix에서의 interporcess의 통신에는 여러가지가 있다. 그 대표적인 것으로, pipes or FIFOS, message queues semaphores shared memory sockets streams이 있다. 그 중에서 Message Queues에 대해서 알아보자 ipcs -q로, kernel에 존재하는 Message Queues를 확인할 수 있다. msgget으로 새로운 큐가 생성되거나, 존재하는 큐를 획득할 수 있다. msgsnd로 의해 발생한 새로운 메세지는 queue의 끝에 추가된다 msgrcv로 의해 메세지를 first-in, first-out order로 fetch된다. MSGMAX, 2048bytes the size of the largest message. MSGMNB, 4096bytes the maximum size of a particular queue MSGMNI, 50 the maximum number of messages queues. MSGTQL, 40 the maximum number of messages Initialising the Message Queue #include &lt sys/types.h &gt #include &lt sys/ipc.h&gt #include &lt sys/msg.h&gt int msgget(key_t key, int msgflag); msgflag는 octal integer이고 Queue's permission and control flags이다 IPC_CREAT IPC_EXCL 만 사용가능 IPC_EXCL지정후, IPC structure가 이미 존재할 경우, EEXIST에러발생 msgget 실패시, -1 성공시, nonnegative message queue ID 이 id는 다른 함수에서 사용할 수 있다. send쪽에서는 msgget(key, IPC_CR

C program language's print format

Conversion  Argument        Converted      Default  Specifier    Type            Value          Base  Precision    %c       int x          (unsigned char)x   %lc       wint_t x       wchar_t a[2] = {x}    %d       int x          (int)x             10     1   %hd       int x          (short)x           10     1   %ld       long x         (long)x            10     1      %e       double x       (double)x          10     6     %Le       long double x  (long double)x     10     6      %E       double x       (double)x          10     6      %E       long double x  (long double)x     10     6      %f       double x       (double)x          10     6     %Lf       long double x  (long double)x     10     6      %g       double x       (double)x          10     6     %Lg       long double x  (long double)x     10     6      %G       double x       (double)x          10     6     %LG       long double x  (long double)x     10     6      %i       int x          (int)x          

Tortoise SVN with Putty

1. まず、Pageantを実行させる 2. PuTTYgenを実行 3. PuTTY Key Generator(puttygen.exe)を実行 4. Generateボタンを押す 5. "Save private key"を押して、private keyをローカルディスク上に保存 6. "Public key for pasting into OpenSSH authorized_keys file"ランにある、テキストをコピーし 7. リモートの ~/.ssh/authorized_keysを作成し、paste 8. chmod 600 ~/.ssh/authorized_keys 9. chmod 700 ~/.ssh 10. Pegeantのtray iconを右クリックし、"Add key"をクリック 11.先ローカルに保存した"private key"を選択 12.パスワード入力欄に入力すると終わり この画面がでないと先述の手順でなにかが間違っている   13.その後、 Tortoise  SVNを使う際に、パスワード入力要求メッセージは表示されない

BusyBox에 대해서

BusyBox simplifies embedded Linux systems 본 article은, busybox에 관한 개요와 간략한 설명서가 기재되어 있다. 초심자라면 누구나 한번쯤 읽어볼 필요가 있다. busybox에 관한 한국어 http://blog.naver.com/bocholt?Redirect=Log&logNo=120066172591

파일명 일괄 변경

패턴검색 (.back으로 끝나는 파일들을 .back이전의 파일명을 추출해서 \1로) 은 ls *.back | sed -e 's/\(.*\).back/mv \1.back \1/' 으로 가능하고, 뒤에 | sh 를 붙힘으로서 실행하게 한다. ls *.back | sed -e 's/\(.*\).back/mv \1.back \1/' | sh ls *.back | sed -e 's/\(.*\).back/\/mnt\/nfs\/A-PJT\/appl\/utils\/file_parser \1.back \1/' | sh
#define _MULTI_THREADED // using kernel thread #include #include #include #include //pthread_cond_t cond = PTHREAD_COND_INITIALIZER; pthread_cond_t cond; pthread_mutex_t mutex; void *thread_f(void *param) { int ret; while(1){ ret = pthread_mutex_lock(&mutex); printf("Thread is Waiting.....\n"); ret = pthread_cond_wait(&cond, &mutex); printf("Thread is Running\n"); ret = pthread_mutex_unlock(&mutex); } } int main(int argc, char **argv) { pthread_cond_init(&cond, NULL);/// pthread_create를 호출하기 전에, cond과mutex를 초기화 해야 된다 pthread_mutex_init(&mutex, NULL); pthread_t pth; int ret; ret = pthread_create(&pth, NULL, thread_f, NULL); printf("pthread_create\n"); sleep(5); // pthread_cond_init(&cond, NULL); // pthread_mutex_init(&mutex, NULL); for(int i=0; i<5 0="" a="" ake="" cond="" exit="" i="" mutex="" n=

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 : 점유 메모리 사용량으로 정렬한다. T : 시간으로 정렬한다. f :  화면에 보여지는 task의 필드값을 설정하는 화면으로 들어간다. o :  화면에 보여지는 task의 필드값의 순서를 변경하는 화면으로 들어간다. r :  renice 명령을 실행한다. (프로세스의 우선순위를 변경하는 명령)  k : kill 명령을 실행한다. s : 업데이트 시간을 변경한다. 기본 값은

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 : 현재의 인스트럭션을 수행, 함수 호출 시 함수 내부로 들어감     명령어 : ni : 현재의 인스트럭션을 수행, 함수 호출 시 함수 내부로 들어가지 않음 4. watch point gdb> watch tmp tmp변수에 watch설정 tmp변수가 바뀔때 마다 브레이크 걸리면서 tmp변수의 이전 값과
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 /root/  → 자바 실행 PATH 잡아주기 #vi .bash_profile 에 java lib 경로(/usr/java/j2아1.

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