Bay Area Chinese Restaurants
install web server on debian 6
$ sudo apt-get install postfix postfix-mysql postfix-doc mysql-client mysql-server
$ sudo vi /etc/mysql/my.cnf
uncomment #bind-address = 127.0.0.1
$ sudo /etc/init.d/mysql restart
check sql is enabled:
$ sudo netstat -tap | grep mysql
install bind9
$ sudo apt-get install bind9 dnsutils
install apache, php
$ sudo apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libruby libapache2-mod-ruby
$ sudo /etc/init.d/apache2 restart
edit /etc/hosts and
$ echo server1.example.com > /etc/hostname
$ /etc/init.d/hostname.sh start
edit /etc/network/interface to set up static ip address:
sample:
post installation of debian 6
Clike here.
Install commonly used apps
$sudo aptitude install vim ssh open-ssh git google-chrome gimp gparted kate ksnapshot chmsee mpg123 vlc mplayer acrobat acread-plugins rar unrar
Install google's open sources:
glog, gtest, gflags, snappy, protocol buffers, closure
Install python:
sudo aptitude install python python-dev python-pip build-essential
Install awesome desktop manager
sudo aptitude install awesome
To prevent nautilus to display desktop: open gconf-editor, then choose apps-->nautilus-->preferenceuncheck show-desktop.
To enable dual monitors, click here.
Install virtualbox:
-- add the following line to /etc/apt/sources.list $
deb http://download.virtualbox.org/virtualbox/debian squeeze contrib non-free
-- and then add the public key:
$wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
-- and install $ sudo apt-get update
$sudo apt-get install virtualbox-4.1
-- finally, install extension pack
Install Java plguin, flash player, java JDK
sudo aptitude install sun-java6-plugin sun-java6-jdk sun-java6-jre sun-java6-bin sun-java6-sources
sudo aptitude install flashplugin-nonfree
Install multimedia players and codecs
aptitude install w64codecs libdvdcss2 gstreamer0.10-fluendo-mp3 ffmpeg sox twolame vorbis-tools lame faad gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad avifile-divx-plugin libfacc0
Install locales
sudo apt-get install locales sudo dpkg-reconfigure locales
Install Chinese fonts
apt-get install ttf-arphic-newsung apt-get install ttf-arphic-ukai ttf-arphic-uming apt-get install ttf-arphic-gbsn00lp ttf-arphic-bkai00mp ttf-arphic-bsmi00lp ttf-arphic-gkai00mp apt-get install ttf-bitstream-vera ttf-dejavu apt-get install msttcorefonts
Install SCIM input method
sudo apt-get install scim scim-pinyin scim-tables-zh scim-gtk2-immodule scim-qtimm
sudo vi /etc/X11/Xsession.d/95xinput
add the following lines:
/usr/bin/scim -d
XMODIFIERS="@im=SCIM"
export XMODIFIERS
export GTK_IM_MODULE=scim
Change the default shell
The default shell under Debian is dash. To use bash,
$ dpkg-reconfigure dash
and select No to the question "Use dash as the default system shell (/bin/sh)?". This will link /bin/sh to /bin/dash.
安装 Debian 6.0 Squeeze
1. Install virtualbox:
-- add the following line to /etc/apt/sources.list
$ deb http://download.virtualbox.org/virtualbox/debian squeeze contrib non-free
--nd then add the public key:
$wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
-- and install
$ sudo apt-get update
$sudo apt-get install virtualbox-4.1
--finally, install extension pack
Two ways to connect a server through a socket
食物搭配禁忌(转载)
黄瓜:不能与花生同食。
白萝卜:不能与红萝卜混吃,因红萝卜中所含分解酵素会破坏白萝卜中的维生素C。严禁与桔子同食,如同食会患甲状腺肿。同时也不能与梨、苹果、葡萄等水果同食。忌与何首乌、地黄混食。服人参时禁食萝卜。
胡萝卜:不得与酒同食,因为胡萝卜素与酒精一同进入人体,会在肝脏产生毒素,引起肝病。还不宜与西红柿、萝卜、辣椒、石榴、莴苣、木瓜等一同食用,因胡萝卜中含有分解酶,可使其他果菜中的维生素失去。胡萝卜最好单独食用或与肉类一起食用。
How to connect client and server by socket
The steps to establish a socket on the client side:
1. Create a socket with the socket() system call
int socket(int domain, int type, int protocol);
[C++]Function Prototypes in Socket programming
// sys/types.h // sys/socket.h int accept(int s, struct sockaddr *addr, socklen_t *addrlen);
[C++]Structs in Socket Programming
Hash Tables in Java
Install MySQL connector/C++ on Ubuntu 11.04
First install MySQL Server.
Then download MySQL connector/C++ from here.
I used the binary file.
Install VirtualBox on Fedora
yum install gcc kernel-devel kernel-headers ## PAE kernel users install ## yum install gcc kernel-PAE-devel kernel-headers
Add VirtualBox User to vboxusers Group
usermod -a -G vboxusers user_name
Quicksort
Maximum-subarray problem
Maximum-subarray problem
Given an array, find the subarray whose sum is the largest among all of the subarrays. The program prints the left index, right index and the sum of the subarray. The maximum-subarray problem is interesting only when the array containssome negative numbers.
The program uses divide-and-conquer algorithm described on Page68, Introduction to Algorithms.
Of course, this problem can be solved by using loops directly as the second program does.
*/
[C++]Polynomial Class
The eval member function uses Horner algorithm.
File: polynomial.h
A 0-1 Knapsack Problem
Input two integers M and N. Find all possible ways that the sum of numbers chosen from 1, 2,3,...N equals M. Print all possible combinations.
*/
Combination of letters
// traverse letters from the first one to the last one.
// combination[ ] is used to save the result of each combination.
// layer indicates the number of letters in the combination, also it tells you
// the position of the newly visited letter in combination[ ]
// layer increases by one in each recursion
Sieve of Eratosthen algorithm
The following codes(modified) are from Algorithms in C++ and Core Java Volume I.