Sunday, February 27, 2011

Trusted Platform Module

TPM: check the integrity of BIOS, linux kernel code, application code.


Use hash algorithm. NewHash = H{OldHash + m}

Run PC apps on Mac(or Linux), and run terminals on Windows

Run PC apps on Mac(or Linux): wine
and run terminals on Windows: cgwin

Tuesday, February 15, 2011

PGP Key HOWTO

1. install GPG (GNU Privacy Guard) or OpenPGP
Windows: http://www.gpg4win.org/download.html
Ubuntu: already installed
Mac: http://www.securelaptop.org/component/content/article/37-secure/73-openpgp-for-macosx.html

2. generate key
$gpg --gen-key

3. show keys
$gpg --list-keys

4. import other people key
$gpg --import someonePGPKey.asc

5. post mykey to key server
key server: http://pgp.mit.edu/
$export GPGKEY=D8FC66D2
$gpg --output mykey.asc --export -a $GPGKEY
 
6. encrypt file
$gpg --encrypt file -r UerID

More information:

https://help.ubuntu.com/community/GnuPrivacyGuardHowto

Sunday, February 13, 2011

latex problems

If you have following problem at ubuntu 10.4

LaTeX Error: File `algorithmic.sty' not found.
 install this:

$sudo apt-get install texlive-science


if you missing:
! LaTeX Error: File `multirow.sty' not found
! LaTeX Error: File `metre.sty' not found


$sudo apt-get install texlive-latex-extra
or
$sudo port install textlive-latex-extra

Wednesday, February 9, 2011

What type of shell are you using?

echo $SHELL

it could be bash, cshell, kshell...

Tuesday, February 8, 2011

Windows XP SP3 enable Hibernation

execute: "powercfg /hibernate on" on terminal
Click Turn off computer button, then hold shift.
Stand By button will change to Hibernation button

More detailed please see:
http://social.answers.microsoft.com/Forums/en-US/xpdesktop/thread/c315fe19-0d53-4136-812a-14cb080baa76

Monday, February 7, 2011

Excel HowTO

1. Import data from file
You could use copy and paste, it would pop up a import dialog, so you could choose the separation symbol, E.g. Space or tab

2. set the function you want to use
E.g. substraction
click on the rectangle where you want to put the result at
type: "=F1-D1", Enter
if you want to apply this function to other rows, just drag the result rectangle

E.g. average
Click on the rectangle where you want to put the result at
type "=AVERAGE(F27:F36)", Enter

Remember, if you start with "=", it would assume it is a function, you could also search the function.

Saturday, February 5, 2011

Understanding PCI Device / Configuration Registers

what is PCI? 
PCI is a standard, which help devices on board to communicate with each other.

What is PCI device?
E.g. all kinds of controllers, like SATA controller at southbridge, Memory controller at northbridge.

What is controller?
this controller may have single or multiple funtions (based on board m2v-mx_se)
SATA controller: bus0, device15, function0 (see vt8237r datasheet page 61)
Memory controller: bus0, device 18, function0,1,2,3 (see AMDK8 BKDG page 39)

What is in the function?
each function has 256 bytes, (offset from 0x00 to 0xff), there are many PCI configuration registers in each function. you can access these registers by standard PCI function. see previous article pci programming

PCI configuration Space:
Total 256 bytes, first 64 bytes of configuration space are standardized; the remainder are available for vendor-defined purposes. The format of the head can be found here

NVRAM, DRAM, SRAM

Non-Volatile random access memory.
E.g. flash disk
it will not loose data after power off
Dynamic random access memory (DRAM) and Static random access memory (SRAM) will need power to keep data.
DRAM: volatile, need periodically refreshed (home PCs are DRAM)
SRAM: volatile

NVRAM fast than disk, but it more expensive

Friday, February 4, 2011

mount LVM partition from other disk

 Supposed you installed Ubuntu or Cent OS on your machine, you want to mount another LVM paritition disk.
Following is the detailed steps:

2. Boot using the live cd. Search for these tools: lvm2. If the cd do not have it, install it. (Cent OS already installed, Ubuntu maybe not)
# apt-get install lvm2

3. To make sure the harddisk is recognised, you can use fdisk
# fdisk -lu

4. Once installed, run pvscan to scan all disks for physical volume. this to make sure your LVM harddisk is detected by Ubuntu
# pvscan
PV /dev/sda2 VG VolGroup00 lvm2 [74.41 GB / 32.00 MB free]
Total: 1 [74.41 GB] / in use: 1 [74.41 GB] / in no VG: 0 [0 ]

5. After that run vgscan to scan disks for volume groups.
# vgscan
Reading all physical volumes. This may take a while...
Found volume group "VolGroup00" using metadata type lvm2

6. Activate all volume groups available.
# vgchange -a y
2 logical volume(s) in volume group "VolGroup00" now active

7. Run lvscan to scan all disks for logical volume. You can see partitions inside the hard disk now active.
# lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [72.44 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [1.94 GB] inherit

8. Mount the partition to any directory you want, usually to /mnt
# mount /dev/VolGroup00/LogVol00 /mnt

more info:
http://linuxwave.blogspot.com/2007/11/mounting-lvm-disk-using-ubuntu-livecd.html

Thursday, February 3, 2011

Get the time information from CMOS

Get the layout of CMOS on current motherboard.
E.g. First byte indicates the seconds of current time

outb(0, 0x70);
unsigned char sec = inb(0x71);

CMOS read write please see previous post

make a program start after booting

Add the short cut of the executable to Startup

Linux Terminal in Windows: cygwin

Install it by running setup.exe.
Use setup.exe to update an existing installation(E.g. if you want to install vim, gcc)

more detail, please google it.