Wednesday, March 30, 2016

Handling non-functional requirements in scrum

Product owners defines application functionalities and requirements about what application should do. Such requirements are called functional requirements.

There use to be some inherent requirements of a system like performance,scalability, manageability, which the software architect needs to identify and define.These are called non-functional requirements of a system.Non functional requirements defines the quality or constraints of a system.If these are not taken care during software architecture phase, application ends up with technical debt, which leads to high cost of maintenance, enhancement and support.

The distinction between functional and non-functional requirement can be understood from a ticket booking application. The functional requirement would be that users should be able to book the tickets between two locations. Whether the application should remain available all the time or can be brought down for some time weekly or monthly for maintenance would be a non-functional requirement.

Some examples of non-functional requirements of an application are as following -
  1. Scalability (Capability to handle growing amount of work)
  2. Performance
  3. Usability (Easy to use, learn and fit for purpose)
  4. Manageability (Easy to configured, deployed, controlled and supervised)
  5. Security
  6. Documentation
  7. Extensibility (Ability to be extended with minimal or no change in existing code/behaviour)
  8. Portability (Usability in different environment)
  9. Reliability (Ability to function under stated condition for specified period of time)
  10. Robustness (Ability to cope up with error or erroneous input during execution)
  11. Availability (Ratio of time of application at operable/committed level to total time)
  12. Resilience (Ability to provide accepted level on service in case of faults, natural disasters or targeted attacks)
  13. Configuration management (Track and control changes in software)
  14. Disaster recovery (Procedures to recover from natural or human made disasters)
In scrum, such non functional requirements, can be handled in following ways-

Creating the stories and getting the product-owners buy-in for prioritization -In this approach, we talk to product owner to get the non-functional requirements considered as user stories. The example of such story with acceptance criteria might be "As a user, I want the application to remain available 24*7. It should not need to be brought down for upgrades" . The limitation of this approach is that some of the times, such stories might not be prioritized by product owners for a long time. The positive side of this approach is that whenever its picked up, we would have complete buy-in from product-owners.

Considering the non-functional requirements part of functional story itself - In this approach, the non-functional requirements gets implemented along with the story itself, but it would have impact on the estimation of stories. While following this approach, the estimation would be higher than it would have been without non-functional requirements

In this article, I explained the way to understand and manage the non-functional requirements. Please let us know,your experience as well about managing and handling non-functional requirements

Monday, March 7, 2016

Direct vs Seda vs Direct-Vm vs VM end points in Apache Camel

Apache camel is a rule based routing and mediation engine. It provides facility to perform seamless integration of various type of components via routes and endpoints.

Camel comes up with four camel aware end points.These end points have following similarities-
1. All of these end points accept camel exchange message only.
2. All of these end points are in-memory. Message in these queues would get lost in case of abrupt shutdown of system.

All of these queues provide better performance than other end points because no camel message transformation is performed by the end point.

Despite having multiple similarities, the purpose of each and every end point is different.The exact nature of difference can be noticed from the following matrix -


With In Same Camel Context
Across Camel contexts in a Single JVM
Synchronous
direct
direct-vm
Asynchronous
seda
vm

Synchronous communication refers to the communication, where the sender sends the message and proceed ahead only when response is retrieved back. In this case, all further processing happens on the received message.

Asynchronous communication refers to the kind of communication, where sender sends a copy of message to the receiver and proceeds without waiting for the processing at receiver to be completed.

In the following example, I will show you the behavior of direct end point and let you use the same example to test and understand the behavior of seda, direct-vm and vm end points. In case of any difficulty, you can download the complete project with the example of all of the end points from the following git hub location.-


Technology used -
java version "1.8.0_73"
Apache Camel 2.16.2
Apache Maven 3.0.4

pom.xml -
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>camel</groupId>
 <artifactId>CamelAwareEndPoints</artifactId>
 <packaging>jar</packaging>
 <version>1.0-SNAPSHOT</version>
 <dependencies>
  <dependency>
   <groupId>org.apache.camel</groupId>
   <artifactId>camel-core</artifactId>
   <version>2.16.2</version>
  </dependency>
  <dependency>
   <groupId>org.slf4j</groupId>
   <artifactId>slf4j-simple</artifactId>
   <version>1.6.4</version>
  </dependency>
 </dependencies>
</project>
Project Structure

DirectEndPointRouter.java-
package com.salil.camelawareendpoints.router;

import org.apache.camel.builder.RouteBuilder;

public class DirectEndPointRouter extends RouteBuilder  {

 public static final String DIRECT_END = "direct:End";
 public static final String DIRECT_START = "direct:start";

 @Override
 public void configure() throws Exception {
  from(DIRECT_START).routeId("StartRouteId")
  .setBody().simple("Start Message")
  .to(DIRECT_END)
  .log("Message at start route completion = ${body}");
  
  
  from(DIRECT_END).routeId("EndRouteId")
  .setBody().simple("End Message")
        .log("message after end-route completion = ${body}");
 }

}

DirectEndPointBehaviorExample.java-
package com.salil.camelawareendpoints.ContextExample;

import com.salil.camelawareendpoints.router.DirectEndPointRouter;
import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.impl.DefaultCamelContext;

/**
 * Created by Salil on 29-02-2016.
 */
public class DirectEndPointBehaviorExample {

    public static void main(String[] args) throws Exception {
        CamelContext camelContext = new DefaultCamelContext();
        camelContext.addRoutes(new DirectEndPointRouter());
        camelContext.start();

        ProducerTemplate producerTemplate=camelContext.createProducerTemplate();
        producerTemplate.sendBody(DirectEndPointRouter.DIRECT_START, "Initial Message");
    }
}

Execution output-
427 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.16.2 (CamelContext: camel-1) is starting
429 [main] INFO org.apache.camel.management.ManagedManagementStrategy - JMX is enabled
843 [main] INFO org.apache.camel.impl.converter.DefaultTypeConverter - Loaded 182 type converters
973 [main] INFO org.apache.camel.impl.DefaultRuntimeEndpointRegistry - Runtime endpoint registry is in extended mode gathering usage statistics of all incoming and outgoing endpoints (cache limit: 1000)
1280 [main] INFO org.apache.camel.impl.DefaultCamelContext - AllowUseOriginalMessage is enabled. If access to the original message is not needed, then its recommended to turn this option off as it may improve performance.
1280 [main] INFO org.apache.camel.impl.DefaultCamelContext - StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
1441 [main] INFO org.apache.camel.impl.DefaultCamelContext - Route: StartRouteId started and consuming from: Endpoint[direct://start]
1451 [main] INFO org.apache.camel.impl.DefaultCamelContext - Route: EndRouteId started and consuming from: Endpoint[direct://End]
1451 [main] INFO org.apache.camel.impl.DefaultCamelContext - Total 2 routes, of which 2 is started.
1459 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.16.2 (CamelContext: camel-1) started in 1.031 seconds
1501 [main] INFO EndRouteId - message after end-route completion = End Message
1501 [main] INFO StartRouteId - Message at start route completion = End Message

In this case, we can notice following things
1- The output of end route got printed before the completion of start route
2- Both start route and end route had the same message in the body of the message at the time of printing
3- All the execution happens on the main thread only

This behavior appears because of synchronous nature of direct end point, where at the call of '.to(DIRECT_END)', the execution of first route stopped & it resumed again on receiving of the message with body 'End Message'

Let us know whether you could understand the behavior of seda, direct-vm and vm points, or faced any difficulty even after executing the examples at following git hub location

Tuesday, March 1, 2016

Lamda expression vs Anonymous class in java

Lamda expression are anonymous methods, which can be assigned to a variable, passed as an argument or returned as a value of function call.

Lamda expression in java 8 comes as a big relief from writing the boiler plate code needed to implement single method interfaces like comparable, comparator, runnable or callable etc. For writing such methods using anonymous class it use to take minimum six to seven lines of code. The same can be written in a single line while using Lamda expression.

In the following example, we are trying to print 'Salil Verma' using thread. we can notice that Lamda expression is very concise and anonymous class contains boiler plate code.

Anonymous class approach -

public class ThreadAnonymousClassExample {
   
 public static void main(String[] args) {
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                System.out.println("Salil Verma");
            }
        };
        new Thread(runnable).start();
    }
}

Lamda expression approach -

public class ThreadLamdaExample {
   
 public static void main(String[] args) {
        new Thread(()->System.out.println("Salil Verma")).start();
    }
}

Although Lamda expression looks very handy and concise in writing, it has got limitations. This expression can be used only on the situations where we are using single method interface. On situations where interface or abstract class has got more than one methods, Anonymous class is the way to go.

In short, Lamda expression should be preferred over anonymous class where we are implementing single method interface otherwise anonymous class is the way to go.

Tuesday, February 23, 2016

How to minimize the performance impact of locking in database

Database locks work as a solution to the problems associated with concurrency, consistency and integrity. But it comes with its own drawback of performance hit. In this article, we will talk about steps, we could take during database design to reduce the performance impact of locking.
Introduce optimum indexes - Introducing optimum indexes improves the performance impact of locking caused by those update and delete statements, which have got filter criteria associated with them. When a update or delete query with filter criteria is fired in database, it initially takes a lock on complete table to identify the records getting impacted. Once the records are identified, Sybase can take the lock on the selected rows, depending on the locking level set on the table . Implementing the index, would minimize the time required in identifying rows to be updated or deleted, which in turn would reduce the all page level locking time.
Choose the optimum locking level on server- Sybase ASE provide option to set the default locking scheme to be applied on newly created tables.It can be set as "allpages", "datapages" or "datarows "level. In "allpages" lock level, all the pages of table gets locked during any DML operation. In "datapages" lock level only the pages, which contains impacted data, gets locked. In "datarows " lock level, only the rows impacted with DML operations,gets locked.
 
The default locking scheme can be checked by firing following query -
 sp_configure "lock scheme"
  
Default locking scheme can be changed by following query - 
sp_configure "lock scheme", 0,  {allpages | datapages | datarows}
Choose optimum lock level on tables -It might not always be possible to set least restrictive locking scheme on the database server level. For these cases, Sybase ASE provide option to set locking level on table level. This locking level can be set during table creation as a part of create statement or changed later via alter statement.
Option to set locking level in create table statement -
create table table_name (column_name_list)[lock {datarows | datapages | allpages}]

Option to set locking level in alter table statement -
alter table table_name lock {allpages | datapages | datarows}
Keeping the transaction duration to minimum- locks are taken as a part of transaction and released at the end of transaction. Keeping the transaction duration sort helps us minimizing the lock duration and its impact on performance.
Partition the table- In a non-partitioned table, with no clustered index, all the inserts happens on the last page of the table. In case of concurrent inserts, it would create performance hit as every transaction would cause lock on the last page and let another transaction wait until the completion. In case of partitioned table, there would be multiple last pages causing less impact of locking.
Creating the clustered index-Clustered index provides multiple last page insertion points, which helps in reducing the impact of locks in concurrent inserts. But it also introduces an overhead of ordering, which might again have an impact on performance.
I hope, this article would have helped you in understanding the way, we could minimize the impact of locking in our application. Let me know your experience as well, if this article could help you some way or you could find some other ways as well to minimize the performance impact of locking.

Saturday, February 20, 2016

Testing method arguments using JUnit and Mockito ArgumentCaptor with example

Multiple times, we get to a situation, where we have a  public void method in our program, whose behaviour needs to be tested using  Junit.  Mostly such void methods, take some arguments to perform some operation locally and then pass objects for remote processing.

Automated testing of such scenarios can be done in one of following two approaches. - 
  1. Write a unit test and verify that our public method is performing necessary operations accurately and sending correct object to remote resources.
  2. Write an integration test by including third party module as well and then verify result from the remote resource.


In this article, we will be focus on first approach, where we write a JUnit test to ensure that our method is performing local operations accurately and sending the right object with right values to remote resource.

we can write such test cases using Mockito framework and its Argument captor API. Argument API provides us methods  like capture, getValue and getAllValues to capture the values passed by the method under test to mock of remote resource  and retrieve those values for verification.

In this Mockito Agrument captor example, we have a class MailProcessor, which takes the employee object from database on the basis of id, transform it to dto object  and pass it to mailing service for sending mail.

Technology used -
java version "1.7.0_06"
Apache Maven 3.0.4
junit -4.12
mockito -1.10.19

pom.xml -

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>mockito</groupId>
 <artifactId>ArgumentCaptorExample</artifactId>
 <packaging>jar</packaging>
 <version>1.0-SNAPSHOT</version>
 <dependencies>
  <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <version>4.12</version>
   <scope>test</scope>
  </dependency>
  <dependency>
   <groupId>org.mockito</groupId>
   <artifactId>mockito-all</artifactId>
   <version>1.10.19</version>
  </dependency>
 </dependencies>
</project>

Project Structure


Employee.java

package salil.mockito.argumentcaptorexample;

public class Employee {

 private int employeeId;
 private String name;
 private String email;
 private int salarry;

 public int getEmployeeId() {
  return employeeId;
 }

 public void setEmployeeId(int employeeId) {
  this.employeeId = employeeId;
 }

 public String getName() {
  return name;
 }

 public void setName(String name) {
  this.name = name;
 }

 public String getEmail() {
  return email;
 }

 public void setEmail(String email) {
  this.email = email;
 }

 public int getSalarry() {
  return salarry;
 }

 public void setSalarry(int salarry) {
  this.salarry = salarry;
 }

}

EmployeeDao.java

package salil.mockito.argumentcaptorexample;

public interface EmployeeDao {

 Employee getEmployee(int employeeId);
}


EmpMailDTO.java

package com.salil.argumentCaptor.domain;

public class EmpMailDTO {

 private final String reciepientEmail;
 private final String sender="admin@salilstock.blogspot.com";
 private final String subject="Salary notification";
 private final static String templateMessage="Dear %s\n\n we are processing your salary amount %s. \n\n Regards\nAdmin";
 private final String message;
 
 public EmpMailDTO(final String name,final String reciepientEmail,final int salary)
 {
  this.reciepientEmail=reciepientEmail;
  this.message=String.format(templateMessage, name,salary);
 }
 
 public String getReciepientEmail() {
  return reciepientEmail;
 }

 public String getSender() {
  return sender;
 }
 public String getMessage() {
  return message;
 }

 public String getSubject() {
  return subject;
 }
}

MailingService.java

package com.salil.argumentCaptor;

import com.salil.argumentCaptor.domain.EmpMailDTO;

public interface MailingService {
 void sendEmail(EmpMailDTO employeeMail);
}

Method to be tested - MailProcessor.sendEmailToEmployee -
package salil.mockito.argumentcaptorexample;

public class MailProcessor {

 private final EmployeeDao employeeDao;
 private final MailingService mailingService;
 
 public MailProcessor(EmployeeDao employeeDao, MailingService mailer) {
  this.employeeDao = employeeDao;
  this.mailingService = mailer;
 }
 
 public void sendEmailToEmployee(int employeeId)
 {
  Employee employee = employeeDao.getEmployee(employeeId);
  if(isEmployeeMailValid(employee.getEmail()))
  {
  EmpMailDTO empMailDTO = new EmpMailDTO(employee.getName(), employee.getEmail(), employee.getSalarry());
  mailingService.sendEmail(empMailDTO);
  }
 }
 
 private boolean isEmployeeMailValid(String email)
 {
  return email!=null;
 }
}

Corresponding test case would be as following -

package salil.mockito.argumentcaptorexample;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class MailProcessorTest {

 @Mock
 private EmployeeDao employeeDao;
 @Mock
 private MailingService mailingService;
 
 private int employeeId=1;
 private String name="Salil";
 private String email="admin@salilstock.blogspot.com";
 private int salarry=5000;
 private Employee employee;
 
 @Before
 public void setup() {
  employee = new Employee();
  employee.setEmployeeId(employeeId);
  employee.setName(name);
  employee.setEmail(email);
  employee.setSalarry(salarry);
 }
 
 
 @Test
 public void testSendEmailToEmployee() {
  MailProcessor mailProcessor = new MailProcessor(employeeDao, mailingService);
  Mockito.when(employeeDao.getEmployee(1)).thenReturn(employee);
  
//  Instantiate argument captor to capture the argument of EmployeeMail type  
  ArgumentCaptorargumentCaptor =ArgumentCaptor.forClass(EmpMailDTO.class);
  
//  Perform operation
  mailProcessor.sendEmailToEmployee(1);
  
//  Capture the argument
  Mockito.verify(mailingService).sendEmail(argumentCaptor.capture());
  
//  verify the correctness of the receiving object
  EmpMailDTO empMailDTO=argumentCaptor.getValue();
  assertEquals(empMailDTO.getReciepientEmail(), this.email);
  assertEquals(empMailDTO.getMessage(),"Dear Salil\n\n we are processing your salary amount 5000. \n\n Regards\nAdmin");
 }

}

This complete project can be accessed from the following git hub location.

Please let us know whether you found this article useful and your experience on using argument captor in your project.

Friday, August 30, 2013

Generating the DDL of Oracle Schema Objects


set serveroutput on size unlimited
begin
dbms_output.put_line('--');
dbms_output.put_line('-- DROP TABLES --');
dbms_output.put_line('--');
    for rt in (select table_name tname from user_tables order by tname) loop
        dbms_output.put_line('DROP TABLE '||rt.tname||' CASCADE CONSTRAINTS;');
    end loop;
end;
/        

declare 
    v_tname  varchar2(30);
    v_cname  char(32);
    v_type     char(20);
    v_null   varchar2(10);
    v_maxcol number;
    v_virg     varchar2(1);
begin
dbms_output.put_line('--');
dbms_output.put_line('-- CREATE TABLES --');
dbms_output.put_line('--');
    for rt in (select table_name from user_tables order by 1) loop
        v_tname:=rt.table_name;
        v_virg:=',';
        dbms_output.put_line('CREATE TABLE '||v_tname||' (');
        for rc in (select table_name,column_name,data_type,data_length,
                            data_precision,data_scale,nullable,column_id
                from user_tab_columns tc
                where tc.table_name=rt.table_name
                order by table_name,column_id) loop
                    v_cname:=rc.column_name;
                    if rc.data_type='VARCHAR2' then
                        v_type:='VARCHAR2('||rc.data_length||')';
                    elsif rc.data_type='VARCHAR' THEN
                        v_type:='VARCHAR('||rc.data_length||')';
                    elsif rc.data_type='NVARCHAR2' THEN
                        v_type:='NVARCHAR2('||rc.data_length||')';
                    elsif rc.data_type='NUMBER' and rc.data_precision is null and
                                         rc.data_scale=0 then
                        v_type:='INTEGER';
                    elsif rc.data_type='NUMBER' and rc.data_precision is null and
                                     rc.data_scale is null then
                        v_type:='NUMBER';
                    elsif rc.data_type='NUMBER' and rc.data_scale='0' then
                        v_type:='NUMBER('||rc.data_precision||')';
                    elsif rc.data_type='NUMBER' and rc.data_scale<>'0' then
                        v_type:='NUMBER('||rc.data_precision||','||rc.data_scale||')';
                    elsif rc.data_type='CHAR' then
                         v_type:='CHAR('||rc.data_length||')';
                    else v_type:=rc.data_type;
                    end if;
                    
                    if rc.nullable='Y' then
                        v_null:='NULL';
                    else
                        v_null:='NOT NULL';
                    end if;
                    select max(column_id)
                        into v_maxcol
                        from user_tab_columns c
                        where c.table_name=rt.table_name;
                    if rc.column_id=v_maxcol then
                        v_virg:='';
                    end if;
                    dbms_output.put_line (v_cname||v_type||v_null||v_virg);
        end loop;
        dbms_output.put_line(');');
    end loop;
end;  
/

declare 
    v_virg        varchar2(1);
    v_maxcol    number;
begin
dbms_output.put_line('--');
dbms_output.put_line('-- PRIMARY KEYS --');
dbms_output.put_line('--');
    for rcn in (select table_name,constraint_name 
            from user_constraints 
            where constraint_type='P' 
            order by table_name) loop
        dbms_output.put_line ('ALTER TABLE '||rcn.table_name||' ADD (');
        dbms_output.put_line ('CONSTRAINT '||rcn.constraint_name);
        dbms_output.put_line ('PRIMARY KEY (');
        v_virg:=',';
        for rcl in (select column_name,position 
                from user_cons_columns cl 
                where cl.constraint_name=rcn.constraint_name
                order by position) loop
            select max(position)
                into v_maxcol
                from user_cons_columns c
                where c.constraint_name=rcn.constraint_name;
            if rcl.position=v_maxcol then
                v_virg:='';
            end if;
            dbms_output.put_line (rcl.column_name||v_virg);
        end loop;
        dbms_output.put_line(')');
        dbms_output.put_line('USING INDEX );');
    end loop;
end;
/

declare
    v_virg        varchar2(1);
    v_maxcol    number;
    v_tname        varchar2(30);
begin
dbms_output.put_line('--');
dbms_output.put_line('-- FOREIGN KEYS --');
dbms_output.put_line('--');
    for rcn in (select table_name,constraint_name,r_constraint_name 
            from user_constraints 
            where constraint_type='R'
            order by table_name) loop
        dbms_output.put_line ('ALTER TABLE '||rcn.table_name||' ADD (');
        dbms_output.put_line ('CONSTRAINT '||rcn.constraint_name);
        dbms_output.put_line ('FOREIGN KEY (');
        v_virg:=',';
        for rcl in (select column_name,position 
                from user_cons_columns cl 
                where cl.constraint_name=rcn.constraint_name
                order by position) loop
            select max(position)
                into v_maxcol
                from user_cons_columns c
                where c.constraint_name=rcn.constraint_name;
            if rcl.position=v_maxcol then
                v_virg:='';
            end if;
            dbms_output.put_line (rcl.column_name||v_virg);
        end loop;
        select table_name 
            into v_tname
            from user_constraints c
            where c.constraint_name=rcn.r_constraint_name;
        dbms_output.put_line(') REFERENCES '||v_tname||' (');

        select max(position)
                into v_maxcol
                from user_cons_columns c
                where c.constraint_name=rcn.r_constraint_name;
        v_virg:=',';
        select max(position)
            into v_maxcol
            from user_cons_columns c
            where c.constraint_name=rcn.r_constraint_name;
        for rcr in (select column_name,position 
                from user_cons_columns cl
                where rcn.r_constraint_name=cl.constraint_name
                order by position) loop
            if rcr.position=v_maxcol then
                v_virg:='';
            end if;
            dbms_output.put_line (rcr.column_name||v_virg);
        end loop;
        dbms_output.put_line(') );');
    end loop;
end;
/
        
begin
dbms_output.put_line('--');
dbms_output.put_line('-- DROP SEQUENCES --');
dbms_output.put_line('--');
    for rs in (select sequence_name 
            from user_sequences
            where sequence_name like 'SQ%'
            order by sequence_name) loop
        dbms_output.put_line('DROP SEQUENCE '||rs.sequence_name||';');
    end loop;
dbms_output.put_line('--');
dbms_output.put_line('-- CREATE SEQUENCES --');
dbms_output.put_line('--');
    for rs in (select sequence_name 
            from user_sequences
            where sequence_name like 'SQ%'
            order by sequence_name) loop
        dbms_output.put_line('CREATE SEQUENCE '||rs.sequence_name||' NOCYCLE;');
    end loop;
end;
/

declare
    v_virg        varchar2(1);
    v_maxcol    number;
begin
dbms_output.put_line('--');
dbms_output.put_line('-- INDEXES --');
dbms_output.put_line('--');
    for rid in (select index_name, table_name 
            from user_indexes
            where index_name not in (select constraint_name from user_constraints) 
                and index_type<>'LOB'
            order by index_name) loop
        v_virg:=',';
        dbms_output.put_line('CREATE INDEX '||rid.index_name||' ON '||rid.table_name||' (');    
        for rcl in (select column_name,column_position 
                from user_ind_columns cl 
                where cl.index_name=rid.index_name
                order by column_position) loop
            select max(column_position)
                into v_maxcol
                from user_ind_columns c
                where c.index_name=rid.index_name;
            if rcl.column_position=v_maxcol then
                v_virg:='';
            end if;
            dbms_output.put_line (rcl.column_name||v_virg);
        end loop;
        dbms_output.put_line(');');
    end loop;
end;
/



http://www.dba-oracle.com/art_builder_get_schema_syntax.htm
http://docs.oracle.com/cd/E17781_01/server.112/e18804/impexp.htm
http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_metada.htm
http://docs.oracle.com/cd/E11882_01/server.112/e22490/original_import.htm

Saturday, July 20, 2013

Preparing environment for Andiod Development

While thinking about Android application development, first question comes into our mind, that how can we get the android environment into our laptop or desktop.

There are two ways, we could deal with this challenge one installing an android simulator and another installing android operating system in the laptop. 

The example of some android simulators are as follows -
  1. BlueStacks
  2. Youwave
Installation of Android operating system directly needs vm virtual box. The steps of same can be accessed from here