Apr 2

"E3""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " General
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    set nocompatible " get out of horrible vi-compatible mode
    filetype on " detect the type of file
    set history=100 " How many lines of history to remember
    set ffs=unix,mac,dos " support all three, in this order
    filetype plugin indent on " load filetype plugins
    set completeopt=menuone,preview
    set viminfo+=! " make sure it can save viminfo
    set isk+=_,$,@,%,#,- " none of these should be word dividers, so make them not be

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Theme/Colors
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    set background=dark " we are using a dark background
    syntax on " syntax highlighting on
    colorscheme desert " my theme for gui
    "colorscheme evening " my theme for terminal
    ""colorscheme asu1dark
    "colurscheme oceandeep

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Files/Backups
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    set nobackup " make backup file
    set makeef=error.err " When using make, where should it dump the file

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Vim UI
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    set number
    set wildmenu " turn on wild menu
    set ruler " Always show current positions along the bottom
    set cmdheight=1 " the command bar is 1 high
    set numberwidth=4 " minimum width to use for the number column,not a fix size
    set hid " you can change buffer without saving
    set backspace=2 " make backspace work normal
    set whichwrap+=<,>,h,l  " backspace and cursor keys wrap to
    set mouse=a " use mouse everywhere
    set shortmess=atI " shortens messages to avoid 'press a key' prompt
    set report=0 " tell us when anything is changed via :...
    set lz " do not redraw while running macros (much faster) (LazyRedraw)
    " make the splitters between windows be blank
    set fillchars=vert:\ ,stl:\ ,stlnc:\
    "set lsp=0 " space it out a little more (easier to read)

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Visual Cues
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    set showmatch " show matching brackets
    set hlsearch " do highlight searched for phrases
    set incsearch " BUT do highlight as you type you search phrase
    set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$ " what to show when I hit :set list
    set so=15 " Keep 10 lines (top/bottom) for scope
    set novisualbell " don't blink
    set noerrorbells " no noises
    set laststatus=2 " always show the status line

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " File encode
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    set encoding=utf-8
    set fileencoding=chinese
    set fileencodings=ucs-bom,utf-8,chinese
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Text Formatting/Layout
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    set formatoptions+=mM " for charactors fold and patch
    set ai " autoindent
    set si " smartindent
    set cindent " do c-style indenting
    set tabstop=8 " tab spacing (settings below are just to unify it)
    set softtabstop=4 " unify
    set shiftwidth=4 " unify
    set noexpandtab " real tabs please!
    set nowrap " do not wrap lines 
    set smarttab " use tabs at the start of a line, spaces elsewhere
    :autocmd BufEnter * call DoWordComplete()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Folding
    " Enable folding, but by default make it act like folding is off, because folding is annoying in anything but a few rare cases
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "set foldenable " Turn on folding
    set foldlevel=100 " Don't autofold anything (but I can still fold manually)
        set foldmethod=syntax " use the syntax on methon
    set foldopen-=search " don't open folds when you search into them
    set foldopen-=undo " don't open folds when you undo stuff
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " taglist
    "let Tlist_Use_Right_Window=1
    "let Tlist_File_Fold_Auto_Close=1
    let Tlist_Exit_OnlyWindow=1
    let Tlist_Show_One_File=1

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "tags
    :if getfsize("vimscript")>0
            source vimscript
    :endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "WinManager
    let g:winManagerWindowLayout='FileExplorer|TagList'
    nmap wm :WMToggle<cr>

    "minbufExplorer
    let g:miniBufExplMapCTabSwitchBufs = 1
    let g:miniBufExplMapWindowNavVim = 1 "则可以用<C-h,j,k,l>切换到上下左右的窗口中去
    let g:miniBufExplMapWindowNavArrows = 1
    "let g:miniBufExplModSelTarget = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "omnicpp
    let OmniCpp_GlobalScopeSearch = 1  " 0 or 1
    let OmniCpp_NamespaceSearch = 1   " 0 ,  1 or 2
    let OmniCpp_DisplayMode = 1
    let OmniCpp_ShowScopeInAbbr = 0
    let OmniCpp_ShowPrototypeInAbbr = 1
    let OmniCpp_ShowAccess = 1
    let OmniCpp_MayCompleteDot = 1
    let OmniCpp_MayCompleteArrow = 1
    let OmniCpp_MayCompleteScope = 1   
   
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "cscope
    :cs add ~/linux/robocup/seu-spark/src/cscope.out /home/jack/robocup/seu-spark/src
    nmap <C-c><C-s> :cs find s <C-R>=expand("<cword>")<CR><CR>
    nmap <C-c><C-g> :cs find g <C-R>=expand("<cword>")<CR><CR>
    nmap <C-c><C-c> :cs find c <C-R>=expand("<cword>")<CR><CR>
    nmap <C-c><C-t> :cs find t <C-R>=expand("<cword>")<CR><CR>
    nmap <C-c><C-e> :cs find e <C-R>=expand("<cword>")<CR><CR>
    nmap <C-c><C-f> :cs find f <C-R>=expand("<cfile>")<CR><CR>
    nmap <C-c><C-i> :cs find i ^<C-R>=expand("<cfile>")<CR><CR>
    nmap <C-c><C-d> :cs find d <C-R>=expand("<cword>")<CR><CR>

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "Grep
    "nnoremap <silent> <F3> :Grep<CR>

    "SuperTab
    "let g:SuperTabRetainCompletionType=2
    "let g:SuperTabDefaultCompletionType="<C-X><C-O>"

Apr 2

AI Techniques for Game Programming》这本书的第三章是关于一个机器人走迷宫的简单列子,通过这个简单的列子和相应的示列程序介绍了遗传算法的原理与实现过程,整个过程浅显易懂,应该算是一个遗传算法入门非常理想的教材。

Apr 2

 

今天ubuntu突然不能自动识别U盘了,用lsusb是可以看到U盘的,于是尝试着用mount手动挂载,使用sudo fdisk -l可以看到存在的盘符设备

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x8a941a0f

Device Boot Start End Blocks Id System
/dev/sda1 * 1 1913 15366141 7 HPFS/NTFS
/dev/sda2 1914 11952 80638267+ f W95 Ext'd (LBA)
/dev/sda3 11953 12076 996030 82 Linux swap / Solaris
/dev/sda4 12077 14593 20217802+ 83 Linux
/dev/sda5 1914 5738 30724281 b W95 FAT32
/dev/sda6 5739 11952 49913923+ 83 Linux

Disk /dev/sdb: 1999 MB, 1999568384 bytes
32 heads, 63 sectors/track, 1937 cylinders
Units = cylinders of 2016 * 512 = 1032192 bytes
Disk identifier: 0x4094441b

Device Boot Start End Blocks Id System
/dev/sdb1 1 1937 1952464+ b W95 FAT32

Disk /dev/sdc: 1064 MB, 1064566784 bytes
255 heads, 63 sectors/track, 129 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0d0c0b0a

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 129 1036161 b W95 FAT32

, 然后sudo mkdir /media/usbdisk创建一个文件夹,就可以用sudo mount -t vfat -o iocharset=utf8,umask=000 /dev/sdb1 /media/usbdisk/挂载U盘了,一开始老师提示“mount: wrong fs type, bad option, bad superblock on /dev/sdc,
missing codepage or helper program, or other error
系统日志中可能有一些重要的信息,
试试用 dmesg | tail 之类的命令查看。”

使用dmesg | tail可看到老是找不到盘

dmesg |tail
[ 1827.723226] VFS: Can't find a valid FAT filesystem on dev sdc.
[ 2109.229588] FAT: invalid media value (0xa5)
[ 2109.229595] VFS: Can't find a valid FAT filesystem on dev sdc.
[ 2200.193661] FAT: invalid media value (0xa5)
[ 2200.193669] VFS: Can't find a valid FAT filesystem on dev sdc.
[ 2465.332572] FAT: invalid media value (0xa5)
[ 2465.332578] VFS: Can't find a valid FAT filesystem on dev sdc.
[ 2501.270833] FAT: Unrecognized mount option "isochaset=cp936" or missing value
[ 2517.218127] FAT: invalid media value (0xa5)
[ 2517.218135] VFS: Can't find a valid FAT filesystem on dev sdc.

原来是我把加载的盘弄错了,应该是/dev/sdb1而不是/dev/sdb,sdb只是一个总称,sdb1才是具体的设备,

卸载用sudo umout /media/usbdisk就可以了.