Linux 壓縮與解壓縮

.tar
解壓:tar xvf FileName.tar
壓缩:tar cvf FileName.tar DirName
(注:tar是包裹(把多個檔案合成一個),不是壓缩!)
---------------------------------------------
.gz
解壓1:gunzip FileName.gz
解壓2:gzip -d FileName.gz
壓缩:gzip FileName
.tar.gz
解壓:tar zxvf FileName.tar.gz
壓缩:tar zcvf FileName.tar.gz DirName
---------------------------------------------
.bz2
解壓1:bzip2 -d FileName.bz2
解壓2:bunzip2 FileName.bz2
壓缩: bzip2 -z FileName
.tar.bz2
解壓:tar jxvf FileName.tar.bz2
壓缩:tar jcvf FileName.tar.bz2 DirName
---------------------------------------------
.bz
解壓1:bzip2 -d FileName.bz
解壓2:bunzip2 FileName.bz
壓缩:未知
.tar.bz
解壓:tar jxvf FileName.tar.bz
壓缩:未知
---------------------------------------------
.Z
解壓:uncompress FileName.Z
壓缩:compress FileName
.tar.Z
解壓:tar Zxvf FileName.tar.Z
壓缩:tar Zcvf FileName.tar.Z DirName
---------------------------------------------
.tgz
解壓:tar zxvf FileName.tgz
壓缩:未知
.tar.tgz
解壓:tar zxvf FileName.tar.tgz
壓缩:tar zcvf FileName.tar.tgz FileName
---------------------------------------------
.zip
解壓:unzip FileName.zip
壓缩:zip FileName.zip DirName
---------------------------------------------
.rar
解壓:rar a FileName.rar
壓缩:rar e FileName.rar


rar請到:http://www.rarsoft.com/download.htm 下載!
解壓後請将rar_static拷貝到/usr/bin目錄(其他由$PATH環境變數指定的目錄也可以):
[root@www2 tmp]# cp rar_static /usr/bin/rar
---------------------------------------------
.lha
解壓:lha -e FileName.lha
壓缩:lha -a FileName.lha FileName

lha請到:http://www.infor.kanazawa-it.ac.jp/~ishii/lhaunix/下載!
解壓後請将lha拷贝到/usr/bin目錄(其他由$PATH環境變數指定的目錄也可以):
[root@www2 tmp]# cp lha /usr/bin/
---------------------------------------------
.tar .tgz .tar.gz .tar.Z .tar.bz .tar.bz2 .zip .cpio .rpm .deb .slp .arj .rar .ace .lha .lzh .lzx .lzs .arc .sda .sfx .lnx .zoo .cab .kar .cpt .pit .sit .sea
解壓:sEx x FileName.*
壓缩:sEx a FileName.* FileName

sEx只是調用相關程序,本身並無壓缩、解壓功能,請注意!\r
sEx請到:http://sourceforge.net/projects/sex下載!
解壓后請将sEx拷贝到/usr/bin目錄(其他由$PATH環境變數指定的目錄也可以):
[root@www2 tmp]# cp sEx /usr/bin/ 

Remove sun-java6-jdk on UBUNTU

SDK instal and path set up  

http://wallyjue.blogspot.com/2011/04/ubuntu-1004java-jdk-15.html

Remove java
$sudo apt-get remove sun-java6-jdk
$sudo apt-get remove sun-java6-jre
$sudo apt-get remove sun-java6-bin

Introduce the Linux Directories


If you look at the Linux file hierarchy, you find the following :
  • /bin - common binaries
  • /sbin - Binaries used for system administration are placed here.
  • /boot - static files of the boot loader. Usually it contain the Linux kernel, Grub boot loader files and so on.
  • /dev - device files such as your CD drive, hard disk, and any other physical device. (In Linux/Unix, the common premise is that everything is a file).
  • /home - user home directories are found here. In unices like FreeBSD, the home directoriesare found in /usr/home. And in Solaris it is in /export. So quite a big difference here.
  • /lib - Essential shared libraries and kernel modules
  • /mnt - temporary mount point useful for when you insert your USB stick and it gets mounted under /mnt. Though in Ubuntu and the likes, it is usually mounted under /media.
  • /var - variable data, such as logs, news, mail spool files and so on which is constantly being modified by various programs running on your system.
  • /tmp - temporary files are placed here by default.
  • /usr - the secondary hierarchy which contain its own bin and sbin sub-directories.
  • /etc - Usually contain the configuration files for all the programs that run on your Linux/Unix system.
  • /opt - Third party application packages which does not conform to the standard Linux file hierarchy can be installed here.
  • /srv - Contains data for services provided by the system.

Problem: xxx is not in the sudoers file

sudo时提示"xxx is not in the sudoers file. This incident will be reported.其中XXX是你的用户名,也就是你的用户名没有权限使用sudo,我们只要修改一下/etc/sudoers文件就行了。下面是修改方法:

1)进入超级用户模式。也就是输入"su -",系统会让你输入超级用户密码,输入密码后就进入了超级用户模式。(当然,你也可以直接用root用)
 

2)添加文件的写权限。也就是输入命令"chmod u+w /etc/sudoers"。
 
3)编辑/etc/sudoers文件。也就是输入命令"sudo gedit  /etc/sudoers",输入"i"进入编辑模式,找到这一 行:"root ALL=(ALL) ALL"在起下面添加"xxx ALL=(ALL) ALL"(这里的xxx是你的用户名),然后保存(就是先按一 下Esc键,然后输入":wq")退出。 
4)撤销文件的写权限。也就是输入命令"chmod u-w /etc/sudoers"。

Install repo

Problem:
-----------------------------------------------------------------------------------------------------------------------------
fatal: unable to connect a socket


Resolution:
-----------------------------------------------------------------------------------------------------------------------------
會出現這個問題是因為Android git   Server的DNS查詢回應太慢的關係可依照下列方法解決
1.  ping android.git.kernel.org ,將結果的IP記錄下來
2.  更改系統的hosts, 將android.git.kernel.org與IP之對照表建立起來
     方法:sudo gedit /etc/hosts 新增一行 IP address 對照到 android.git.kernel.org
3. 修改專案目錄下的  .repo/manifest.xml, 將android.git.kernel.org 替換成剛剛找到的IP
4. repo init ................................................................................


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


http://5i01.com/topicdetail.php?f=423&t=1130384&p=1

Install sun-java5-jdk in UBUNTU


$ sudo  add-apt-repository  "deb http://old-releases.ubuntu.com/ubuntu/ jaunty multiverse"


$ sudo  add-apt-repository  "deb http://old-releases.ubuntu.com/ubuntu/ jaunty-updates multiverse"


$ sudo  apt-get  update


$ sudo  apt-get  install  sun-java5-jdk






http://a7419.pixnet.net/blog/post/73106685

What is Design Pattern!?

什麼是 Design Pattern
所以,Pattern 就是一種「千錘百鍊」的智慧結晶。有經驗的專家和沒經驗的新手,差別就在於:有經驗的專家知道如何在適當的時機,套用某些公式(Pattern)以解決特定 的問題,這是專家經年累月所培養出來的 Know-How(請參見「軟體產業的知識經濟」一文)。

一般來說,物件導向軟體開發的程序可以粗略分成 OOA(物件導向分析)、OOD(物件導向設計)、OOP(物件導向實作)。在 OOD(Object-Oriented Design)階段所採用的 Pattern 就稱為 Design Pattern。運用良好的 Design Pattern,可以使得系統架構更優良(也更快完成),對於後續的 OOP、測試、維護,都會有很大的 幫助。Design Pattern 會告訴你,什麼情況下用 Delegation 而不要用繼承、什麼情況下用 Interface 而不要用 Class... 諸如此類的知識。這些都是軟體界前輩的智慧結晶。

我要強調 Design Pattern 專指 Design 時期的 Pattern。但是 Coding 時的 Pattern(例如程式碼內縮)最好不要稱為 Pattern,以免混淆。Coding 時期的 Pattern 最好稱為 Coding Style(或 Code Style)。

Design Pattern 這個名詞也可沿用到許多地方。我認為孫子兵法就是一本軍事領域 Design Pattern 的書,它告訴你什麼時候該採什麼樣的軍事動作。至於怎麼去砍人,則是屬於 implementation 的部分,不屬於孫子兵法的範圍。

什麼是 Anti-Pattern
並非所有的 Pattern 都是好的,不好的 Pattern 稱為 Anti-Pattern。如果你的系統中出現了 Anti-Pattern,就表示你犯了別人「常犯的典型錯誤」。簡言之,Anti-Pattern 就是錯誤的示範,要盡量避免。