星期二 四月 14, 2009

Quick Design "Calculator" with GUI Builder in NetBeans 6.5

During NetBeans 6.5,you can do the GUI design very quickly and it's very convenient for you to use.You can work out the project by just drafting the swing components.


Before get started,you should install NetBeans 6.5(6.7 Milestone 1/2/3 is  also okay) and JDK 6(or higher edition) on your computer.


This time I'd like to do a simple calculator with NetBeans 6.5.


First of all,just oepn NetBens 6.5,choose Javase,create a new java desktop application, name for your project and make it the main project.


After that,we can design the calculator by drifting the swing components ,here we use Jbutton for the number 1 to 9 ,and use textfield to display the result.Like below:


 


I put the sourcecode in the attachment,you can download it and run it on your computer.


However,this is just a simple application,contains four arithmetic operations(add,subtract,multiply,divide)and arithmetic point operations.Besides,with it ,you can continue your next calculation .Of course, you can do further developing with the existing one.


 Source code:http://blogs.sun.com/Chinese_Functional_CA/resource/src.rar


 

星期一 三月 30, 2009

The development process of virtualization

Virtualization is a very hot topic recently in IT industry, but what’s a
real virtualization?

[Read More]

星期五 三月 06, 2009

How to do the interface embellishment and font setting in NetBeans 6.5


(1)Install the newest JDK


Pls download the Java SE Development Kit (JDK) 6 Update 10 or higher edition to supprot the antialiasing font better.


The JDK download link:http://java.sun.com/javase/downloads/index.jsp


(2)Install ClearType


ClearType Tuner PowerToy can be used ot adjust the Expert Settings of antialiasing font.With the help of it, you can make the font more boldfaced.



Download this software:http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx


(3)Modify the start setting of NetBeans


 Open filw netbeans.conf  from the path C:\\Program Files\\NetBeans 6.5\\etc\\ and find the lines like below:




# Options used by NetBeans launcher by default, can be overridden by explicit # command line switches: netbeans_default_options=.....



Add –fontsize 12 –laf javax.swing.plaf.metal.MetalLookAndFeel to the parameter string of netbeans_default_options  ,then it looks like this:



(4)Modify the setting of  Java font


Open  C:\\Program Files\\Java\\jdk1.6.0_10\\jre\\lib ,Rename or delete the   fontconfig.98.bfc and fontconfig.98.properties.src two files.After that, Make a copy of  fontconfig.properties.src and save as  fontconfig.properties, then open the fontconfig.properties  with text editor .


The reason why modifying  the conf file is to display the Java Program with diffrent font when ie has both  Chinese and English strings. Like this belowing code:




/\*\*
\* 通过控件视图渲染结果 \* \* 对应的控件视图文件是 view/_controls/footer_control.php 。 \*/ $this->_renderBlock('footer', $return);



The Chinese part Use Song Ti and the English part use  Consolas, Here is the displaying  effect:


 


In order to achieve the above effect, it needs to modify three parts of the font file.


A:Defination of filename:Make sure the correspondence between  font name and the font filename;


B:The correspondence between  virtual font and actual font:Make sure which actual font is used to display


the specific virtual font;


C:Make sure which font can be used to display the strings.


The font filename can use the belowing format.You can also define your favorite font by yourself.But please should keep it in mind that the font  name can not be used in Chinese.Like below:




# filename. 字体名=字体文件名 filename.Consolas=CONSOLA.TTF filename.Consolas_Bold=CONSOLAB.TTF filename.Consolas_Italic=CONSOLAI.TTF filename.Consolas_Bold_Italic=CONSOLAZ.TTF



After defining the font name, we can specify the  correspondence between  virtual font and actual font.


For example:I make the default  monospaced (virtual font)specify to the newly defined  Consolas ,and



change the configuration as follows:


        monospaced.plain.alphabetic=Courier New
        monospaced.bold.alphabetic=Courier New Bold
        monospaced.italic.alphabetic=Courier New Italic
        monospaced.bolditalic.alphabetic=Courier New Bold Italic
       #
modified as



monospaced.plain.alphabetic=Consolas
monospaced.bold.alphabetic=Consolas Bold
monospaced.italic.alphabetic=Consolas Italic
monospaced.bolditalic.alphabetic=Consolas Bold Ttalic



Finally,make change for the font searching order .After modifing,it will search for English font first and Chinese font second.As there is no Chinese font style in the English font,so it is showed clearly when using different English and Chinese font.



        sequence.monospaced.GBK=chinese-ms936,alphabetic,dingbats,symbol
        sequence.monospaced.GB18030=chinese-gb18030,alphabetic,dingbats,symbol
        # Modified as
       sequence.monospaced.GBK=alphabetic,chinese-ms936,dingbats,symbol
       sequence.monospaced.GB18030=alphabetic,chinese-gb18030,dingbats,symbol


 


After finishing all the steps above, restart NetBeans,it  looks like more attractive. 


星期二 十一月 25, 2008

Snapshot in OpenSolaris and system recovery based on zfs

In Solaris 10 or other type of Solaris based on ufs file system, you
can use the command“ufsdump” or “ufsrestore” to backup or recover the file
system(you should uninstall the file system firstly), and use “fssnap” to
create an online snapshot of the file system to backup it. Snapshot is an
excellent solution of the online file system backup.

[Read More]

星期四 八月 07, 2008

Create RESTful Web Services in Netbeans

Representational
state transfer (REST) is a style of software architecture for distributed
hypermedia systems. The terms “representational state transfer” and “REST” were
introduced in 2000 in
the doctoral dissertation of Roy Fielding.
Now, with Netbeans, we could create a RESTful web
services application in Java from scratch easily.

[Read More]

星期一 八月 04, 2008

Django will run on Jython

Jython is an implementation of high-level, dynamic, object-oriented language Python written in 100% Pure Java. We can run Python code on Java platform with the support of Jython.
Python web framework Django could also run on Jython now. Jim Baker has written an article: Django on Jython is almost there to show that even there's still more work to do, Django could run on Jython platform.

[Read More]

星期四 七月 10, 2008

New features in Globus 4.2.0

The Globus Toolkit
is a powerful open source software toolkit used for building Grid systems and
high performance computing environment. It is being developed by the Globus
Alliance and many others all over the world. Many projects which aim to realize
the high performance computing in distributed environment use the Globus Toolkit
to build their grid infrastructure.

[Read More]

星期一 六月 30, 2008

NetBeans Multi-Language Support

NetBeans has strong ability with in multi-language support.


After installed, it looks like in Simplified Chinese only. In fact, you can easily switch it to English/Japanese version by a little change of shortcut command line. You need not install other package or plugin.

[Read More]

星期三 六月 25, 2008

Solaris File System Administration

 Solaris OS file system is very different from Windows OS.FAT16,FAT32,NTFS are file systems for Windows,But Solaris belong to UNIX architecture .Learning Solaris file system is a difficulty for the beginner.
      What is file system? Simply,file system is a directory collections ,and it is used for locating and storing file.

[Read More]

Run Windows Programs in OpenSolaris 2008.05

Authorhongbingfeng

       Emailbfhong@gmail.com


   Under Opensolaris ,we can run Linux program by many way,such as zone and so on .Actually Opensolaris can aslo run Windows Programs.


The article introduce wine and use wine to run Windows Programs in Opensolaris 2008.05.


Tools:     OpenSolaris 2008.05


               Wine 1.0-rc1

[Read More]

星期二 六月 24, 2008

the HPC in Fuzhou University Has Been Set Up

   on June 19th, 2008, the HPC which is in Fuzhou University has been set up. The computed speed can achieve about 13.58 trillion per second, it is the third in China, and also it is in the TOP 500 all over the world.

   There are about 160 blade 6250 servers, which compose a cluster, and 150 servers of them server for the computed nodes, others is used to be the management nodes.

   The HPC will server for the Fujian province, some application for example, weather forecast and earthquake predication will use the cluster computers to did a better work.

    In the picture shows below, one of Functional Campus Ambassador in China is demonstrating a 3D image which is computed by the HPC, I thought it so cool~!




星期一 六月 09, 2008

JRuby and Rails Introduction

Author:Gao Ang
Contact:tomgaoang # gmail.com

JRuby
is an 100% pure-Java implementation of the Ruby programming language. The program written in Ruby could run upon JVM with the help of JRuby. Besides, we can get access to all kinds of Java library with JRuby in our Ruby program.

Now, the latest version of JRuby is 1.1.2, which is compatible to Ruby interpreter 1.8.6. JRuby 1.1.2 is the second point release of JRuby 1.1. The fixes in this release are primarily obvious compatibility problems and performance enhancements.

JRuby also provides support for interacting with and defining java classes from within ruby. In the presentation, the content includes the introduction of Ruby language, Rails framework and JRuby support in Netbeans.

Click this link to download the presentation file.

星期日 五月 25, 2008

Manage ZFS with Web Console

Manage ZFS with Web Console   


ZFS file system is the an important feature to the Solaris 10, it is not an improvement for the old file system, but a new one. ZFS is the first file system with 128 bit, and it have the features of infinity capacity、freeness、consistent data and easy management.


ZFS abandon the volume management, and adopt the pool conception. The volume management is a way to manage the physical storage devices, and the pool is to manage the virtual device, the virtual devices could be file and device set, besides the physical device. We con add devices into the pool expediently, and all the devices in the pool can be shared by all the file systems that used the pool. When we make a new file system, we need not to assign it to an independent device any more, other than, we can set the size and attributes of the file system by ourselves.


In the Solaris 10, we can use the command to manage the ZFS, and also, there is a Web Console for us to manage the ZFS.


To use the Web Console, we can type the URL:https://hostname:6789 or https://host-id:6789 in the browser.


1、type https://127.0.0.q:6789 in the browser to open Web Console.



 


2、type the user name and password to login in.


 


 


3、Choose the “ZFS管理” to get into the ZFS management interface.


 


 


4、Choose the “创建存储池” to create a new pool. 


 


 


5、Name the pool, choose redundancy level, and create the pool with the guide. There, I use an U disk to create a pool. Of course, you can make a pool with files. 


5            #format –e   -------------See the name of my U disk.


 My U disk name is c4t0d0.


       #zpool create dh c4t0d0  ---------------Create a pool which is named "dh".


 


6、To see the pool and the file system that have been created.


 


 


7、We can create the new data set in the appointed pool with the Web Console.


 


 


8、Define the file system that we will create. there, I create a sub file system with the name  "Tonsen" below the file syetem whose name is "dh". in fact, "Tonsen" is my English name, and "dh" my Chinese name for short.  \^-\^



 


    9、Set the mountpoint for the file system. In the ZFS, if we set the mountpoint, the file system will be mounted automatically.


 


 


10、Set the quota and reservation for the file system.


 


 


11、Set other attributes for the file system.


 


 


12、 Check the setting that you made.



 


13、We can also see the commands about the setting that we done with the Web console.



 


14、Open a terminal, type the command to check the pool and zfs.



 


the Chinese blog site:


http://developers.sun.com.cn/blog/functionalca/entry/%E4%BD%BF%E7%94%A8web_console%E7%AE%A1%E7%90%86zfs

Solaris User Management

      Solaris OS has a core conception --- user and user account management .User has all of processes and files . If OS has no users,it can not finish data operation and system management. User must has an account to login the system,and he can finish the  prospective work. As Solaris system administrator, it is a key job to manage user and account(there are some conception about user group,but I do not introduce this).


     The loginning name has 8 characters at most. After creating the account, we can :1.start Shell; 2.implement application program ;3.call all kinds of system serveice. User management refer to 3 document: 1./etc/passwd: user acconut information. 2./etc/group:group configuration information; 3./ect/shadow: account password and all kinds of control information. Solaris integrate user account management into SMC,and SMC help administrators manage system and applications.Besides SMC, we can finish management work by command-line.


     1.add user:#useradd -u uid -g gid -d home_directory -s path_to_shell -c comment login_name 


    2 change user account attribute:usermod


    3 delete user:userdel


DEMO 1


add user sun1 and sun2:


#useradd -u 200 -g other -d /export/home/sun1 -m -c "first user" -k /etc/skel sun1


#useradd -u 300 -g other -d /export/home/sun2 -m -s /usr/bin/sh -c "second" sun2


change user UID,and change the password:


#usermod -u 400 sun1


#grep sun1 /etc/passwd


#passwd sun1


change user and user home:


#usermod -d /export/home/sun22 -m -l sun22 sun2


#ls -ld /export/home/sun22


user accuont control strategy,lock and unlock:


#usermod -f 10 -e 12/31/2008 sun1


#passwd -l sun1


#passwd -u sun1


delete user


#userdel -r sun1


DEMO2


create the bulk of user


1.create user list file:userlist.lst    #cat/export/home/userlist.lst


sun1 sun2 sun3


2.create Script file:adduser.sh,#cat/export/home/adduser.sh


for i in 'cat/export/home/userlist.lst'
                          do
                            useradd -d /export/home/$i -m $i
                          done


#chmod u+x /export/home/adduser.sh


3.run script file:#./export/home/adduser.sh


The end !Thank you very much!


 

About

This is Chinese Functional CA Team Blog. Any suggestion is appreciated.

Search

Archives
« 四月 2014
星期日星期一星期二星期三星期四星期五星期六
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
今天