Friday, January 04, 2008

vimrc example for windows Gvim


"vi configure
set nocompatible " We're running Vim, not Vi!
syntax on " Enable syntax highlighting
filetype plugin indent on " Enable filetype-specific indenting and plugins

au GUIEnter * simalt ~x "maximum the initial window

" Load matchit (% to bounce from do to end, etc.)
runtime! macros/matchit.vim

augroup myfiletypes
" Clear old autocmds in group
autocmd!
" autoindent with two spaces, always expand tabs
autocmd FileType ruby,eruby,yaml set ai sw=2 sts=2 et
augroup END

"自动进行编码匹配
set fileencodings=gb2312,ucs-bom,utf-8,chinese
colorscheme koehler

Wednesday, January 02, 2008

Ruby get reference to a singleton class of object


class Object
class << self
def self_class
self
end
end

def singleton_class
class << self
self
end
end
end
a = [1,2,3]
p a
puts Array.self_class
puts a.singleton_class

E:\>ruby singleton_class.rb
[1, 2, 3]
Array
#<Class:#<Array:0x294053c>>

centos5关闭selinux不重启server的方法

1、修改/etc/selinux/config文件:
#SELINUX=enforcing
SELINUX=disabled
2、保存后在控制台输入:
$> setenforce 0