Ads 468x60px

Wednesday, March 28, 2012

Configuring Semantic Web Technology for Oracle 11g

In order to enable semantic web technology for Oracle 11g, follow the following steps
  1. Oracle 11g should be installed on your machine.
     
  2. Download 156998.zip from http://goo.gl/U7yJv 
  3. Extract 156998.zip to some folder [i.e. c:\156998]
     
  4. Go to Windows Command Line
    • Start => Run
    • Type cmd
       
  5. From Command Line, goto to Oracle Home Directory
    • cd $Oracle_Home/product/11.0.1.0/md/admin
       
  6. connect as SYS user
    • Assume that sys password is sys
    • sqlplus sys/sys as sysdba
       
  7. Execute the command that restores Oracle 10 RDF data.
    • @c:\156998\catsem10i.sql;
       
  8. Execute the command that installs 11 RDF, confirm with the snapshot given below to check if procedure has been executed successfully.
    • @c:\156998\catsem11i.sql; 
       
  9. Now, alter the “mdsys” user by the following command
    • ALTER USER mdsys IDENTIFIED BY mdsys;
    • ALTER USER mdsys ACCOUNT UNLOCK;
       
  10. Connect via mdsys user
    • conn mdsys/mdsys
       
  11. Now, apply the patch to enable Semantic web Data support. Execute the following commands in the same sequence shown below
    • @c:\156998\sdordfh.sql;
    • @c:\156998\sdordfxh.sql;
    • @c:\156998\sdordfa.sql;
    • @c:\156998\sdordfb.plb;
    • @c:\156998\sdordfxb.plb;
    • @c:\156998\sdoseminfhb.plb;
    • @c:\156998\sdordfai.plb;
       
  12. connect as SYS user
    • Assume that sys password is sys
    • sqlplus sys/sys as sysdba
       

Saturday, March 17, 2012

XAF : Extend Built-in Property Editor's Functionality

This topic describes how to customize a built-in XAF Property Editor. The DatePropertyEditor will be customized to display date and time in the full format. The Property Editor control's dropdown will display the calendar and the clock in the Windows Vista style. The image below shows the resulting Property Editor:


Since the Property Editor inherits from the DatePropertyEditor class, which is the DXPropertyEditor class descendant, its settings can be accessed via the Repository Item. To apply the customization to the controls created both in the Detail View and List View, override the SetupRepositoryItem method. The PropertyEditor attribute is applied to the implemented Property Editor, to specify that it can be used for the String type properties:

   1:  Imports System
   2:   
   3:  Imports DevExpress.ExpressApp
   4:  Imports DevExpress.ExpressApp.Editors
   5:  Imports DevExpress.ExpressApp.Win.Editors
   6:  Imports DevExpress.ExpressApp.Model
   7:   
   8:  <PropertyEditor(GetType(DateTime), "CustomDateTimeEditor", False)> _
   9:  Public Class CustomDateTimeEditor
  10:      Inherits DatePropertyEditor
  11:      Public Sub New(ByVal objectType As Type, 
                            ByVal info As IModelMemberViewItem)
  12:          MyBase.New(objectType, info)
  13:      End Sub
  14:   
  15:      Protected Overrides Sub SetupRepositoryItem(ByVal item As 
            DevExpress.XtraEditors.Repository.RepositoryItem)
  16:          MyBase.SetupRepositoryItem(item)
  17:          DirectCast(item, RepositoryItemDateTimeEdit).VistaDisplayMode = _
  18:          DevExpress.Utils.DefaultBoolean.[True]
  19:          DirectCast(item, RepositoryItemDateTimeEdit).VistaEditTime = _
  20:          DevExpress.Utils.DefaultBoolean.[True]
  21:          DirectCast(item, RepositoryItemDateTimeEdit).Mask.EditMask = _
  22:          "MM.dd.yyyy hh:mm:ss"
  23:      End Sub
  24:  End Class
  25:   

Thursday, March 15, 2012

.NET Custom DateTime Format Strings

Format
Code
Result
MM/dd/yyyy
Date.Now().ToString(”d”)
1/15/2010
dddd, dd MMMM yyyy
Date.Now().ToString(”D”)
Friday, January 15, 2010
dddd, dd MMMM yyyy hh:mm tt
Date.Now().ToString(”f”)
Friday, January 15, 2010 11:06 AM
dddd, dd MMMM yyyy HH:mm:ss
Date.Now().ToString(”F”)
Friday, January 15, 2010 11:06:46 AM
MM/dd/yyyy h:mm tt
Date.Now().ToString(”g”)
1/15/2010 11:06
MM/dd/yyyy HH:mm:ss
Date.Now().ToString(”G”)
1/15/2010 11:06
MMMM dd
Date.Now().ToString(”m”)
15-Jan
dd MMM yyyy HH’:'mm’:’ss ‘GMT’
Date.Now().ToString(”r”)
Fri, 15 Jan 2010 11:06:46 GMT
yyyy’-'MM’-'dd’T'HH’:'mm’:’ss
Date.Now().ToString(”s”)
2010-01-15T11:06:46
yyyy’-'MM’-'dd HH’:'mm’:’ss’Z’
Date.Now().ToString(”u”)
2010-01-15 11:06:46Z
dddd, MMMM dd yyyy HH:mm:ss
Date.Now().ToString(”U”)
Friday, January 15, 2010 3:06:46 AM
yyyy MMMM
Date.Now().ToString(”y”)
January, 2010

Writing Use Cases in XML

Writing use cases is the most important step for modeling user requirements. Use cases focus on describing scenarios of using the system and are usually written in a textual form. To assist use case writing, various templates have been proposed, mainly differing in their visual representation. XML is a platform independent language for describing data and their structure without referring to their visual presentation. Here, we will propose the writing of use cases in XML. Using XML, we achieve the clear separation of the semantic part of use case descriptions from their visual representations. Hence, the same description can be visualized in many different ways. Furthermore, our encoding allows the integration of tools for Writing and validating use cases. We introduce an appropriate structure for use case descriptions and we model this structure using DTD (Document Type Definition).

Use cases constitute the basic way of modelling user requirements during software development. Nevertheless, there exist no standard rules for writing them. During the last years, many templates have been proposed for writing use cases. Some examples are the fully-dressed, the table, and the two-column format. Essentially, all these formats contain the same information presented in a different way. Also, different levels of detail are needed in different phases of software development. This need presupposes that the information is not degraded during its transformation in more detailed forms. XML (eXtensible Markup Language)is a language for data description, which has the potential of representing information in different forms, as well as, in different levels of detail. Compared to other documents, such as HTML and PDF, an XML document is not bound to an explicit output format. With the description written in XML, it is possible to produce any of the desired formats without rewriting the contents.

Our aim is to define a technique that will assist developers in writing use cases, without bothering about its visual representation, while at the same time respecting the logical structure of a use case. For visualization purposes, we provide several XSLT transformations that can be applied and result different visual formats in different levels of detail.

Use Cases:

Use cases are a technique for documenting functional requirements of a system under development. User requirements are modeled twofold: writing use cases descriptions and constructing a use case diagram. A use case diagram is composed of use cases and represents the global system’s behavior. Each use case corresponds to an exact behavior of the system that satisfies a user goal. Formally, a use case is defined as a sequence of events that illustrates the behavior of a system and its components when a service is invoked this behavior is described in several ways but the most common one is the textual description.

Tuesday, March 13, 2012

Configuring weblogic with postgresql Database

Follow these steps to connect Weblogic with Postgresql database:
  1. Download postgresql setup from here
  2. Download postgresql connection jar  file from here
  3. install postgres database on your PC [during setup, you will enter database password]
  4. create a database using postgres pgadmin interface [ex: database name: tdb]
  5. put jar file some where on your pc [ex: C:\jars\postgresql-9.0-801.jdbc3.jar]
  6. edit file setDomainEnv.cmd under integration directory inside weblogic home directory  [ex: C:\bea\weblogic81\samples\domains\integration]
  7. add jar file path [C:\jars\postgresql-9.0-801.jdbc3.jar] at line 1999.
    [ex: set CLASSPATH=%ARDIR%\ant\ant.jar;%JAVA_HOME%\jre\lib\rt.jar;C:\jars\postgresql-9.0-801.jdbc3.jar]
  8. open weblogic and start weblogic server
  9. click on tools menu, then weblogic server=> data source viewer
  10. click on New Data Source
  11. fill data source form:
    data Source:postgres
    pool : postgresbool
    driver: select [org.postgresql.Driver]
    url: jdbc://postgresql://localhost:5432/tdb
    user: postgres
    password: password that you entered in postgres installation

XAF : Set Default Property For Object Attribute

Here we will set a default value for a property of a business class, In this example we will set the default 'Priority' property in DemoTask to 'Normal' state. To do this, first we want to build DemoTask Class with 'Priority' property:

   1:  Public Class DemoTask
   2:      Inherits Task
   3:      ' ...
   4:      Private fPriority As Priority
   5:      Public Property Priority() As Priority
   6:          Get
   7:              Return fPriority
   8:          End Get
   9:          Set(ByVal value As Priority)
  10:              SetPropertyValue("Priority", fPriority, value)
  11:          End Set
  12:      End Property
  13:      '...
  14:  End Class
  • 'Priority' property added to DemoTask class

Monday, March 12, 2012

Structure for writing Software Requirements Specification (SRS)

Software Requirements Specification (SRS) is a requirements specification for a software system, in other words it is a complete description of the behavior of a system to be developed. It is includes a set of use cases that describes the interactions between system actors (System Users) with the Software system. Also SRS contains list of functional and non-functional software requirements.

This document lists all necessary requirements for application development, so it is written after a meeting or detailed communication between project manager and customer. A general structure of an SRS will be as follows:
  1. Introduction:
    This part provide an overview of the SRS document, and it should contain all information needed by a software engineer to design and implement the software product described by the requirements listed in this document.
    1. Purpose:
      What is the purpose of this
      SRS and the (intended) audience for which it is written.
       
    2. Scope:
      Here we will identify software product by its name, and explain what the software product(s) will, and, if necessary, will not do. Then we can describe the application of the software being specified. As a portion of this, it should be consistent with similar statements in higher-level specifications, and describe all relevant benefits, objectives, and goals as precisely as possible.
       
    3. Definitions and Abbreviations:
      Provide the definitions of all terms, and abbreviations required to properly interpret the
      SRS. This information may be provided by reference to one or more appendixes in the SRS or by reference to other documents.
       
    4. References:
      This subsection should provide a complete list of all documents referenced elsewhere in the
      SRS, or in a separate, specified document. Identify each document by title, report number, and publishing organization. And specify the sources from which the references can be obtained. This information may be provided by reference to an appendix or to another document.

Sunday, March 11, 2012

XAF : Implement One-to-Many Relationship

The following snippet of code present One-to-Many Relationship between Department and Contact business classes, in which Department object has many Contacts.
To implement the "One" part of the Department-Contacts relationship, decorate the Contact class Department property with the Association attribute.


   1:  <DefaultClassOptions()> _
   2:  Public Class Contact
   3:      Inherits Person
   4:      '...
   5:      Private fDepartment As Department
   6:      <Association("Department-Contacts", GetType(Department))> _
   7:      Public Property Department() As Department
   8:          Get
   9:              Return fDepartment
  10:          End Get
  11:          Set(ByVal value As Department)
  12:              SetPropertyValue("Department", fDepartment, value)
  13:          End Set
  14:      End Property
  15:      '...
  16:  End Class
  17:   
  18:   

Saturday, March 10, 2012

Writing Numbers in Words


   1:  #include <iostream.h>
   2:  int q(float);
   3:  #include <math.h>
   4:  void main()
   5:  {
   6:      float number;
   7:          int w,x,y,z,L;
   8:      char* A;
   9:      char* B;
  10:      char* C;
  11:      char *a[10]={"","ONE HUNDERD","TWO HUNDERD","THREE HUNDERD",
"FOUR HUNDERD","FIVE HUNDERD","SIX HUNDERD","SEVEN HUNDERD",
"EIGHT HUNDERD","NINE HUNDERD"};
  12:      char *b[10]={"","","TWENTY","THERTY","FOURTY","FIFTY",
"SIXTY","SEVENTY","EIGHTY","NINETY"};
  13:      char *c[10]={"","ONE","TWO","THREE","FOUR","FIVE","SIX",
"SEVEN","EIGHT","NINE"};
  14:      char *d[10]={"TEN","ELEVEN","TWELVE","THIRTEEN",
  15:          "FOURTEEN","FIFTEEN","SEVENTEEN","EIGHTEEN","NINETEEN"};
  16:      
  17:      cout<<"Enter Number Between 0 and 999\n";
  18:      cin>>number;
  19:      

Calculate Sin(X)


   1:  #include <iostream.h>
   2:  #include <math.h>
   3:   
   4:  int fact(int);
   5:   
   6:  void main()
   7:  {
   8:  float x,sinx=0,Result,b;
   9:  int p=1,i,counter=0,n=1;
  10:  cout<<"Enter Positive integer between\n";
  11:  cin>>x; // Read Positive Number
  12:  if(x==999)
  13:  cout<<"end program";
  14:  else if(x>0)
  15:  {for(i=0;i<100;i++)
  16:   
  17:   
  18:  {   b = pow(x,p)/fact(p);
  19:      Result = pow(x,p)/fact(p);
  20:      Result *=n;
  21:      sinx = sinx + Result;
  22:      p+=2;
  23:       counter++;   // To Calculate The Number Terms
  24:      n*=-1;
  25:      if(b<0.0001) break;  // To Stop When the value of term become <0.0001
  26:  }
  27:   

XAF : Implement Many-to-Many Relationship

The following code snippet shows Many-to-Many Relationship between DemoTask and Contact business classes objects.

DemoTask Class:

   1:  Public Class DemoTask
   2:      Inherits Task
   3:      Public Sub New(ByVal session As Session)
   4:          MyBase.New(session)
   5:      End Sub
   6:      <Association("Contact-DemoTask", GetType(Contact))> _
   7:      Public ReadOnly Property Contacts() As XPCollection
   8:          Get
   9:              Return GetCollection("Contacts")
  10:          End Get
  11:      End Property
  12:  End Class
  13:   
  14:   
  • The Association attribute is applied to the XPCollection type Contacts property, representing the collection of associated Contacts.
  • The Association attribute is required when setting a relationship between objects
  • The GetCollection method is used to return a collection in Contacts property getter implementation.

Friday, March 9, 2012

XAF : Building Domain Class

Business Class can be implemented in your application either from scratch by inherit your class from BaseObject or by using Business Class Library, which is contains the most common business classes such as Contact class which is include basic information about contact like FullName, SpouseName, FirstName and LastName. Note that only public members are mapped into database tables.


Create Business Class by inheriting from BaseObject:

   1:  Imports System
   2:  Imports System.ComponentModel
   3:   
   4:  Imports DevExpress.Xpo
   5:  Imports DevExpress.Data.Filtering
   6:   
   7:  Imports DevExpress.ExpressApp
   8:  Imports DevExpress.Persistent.Base
   9:  Imports DevExpress.Persistent.BaseImpl
  10:  Imports DevExpress.Persistent.Validation
  11:   
  12:   
  13:  <DefaultClassOptions()> _
  14:  Public Class Department
  15:      Inherits BaseObject
  16:      <Association("DepartmentContacts", GetType(Contact))> Public ReadOnly Property 
Contacts As XPCollection
  17:          Get
  18:              Return GetCollection("Contacts")
  19:          End Get
  20:      End Property
  21:      Private _departmentName As String
  22:      Public Property DepartmentName As String
  23:          Set(ByVal value As String)
  24:              SetPropertyValue("DepartmentName", Me._departmentName, value)
  25:          End Set
  26:          Get
  27:              Return Me._departmentName
  28:          End Get
  29:      End Property
  30:      Public Sub New(ByVal session As Session)
  31:          MyBase.New(session)
  32:          ' This constructor is used when an object is loaded from a persistent storage.
  33:          ' Do not place any code here or place it only when the IsLoading property is false:
  34:          ' if (!IsLoading){
  35:          '   It is now OK to place your initialization code here.
  36:          ' }
  37:          ' or as an alternative, move your initialization code into the AfterConstruction method.
  38:      End Sub
  39:      Public Overrides Sub AfterConstruction()
  40:          MyBase.AfterConstruction()
  41:          ' Place here your initialization code.
  42:      End Sub
  43:  End Class


Thursday, March 8, 2012

Billiards Ball Movement Simulation

Abstract:
In this project we will talk about ball collisions which is happened inside Billiards Squared Table, what happened to ball before and after the collusion, In order to realistic this behavior we will mention some of basics and rules about this collisions, I have put these rules and assumptions in order to realistic this movement. The flow for this project will be as follows, first of all we will take an introduction to what happened to speed after and before the collision, then we will choose 8 movements instead of know the angle of shoot, then we will see the samples for this simulation according to different speeds and positions. Finally we will go throughout simulation code about this problem.

XAF : Business Classes vs Database Tables

In an application where you have to deal with information, you most likely have database tables, database systems, SQL queries, records and columns. Using relational models is a traditional way to work with databases. Today, the most common approach to database access is probably ADO.NET technology. It has the DataSet type that grants a local copy of multiple interrelated database tables. Via the DataSet object, a user can locally execute various operations, with the content of a database being physically disconnected from the DBMS.

The eXpressApp Framework (XAF) concentrates its efforts on another flow of today's development: object-oriented data handling. The need to store object-oriented data appeared when object-oriented programming became pervasive. Currently, most modern, nontrivial applications use an object-oriented paradigm to model application domains. This means that you can abstract from any persistence details, and have a clean, simple, object-oriented API to perform data storage. You do not need to handle persistence details and internal data representation in data stores be they relational, object-based, or something else. Why should you deal with low-level constructs of the data-store model, such as rows and columns, and constantly translate them back and forth? Instead, concentrate on complex applications you are required to deliver.

The ability to use object-based data handling, instead of direct interaction with databases, leads to a layer that provides mapping of objects into database tables (Object-Relational Mapping tool). In the XAF, such a layer is provided by the eXpress Persistent Objects (XPO). The XPO provides reliability and flexibility in storing the information. Its simplicity comes from the fact that you do not need to learn the details of how the data is stored.


Wednesday, March 7, 2012

Dev-Express Framework Overview (XAF)

A software can be developed either by create a software from scratch or configure a universal product based on company needs. XAF is lies between these two scenarios, developers still need to write code, but a great deal of it has already been completed for them. XAF gives them a development platform that makes it much easier to develop business applications. These are the applications described at the beginning of this overview - those designed to enter, store, browse, analyze, print data, or if needed, organize company workflow. If you are trying to build an application of another type - a game, a graphic editor, a word processor, etc. - the XAF will not help you.

Of course, the XAF was initially designed to address issues that take place when you develop an application from scratch. Thus, the main goals of the XAF technology are: