ThreadAbortException: Thread was being aborted.

21. February 2010

You have created a page to give response and before it finalizes the response, you have to catch the exceptions and show the error message as response.

When you have implemented the try-catch block, you have catched an unexpected exception thrown by Response.End() which gives the message as "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack."; well no problem at all. The exception is actually expected by IIS and you should not catch it, so the solution is as below.

try

     //do your work here
}
catch(Exception ex)
{
     //handle your response or
     Response.Write(ex.Message);
}
finally
{
     Response.End();
}

You may want to use Response.Redirect("Page.aspx"); in try-catch block so you have to use Response.Redirect("Page.aspx", false); as described in Microsoft Support

Dimensions, Hierarchies and Levels

17. January 2010

Dimension

A dimension, as it is possible to evalute from the name, used in OLAP databases to give the user one more point of view to information. An OLAP database can have many dimensions, which makes possible to read the company statistics easily and clearly. Dimension types are as below;

  • Star Schema: Dimension from single table
  • Snowflake Schema: Dimension from multiple tables
  • Parent-Child: Dimension from single table with parent-child hierarchy

Hierarchy

Hierarchy is actualy another aspect of a dimension. Think of a dimension which is created to see the cities in a geographical view as below.

  • Turkey
    • Marmara
      • Istanbul
      • Bursa
      • Izmit
    • Ege
      • Izmir
      • Balikesir
      • Manisa

And lets have another point of view such like population density on the same dimension.

  • Turkey
    • High Populated
      • Istanbul
      • Izmır
    • Medium Populated
      • Bursa
      • Izmit
    • Low Populated
      • Balikesir
      • Manisa

So we can name the dimensions with hierarchy extension like "State.Geo" and "State.Population". But to have different hierarchies the required data should be provided in OLTP database as below.

ID City State Population
1 Istanbul Marmara High
2 Bursa Marmara Medium
3 Izmit Marmara Medium
4 Izmir Ege High
5 Balikesir Ege Low
6 Manisa Ege Low

Levels

Level is the steps of hierarchy which makes it is possible to create different hierarchies on a dimension. Levels of above example are "Marmara" and "Ege" for geographical view, "High Populated", "Medium Populated" and "Low Populated" for population density view. As I expressed above that to create different hierarchy data should be provided from OLTP, this is because levels are the columns of table(s).

General

Basic Rules of Object-Oriented Programming

24. October 2009

Object-Oriented Principles are first defined by Alan Kay in 1993.

  1. Everything is an object.
  2. Computation is performed by objects communicating with each other, requesting that other objects perform actions. Objects communicate by sending and receiving messages. A message is a request for action bundled with whatever arguments may be necessary to complete the task.
  3. Each object has its own memory, which consists of other objects.
  4. Every object is an instance of a class. A class simply represents a grouping of similar objects, such as integers or lists.
  5. The class is the repository for behavior associated with an object. That is, all objects that are instances of the same class can perform the same actions.
  6. Classes are organized into a singly rooted tree structure, called the inheritance hierarchy. Memory and behavior associated with instances of a class are automatically available to any class associated with a descendant in this tree structure.

General

Invoke SAP Web Service from Eclipse (Java)

21. September 2009

Lets' go step by step

  1. After creating your web service in SAP, open wsadmin transaction.
  2. Find your web service and press Ctrl+F1 after selecting  your service.
  3. Just click OK to new window
  4. In browser your web service will be shown as xml type document*
  5. Copy all the text in the window
  6. Open a new project in Eclipse and create a text(*.txt) file
  7. Insert copied text to this text file and save it.
  8. Rename file extension to wsdl (*.wsdl), you will see the change in  icon
  9. Right click new wsdl file and click Web Services ->  Generate Client
  10. Eclipse will generate the required classes to invoke the web service
  11. Create a Java class with main method. Assume that my web service name is  Z_Customers and method name is getCustomers()
  12. In the main method copy the following I hope you will not face any  difficulties

try{

 //Creates new service from locator
 Z_CustomersService service = new Z_CustomersServiceLocator();
 System.out.println("!service called!");

 //Kna1 is a Customer table of SAP, in my web service 
 //I just select the customer from this table. This class also
 //generated by eclipse.
 Kna1[] customers = new Kna1[100];

 //Binding the web service
 Z_Customers binding = service.getz_customersSoapBinding();
 System.out.println("!service binded!");

 //Tables are changeable (import/export) type in SAP so
 //I have to give my table as a parameter and assign the result.
 customers = binding.GetCustomers(customers);

 for(int i=0; i<tcustomers.length; i++){
 System.out.println(customers[i].getName());
 }

} catch(RemoteException e){
 e.printStackTrace();
} catch (ServiceException e) {
 e.printStackTrace();
}

* Some browsers does not show, right click and view the source.

, ,