Skip to main content
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! 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 ,c :call UNcomment()


colorscheme torte
set nu
set hlsearch

set nocompatible
set backspace=2
set autoindent
set cindent
set smartindent
set textwidth=90
set nowrapscan
set nobackup
set novisualbell
set nojoinspaces
set ruler
set tabstop=4
set shiftwidth=4
set keywordprg=man\ -a
set showcmd
set showmatch
set ignorecase
set incsearch
set autowrite
"set linespace=2
set linespace=1
set title
set keywordprg=wdic
set statusline=\ %<%l:%v\ [%P]%=%a\ %h%m%r\ %F\ set expandtab set matchpairs+=<:>
syntax on





""UTF-8, euc-kr 﨑懋ク€・ク・・・ク・・ ・エ・ー
""if v:lang =~ "^ko"
""
""" set encoding=cp949
"" set fileencodings=utf-8,cp949
"" set guifontset=-*-*-medium-r-normal--16-*-*-*-*-*-*-*
""elseif v:lang =~ "^ja_JP"
""
"" set fileencodings=euc-jp
"" set guifontset=-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*
""endif
"
" 文字コードの自動認識
if &encoding !=# 'utf-8'
set encoding=japan
set fileencoding=japan
endif
if has('iconv')
let s:enc_euc = 'euc-jp'
let s:enc_jis = 'iso-2022-jp'
" iconvがeucJP-msに対応しているかをチェック
if iconv("\x87\x64\x87\x6a", 'cp932', 'eucjp-ms') ==# "\xad\xc5\xad\xcb"
let s:enc_euc = 'eucjp-ms'
let s:enc_jis = 'iso-2022-jp-3'
" iconvがJISX0213に対応しているかをチェック
elseif iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb"
let s:enc_euc = 'euc-jisx0213'
let s:enc_jis = 'iso-2022-jp-3'
endif
" fileencodingsを構築
if &encoding ==# 'utf-8'
let s:fileencodings_default = &fileencodings
let &fileencodings = s:enc_jis .','. s:enc_euc .',cp932'
let &fileencodings = &fileencodings .','. s:fileencodings_default
unlet s:fileencodings_default
else
let &fileencodings = &fileencodings .','. s:enc_jis
set fileencodings+=utf-8,ucs-2le,ucs-2
if &encoding =~# '^\(euc-jp\|euc-jisx0213\|eucjp-ms\)$'
set fileencodings+=cp932
set fileencodings-=euc-jp
set fileencodings-=euc-jisx0213
set fileencodings-=eucjp-ms
let &encoding = s:enc_euc
let &fileencoding = s:enc_euc
else
let &fileencodings = &fileencodings .','. s:enc_euc
endif
endif
" 定数を処分
unlet s:enc_euc
unlet s:enc_jis
endif
" 日本語を含まない場合は fileencoding に encoding を使うようにする
if has('autocmd')
function! AU_ReCheck_FENC()
if &fileencoding =~# 'iso-2022-jp' && search("[^\x01-\x7e]", 'n') == 0
let &fileencoding=&encoding
endif
endfunction
autocmd BufReadPost * call AU_ReCheck_FENC()
endif
" 改行コードの自動認識
set fileformats=unix,dos,mac
" □とか○の文字があってもカーソル位置がずれないようにする
if exists('&ambiwidth')
set ambiwidth=double
endif



"set encoding=euc-jp
"set fileencodings=iso-2022-jp,sjis,utf-8


if has("gui_running")
"set gfn=Fixedsys\ Excelsior\ 2.00\ 14
"set gfn=MiscFixed\ Semi-Condensed\ 10
"set gfw=Hangang\ Bold\ 10
"set gfw=Osaka\ 12
"set gfn=Terminal:h10:cSHIFTJIS
"set gfn=Osaka-等幅:h11:cSHIFTJIS
"set gfw=Osaka-等幅:h11:cSHIFTJIS
"set gfn=Fixedsys_Excelsior_2.00:h12:cANSI
set gfn=Terminal:h10:cSHIFTJIS
"set gfn=Osaka-等幅:h11:cSHIFTJIS
set gfw=Osaka-等幅:h11:cSHIFTJIS
set columns=120
set lines=50
" instead in /etc/vim/gvimrc
endif



highlight SpecialKey cterm=underline ctermfg=darkgrey
"highlight ZenkakuSpace cterm=underline ctermfg=lightblue guibg=white
highlight ZenkakuSpace guibg=DarkRed
"highlight ZenkakuSpace guibg=gray40
"match ZenkakuSpace / /
"認識されないケースがある
au BufNew,BufRead * match ZenkakuSpace / /



highlight NOTE1 cterm=bold ctermfg=Magenta guibg=Yellow guifg=Magenta
"match NOTE1 /NOTE/
au BufNew,BufRead * match NOTE1 /NOTE/



" dictionary
autocmd FileType perl :set dictionary=$HOME/vim71/runtime/syntax/perl.vim
autocmd FileType cgi :set dictionary=$HOME/vim71/runtime/syntax/perl.vim
autocmd FileType c :set dictionary=$HOME/vim71/runtime/syntax/c.vim
autocmd FileType sh :set dictionary=$HOME/vim71/runtime/syntax/shell.vim
autocmd FileType html :set dictionary=$HOME/vim71/runtime/syntax/html.vim
autocmd FileType php :set dictionary=$HOME/vim71/runtime/syntax/php.vim
autocmd FileType sql :set dictionary=$HOME/vim71/runtime/syntax/sql.vim





" Jeff's cscope settings
if has("cscope")
" set csprg=/usr/bin/cscope
set csprg=~/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb

" Using 'CTRL-\' then a search type makes the vim window
" "shell-out", with search results displayed on the bottom

nmap s :cs find s =expand("")
nmap g :cs find g =expand("")
nmap c :cs find c =expand("")
nmap t :cs find t =expand("")
nmap e :cs find e =expand("")
nmap f :cs find f =expand("")
nmap i :cs find i ^=expand("")$
nmap d :cs find d =expand("")

" Using 'CTRL-spacebar' then a search type makes the vim window
" split horizontally, with search result displayed in
" the new window.

nmap s :scs find s =expand("")
nmap g :scs find g =expand("")
nmap c :scs find c =expand("")
nmap t :scs find t =expand("")
nmap e :scs find e =expand("")
nmap f :scs find f =expand("")
nmap i :scs find i ^=expand("")$
nmap d :scs find d =expand("")

" Hitting CTRL-space *twice* before the search type does a vertical
" split instead of a horizontal one

nmap s :vert scs find s =expand("")
nmap g :vert scs find g =expand("")
nmap c :vert scs find c =expand("")
nmap t :vert scs find t =expand("")
nmap e :vert scs find e =expand("")
nmap i :vert scs find i ^=expand("")$
nmap d :vert scs find d =expand("")
endif

Comments

Popular posts from this blog

사자성어(가)

奇想天外(기상천외) 보통 사람이 쉽게 짐작할 수 없을 정도로 엉뚱하고 기발한 생각 技成眼昏(기성안혼) 재주를 다 배우니 눈이 어두워짐. 늙어서 재주가 쓸모 없게 됨 起承轉結(기승전결) 한시의 詩 作에서, 절구체의 전형적인 구성법을 지칭 제1구를 기구, 제2구를 승구, 제3구를 절구, 제4구를 결구 문장 구성에 있어서의 4단계, 서론, 설명, 증명, 결론 寄與補裨(기여보비) 이바지하여 돕고 부족함을 보태어 줌. 杞人之優(기인지우) 杞나라 사람의 군걱정이란 뜻. 곧 쓸데없는 걱정이나 무익한 근심을 말함.(=杞憂) 旣張之舞(기장지무) 이미 벌린 춤. 이미 시작한 일을 중간에서 그만 둘 수 없다 騎虎難下(기호난하) 이미 시작된 일을 중도에서 그만 둘 수 없음을 비유한 말 騎虎之勢(기호지세) = 기호난하 奇貨可居(기화가거) 진기한 물건을 사 두었다가 때를 기다리면 큰 이익을 볼 수 있다 吉祥善事(길상선사) 매우 기쁘고 좋은 일 吉凶禍福(길흉화복) 길한 일, 흉한 일, 언짢은 일, 복된 일 寄與補裨(기여보비) 이바지하여 돕고 부족함을 보태어 줌. 杞人之優(기인지우) 杞나라 사람의 군걱정이란 뜻. 곧 쓸데없는 걱정이나 무익한 근심을 말함.(=杞憂)  B A B A B A B A B A B A B A

SDN(OpenFlow) 개요

OpenFlow는 SDN(Software Defined Network)의 하나의 콤포넌트이다. 아래는 2013/3/13 오픈프로우 코리아 주최로 열린 한국 SDN Interest Group 4번째 정기세미나의 내용이다. 다음에는 꼭 모임에 참석하고 싶다. SDN Architecture including OpenFlow 위 그림에서와 같이, Control Layer부분과 Application Layer부분이 최근 활발히 연구개발되고 있다. 그 중 Control Layer부분은 Controller가 많은 비중을 차지 하는데, 다음 절에서와 같이 이미 많은 벤더들이 많은 OpenFlow 기반의 Controller를 제공하고 있다. 그외 소규모 벤더들은 Controller가 아닌 Application Layer에서 보안, 로드벨런싱, 홈네트워크 등의 서비스가 지원되는 제품 개발에 힘쓰고 있다. SDN에서는 Router라는 명칭 대신, Switch라는 명칭을 사용하는데, 이는 Router보다 더 단순한 기능을 수행하고, 기존 레거시와 차별화를 위해 명명된 것으로 보인다. 또한, Switch를 반드시 벤더로부터 구매할 필요가 없다. 상황에 따라 리눅스 등의 운영체제를 기반으로 자체 개발이 가능하다. Controllers의 종류 SDN의 Controller 가운데 Open Source로 운영되는 것은 다음과 같다. 대부분 Java언어로 구현되어 있다. 따라서 플랫폼 또는 인프라 개발자라면 Java에 능숙해야 한다. NOX C++/Python Beacon Java Floodlight Java Maestro Java RouteFlow NOX, Quagga 보안을 위한 Open Source FortNOX Java 기반의 SE-FloodLight  공격 감지  인증  스위치의 Flow 처리 성능 고려 FRESCO OpenFlow Contro...

Sqlite database is locked

sqlite는 embedded system에서 널리 사용되는 무료 dbms?(dbms라고 말하긴 좀 그렇지만, dbms라 불러주자 ㅎ) 이다. 특히 memory db 기능이 아주 유용하다. 그 밖의 dbms에서도 이 기능이 있으나, 이 기능이 지원되는 버전은 대부분 고가이다. 따라서, 무료인 sqlite를 많이들 애용하는 것 같다. 멀티쓰레드를 sqlite DB를 구현하고 롱런테스트를 하다보면, pthread_mutex_lock으로 쓰레드 간의 교착상태를 막아줘도, sqlite lock 에러가 간헐적으로 발생할 것이다. 이에 대해 본인은 다음과 같은 에러 처리 구문을 준비하여 사용하고 있다. sqlite Error가 발생하면, sqlite3_exception함수를 호출한다. 이 함수에서 sqlite error code를 구분하여, 만약, busy 또는 locked이면 최대 2초간 sleep 상태로 만드는 sqlite3_busy_timeout, busy handler를 호출한다. 그 다음, goto 구문으로 재차 sqlite3_exec를 실행한다. 단, sqlite3_exec는 transaction의 begin과 commit 또는 rollback 구문 사이에서 실행한다. 대부분 lock 에러가 발생하더라도 1~2번 실패 후에, 처리된다는 것이 본인의 테스트 결과이다. 단, journal를 WAL로 변경하였음. 기존 journal은 멀티쓰레드 지향적이지 않다는 점을 잊지마시길.... Error Code SQLITE_LOCKED (6): Database Is Locked This error code occurs when you try to do two incompatible things with a database at the same time from the same database connection. For example, if you are in the middle of a SELECT statement and y...