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 閱讀(308) | 評論 (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 閱讀(284) | 評論 (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 閱讀(273) | 評論 (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 閱讀(358) | 評論 (0)編輯 收藏

          The location of EMF ResourceSet

          The EMF ResourceSet is located in the EdtingDomain of Editor

          posted @ 2007-12-17 15:34 Xiaobo Sun 閱讀(238) | 評論 (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 閱讀(319) | 評論 (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 閱讀(289) | 評論 (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 閱讀(273) | 評論 (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 閱讀(222) | 評論 (0)編輯 收藏

          IAdaptable & IAdapterFactory

               摘要: 在Eclipse中使用IAdaptable接口的方式有兩種 1:某個類希望提供新的接口,但又不希望將其暴露在API中,在這種情況下,IAdaptable接口中的方法getAdaptor()方法將由本類實現。(希望支持新的接口,而又不想把已經發布的API造成影響,這種機制很有用) 2:外界要求某個類提供新的服務,這種情況下不需要修改現有類的代碼,getAdaptor()由一個工廠提供。(不使用d...  閱讀全文

          posted @ 2007-06-12 11:06 Xiaobo Sun 閱讀(648) | 評論 (0)編輯 收藏

          僅列出標題
          共7頁: 上一頁 1 2 3 4 5 6 7 下一頁 
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          導航

          統計

          常用鏈接

          留言簿(3)

          隨筆分類

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 明星| 济阳县| 武川县| 韶关市| 区。| 郯城县| 香河县| 淮滨县| 基隆市| 宜春市| 雅江县| 大理市| 高平市| 黑河市| 岢岚县| 嘉祥县| 罗源县| 繁昌县| 鹤壁市| 界首市| 乌兰察布市| 宣汉县| 定日县| 永州市| 惠安县| 晋城| 聂荣县| 乐昌市| 双鸭山市| 库车县| 色达县| 育儿| 铜川市| 桦南县| 泌阳县| 崇州市| 徐水县| 枣庄市| 广州市| 大邑县| 陇南市|