Xiaobo Sun

Eclipse-Unix http://umlfact.berlios.de/~s_xsun/

fstab

During the boot process, file systems listed in /etc/fstab are automatically mounted (unless they are listed with the noauto option).
device       /mount-point fstype     options      dumpfreq     passno
device

A device name (which should exist), as explained in Section 18.2.

mount-point

A directory (which should exist), on which to mount the file system.

fstype

The file system type to pass to mount(8). The default FreeBSD file system is ufs.

options

Either rw for read-write file systems, or ro for read-only file systems, followed by any other options that may be needed. A common option is noauto for file systems not normally mounted during the boot sequence. Other options are listed in the mount(8) manual page.

dumpfreq

This is used by dump(8) to determine which file systems require dumping. If the field is missing, a value of zero is assumed.

passno

This determines the order in which file systems should be checked. File systems that should be skipped should have their passno set to zero. The root file system (which needs to be checked before everything else) should have its passno set to one, and other file systems' passno should be set to values greater than one. If more than one file systems have the same passno then fsck(8) will attempt to check file systems in parallel if possible.

Consult the fstab(5) manual page for more information on the format of the /etc/fstab file and the options it contains.

3.6.2 The mount Command

The mount(8) command is what is ultimately used to mount file systems.

In its most basic form, you use:

# mount device mountpoint

There are plenty of options, as mentioned in the mount(8) manual page, but the most common are:

Mount Options

-a

Mount all the file systems listed in /etc/fstab. Except those marked as “noauto”, excluded by the -t flag, or those that are already mounted.

-d

Do everything except for the actual mount system call. This option is useful in conjunction with the -v flag to determine what mount(8) is actually trying to do.

-f

Force the mount of an unclean file system (dangerous), or forces the revocation of write access when downgrading a file system's mount status from read-write to read-only.

-r

Mount the file system read-only. This is identical to using the ro (rdonly for FreeBSD versions older than 5.2) argument to the -o option.

-t fstype

Mount the given file system as the given file system type, or mount only file systems of the given type, if given the -a option.

“ufs” is the default file system type.

-u

Update mount options on the file system.

-v

Be verbose.

-w

Mount the file system read-write.

The -o option takes a comma-separated list of the options, including the following:

noexec

Do not allow execution of binaries on this file system. This is also a useful security option.

nosuid

Do not interpret setuid or setgid flags on the file system. This is also a useful security option.


posted @ 2008-01-09 09:16 Xiaobo Sun 阅读(299) | 评论 (0)编辑 收藏

Eclipse restart

delete everything except the config.ini under the folder /eclipse/configuration, and then start eclipse to load the new installed plugins.

posted @ 2008-01-08 16:40 Xiaobo Sun 阅读(275) | 评论 (0)编辑 收藏

OutOfMemoryError

If Java runs out of memory, the following error occurs:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

This can have two reasons:

  • Your Java application has a memory leak. There are tools like YourKit Java Profiler that help you to identify such leaks.
  • Your Java application really needs a lot of memory (more than 128 MB by default!). In this case the Java heap size can be increased using the following runtime parameters:
java -Xms<initial heap size> -Xmx<maximum heap size>

Defaults are:

java -Xms32m -Xmx128m

You can set this either in the Java Control Panel or on the command line, depending on the environment you run your application.

posted @ 2007-12-19 11:29 Xiaobo Sun 阅读(267) | 评论 (0)编辑 收藏

Current Editor/ Property Sheet

======Current Editor===============================================================
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
// must from the UI Thread, else get the null.
IWorkbenchPage page = window.getActivePage();
IEditorPart editor = page.getActiveEditor();
======Current Property==========================================================
1. Common Way:

IViewReference[] viewRefs = Ub900Plugin.getPlugin().getWorkbench()
                .getActiveWorkbenchWindow().getActivePage().getViewReferences();
        for (int i = 0; i < viewRefs.length; i++) {
            if (viewRefs[i].getId()
                    .equals("org.eclipse.ui.views.PropertySheet")) {
                PropertySheet sheet = (PropertySheet) viewRefs[i]
                        .getPart(false);
                ((PropertySheetPage) sheet.getCurrentPage()).refresh();
            }
        }
2. EMF Property Sheet:
Editor.getPropertySheetPage();

posted @ 2007-12-17 15:40 Xiaobo Sun 阅读(351) | 评论 (0)编辑 收藏

The location of EMF ResourceSet

The EMF ResourceSet is located in the EdtingDomain of Editor

posted @ 2007-12-17 15:34 Xiaobo Sun 阅读(231) | 评论 (0)编辑 收藏

Java initialization

The JAVA field (which is located in the Object in the heap) is default initialized as 0, false, and null.

A a = new A(); // equal

A a; // a is pointer/ref in the stack. (In stack the integer value take the random value)
a = new A(); // new A() is the Object in the heap. (In heap the integer value will be initialized as 0)

posted @ 2007-07-16 14:16 Xiaobo Sun 阅读(312) | 评论 (0)编辑 收藏

Composition & Aggregation

Composition: b's lifetime is up to its context (object of A).
==C++==
class A{
    B b;
}
==java==
class A{
    B b;
    public A(){
       b = new B();
    }
}

Aggregation: b can live without its context (object of A).
============================================
==C++==
class B{
    B* b;
}
==java==
class B{
    B b;
    public A(B b){
       this.b = b;
    }
}

posted @ 2007-07-12 16:39 Xiaobo Sun 阅读(284) | 评论 (0)编辑 收藏

EMF dynamic -> reflection

The situation where an application simply wants to share data without the need for a generated type-safe API. The reflective EMF API is sometimes all one really needs.

EMF provides a dynamic implementation of the reflective API (that is, the EObject interface) which, although slower than the one provided by the generated classes, implements the exact same behavior. If you don't need a type-safe API, then the only advantage of generating Java classes, as opposed to simply using the dynamic implementation, is that they use less memory and provide faster access to the data. The down-side is that the generated classes have to be maintained as the model evolves, and they have to be deployed along with the application. This is the normal trade-off between dynamic and static implementations.

Dynamic:

================create dynamic models (types)=========================

EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE;
EcorePackage ecorePackage = EcorePackage.eINSTANCE;

EClass employeeClass = ecoreFactory.createEClass();
employeeClass.setName("Employee");

EAttribute employeeName = ecoreFactory.createEAttribute();
employeeName.setName("name");
employeeName.setEType(ecorePackage.getEString());
employeeClass.getEAttributes().add(employeeName);
EAttribute employeeManager = ecoreFactory.createEAttribute();
employeeManager.setName("manager");
employeeManager.setEType(ecorePackage.getEBoolean());
employeeClass.getEAttributes().add(employeeManager);

EClass departmentClass = ecoreFactory.createEClass();
departmentClass.setName("Department");

EAttribute departmentName = ecoreFactory.createEAttribute();
departmentName.setName("name");
departmentName.setEType(ecorePackage.getEString());
departmentClass.getEAttributes().add(departmentName);

EAttribute departmentNumber = ecoreFactory.createEAttribute();
departmentNumber.setName("number");
departmentNumber.setEType(ecorePackage.getEInt());
departmentClass.getEAttributes().add(departmentNumber);

EReference departmentEmployees = ecoreFactory.createEReference();
departmentEmployees.setName("employees");
departmentEmployees.setEType(employeeClass);
departmentEmployees.setUpperBound(
EStructuralFeature.UNBOUNDED_MULTIPLICITY);
departmentEmployees.setContainment(true);
departmentClass.getEReferences().add(departmentEmployees);

EPackage companyPackage = ecoreFactory.createEPackage();
companyPackage.setName("company");
companyPackage.setNsPrefix("company");
companyPackage.setNsURI("http:///com.example.company.ecore");
companyPackage.getEClassifiers().add(employeeClass);
companyPackage.getEClassifiers().add(departmentClass);

=====================create objects==============================
EFactory companyFactory = companyPackage.getEFactoryInstance();

EObject employee1 = companyFactory.create(employeeClass);
employee1.eSet(employeeName, "John");

EObject employee2 = companyFactory.create(employeeClass);
employee2.eSet(employeeName, "Katherine");
employee2.eSet(employeeManager, Boolean.TRUE);

EObject department = companyFactory.create(departmentClass);
department.eSet(departmentName, "ABC");
department.eSet(departmentNumber, new Integer(123));
((List)department.eGet(departmentEmployees)).add(employee1);
((List)department.eGet(departmentEmployees)).add(employee2);

posted @ 2007-06-28 10:25 Xiaobo Sun 阅读(268) | 评论 (0)编辑 收藏

Java Reflection

Purpose: use the Instances of the class java.lang.Class to represent classes and interfaces in a running Java application.

1. create Object:

A a = (A)Class.forName("A").newInstance(); //If A isn't a correct Class Name, it's a Runtime-Exception "ClassForName", comparing to the Compile-Exception from "new A()"

2. get Attributes/Methods information at Runtime:

Class c = Class.forName(args[0]);
Method m[] = c.getDeclaredMethods();

posted @ 2007-06-12 13:14 Xiaobo Sun 阅读(217) | 评论 (0)编辑 收藏

IAdaptable & IAdapterFactory

     摘要: 在Eclipse中使用IAdaptable接口的方式有两种 1:某个类希望提供新的接口,但又不希望将其暴露在API中,在这种情况下,IAdaptable接口中的方法getAdaptor()方法将由本类实现。(希望支持新的接口,而又不想把已经发布的API造成影响,这种机制很有用) 2:外界要求某个类提供新的服务,这种情况下不需要修改现有类的代码,getAdaptor()由一个工厂提供。(不使用d...  阅读全文

posted @ 2007-06-12 11:06 Xiaobo Sun 阅读(638) | 评论 (0)编辑 收藏

仅列出标题
共7页: 上一页 1 2 3 4 5 6 7 下一页 
<2024年12月>
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

导航

统计

常用链接

留言簿(3)

随笔分类

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜