Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

Posted in Uncategorized | 1 Comment

Installation of Hyper-V 2008 step by step

1. Prerequisite

Make sure the hardware supports Hyper-V technology.

Most of the PCs’ CPU don’t supports Hyper-V.

To determine if your machine supports Hyper-V. Use these tools.

1) securable.exe

Make sure these 3 items matches the requirement.

Maximum Bit Length: 64

Hardware D.E.P: Yes

Hardware Virtualization: Yes

If it doesn’t match, reboot the machine to BIOS, modify the parameters.

If there are no such parameters to modify. Maybe because the hardware don’t support it.

2) everest.exe

Make sure the Hyper-Threading Technology(HTT) is supported,enabled.

2. Environment

2.1 Hardware

CPU: Intel® Xeon® CPU E5405 @2.00 GHz 2.00GHz(2 Processor)

(2processor * 4cpu)

Memory: 4G

HardDisk: 500G

2.2 Software

Windows Server 2008 Enterprise SP2 Japanese.

3. Install Windows Server 2008

First install Windows Server 2008 on the server.

Notes:

Please install latest version of windows server 2008. Some old version of windows 2008 don’t support Chinese.

4. Install Hyper-V

Then Enable the Hyper-V role in Windows Server 2008.

1) Open Server Manager, click role.

2) Click Add role.

3) Choose Hyper-V

3) Network.

On the virtual network step. You can choose a network card. Or you can configure it after hyper-v installed.

Here skip this step.

5. Create Virtual Machines

1) Open Server Manager, goto Role->Hyper-V->Hyper-V Manager

2) Right Click. Choose New – Virtual Machine.

3) Input Virtual Machine Name.

4) Memory Size.

5) Network Connection.

6) Virtual Disk.

7) Assign a iso file to install OS.

8) Now you can see the OS is installing….

6. Virtual Machine Network Issue.

1) Configure External Network.

If you haven’t configure network when install Hyper-V. You can configure it here.

Here I configure the network as External.

2) Install Integrated Components.

First after install the VM, some devices are unrecognizable, like network adapter.

You can not connect the VM to network.

The Integrated Components contains the Drivers needed for these devices.

7. Create AD

AD should be created before install SCVMM.

1) Add Role and select AD.

2) Give a FQDN.

Here use hyperv.test.

3)3

3

3) Level .

8. Install IIS Role Service

Some IIS role service needed in SCVMM installation. Enable it first.

9. Install SCVMM

9.1 Install VMM Server

1) Click VMM Server to install.

2) Input User name and group name.

3) Prerequisite.

4) Here choose install SQL Server Express.

5) Library.

6) Ports.

9.2 Install VMM Management Console

9.3 Install VMM Self-service Portal

9.4 Install Local Agent

Local Agent don’t need install.

10. Use SCVMM

1) First connect to a server when open SCVMM.

2) Create a host group.

3) Add a host.

4) Then you can do management with SCVMM now.

Posted in Uncategorized | 5 Comments

Increase disk space for AIX6.1

# chfs -a size=+2000000 /opt
Filesystem size changed to 21495808
# df -k
Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4          3407872    521980   85%    40381    24% /
/dev/hd2          9961472    524516   95%    62594    34% /usr
/dev/hd9var       8650752   8080616    7%      558     1% /var
/dev/hd3          3407872    539720   85%     6513     6% /tmp
/dev/hd1           262144    106084   60%     2829     9% /home
/dev/hd11admin      262144    261760    1%        5     1% /admin
/proc                   –         –    –         –     –  /proc
/dev/hd10opt     10747904   3162472   71%    44626     6% /opt
photon:/bmc/patrol/of_img   366870528        20  100%  4070209    96% /patrol_offical_img
rnd-clunfs:/bmc/patrol/bap_img_rep   366187136  30258304   92%  1023095    12% /patrol_img_rep
#

Posted in Uncategorized | Leave a comment

A small program used to automatic do mouse click and keyboard press

 

import java.awt.AWTException;

import java.awt.Robot;

import java.awt.event.InputEvent;

import java.awt.event.KeyEvent;

public class Robot2 {

    public static void main(String[] args) {

        try {

            while(true){

               Robot robot = new Robot();

               //Delay for 5 seconds

                robot.delay(5000);  

               //Move cursor to left, so that won’t interfere other window

               robot.mouseMove(100, 500);

               robot.mousePress(InputEvent.BUTTON1_MASK);

               robot.mouseRelease(InputEvent.BUTTON1_MASK);

              //enter $date on X-Window’s dtterm. then press enter.

               robot.keyPress(KeyEvent.VK_D);

              robot.keyPress(KeyEvent.VK_A);

               robot.keyPress(KeyEvent.VK_T);

               robot.keyPress(KeyEvent.VK_E);

               robot.keyPress(KeyEvent.VK_ENTER);

            }

        } catch (AWTException e) {

            e.printStackTrace();

        }

    }

}

Posted in Uncategorized | Leave a comment

Portlist of Oracle Enterprise Manager

C:\oracle\product\10.2.0\db_1\install\portlist.ini
 
iSQL*Plus HTTP port number =5561
Enterprise Manager Console HTTP Port (orcl) = 1158
Enterprise Manager Agent Port (orcl) = 3938
Enterprise Manager Console HTTP Port (a) = 5500
Enterprise Manager Agent Port (a) = 1830
Posted in Computers and Internet | Leave a comment

prtconf to check the Processor type of AIX

# prtconf
System Model: IBM,9110-51A
Machine Serial Number: 1067F30
Processor Type: PowerPC_POWER5
Number Of Processors: 1
Processor Clock Speed: 1648 MHz
CPU Type: 64-bit
Kernel Type: 64-bit
LPAR Info: 5 hou-rds-lpar1
Memory Size: 2048 MB
Good Memory Size: 2048 MB
Platform Firmware level: Not Available
Firmware Version: IBM,SF240_332
Console Login: enable
Auto Restart: true
Full Core: false
Network Information
        Host Name: hou-rds-lpar1
        IP Address: 172.19.142.14
        Sub Netmask: 255.255.254.0
        Gateway: 172.19.142.253
        Name Server: 172.17.19.252
        Domain Name: bmc.com
Paging Space Information
        Total Paging Space: 512MB
        Percent Used: 2%
Volume Groups Information
==============================================================================
0516-010 : Volume group must be varied on; use varyonvg command.
==============================================================================
rootvg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk1            active            199         59          19..00..00..00..40
==============================================================================
INSTALLED RESOURCE LIST
The following resources are installed on the machine.
+/- = Added or deleted from Resource List.
*   = Diagnostic support not available.
  Model Architecture: chrp
  Model Implementation: Multiple Processor, PCI bus
+ sys0                                                       System Object
+ sysplanar0                                                 System Planar
* vio0                                                       Virtual I/O Bus
* vscsi1           U9110.51A.1067F30-V5-C5-T1                Virtual SCSI Client
 Adapter
* hdisk1           U9110.51A.1067F30-V5-C5-T1-L810000000000  Virtual SCSI Disk D
rive
* ent0             U9110.51A.1067F30-V5-C2-T1                Virtual I/O Etherne
t Adapter (l-lan)
* vsa0             U9110.51A.1067F30-V5-C0                   LPAR Virtual Serial
 Adapter
* vty0             U9110.51A.1067F30-V5-C0-L0                Asynchronous Termin
al
+ L2cache0                                                   L2 Cache
+ mem0                                                       Memory
+ proc0                                                      Processor
Posted in Computers and Internet | Leave a comment

Configure SUDO on Solaris 10

To configure sudo on Solaris 10, follow the steps like this:

1.  Download the files needed to install sudo from http://www.sudo.ws/sudo/.

     Open http://www.sudo.ws/sudo/download.html, choose the OS as Solaris: http://www.sunfreeware.com/.  Open the link and select  SPARC/Solaris 10,  select sudo-1.7.0.

     Then you can find the link of sudo-1.7.0-sol10-sparc-local.gz. Click the link to download sudo-1.7.0-sol10-sparc-local.gz. and related libs libiconv, libintl,l ibgcc-3.4.6.

ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/sudo-1.7.0-sol10-sparc-local.gz

ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/libiconv-1.11-sol10-sparc-local.gz

ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/libintl-3.4.0-sol10-sparc-local.gz

ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/libgcc-3.4.6-sol10-sparc-local.gz

These links are OS-Dependent packages, so don’t need much compile it. This can avoid much compile issues.

2. Copy these 4 files to solaris. unzip the files.

    gunzip sudo-1.7.0-sol10-sparc-local.gz

    gunzip libiconv-1.11-sol10-sparc-local.gz

    gunzip libintl-3.4.0-sol10-sparc-local.gz

    gunzip libgcc-3.4.6-sol10-sparc-local.gz

3. Install the unziped files.

    pkgadd –d gunzip sudo-1.7.0-sol10-sparc-local

    pkgadd –d libiconv-1.11-sol10-sparc-local

    pkgadd –d libintl-3.4.0-sol10-sparc-local

    pkgadd –d libgcc-3.4.6-sol10-sparc-local

4. Test if sudo command works.

    Run /usr/local/bin/sudo . If you didn’t get error message, that means the sudo was installed ok.

5. Modify sodoers file to add sudo users.

    vi /usr/local/etc/sudoers

     suppose user sudo1 is a normal non-root user.   Add a line like this into sudoers:

    sudo1 ALL=(ALL) NOPASSWD: ALL

    (Notes: don’t contain any space in it. as the document said in this sudo version.)

    save it.

6. Login with user sudo1.

    Run: $sudo pwd

    If no password that need you input, and you can get the result. That means you are sucessed.

 

References:

http://safe.it168.com/a2008/0922/205/000000205884.shtml

http://www.itus.cn/os/6/Solaris-29130_4.shtml

http://www.sudo.ws/sudo/download.html

Posted in Computers and Internet | 1 Comment

java.io的Decorator设计模式

 

当提到Decorator(装饰者)模式的时候,都经常会提到java.io的设计模式。

作为一个灵活的,可扩展的类库,JDK中使用了大量的设计模式,对JDK中模式的研究不仅能增加对模式的理解,而且还有利于更透彻的了解类库的结构和组成。

在java.io包中,OutputStream,InputStream,Reader,Writer等都用到了Decorator模式。

Decorator模式简介:

Decorator模式又称Wrapper(包装器)模式,它用于给一个对象动态的添加一些额外的职责。

     以下是Decorator模式的UML示意图。

Component:被装饰对象的基类

定义对象的接口/抽象类,可以给这些对象动态增加职责

ConcreteComponent:具体被装饰的对象

定义具体的对象,Decorete可以为它增加额外的职责

Decorator:装饰者抽象类

维护一个指向Component实例的引用,并且定义了与Component一致的接口

ConcreteDecorator:具体装饰者

具体的装饰对象,给内部持有的具体被装饰对象增加具体的职责

java.io包中OutputStream中的Decorator模式:

在java.io包中OutputStream是一个的Decorator模式的设计,OutputStream抽象类作为Decorator,BufferedOutputStream是ConcreteDecorator。

他们的关系如下图的UML图中示意:

其中OutputStream作为Component和Decorator,FilterOutputStream和BufferedOutputStream作为ConcreteDecorator。其中BufferedOutputStream也对FilterOutputStream做了具体的装饰,如flush()和write(int)方法。

OutputStream是一个抽象类,它是所有输出流的公共父类,其源代码如下:

package java.io;

public abstract class OutputStream implements Closeable, Flushable {

    public abstract void write(int b) throws IOException;

    public void write(byte b[]) throws IOException {

    write(b, 0, b.length);

    }

    public void write(byte b[], int off, int len) throws IOException {

    if (b == null) {

        throw new NullPointerException();

    } else if ((off < 0) || (off > b.length) || (len < 0) ||

           ((off + len) > b.length) || ((off + len) < 0)) {

        throw new IndexOutOfBoundsException();

    } else if (len == 0) {

        return;

    }

    for (int i = 0 ; i < len ; i++) {

        write(b[off + i]);

    }

    }

    public void flush() throws IOException {

    }

    public void close() throws IOException {

    }

}

它定义了write(int b)的抽象方法。这相当于Decorator模式中的Component类。 FilterOutputStream是从OutputStream中继承的。

package java.io;

public  class FilterOutputStream extends OutputStream {

    protected OutputStream out;

    public FilterOutputStream(OutputStream out) {

    this.out = out;

    }

    public void write(int b) throws IOException {

    out.write(b);

    }

    public void write(byte b[]) throws IOException {

    write(b, 0, b.length);

    }

    public void write(byte b[], int off, int len) throws IOException {

    if ((off | len | (b.length – (len + off)) | (off + len)) < 0)

        throw new IndexOutOfBoundsException();

    for (int i = 0 ; i < len ; i++) {

        write(b[off + i]);

    }

    }

    public void flush() throws IOException {

    out.flush();

    }

    public void close() throws IOException {

    try {

      flush();

    } catch (IOException ignored) {

    }

    out.close();

    }

}

FilterOutputStream中的protected OutputStream out;属性相当于Decorator的Component。FilterOutputStream中并未真正给出write(int)的实现,而是调用out的write方法,flush()方法也同样。具体的write(int)方法和flush()方法是在BufferedOutputStream中实现的。

BufferedOutputStream的代码实现如下:

package java.io;

public

class BufferedOutputStream extends FilterOutputStream {

    protected byte buf[];

    protected int count;

    public BufferedOutputStream(OutputStream out) {

    this(out, 8192);

    }

    public BufferedOutputStream(OutputStream out, int size) {

    super(out);

        if (size <= 0) {

            throw new IllegalArgumentException("Buffer size <= 0");

        }

    buf = new byte[size];

    }

    /** Flush the internal buffer */

    private void flushBuffer() throws IOException {

        if (count > 0) {

        out.write(buf, 0, count);

        count = 0;

        }

    }

    public synchronized void write(int b) throws IOException {

    if (count >= buf.length) {

        flushBuffer();

    }

    buf[count++] = (byte)b;

    }

    public synchronized void write(byte b[], int off, int len) throws IOException {

    if (len >= buf.length) {

        flushBuffer();

        out.write(b, off, len);

        return;

    }

    if (len > buf.length – count) {

        flushBuffer();

    }

    System.arraycopy(b, off, buf, count, len);

    count += len;

    }

    public synchronized void flush() throws IOException {

        flushBuffer();

    out.flush();

    }

}

在BufferedOutputStream类中给出了flush()和write(int)的具体实现,是Decorator的具体装饰。

参考资料:

软件包 java.io 的分层结构

Original GoF Patterns

来杯咖啡-装饰者模式(Decorator)

JAVA IO 设计模式彻底分析

Posted in Uncategorized | Leave a comment

用Windows Live Writer写CSDN博客

Windows Live WriterCSDN博客的步骤如下:

工具->账户

在第一步“选择“其它日志服务”。

在第二步中输入你的CSDN博客首页地址,比如:

http://blog.csdn.net/userxxx

还有CSDN的登录用户名和密码

接下来的一步中选择提供程序,在此选择你的blog 提供商的类型及它的接口地址。

Live Writer支持多达目前流利的7种blog接口类型。

CSDN blog使用的 Metaweblog API 做为接口提供,所以这里我选:Metaweblog API 这种方式。

完后输入blog 的接口地址:

比如CSDN blog的地址就为http://blog.csdn.net/userxxx/services/metablogapi.aspx

(注意把userxxx替换成你的csdn用户名)

点击下一步验证你的博客信息就可以了。

Posted in Uncategorized | Leave a comment

system-config-packages

Usage: system-config-packages –tree=PATH –isodir=PATH

Install new package on redhat4

Posted in Uncategorized | Leave a comment