2011年10月29日 星期六

LAMP

#how to install lamp - apache2 , mysql , php

sudo apt-get install apache2

#test if http://localhost/  has been works.
_________________________________________________
#install php5 and dependecy

sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
_________________________________________________
#install mysql

sudo apt-get install mysql-server

#set mysql root password

_________________________________________________

Then get phpmyadmin to control you MySQL by browser

follow instruction in such sample.config file
and rename to erase 'sample'

It should be put in /var/www/

ps.
if  http://localhost/phpmyadmin is not found

check /etc/apache2/apache2.conf
remember restart

PS
if phpmyadmin has something wrong
remove all php5
install php5 / php5-mysql / php5-mcrypt at same time

2011年10月28日 星期五

SQL-add user

add a newuser in mysql by SQL below:


CREATE USER 'cfg'@'%' IDENTIFIED BY '***';

GRANT ALL PRIVILEGES ON * . * TO 'cfg'@'%' IDENTIFIED BY '***' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0MAX_USER_CONNECTIONS 0 ;

GRANT ALL PRIVILEGES ON `mysql` . * TO 'cfg'@'%';

2011年9月13日 星期二

Linux-tar

tar是Linux上用來封裝(打包)檔案用的

tar [-j|-z] [-cv] -f tar_name target
打包target

tar [-j|-z] [-tv] -f tar_name
察看tar之檔

tar [-j|-z] [-xv] -f tar_name [-C director]
解開tar
-C可指定愈放置檔案之目錄
預設是在當前目錄

-j -z 不要亂加
-j為支援bzip2,tarname要是*.tar.bz2
-z為支援gzip,tarname要是*.tar.gz

-c 打包
-t 察看
-x 解開
-v 顯示詳細內容
-f 檔案
一般用此即可
tar -cvf xxx.tar file
tar -xvf xxx.tar [-C director]

2011年9月1日 星期四

Algorithms-simple binary search

first,you need sort

then you could search the 'numeber'

variable t show the recursive times

code:

2011年8月23日 星期二

C-集合

列出{1,2,....,n}之所有子集,包括空集合ϕ

code:(參考名題百則)


notion:
產生布林表
利用i,j找出對應值
0000 --> {}
1000 --> {1}
0100 --> {2}
1100 --> {1,2}
0010 --> {3}
1010 --> {1,3}
0110 --> {2,3}
依此類推

2011年8月15日 星期一

Linux vim copy and paste

if copy and paste can't work

in vim

:h gui-clipboard

add this line in _vimrc
source $VIMRUNTIME/mswin.vim