Bay Area Chinese Restaurants

Want to find a list of Chinese restaurants in Bay Area? Here is one: https://memorybit.net

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:

 

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
        address 192.168.0.100
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
$sudo /etc/init.d/networking restart
 
edit /etc/hosts:
127.0.0.1       localhost.localdomain   localhost
192.168.0.100   yiznix.com    host
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
 
edit /etc/hostname:
$sudo echo yiznix.com > /etc/hostname
$sudo /etc/init.d/hostname.sh start
 
check hostname:
$sudo hostname
$sudo hostname
both of them must be yiznix.com

post installation of debian 6

Edit the repositories:
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

 0. Install sudo (open users and groups form System-Administrations, check your username under relevant groups)
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

1. using getaddrinfo()

食物搭配禁忌(转载)

蔬菜类

黄瓜:不能与花生同食。
白萝卜:不能与红萝卜混吃,因红萝卜中所含分解酵素会破坏白萝卜中的维生素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

accept()

// sys/types.h
// sys/socket.h

int accept(int s, struct sockaddr *addr, socklen_t *addrlen);

[C++]Structs in Socket Programming

Below are IP structs used in socket programming.

Hash Tables in Java

A Well-known data structure for finding objects quickly is the hash table.  A hash table computes an integer called the hash code, for each object. A hash code is an integer that is somehow derived from the instance fields of an object, preferably such that objects with different data yield different codes.