2011年5月24日 星期二

測不準原理

量子力學中兩個最具哲理的觀念 ( 也最常被誤用) 是海森堡的測不準原理和波恩的機率論 ( 愛因斯坦不接受而說上帝不擲篩子)

什麼是測不準原理

通俗來說,就是觀察者(光子)會影響到被觀察的物體(電子),以致於無法準確的得到物體的狀態。

更定性而言:如果用短波長的光子觀察電子,可以得到電子準確的位置(x),但卻失去了電子的動量(p)。相反的,如果用長波長的光子觀察電子,雖然不會干擾電子的運動,但卻失去了電子的位置。測不準原理預測永遠無法同時得到電子的位置和動量。

海森堡給了一個定量的關係:Δx Δp > h  (Planck constant)

等價的關係如:Δt ΔE > h  (Planck constant)

幾個有關的原理

1. 原子的存在

    古典電磁學預測:環繞原子核的電子會持續放出電磁波,且最終將落入原子核。測不準原理 Δx Δp > h

所以電子不可能如同古典電磁學所預測的 Δx Δp   = 0

delta x  x delta p > h  所以不可能

2. 化學鍵之所以存在

Dx DP > h

3. 輻射線的半衰期

Dt DW > h

4. 核的強力

2011年5月11日 星期三

Maxwell 的應用

Introduction

img012

Maxwell published his famous equations governing all electrical and electronic phenomenon (with some quantum mechanics in some cases) in 1873.  There are two problems.  First, it is hard to solve these partial differential equations.  Secondly, it is hard to grasp the physical picture of different EM phenomenon

幸運的是在某些條件下,我們可以簡化 Maxwell Equation 解決上述難題 。Fig. 2 分類可作的簡化。

(A0) only statics:  div E = e,   curl E = 0;   div B = 0,  curl B = J    No interaction between E and B.

 

(A) Lumped circuit: 當系統的大小遠小於工作的波長,i.e.  ( S << l = 1/f  or f << 1/S)。系統的波動特性可忽略。可視為有一個固定的參考面電壓。以Maxwell equation 來說 :

curl E – k – 1/S >>  dB/dt – f   ==> curl E = 0 ==> define global voltage reference to ground:   KVL

curl B = u J   KCL

基本上這是電路學的理論基礎。也是最簡化的 Maxwell Equation。

Example:  discrete circuit with low frequency

VLSI at very high frequency (s is small)

(B) Transmission line: 這時系統的大小相當或大於於工作的波長。意即波的特性不可忽略。但可就Maxwell equation 簡化。假設可以找到一連串參考面,定義局部的 curl E = 0 (no B field) and curl B = 0 (no E field and net J =0).  仍可定義出局部的電壓和電流,避開 E and B field calculation。TEM wave over transmission line 為例子。

Example:

電力線  60Hz over 100 km.

CAT5 ethernet cable.

Tools:

Smith chart for narrow-band system (電力線 microwave)

ABCD matrix for broad-band DSL

 

(C) Only wave :   ignore J and e.  still difficult!

(C1) 再來就必須面對 wave,  但若能簡化為 scaler wave equation 仍比 vector Maxwell equation 容易。

Maxwell equation –>  Helmholtz wave equation (A) –> separation of variables –> scaler wave equation.

Example:  geometric optics, gaussain beam optics (paraxial symmetry Helmholtz equation)

Tools: Gaussian

 

(D) if J and e cannot be ignore, and plus wave.  This is the most difficult case

Example: CED, plasma physics

 

 

 

Lumped circuit model provides a simple approximation of a dipole antenna, it is useful but only valid within limited frequency range.  The situation is shown in Fig. 6.

img011

Fig. 6: Different abstraction in electrical discipline

Luckily, there is a another tool originally derived from transmission line, namely Smith Chart, provides useful physical insight and enough accuracy for understanding the dipole antenna.  A brief introduction of Smith Chart is on the other article.  Lumped circuit is a subset included in Smith Chart.  Smith Chart (transmission line) is based on a specific EM wave called TEM (transverse EM) wave where the dynamic electrical and magnetic fields are perpendicular to the wave propagation direction.  The majority of EM wave and waveguide either belong to the TEM domain or can be approximated by TEM wave.  That is, Smith Chart is a very useful tool to solve most electrical problems.

 

The Smith Chart is plotted on the complex reflection coefficient plane in two dimensions and is scaled in normalized impedance (the most common), normalized admittance or both.  Normalized scaling allows the Smith Chart to be used for problems involving any characteristic impedance or system impedance, although by far the most commonly used is 50 Ohm.  With relatively simple graphical construction it is straightforward to convert between normalized impedance and the corresponding complex voltage reflection coefficient.  Please refer wiki's Smart Chart for details and this reference.

How Smith Chart Work?

The keys are complex reflection coefficient, G, and normalized impedance, z, are plotted on the same chart as shown in Figure 1. 

  • The red x-y aisles represents the real and imaginary part of G.  The intersecting point is the origin of the Smith Chart.  Because |G| <= 1, the Smith Chart is fit inside a unit circle.  The Smith Chart is not suitable for active circuit where the reflection coefficient might be larger than 1.     
  • The green circles represent zr = constant (zr is the real part of normalized impedance).  The constant must be positive.  The largest circle corresponds to zr=0 and also |G|=1.  As zr increases to infinity, the circle converges to a point G=1 that is a open load.   
  • The black circles represents zi = constant (zi the imaginary part of normalized impedance).  The constant can be positive/inductive, circles on the upper plane; or negative/capacitive,  circles on the lower plane.  The largest circle, x-axis,  corresponds to zi=0.  As zi increases to both positive/negative infinity, the circles also converges to a point G=1 that is a open load.     

image 

Fig. 1: Smith Chart Fundamental

smith chart 

Fig. 2: Smith Chart

  • The red-dot in Fig. 2 corresponds to no reflection (50Ohm load, G=0) ; the blue-dot corresponds to short load (G=-1); the green-dot corresponds to open load (G=1).  The open load and short load is mirrored to each other through l/4 transformation as discussed in the next section.
Example:

Assume the characteristic impedance is 50Ω :

Z1 = 100 + j50Ω    Z2 = 75 - j100Ω    Z3 = j200Ω
Z4 = 150Ω  Z5 = ∞ (open)   Z6 = 0 (short)
Z7 = 50Ω   Z8 = 184 - j900Ω

smith chart3 

Fig. 3: Some Example Impedance

Note that a dipole antenna is close to open (Z5) at DC and becomes capacitive at lower frequency (Z8).  If it is well matched at operating frequency, the impedance is close to 50Ohm (Z7); that is: Z5->Z8->Z2->Z7.  Practically, the trajectory may be similar to the purple area because of non-perfect matching.

 

Transmission Line on Smith Chart

image 

Fig. 4: Input Impedance with Transmission Line

One key advantage of Smith Chart is to obtain the input impedance of a load with transmission line shown in the above figure. 

  • For a lossless transmission line, the input impedance toward source is simply a clockwise rotation of the load impedance on the Smith Chart shown in Fig. 2.  To remember clockwise rotation is to observe open load (green-dot) turns to capacitive (negative) load first; or short load (blue-dot) turns to inductive (positive) load first.
  • One full circle rotation on Smith Chart represents half-wavelength (l/2) transmission line length; half circle rotation represents l/4 line length.  Remember the famous quarter wavelength impedance transformation.  From open to short is half circle rotation, corresponds to l/4 transmission line length.  For any load after the l/4 transformation, the input impedance becomes the mirror point (with origin) on the Smith Chart.

Even though the Smith Chart is developed for system with transmission line, it is also very useful in lumped circuit for matching and analysis purpose in RF IC design  shown in next sections.

 

Admittance Smith Chart

The Smith chart is built by considering impedance (resistor and reactance).  Once the Smith chart is built, it can be used to analyze these parameters in both the series and parallel worlds.  Adding elements in a series is straightforward.  New elements can be added and their effects determined by simply moving along the circle to their respective values.  However, summing elements in parallel is another matter.  This requires considering additional parameters.  Often it is easier to work with parallel elements in the admittance world.

It turns out that the expression for y is the opposite, in sign, of z, and Γ(y) = -Γ(z).  If we know z, we can invert the signs of Γ and find a mirror point situated in the opposite direction.   Thus, an admittance Smith chart can be obtained by rotating the whole impedance Smith chart by 180°.  This is extremely convenient, as it eliminates the necessity of building another chart.  The intersecting point of all the circles (constant conductance and constant susceptances) is at the point (-1, 0) automatically.  With that plot, adding elements in parallel also becomes easier.  Math details can refer to this.

 

Lumped Elements on Smith Chart

When solving problems where elements in series and in parallel are mixed together, we can use the same Smith chart and rotate it around any point where conversions from z to y or y to z exist. 

Let's consider the network of Fig. 5 (the elements are normalized with Z0 = 50Ω).  The series reactance (x) is positive for inductance and negative for capacitance. The susceptance (b) is positive for capacitance and negative for inductance.

image 

Fig. 5: Input Impedance of Lumped Elements

The circuit needs to be simplified (see Fig. 6).  Starting at the right side, where there is a resistor and an inductor with a value of 1, we plot a series point where the r circle = 1 and the l circle = 1.  This becomes point A.  As the next element is an element in shunt (parallel), we switch to the admittance Smith chart (by rotating the whole plane 180°).  To do this, however, we need to convert the previous point into admittance.  This becomes A'.  We then rotate the plane by 180°.  We are now in the admittance mode.  The shunt element can be added by going along the conductance circle by a distance corresponding to 0.3.  This must be done in a counterclockwise direction (negative value) and gives point B.  Fig. 7 shows the complete impedance transformation using Smith Chart.

image

Fig. 6: Break the Network for Analysis

image

Fig. 7: Impedance Using Smith Chart

 

In summary

1. Add a serial L:

Move up (clockwise) along  r=constant circle (circles intersects at (1,0))

2. Add a shunt L:

Move up (counter-clock) along g=constant circle (circles intersects at (-1,0))

3. Add a serial C:

Move down (counterclockwise) along r=constant circle (circles intersects at (1,0))

4. Add a shunt C:

Move  down (clockwise) along g=constant circle (circles intersects at (-1,0))

The following figure shows the summary.

image 

 

How to do matching using Smith Chart

L-match (8 types)

The following figure shows 4 different type of L match for positive reactance matching

 

image

 

Similarly, there are 4 types for negative reactance just exchange L and C.

pi/T-match

image

 

There are above 8 types of pi/T matching.  Similarly, the mirror from positive to negative is to change L and C.

 

Examples

(I) Impedance Transformation from Tom Lee's RF CMOS book.

* If ZL is a pure resistance and ZL > Zo; only type2 (shunt-C with serial-L, or shunt-L with serial C) can convert Zin < ZL and Zin = ZL / ??  (only at resonant frequency, normally is a LPF or  HPF)

* If ZL is a pure resistance and ZL < Zo; only type 4 (serial-C with shunt-L, or  serial C with shunt C) can convert Zin > ZL and Zin = ?? (only at resonant frequency, normally is a HPF)

The above two L matches are in Tom Lee's book.

(II)

For dipole antenna below resonating frequency, it is like a serial RLC resonator; the resistor is higher than 50Ohm (air is 270Ohm); typical may be  75Ohm.  The resonating  frequency is assumed to be higher than the desired frequency.   (Example, the LC frequency maybe 1GHz, but the operating frequency is 600MHz, etc.) 

Therefore, the impedance is  75+X j Ohm (X is -200 to -50 Ohm).  Is it possible to design a matching network? 

Before/after resonating frequency

Condition 1: Re > 50Ohm and Im < 0 (capacitive load with high real impedance): example: dipole antenna before resonator

Condition 2: Re < 50Ohm and Im > 0 (inductive load and low real impedance): example: loop antenna

Condition 3: Re > 50Ohm and Im > 0 (inductive load with high real impedance??): example: dipole antenna after the resonator?

Condition 4: Re < 50Ohm and Im < 0 (capacitive load with low real impedance??): example: loop antenna

The matching choice (a) serial inductor; (b) parallel inductor.  Both reduce the reactive part.  The problem of (a) is real part is not change.  Therefore choose (b) to reduce R from 72 to 50.  Then use a serial capacitor to bring to the right matching point!!!

The best way to do is to use the center frequency first, not considering the entire frequency range.  E.g. 400M to 800M, maybe use 600M for the matching purpose!!

Examine the L and Pi match

Impedance Matching with Smart Chart

http://www.maxim-ic.com/appnotes.cfm/an_pk/742/

  • Match for maximum power transfer or optimize the noise figure or highest gain?  Highest gain is always lowest noise figure?
  • Maximum power transfer => Rs = RL*
  • ?Ensure quality factor impact or access stability analysis because the matching network can be LPF or HPF or BPF.
  • ? Can we replace RLC with scattering wave analysis using smith chart for both passive and active component (cmos?)  there is no concept of impedance at low frequency? wrong, can I still normalize to 50Ohm since there is still finite value of impedance?

2011年2月13日 星期日

Matlab 替代方案

Matlab 毫無疑問是最常用的 computation 及 DSP 的軟體。大概也是我從大學以來使用程度最高的 programming language.  (其次是 perl,甚少用 C 或其它語言)  主要的好處 :

* Easy to use:  No malloc of array; matrix and vector operation; dynamic typing

* Complete DSP functions: windowing, fft, etc.

* Very nice graphics

主要的缺陷 :

1. Cost

2. Lack of general purpose programming language capability

3. Hard to integrate with other tools (such as verilog PLI) and do batch job.  Always need to open the matlab

I was looking for the right solution.   Octave is almost the same as Matlab as far as my work is concerned.  It only solved the cost part.

Pylab

Python is another alternative.   However, I found it’s difficult to use at beginning even with NumPy, SciPy, and Matplotlib.   For example, you need to do a=Vector([1, 2, 3]) instead of  a=[1,2,3].  Not mentioned to install the right tools.

The key is to Pylab (similar to Matlab) combines NumPy, SciPy, Matplotlib into an integrated  and consistent environment.  Pylab is an interactive mode of IPython (#ipython –pylab) similar to Matlab.

The most import thing is:

from pylab import *

Based on KeirMierle’s viewpoint, Pylab still needs to resolve these API consistency and installation issues.

Three Distributions Targeting Scientific Computing

Then I found the following three distributions based on Python

1. Sage: good for linux, maybe not easy for windows (use ?? as console)

2. Pythonxy: good for windows, maybe not good for linux (use Eclipse/IPython/Spyderlib as console)

3. Enthought Python Distribution (EPD): both for linux and windows.  The founder is the developer of NumPy (use IPython as console)

I found it’s very easy to use:

Cons:

1. First, the size of each distributin is huge.  For example, EPD 7.0 has 250MB.  Sage is similar, if not larger. 

2. EPD only support the lastest built.  EPD7.0 needs to use > glibc2.5.  That is, RHEL 5 or above.  For RHEL 4 you need to pay to get the old distribution.  Similar things may happen in other distribution.

 

Theerefore, alternative is to build your own environment (as many people have done it before).

The most essential part is: python, numpy, scipy, matplotlib, ipython (pylab), and maybe wxpython.

 

Installatin Procedure

Step1: Install python 2.6.5 (Matlibplot requires python 2.4-2.7) 

* Make sure installed python NOT overwrite /usr/bin/python since RHEL uses old python for lots of system scripts.

Step2: Use python2.6.5 to install easy_install for other python packages installation.

Step3: Use easy_install for NumPy

Step3b: Use easy_install for SciPy.  However, it seems to require fortran; encounter problems and skip.

Step4: Use easy_install for Matplotlib

* Matplotlib requires python 2.4-2.7

* NumPy 1.1 or later

* libpng 1.1 or later –> Use: “yum install libpng-devel”

* freetype 1.4 or later

Step5: Use easy_install for ipython

Step6: Add path (../bin before /usr/bin for python)

Run “ipython –pylab” for ipython in pylab mode.

 

The whole thing is summarized in the following shell script.

--------------------------------------------------------------------

#! /bin/sh

builddir=$(pwd)/pythondist
mkdir -p $builddir/source
cd $builddir/source

# Step1
wget 'http://python.org/ftp/python/2.6.5/Python-2.6.5.tgz'
wget 'http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e'
tar -xvzf Python-2.6.5.tgz

# Build python
cd $builddir/source/Python-2.6.5/

# The --prefix argument is the key!
./configure --prefix=$builddir

# Be sure to speed things up with the -j option if you're
# on a multicore machine (e.g. make -j 4 build for a quadcore)
make build
make install

# Step2
# Now install setuptools
cd $builddir/source
tar -xvzf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11/

# The next key is to call this with the python you just built!
$builddir/bin/python setup.py build
$builddir/bin/python setup.py install

# Step3-5
# Now just install numpy, scipy, ipython, matplotlib, etc through easy_install
$builddir/bin/easy_install numpy
$builddir/bin/easy_install scipy
$builddir/bin/easy_install matplotlib
$builddir/bin/easy_install ipython

---------------------------------------------------------------------------------------------------

 

Testing Example

from pylab import *

x = linspace(0, 1000, 1024)

y = sin(x)

win = kaiser(x.size, 12)

plot(x, 20*log10(abs(fft(y*win))))

grid(1)

axis([0, 1, 0, 1])

 

Almost identical to matlab and very easy to use.

2010年5月23日 星期日

如何增進工程師效率 - command line option

Scripting language 大多有內建的 command line option 的支援。相對之下,C 的內建只有 argc 和 argv。善用 command line option 可以讓 script language (1) 根據不同的 option 改變程式的行為而不用重改程式;(2) 可以傳參數進程式而不是在程式中設死。

Ex1: convert_netlist.rb -s => 產生 spice netlist;  convert_netlist -l => 產生 lvs netlist

Ex2: cap_filter -c 1.5 -o output.cdl => 移除 cap 值小於 1.5fF, 並存於 output.cdl

 

本文比較 ruby 和 python 的 command line option 的用法及比較不同

 

Ruby

Ruby 有好幾個不同的 command line option parser.  我們主要 focus 在內建的 optparse, 這是在標準的 library 內,不需要再用 gem.

#!/usr/bin/env ruby
require 'optparse'

# This hash will hold all of the options
# parsed from the command-line by
# OptionParser.
options = {}

optparse = OptionParser.new do |opts|
  # Set a banner, displayed at the top
  # of the help screen.
  opts.banner = "Usage: #{$0} [options] <in.cdl> <out.cdl>"
  # Define the options, and what they do
  options[:force] = false
  opts.on( '-f', '--force', 'Force to overwrite output file' ) do
    options[:force] = true
  end
  options[:capval] = 0.0
  opts.on( '-c', '--cap value', Float, 'CPP -> MOMCAPS' ) do|f|
    options[:capval] = f
  end
  options[:bracket] = false
  opts.on( '-b', '--bracket', 'Bracket <> -> []' ) do
    options[:bracket] = true
  end
  options[:dummy] = false
  opts.on( '-d', '--dummy', 'Dummy cap and resistor removal' ) do
    options[:dummy] = true
  end
  options[:logfile] = nil
  opts.on( '-l', '--logfile FILE', 'Write log to FILE' ) do|file|
    options[:logfile] = file
  end
  # This displays the help screen, all programs are
  # assumed to have this option.
  opts.on( '-h', '--help', 'Display this screen' ) do
    puts opts
    exit
  end
end

# Parse the command-line. The 'parse' method simply parses
# ARGV, while the 'parse!' method parses ARGV and removes
# any options found there, as well as any parameters for
# the options. What's left is the list of files to resize.

begin optparse.parse!(ARGV)

 

rescue OptionParser::InvalidOption => e

puts e

puts optparse

exit

end

puts "Force to overwrite output file" if options[:force]
puts "CPP -> MOMCAPS #{options[:capval]}" if options[:capval]
puts "Bracket <> -> []" if options[:bracket]
puts "Dummy cap & resistor removal" if options[:dummy]
puts "Logging to file #{options[:logfile]}" if options[:logfile]

 

說明如下:

* require 'optparse'   使用內建的 option parser

* 需要用到兩個 class: options (Hash class) 和 optparse (OptonParser class)

optparse 負責 command line 訊息的顯示和處理。以及 handle 例外的情況。

options = {"force"=>true, "calval"=>1.5, "bracket"=>false,"dummy"=>true,"logfile"=>"kkk"}

這是我們熟悉的 Hash class, 儲存 option parser 處理過後的結果。

* ARGV 則是儲存移除 option 後留下的 command line 參數。

 

Python 

from optparse import OptionParser

parser = OptionParser()

parser.add_option("-f", "--file", dest="filename",
help="write report to FILE", metavar="FILE")

parser.add_option("-q", "--quiet",
action="store_false", dest="verbose", default=True,
help="don't print status messages to stdout")

parser.add_option("-s", "--sample", dest="sample", default=900,
type="int", help="measurement samples, 3x")

parser.add_option("-t", "--turn", dest="turn", default=5,
type="int", help="high Q transition turn sample")

parser.add_option("-r", "--rho", dest="rho", default=0.99,
type="float", help="Adaptive rate rho between 0.95 to 1.0")

(options, args) = parser.parse_args()

print options.filename
print options.turn
print options.sample
print options.rho
print options.q_dot

print options
print args

說明如下:

* from optparse import OptionParse

 

* 主要的處理是在 parser (OptionParser class) 完成。如 Ruby 同樣包含 command line 訊息的顯示和處理。以及 handle 例外的情況。

 

* 最後的結果有二個。 options 是處理過後的結果。options.filenames 和 options.verbose (定義在 dest 後).

 

* args 則是儲存移除 option 後留下的 command line 參數。



2009年12月21日 星期一

KPI 用於 Analog Circuit Design

Analog circuit desing is not an art (or only partly is an art).

Majority day-to-day life is normal.  How come it is so difficult????

Because there is a big gap between device level and final result!!!

這是一個認知的間題

 

3 layers of knowledge in analog circuit

 

1. Device level

gm, rout, Cc

ft = gm/Cc;   gain = gm * rout

 

 

 

3. Result and 現象

Oscillator: oscillate or not and lock time, frequency detune

PLL: lock or not and lock time, spur, phase noise

ADC: ENOB, SNDR

 

Problem ==>

1. Need lot of simulation time: garbage in; garbage out!!

2. No physical insight!!!!

Because a big gap between device parameter and result/現象

 

Solution ==> Bridge the gap using KPI

What is KPI?

between device parameters and final results

only a few (2-4 parameters)

A clear coorelation between KPI and final results (best if there is a math formula)

2009年12月18日 星期五

CentOS 常用軟體

Use VMware to install CentOS 4.8 on windows 7

 

Step 1: Install vmware-toolbox on linux, not sure what this toolbox is useful??

network --> bridged mode, very slow?  How about hostonly and NAT?  What's the tradeoff?

Now using bridged mode and works OK.

Step 1.1: Make sure sshd service is on.  And install putty in PC so that can remote control.

 

Step 1a: If need to install the latest update, do “yum update”.  However, this may not be necessary

Step 1b: Some rpm package is NOT in the default repo (check /etc/yum.repo.d).  Need to install other rpm repo.

Some popular rpm repo:   rpmforge (e.g. mercurial),  Ruby.repo (Ruby jam)

==> rpmforge:  http://wiki.centos.org/AdditionalResources/Repositories/RPMForge

A.   Get http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

B.   rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt   (get the GPG key)

C.   rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm  (verify the package A)

D.  rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm  --> check /etc/yum.repo.d/rpmforge.repo exist

 

Step 2: Install VNC server on linux, very useful tool.  However, need to change default twm to gnome-session.  Install ultravnc or realvnc on PC.

Very useful tool:  Host: need to change /etc/sysconfig/vncservers;  Make sure vncserver serivce is running, and editing .vnc/xstartup file.

Can use netstat -lt to check the tcp port status.

It's very useful that pc copy and paste can use directly on linux.   Just run "vncconfig" in linux and make sure all options are checked and keep the vncconfig ON ALL TIME then it works!!

(make sure the correct setting on unltravnc and realvnc are checked, too)

 

2a: Editing /etc/sysconfig/vncservers file to support multiple users, window size, and resolutions:

### /etc/sysconfig/vncservers #################

VNCSERVERS="1:root 2:alu 3:atd"
VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[2]="-geometry 1024x768 -depth 24"
VNCSERVERARGS[3]="-geometry 800x600"

###########################################

 

2b: Use putty login as root, alu, atdl; setting password for each users (very important!! Otherwise service won’t start).

2c:  Start the vnc service as root ==> service vncserver restart

2d: Check system->Administration->Security Level and Firewall->other ports –> add 5901,5902,5903

2d: use putty login, editing /home/alu/.vnc/xstartup as follows:

##################################################

centos4:~/.vnc> more xstartup

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

#[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
#[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#xsetroot -solid grey
#vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &

##################################################

 

One annoying thing is hostname doesn't seem to work.  Need to use IP address for putty and vnc.  However, the IP address is dynamically changed because it's from DHCP server.  How to set hostname instead of using IP address? 

I did the following but not working.  How PC can know the hostname?

First, set the hostname, e.g. : centos5  system->administration->network->DNS->Hostname->centos5

This is corresponding to /etc/sysconfig/network: HOSTNAME

Then, system->administration->network->Devices->Edit->Hostname (optinal): –>centos5

This is corresponding to /etc/sysconfig/network-script/ifcfg-eth0: DHCP_HOSTNAME –> centos5

Then, system->administration->network->Devices->Edit->DNS:192.168.1.1

This is corresponding to /etc/resolv.conf

 

Step 3: Install Samba server on centos.  Samba server is not default on in centos.  Need to use yum install samba first. 

Please refer to vbird's suggestion for configuration.  Samba is based on NetBIOS, not tcp/ip.  It seems to avoid the hostname problem.

step 3(a):  yum install samba   --> rpm –qa  to check samba (samba-common, samba, samba-client)

step 3(b): edit /etc/samba/smb.conf

step 3(c): create smbpasswd:  touch smbpasswd

step 3(d): smbpasswd –a alu  (to add password to smbpasswd)

step 3(e): disable SELinux (important!!!)

step 3(f): /etc/rc.d/init.d/smb restart (start the samba server)

 

Step 4: start license server related service in /etc/rc.local

工具有關軟體

git: Check git during centos installation?  If not pre-installed:

$ rpm -Uvh http://mirror.webtatic.com/yum/centos/5/latest.rpm

$ yum install --enablerepo=webtatic git-all

kompare: Check KDE environment during centos installation.  Or install kompare inside of latest kde rpm.  Do

$ rpm -ivh ... kde ..

kdiff3: same as kompare, but more powerful.  Get the rpm directly from web.

xls2csv: convert Excel file into csv file.  There are two versions.  One is from catdoc; the other from CPAN (perl).   The one from CPAN is better in my opinion.

Ruby:  Check ruby during centos installation. rubygems: gnuplot, fastercsv

Python: Check python during centos installation.  However, the default python of centos or redhat is not the updated version (1.7.x).  For scientific computing or other applications, it is highly recommended to use EPD (Enthought) version instead.  The EPD version is installed in a separate directory, not replacing the default version.  Remember to set the path in .tcshrc or .bashrc to invoke the EPD version.

Perl: Check Perl during centos installation.

 

CAD 有關軟體

* ns3:  http://www.nsnam.org/wiki/index.php/Installation

 

* Composer: make sure to set /etc/sysconfig/vncservers ==> xwindows setting is 24-bits or pseudo 8-bit

* Sanwork: make sure to "yum install openmotif" to avoid the error of not finding libXm.so.3

 

* Vppsim (from MIT MIke Perrott)

do yum install gcc-c++ to install g++

 

To run license of Calibre, Adit,

1. start with host mode

2. Do /tools/ixl_cal_2007.4_21.19/change-hostid.sh  (in bsh, not tcsh) to change mac id

3. Do tcsh to change to tcsh

4. Do source CALIBRE.cshrc

5. Do clic_start to start mentor related license

 

 

Step 5: Script 和 Web 有關軟體

* Ruby: centos comes with default ruby.  However, it is helpful to install rubygems, gnuplot, and other gems.

Please refer to web how to install them.  yun install ruby ruby-gems (?) ruby-devel ..

* RoR (Ruby on Rail): same as above

* Apache2 and CGI.

yum install httpd ruby ruby-devel

* then need to use make install to install mod_ruby to enable the CGI working.  (same for Python and Perl).

* Use amrita for html output generation.  It's easy for viewing purpose

 

Step 6: Support ntfs file system (終於考定, another trouble maker is lib.so…)

CentOS doesn’t support NTFS file system natively, nor extFAT (Microsoft proprietary).   It is troublesome to read external hard drive (mostly NTFS).  Even though most USB drives are still using FAT that centos supports.  However, there is a 2G(?4G) limitation on FAT file size.  It makes things difficult to do external backup in step 7.

Therefore, it is important to make centos to support NTFS file system.  It is particularly troublesome for CentOS4.  Be careful on the following steps.  Reference: http://wiki.centos.org/TipsAndTricks/NTFS

It needs to include the fuse kernel module into kernel.  因此會需要 fuse, fuse-ntfs-3g, dkms, dkms-fuse.  CentOS5.4 and newer has included fuse kernel module.  Therefore, no need for dkms and dkms-fuse.

If you do:    yum install fuse fuse-ntfs-3g dkms dkms-fuse

It will not find anything because these rpm files are not centos default repo.  These rpm files are in rpmforge. 

(1) First, download rpmforge rpm-release from:

i386: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
x86_64: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

(2) After that, run:   rpm –ivh rpmforge-release-xxx

(3)  yum install fuse fuse-ntfs-3g dkms dkms-fuse

(4) check if the running version matches with kernel

uname –r to check the current running kernel

rpm –qa | grep kernel\* | sort to check the kernel and kernel-devel

It may require to do: yum update kernel to make it match.   Make sure to reboot the machine.  Debug: https://www.centos.org/modules/newbb/viewtopic.php?topic_id=26488

(5) do /sbin/modprobe fuse   if there is no error message, it is ok.

(6) From chome VM page, check USB mass storage.  On PC, the external hard drive disappears.

(7) Do   mount –t ntfs-3g /dev/sda1 /export/usb   to mount external drive

(8) Do fdisk –l to check the parition

(9) Do umount /deve/sda1 to un-mount the external hard drive

 

Step 7: setup external backup

Follow bird’s suggestion:

2009年10月23日 星期五

PC 部份常用軟體

本文整理我的 PC 內常用軟體及設定

I. Internet 及網路和雲端軟體

1. Firefox 和 add-on: xmark, IE tab, Wikidiction

2. UltraVNC 取代 Microsoft remote desktop (家用 XP, Windows 7 不支援 remote desktop)。不過 UltraVNC 似乎容易掛掉,網路上有人建議用 WinVNC 或 RealVNC。VNC 的好處是可以用在 linux。

3. Syncplicity 及 Dropbox

4. Evernote 和 Microsoft OneNote

 

G. Google 軟體及 service

1. Google desktop

 

V. 防毒軟體

1. Avira Antivir (小紅傘)

 

T. 工具類軟體

1. Total commander: 支援 unicode,非常好用。Linux 上只有 Konqueror 可用。

2. Free commander: 類似 total commander, 免費且容易使用。不支援 unicode, 會有日文及簡體亂碼。

3. Foxit: PDF reader,比 Adobe 小且快速

4. 7zip: 免費且強大壓縮軟體

 

M. 多媒體

1. Picasa: 最棒的相片 database 軟體

2. GOM player: 最佳的 video player 軟體。取代 Microsoft Media Player, KMplayer.  類似軟體尚有 VLC,MPlayer, 和 KMplayer。說明和下載。

3. iTune: CD ripper 以及 audio database

4. Imgburner: 類似 Nero, 免費且快速,用於燒 DVD 光碟和擷取 DVD -> ISO 軟體。

5. DVDFab HD Decrypter: 擷取 DVD -> ISO 軟體, 同時破除保護。

6. DVD Shrink: 類似 DVDFab HD Decrypter。

7. Daemon Tools: 虛擬光碟機軟體,用於 player ISO 檔案。

 

P. P2P 軟體

1. uTorrent: 小且常用

 

L. Linux 軟體

1. cygwin (1.7.x): gnu+windows+cygnus 簡單的說就是在 windows 上架構 linux,對於習慣在 linux 上工作的人非常方便。

幾點需要注意:change default installation to include: openssh (in Network option), tcsh (in Shell option), xwindows (in X option).

2. VMware/Virtualbox: 除了 cygwin 以外,另外的選擇是 VMware 或 Virtulbox,虛擬的機器。VMware 是商用軟體。Virtualbox 是免費軟體。

追蹤者