2011年8月4日 星期四

subversion server and client TortoiseSVN + for windows

之前,我在ubuntu下使用subversion
但這次,則是在windows 平台下.去安裝subvision server及subvision client.
以及...學習如何使用版本控制

 http://zh.wikipedia.org/wiki/Subversion

2011年5月20日 星期五

vim加裝plugin

安装:
(1) 下载插件 vimim.vim
(2) 把插件扔到vim的plugin文件夹里面
使用:
(1) 进入vim, 进入insert模式
(2) 输入彩蛋 vimimenv
(3) 按 ctrl+6,显示菜单列表 
(4) 按 h,切换显示列表标签 
(5) 按 j, 下移光标 
(6) 按 k,上移光标 
(7) 按 l, 切换列表左右排列 
(8) 按 n,切换列表上下排列 
(9) 按 ctrl+6,输出菜单列表 

特別 : 安裝說明檔
 在其~/.vim/doc 是在放入各個plugin的文件.
 而你可以"helptags ~/.vim/doc"來引入其文件
之後你就可以 ":help XX"了
http://vim.sourceforge.net/scripts/script.php?script_id=2506

2011年5月19日 星期四

掛載硬碟

$sudo mount -t vfat -o iocharset=utf8 /dev/sda[1~5] /media/test
 必須加上, -o iocharset=utf8來顯示中文檔名
 而其mount 一定要加上sudo ?
------------------------------
DESCRIPTION
       All  files  accessible in a Unix system are arranged in one big tree,
       the file hierarchy, rooted at /.  These files can be spread out  over
       several  devices.  The  mount command serves to attach the filesystem
       found on some device to the big file tree.

       The standard form of the mount command, is

              mount -t type device dir

       This tells the kernel to attach the filesystem found on device (which
       is of type type) at the directory dir.   The  previous  contents  (if
       any)  and owner and mode of dir become invisible, and as long as this
       filesystem remains mounted, the pathname dir refers to  the  root  of
       the filesystem on device.

      -t, --types vfstype
              The argument following the -t is used to indicate the filesys‐
              tem type.  The filesystem types which are currently  supported
              include:  adfs,  affs,  autofs,  cifs, coda, coherent, cramfs,
              debugfs, devpts, efs, ext, ext2,  ext3,  ext4,  hfs,  hfsplus,
              hpfs,  iso9660,  jfs,  minix,  msdos,  ncpfs, nfs, nfs4, ntfs,
              proc, qnx4, ramfs, reiserfs,  romfs,  squashfs,  smbfs,  sysv,
              tmpfs,  ubifs,  udf,  ufs,  umsdos,  usbfs,  vfat, xenix, xfs,
              xiafs.



        -o, --options opts
              Options are specified with a -o flag followed by a comma sepa‐
              rated string of options. For example:

                     mount LABEL=mydisk -o noatime,nouser

              For more details, see FILESYSTEM INDEPENDENT MOUNT OPTIONS and
              FILESYSTEM SPECIFIC MOUNT OPTIONS sections.

Mount options for fat
       (Note:  fat  is  not  a separate filesystem, but a common part of the
       msdos, umsdos and vfat filesystems.)

       conv={b[inary]|t[ext]|a[uto]}
              The  fat filesystem can perform CRLF<-->NL (MS-DOS text format
              to UNIX text format) conversion in the kernel.  The  following
              conversion modes are available:

              binary no translation is performed.  This is the default.

              text   CRLF<-->NL translation is performed on all files.

              auto   CRLF<-->NL  translation  is performed on all files that
                     don't have a "well-known binary" extension. The list of
                     known  extensions  can  be  found  at  the beginning of
                     fs/fat/misc.c (as of 2.0, the list is: exe,  com,  bin,
                     app,  sys, drv, ovl, ovr, obj, lib, dll, pif, arc, zip,
                     lha, lzh, zoo, tar, z, arj, tz, taz, tzp, tpz, gz, tgz,
                     deb, gif, bmp, tif, gl, jpg, pcx, tfm, vf, gf, pk, pxl,
                     dvi).

              Programs that do computed lseeks  won't  like  in-kernel  text
              conversion.  Several people have had their data ruined by this
              translation. Beware!

              For filesystems mounted in  binary  mode,  a  conversion  tool
              (fromdos/todos) is available. This option is obsolete.

     iocharset=value
              Character  set  to use for converting between 8 bit characters
              and 16 bit Unicode characters. The default is iso8859-1.  Long
              filenames are stored on disk in Unicode format.

error message:(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'

(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'

這是我在以GUN tool下編譯 最原始NXP LPC2388在日文雜誌上的最簡單的檔案
所產生的錯誤, 以下是我找到的解答,看樣子是因為不加-nostdlib時,在進行連結時
會和GUN 中的library產生,交互作用來產生的衝突

Q.目前,不知是我的板子壞了,還是怎樣?以Magic Flash寫入不順
(侍測)

---------------------------------------------

arm-linux-gcc加上-nostdlib選項就OK啦!

-nostdlib
不連接系統標準啟動文件和標準庫文件,只把指定的文件傳遞給連接器。這個選項常用於編譯內核、bootloader等程序,它們不需要啟動文件、標準庫文件。

--------------------------------------------

2011年5月18日 星期三

版本控制+使用subversion(+2001/6/12

裡面有太多太多要講了.
目前,已完成了 1.使用subversion 2.使用Web建立
此篇,要講的是如何在web存取及設定(其它相關的會改天)

http://www.ithome.com.tw/itadm/article.php?c=67969
  1.需要安裝有 subversion , ApacheHTTPserver,libapache2-svn
   $apt-get install subversion[libapache2-svn]

2.(目前,未知如何在未端下.來建立檔案庫)
   $ svnadmin create /usr/local/svn/newrepos [newrepos:為一個檔案庫]
[$ svn import mytree  file:///usr/local/svn/newrepos/fooproject]
 
 3.設定apache2
   A. 
 /etc/apache2/mods-available/dav_svn.conf 
 
#在web上所可以看到的
     DAV svn
#必加上
     SVNPath /home/svn/myproject
#設定其檔案庫的位置
     AuthType Basic
     AuthName "myproject subversion repository"
     AuthUserFile /etc/subversion/passwd
     
        Require valid-user
     
  
B.
create /etc/subversion/passwd file. This file contains user authentication details
$ sudo htpasswd -c /etc/subversion/passwd user_name
#-c 為避免覆寫passwd 

It prompts you to enter the password. Once you enter the password, the user is added.
C.
restart apache2 web server
$sudo /etc/init.d/apache2 restart

D.結果

$ svn co http://hostname/svn/myproject myproject --username name

參考資料:
http://twpug.net/docs/Subversion/#svn-ch-0-sect-1
https://help.ubuntu.com/community/Subversion
https://help.ubuntu.com/community/InstallingSoftware
 http://svnbook.red-bean.com
https://help.ubuntu.com/community/ApacheHTTPserver

權限對檔案(目錄)的重要性

一,對檔案來言

檔案是實際含有資料的地方,包括一般文字檔、資料庫內容檔、二進位可執行檔(binary program)等等。 因此,權限對於檔案來說,他的意義是這樣的:
  • r (read):可讀取此一檔案的實際內容,如讀取文字檔的文字內容等;
  • w (write):可以編輯、新增或者是修改該檔案的內容(但不含刪除該檔案);
  • x (eXecute):該檔案具有可以被系統執行的權限
那個可讀(r)代表讀取檔案內容是還好瞭解,那麼可執行(x)呢?這裡你就必須要小心啦! 因為在Windows底下一個檔案是否具有執行的能力是藉由『 副檔名 』來判斷的, 例如:.exe, .bat, .com 等等,但是在Linux底下,我們的檔案是否能被執行,則是藉由是否具有『x』這個權限來決定的!跟檔名是沒有絕對的關係的
至於最後一個w這個權限呢?當你對一個檔案具有w權限時,你可以具有寫入/編輯/新增/修改檔案的內容的權限, 但並不具備有刪除該檔案本身的權限!對於檔案的rwx來說, 主要都是針對『檔案的內容』而言,與檔案檔名的存在與否沒有關係喔!因為檔案記錄的是實際的資料嘛!

二,對目錄來言
 目錄主要的內容在記錄檔名清單,檔名與目錄有強烈的關連
  • r (read contents in directory)

    表示具有讀取目錄結構清單的權限,所以當你具有讀取(r)一個目錄的權限時,表示你可以查詢該目錄下的檔名資料。 所以你就可以利用 ls 這個指令將該目錄的內容列表顯示出來!
  • w (modify contents of directory)

    這個可寫入的權限對目錄來說,是很了不起的! 因為他表示你具有異動該目錄結構清單的權限,也就是底下這些權限:

    • 建立新的檔案與目錄;
    • 刪除已經存在的檔案與目錄(不論該檔案的權限為何!)
    • 將已存在的檔案或目錄進行更名;
    • 搬移該目錄內的檔案、目錄位置。

    總之,目錄的w權限就與該目錄底下的檔名異動有關就對了啦!
  • x (access directory)

    咦!目錄的執行權限有啥用途啊?目錄只是記錄檔名而已,總不能拿來執行吧?沒錯!目錄不可以被執行,目錄的x代表的是使用者能否進入該目錄成為工作目錄的用途! 所謂的工作目錄(work directory)就是你目前所在的目錄啦!舉例來說,當你登入Linux時, 你所在的家目錄就是你當下的工作目錄。而變換目錄的指令是『cd』(change directory)囉!

2011年5月17日 星期二

VIM+NERD_commenter.vim

#用來加註解用的.
雖然,早就想安裝了及使用,但是在網路上在搜尋完其使用後
結果,不同.故一直空下來.今天,終於知道為何..會造成了Orz

2011年5月5日 星期四

查看cpu information


~$ cat /proc/cpuinfo
即可

  • /proc - dynamic directory including information about and listing of processes
----------------------------------------------
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 22
model name : Intel(R) Celeron(R) CPU          540  @ 1.86GHz
stepping : 1
cpu MHz : 1861.591
cache size : 1024 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx lm constant_tsc up arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl tm2 ssse3 cx16 xtpr pdcm lahf_lm
bogomips : 3723.18
clflush size : 64
cache_alignment : 64
----------------------------------------
而在 /proc 中的
steven@steven-laptop:/proc$ ls
1      1326   1402  1704  332   8015       cmdline        mounts
10     1327   1413  1711  35    8017       cpuinfo        mtrr
10016  1333   1414  18    4     803        crypto         net
10034  1340   1420  1806  42    8046       devices        pagetypeinfo
1008   1342   1421  19    44    8049       diskstats      partitions
1011   1347   1422  2     47    8052       dma            sched_debug
1046   1354   1432  20    48    807        dri            schedstat
1049   1356   1434  21    49    8299       driver         scsi
10839  1357   1436  22    5     8393       execdomains    self
11     1358   1442  23    50    8440       fb             slabinfo
11140  1359   1451  238   51    8444       filesystems    softirqs
11162  1361   1452  239   52    882        fs             stat
1159   1363   1477  24    586   893        interrupts     swaps
1176   1364   1478  245   591   898        iomem          sys
1193   13808  1480  246   6     9          ioports        sysrq-trigger
1197   13809  1487  247   626   908        irq            sysvipc
12     1381   1488  251   650   909        kallsyms       timer_list
1201   13810  1496  27    656   913        kcore          timer_stats
1261   1385   1498  2742  696   915        key-users      tty
12643  1387   15    28    7     925        kmsg           uptime
12644  1389   1502  285   718   926        kpagecount     version
1267   1391   1551  286   734   945        kpageflags     version_signature
12807  1392   1589  287   787   978        latency_stats  vmallocinfo
1285   1394   1590  29    793   9963       loadavg        vmstat
13     1395   16    3     797   acpi       locks          zoneinfo
13005  1397   1602  30    799   asound     mdstat
13109  13974  1609  31    8     buddyinfo  meminfo
1316   14     1629  32    800   bus        misc
1323   1400   17    329   8012  cgroups    modules

可由此一目錄中查看出所有的相關硬体資訊

------------------------------
參考資料: 

2011年4月20日 星期三

vim + snipmate

snipMate.vim aims to be an unobtrusive, concise vim script that implements some of TextMate's snippets features in Vim. A snippet is a piece of often-typed text that you can insert into your document using a trigger word followed by a

2011年4月18日 星期一

vim 常用的功能(未完

1. 
Q.How To Show Line Numbers In vi / vim Text Editor
    [esc]+:set number
    ps:可在~./vimrc 中加入set number


2.
Q.VI / VIM: Insert Current Date / Time
    [esc]+r + !date

3.
Q.分割視窗,改變視窗大小
   [esc]+: + sp [filename] .沒加filename時,其以原文件分割,(同一文件,可不同位置)
   [esc]+: + vsp[filename] .以vertical  windows.
   改變分割視窗大小
   [esc] + : + res N
   [esc] + : + vertical res N

4.
 Q.在分割視窗下,改變其位置
 ctrl + W + H[J,K,L]

5.複製,到不同的clip上(reg)
   可以用 "1y10y  此為將游標下10行,copy 到 reg1中,而貼上時,"1p

6.GUI clip,vim ??

5.windows move,? windows buffer?
   http://www.cyberciti.biz/

更新應用程式on ubuntu

前因:
一直以後,在使用firefox時,其原來內建於ubuntu.版本為3.6
雖然有用其ubuntu中的程式管理"ubuntu軟體管理中心"這個去找
新的firefox,或是在原本的firefox的功能.
來嘗試來更新,但一直沒有找到相關的.orz
(而且,firefox 3.6 在跑大量flash時常crash)

2011年4月2日 星期六

screen blanking

前題:
因為,在我的Ubuntu下.雖然有選項可以鎖往螢幕.但其螢幕只是全黑.而非關閉螢幕.
前陣子,找到一篇在講在X下設定的文章.目前會先關閉螢幕,再由系統來進入鎖住的動作


2011年3月27日 星期日

dos v.s unix 檔案格式

在dos的斷行字為CR+LF;而在linux中只有LF
故你要在windows下編輯的檔案,那來在linux下需要經過轉換
$dos2unix [-kn] file [newfile]
$unix2dos [-kn] file [newfile]
-k:保留原本的的mtime(不改變其修改時間
-n:保留原本的檔案,而將輸出到一個新的檔案


第一步:basis 2

在vim中,有四個模式
1.Command-Line mode
   一開始,開始vim時.均由此模式開始操作.
   要編輯資料時,就進入insert mode下(參2)
   或刪除資料時,就輸入刪除指令(參3)  
   for entering commands, e.g. :set number

2.Insert mode
    Use only for typing;(由Command-Line mode下,按

    1.  i : 在游標所在字元前開始輸入文字(insert)。
    2.  I :在行首開始輸入文字。
    3. a:在游標所在字元後開始輸入文字(append)。
    4. A:在行尾開始輸入文字。

    在此模式下,可以編輯,仍可移動遊標

3.刪除資料
  • x:刪除目前遊標所指的字元 (可用u恢復
  • dw:刪除其word
  • cw:cw+insert mode
  • dd:delete  a line at the cursor
  • dw:dd+insert mode
  • r:取代目前的字元(x+i)
ps.可以用10dd
We have discussed about the function of ESC above, ESC can also be used to cancel a command, for example, if you wanna change a word but after typing c, you find out that the cursor is at the wrong position, you can use ESC to cancel the command. =item * Replacement

5.vISUAL SELECTION(可視選擇模式
   一般情況下,你要使用剪下時,可直接使用d,(複製,y);(剪下並進入,insert mode.c)
   但為了提示選區,可以使用v,(V)用強光提示.
  •   在可視選擇模式下
          可用 d,y,c
  • 在非可視選擇模式下
        當你很清楚知道你要的東西時,就不需要進行可視模式下.即可節省時間
    1. d{motion}:剪切motion指令跨過的字元到剪貼簿.如:dw,dfS
    2. y{motion}:複制
    3. c{motion}:同d,但會進入insert mode
    4. cc,yy,dd
    5. D:剪切游標位置到行尾的內容到剪貼薄
    6. Y:複制當行
    7. C:同D,但insert
    8. x:剪切當前字元
    9. s:同x,但insert mode
 **使用多重剪貼簿
     在vim稱為暫存器(register),:reg可以列出當前定義的所有register及內容
(" kyy:複制前行到暫存器k中....其暫存器的命名,最好是用小寫字母

    

2011年3月26日 星期六

makefile中的.PHONY(phony target

在makefile中的target中,有一個名為Phony target
但在我的看書上.並沒有針對它的說明

所謂的phony target不是一個真實的file.它只是對一些commands集合的名稱.有二個理由來使用 a.為了避免confilict file name b.改善performance