Tuesday, November 29, 2011

/boot directory is full and remount another partition to /boot direcotry

Problem: /boot directory on /dev/hda1 is full, and no more space on disk
Solve: re-mount /dev/hda6 to /boot 

[root@centos5 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda2             9.5G  7.7G  1.4G  86% /
/dev/hda6              23G  4.7G   17G  22% /home
/dev/hda3             1.9G   37M  1.8G   3% /tmp
/dev/hda1              90M  85M   5M 100% /boot

mount /dev/hda6 /boot


[root@centos5 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda2             9.5G  7.7G  1.4G  86% /
/dev/hda6              23G  4.7G   17G  22% /home
/dev/hda3             1.9G   37M  1.8G   3% /tmp
/dev/hda1              23G  4.7G   17G  22% /boot
tmpfs                 251M     0  251M   0% /dev/shm
/dev/hda6              23G  4.7G   17G  22% /boot

Sunday, November 27, 2011

Latex Table Example

http://en.wikibooks.org/wiki/LaTeX/Tables

Thursday, November 24, 2011

Excel to Latex

http://dataninja.wordpress.com/2006/01/20/excel-to-latex/

1. download add-in, install it in the excel (office 2007 on mac doesn't work, office 2011 works)
Tool-> Add-in

2. select the table, format -> Excel To Latex

3. Copy & paste

Tuesday, November 22, 2011

Count lines of source code of Software

Tool Download:
http://www.dwheeler.com/sloccount/

Install it on CentOS
rpm -iv sloccount-2.26-1.i386.rpm

Run it:
sloccount xen-4.1-testing.hg/xen/

Install RPM file in CentOS

rpm -iv sloccount-2.26-1.i386.rpm

Check out Xen source code

Xen use mercurial repository. 

Friday, November 18, 2011

ifconfig commands

$ifconfig eth0 down

$ifconfig eth1 up

Change MTU setings for NIC interface in order to transfer Jumbo frames

mtu-valueSpecifies the maximum transmission unit (MTU) or packet size that the vNIC accepts. Valid MTU values are 1500 to 9000 bytes; the default is 1500.



For CentOS:
$ vim /etc/sysconfig/network-scripts/ifcfg-eth0 

Add settings,
MTU="9000"

$ service network restart

it also could use command:
$ sudo ifocnfig eth1 mtu 16110


For Ubuntu
$ sudo ifconfig eth1 mtu 9000 up




Note: 
Regular network card MTU is from 1500 to 9000 bytes
Some powerful network card may support 16K packet size, which has max MTU 16110
This link talks about Intel Gigabytes NIC support 16K
http://communities.intel.com/thread/13247?wapkw=(mtu)

jumbo frames are Ethernet frames with more than 1500 bytes of payload.
1500 bytes doesn't include the Ethernet header
So the default MTU 1500 is the size of Ethernet frame payload


More info about Jumbo frames:
http://en.wikipedia.org/wiki/Jumbo_frame



more info about changing MTU:
http://www.cyberciti.biz/faq/centos-rhel-redhat-fedora-debian-linux-mtu-size/

Thursday, November 17, 2011

tcpdump Howto

$ tcpdump -i eth0 -w outputfile // listen on interface eth0, and write all the traffic to outputfile, may need root privilege.

$ tcpdump -r outputfile > textfile // read the raw traffic and put it into textfile

tcpdump -r tcpdump2 -tt > textfile2 // flag -tt mean don't format the time

More: man tcpdump

Monday, November 7, 2011

Checksum offloading

software doesn't do checksum calcalation, it hand over an empty checksum field to the hardware and hardware does that automaticlly. 


Link:http://www.wireshark.org/docs/wsug_html_chunked/ChAdvChecksums.html


Recent network hardware can perform advanced features such as IP checksum calculation, also known as checksum offloading. The network driver won't calculate the checksum itself but will simply hand over an empty (zero or garbage filled) checksum field to the hardware.

Wednesday, November 2, 2011

convert PDF to EPS on Mac

TexShop

  1. Tool in MacTeX.
  2. To convert pdf → eps, open the pdf in TeXShop, choose the "Selection" tool in the Preview window toolbar, select the desired rectangle (or all, either with ⌘-A or manually), choose "Preview>Save Selection to File...", & save as eps

Tuesday, November 1, 2011

Process Address Space

1. Each process has a process descriptor, and the location is in Kernel Space (3G-4G)
e.g. virtual address: 0xF44F7930, physical address: 0x344F7930

2. Each process has a memory descriptor, and the location is in Kernel Space (3G-4G)
e.g. virtual address: 0xF6CEA900, physical address: 0x36CEA900

3. Each process has a CR3 value and page directory and page table are in Kernel Space (3G-4G). And the value in CR3 register is a physical address. and value in pgd field of mm_struct is a virtual address. And pgd = CR3 + PAGE_OFFSET
e.g. CR3: 0x36D1C000, pgd:0xF6D1C000

4. Static code of process is in User Space (0G- 3G). The physical address of static is non-continuous, and it is allocated by page (4K).
e.g. virtual address: 0x8048000 - 0x8048DBC

5. Different process could have same linear address space.
e.g. static code of Firefox: 0x8048000 - 0x806D333; static code of Minicom: 0x8048000 - 0x805E333