Friday, December 30, 2016

SOA and SOI

Q: IS SOI (Service Oriented Integration) Reference Architecture a subset of SOA (Service Oriented Architecture) reference Architecture?

a)  True
b)  False

Tuesday, December 27, 2016

SOA Capabilty Maturity Levels

SOA capability Maturity levels

Level - 0 No SOA : You have not pursued SOA Approach
Level - 1 AD HOC : You are just trying to play around with SOA
Level -2 Opportunistic : you are trying SOA for quick implementation, may be a demo
Level -3 Systematic : you are getting serious with SOA, consistent application with share and reuse Level - 4 Managed : you have step further, considering to drive business value
 Level - 5 Optimized : you are getting full benefit of SOA strategy, cost-effectiveness, business intiatives, standards, processes

Thursday, September 15, 2016

bool Data Type in C++

While making decisions, it is human to think in terms of true or false. In C Programming language false is represented by Zero value and true by Non-Zero. C++ introduced bool data type to hold true or false values.
Code example :
#include <iostream>
using namespace std;
int main()
{
    int x=10,y=20;
    bool b=x>y;
    cout<<" x> y = "<<b<<endl;
    return 0;
}

On execution :




Even though  we can use keywords : true or false for assigning purposes to bool variable, the values stored in a bool variable for true is 1 and false is 0.

bool b=true;
cout<<b<<endl;

The outcome is 1.

std::boolalpha function can be used for text values for bool type.  With boolalpha, cout statement will look like :
    cout<<" x> y = "<<std::boolalpha<<b<<endl; 
On execution :



boolalpha is a format flag...

Wednesday, July 20, 2016

Another way to convert an int to String

import java.util.Scanner;
public class IntToStrMethodsDemo {
    public static void main(String[] args) {
        int num;
        num=readInt();
        String str=intToStr(num);
        System.out.println(intToStr(num)+1);
    }
    public static int readInt(){
        System.out.println("enter an int");
        return new Scanner(System.in).nextInt();
    }
    public static String intToStr(int num){
        return ""+num;
    }

}
Or use the code below :

String str = ""+new Scanner(System.in).nextInt();
        System.out.println(str+1);


It does the same

Saturday, July 16, 2016

Simple utility to convert an int to String

package utilities;
import java.util.Scanner;
public class IntToStr {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter an integer :");
        int num = scanner.nextInt();
        String str = intToStr(num);
        System.out.println("number String : "+str);
    }
    public static String intToStr(Integer num){
        return num.toString();
    }

}

Monday, March 21, 2016

Business Model Canvas

BMC is a single page view, which is works like a strategic management tool for an enterprise to show
  • What you want to do or what you do?
  • How you want to go about it?

It lays out crucial activities and challenges and their relationship. The intention of a company to deliver a service or a product is described by nine building blocks :
  • Customer Segments
  • Value propositions
  • Channels
  • Customer Relationships
  • Revenue Streams
  • Key Resources
  • Key Activities
  • Key partnerships
  • Cost Structures
A Single page view of BMC from hbr.org :



Sunday, March 20, 2016

Strategy Maps

A Strategy map provides a visual framework for company’s objectives. It shows cause-and-effect links, which helps attaining desired outcomes. Four basic perspectives of Balanced Scorecards are considered related to the VISION:
  • Financial
  • Customer
  • Internal
  • Learning and growth


Followed by critical success factors and measures which will validate these critical success factors.

Wednesday, March 16, 2016

A Good Strategy

A good business strategy statement will have
  • Objective
  • Scope
  • Advantage


Remember goals is NOT business strategy

An interesting Challenge....

Can you state/summarize your company strategy in succinct manner (say about 50 words)?

Tuesday, March 15, 2016

Learning Business Architecture - 1

Michael Porter’s 5 competitive forces that help shape a company, its business strategy are:

  •            Rivals
  •           Customers
  •       New Entrants
  •       Suppliers
  •       Substitutes

These forces can vary from business to business. If in one business rivals are the strongest force, new entrants can be in the other. To succeed, business must overcome threats posed by these forces and make and follow business strategy.

Monday, February 1, 2016

My Technical memories: memory - 4

I had been busy, actually very very busy with some technical preparations on SOA. I kind of forgot to look into the past. But like a ghost past pops up at one or the other occasion. So it happened that I had to look into Serialization for some issue and here I see the Ghost of past reminding me of interesting issue about static and serialization. Static data is not serialized. Oh! I forgot to tell you, I am talking about Java Object Serialization. So here is a small example to show from my Java memories…
I created an Employee class which implements Serializable. This class object is to be Serialized.

package test.domain;
import java.io.Serializable;

public class Employee implements Serializable{
    private int empId;
    private String empName;
    private double salary;
    public static final int branchCode=3;
    public static int count;

    /*public Employee() {
        count++;
        empId=count;
    }*/

    public Employee(String empName, double salary) {
        count++;
        empId=count;
        this.empName = empName;
        this.salary = salary;
    }

    public int getEmpId() {
        return empId;
    }

    public void setEmpId(int empId) {
        this.empId = empId;
    }

    public String getEmpName() {
        return empName;
    }

    public void setEmpName(String empName) {
        this.empName = empName;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public static int getCount() {
        return count;
    }

    public static void setCount(int count) {
        Employee.count = count;
    }

    public String toString(){
        return "count : "+count+
        "  Employee Id : "+empId+
        "  Branch Code : "+branchCode+
        "  Employee Name : "+empName+
        "  salary : "+salary;
    }
  }

Then I created a class which can serialize the objects of Employee class. I named this class as PersistEmployee.

package teststatic;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import test.domain.Employee;

public class PersistEmployee {

    public static void main(String[] args) {
        Employee emp;
         try (FileOutputStream fos = new FileOutputStream("d:\\emp.dat");
              ObjectOutputStream out = new ObjectOutputStream(fos)) {
                emp=new Employee("John",120000);
                out.writeObject(emp);
                emp=new Employee("Tim",140000);
                out.writeObject(emp);
         }catch(IOException e){
             System.out.println("Input Output Error...");
         }

        /* Employee e;
         try (FileInputStream fis = new FileInputStream("d:\\emp.dat");
                ObjectInputStream in = new ObjectInputStream(fis)) {
                e = (Employee)in.readObject();
                System.out.println (e);
                e = (Employee)in.readObject();
                System.out.println (e);
        } catch (ClassNotFoundException | IOException i) {
            System.out.println("Exception reading in Portfolio: " + i);
        }*/
    }
}

When I run this class, it serializes two objects of Employee class, static variable will be incremented with every constructor call. After these two objects are created value of count will be 2, branchCode is static final and will always hold value 3.  I am using static and static final variables in the Employee class. The code will show how JVM deals with static and static final during serialization and deserialization.

I created another class ReadEmployee where deserialization is taking place for Employee objects.

package teststatic;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import test.domain.Employee;

public class ReadEmployee {

     public static void main(String[] args) {
        Employee e;
    
        try (FileInputStream fis = new FileInputStream("d:\\emp.dat");
                ObjectInputStream in = new ObjectInputStream(fis)) {
                e = (Employee)in.readObject();
                System.out.println (e);
                e = (Employee)in.readObject();
                System.out.println (e);
        } catch (ClassNotFoundException | IOException i) {
            System.out.println("Exception reading in Portfolio: " + i);
        }
    }
}

Now when I run ReadEmployee it brings this result for me.

run:
count : 0  Employee Id : 1  Branch Code : 3  Employee Name : John  salary : 120000.0
count : 0  Employee Id : 2  Branch Code : 3  Employee Name : Tim  salary : 140000.0
BUILD SUCCESSFUL (total time: 2 seconds)

I can see that static variable value is zero, static variable is not persisted, branchCode is also not persisted, but it prints value 3 because it is static final variable. An interesting part will be be if you uncomment the read code from PersistEmployee and run it. In this case both serialization and deserialization happens in the same class and hence you will find an interesting difference in the outcome. Here it is:

run:
count : 2  Employee Id : 1  Branch Code : 3  Employee Name : John  salary : 120000.0
count : 2  Employee Id : 2  Branch Code : 3  Employee Name : Tim  salary : 140000.0
BUILD SUCCESSFUL (total time: 2 seconds)

Can you figure out why count shows value 2 and not zero?


Saturday, January 23, 2016

My Technical Memories - Memory 3

Ah! What is it? I could see a  lot of symbols. I had to ponder about it  a bit… Na.. I am joking. How can I ever forget Unix Shell Scripts? I have a long lasting relationship with it. It is really interesting to read my thoughts after a long… long… time. Here comes a small and simple snippet of thoughts….
Unix Shell Script to check every minute whether a user is logged in or not?
# usage is : scriptname.sh username
if [ $# -lt 1 ]; then
   echo improper usage
   echo Correct usage is : $0 username
   exit 1
fi
logname=$1
time=0
while true
do
    who | grep `$logname`  > /dev/null
    if [ $? –eq 0 ] ; then
       echo $logname has logged in
       if [ $time – ne 0 ]; then
         echo $logname is $time minutes late
       fi
      exit 0
    else
     time=`expre $time + 1`
     sleep 60
    fi
done

Unix and its look alike or derivatives are really amazing, may it be linux, solaris, venix, xenix, HP-unix, SCO- Unix. I hope I recollected my memory accurately. Why don’t you just execute and check… Lot more on its way… see you again later….

Thursday, January 21, 2016

My Technical Memories: Memory - 2

Here is what I found in the second memory. It looked like a random access to my thoughts. I wondered to see that right from IDENTIFICATION DIVISION it took me to COBOL data files. I thought of sharing it rather than putting it into the background. So here it comes. COBOL file or as a matter of fact any file is a collection of data stored on secondary storage device. In a broader perspective COBOL support three types of file organization.
  • Sequential File
  • Indexed File
  • Random File

Sequential File stores the data in the same order in which the data data is provided by the user. Sequential file can be Line, Record or Printer sequential file. Organization of the data in file can be specified in code as:
     SELECT MYFILE ASSIGN TO “MYFILE.DAT”
     ORGANIZATION IS LINE SEQUENTIAL.
Organization can be otherwise RECORD SEQUENTIAL or PRINTER SEQUENTIAL. By default it is RECORD SEQUENTIAL.
Indexed File  stores data using an Indexed key. Each record contains the primary key which is unique. In Indexed file you can store unique data. It can also be considered Master file or Master Data as we refer in COBOL. Separate file will be created with .idx extension to the data file. It will look something like this:
     SELECT INDFILE ASSIGN TO “INDFILE.DAT”
     ORGANIZTION IS INDEXED
     ACCESS MODE IS DYNAMIC
     RECORD KEY IS IND-FILE-REC-KEY.
By the way, you have a facility to define DUPLICATE KEYS, in that case file can contain redundant data, but hold on, there is a limit which varies depending on type of Index file. Indexed file can be accessed or in other words I can say that data in Indexed file can be organized in three different ways i.e. INDEXED SEQUENTIAL (default, records are accessed on Ascending/Descending Record Key), INDEXED RANDOM (Value of Record Key is used to access the Record) and INDEXED DYNAMIC (Program can switch between Sequential or Random mode by using appropriate I/O statements).
Relative File  identifies each record by ordinal position. This facilitates to access files sequentially or Randomly by using ordinal position in sequence or randomly. If you provide relative position while writing file as 1 and then 100, when you open this data file, can you imagine what will you see? Now, that it my question to you. I was fathomed by what I saw, it was interesting. Another interesting thing I noted while working on Relative files is that although I can create variable length records, System assume the size of largest record length and uses padding for unused spaces. The beneficial side is it brings speed. System can calculate the position of record to be accessed by using relative key and record length. So this is how it looks like:
     SELECT MYRELFILE ASSIGN TO “MYRELFILE.DAT”
     ORGANIZATION IS RELATIVE
     ACCESS MODE IS RANDOM
     RELATIVE KEY IS R-KEY.
Like Indexed file, Relative file can be accessed sequentially or randomly is ACCESS MODE is DYNAMIC.
Enjoy this read and look for more… Now what will be next…I have no idea, it depends, I need to decide whether I have to access my memory sequentially or randomly… have fun..


Monday, January 18, 2016

My Technical Memories : Memory - 1

I just opened my thoughts pot. Ah! I felt it was in a mess. So many different types of thoughts: Technical, Personal etc. It was just like if you have been downloading and saving a lot of information in a hard disk to manage it later. I realized I have been doing it. So I imposed a responsibility on myself to arrange it all. Now the question was how to proceed? To manage technical section of my thoughts was a huge task, as I have been working in the industry from a long time. So I opened that area and started looking at the thoughts to classify and manage. The first thought which I saw was related to COBOL. I have a special soft spot for COBOL, as this is the technology which I used in my very first job. So here it is :

Every COBOL program must have four divisions in the following order:

IDENTIFICATION DIVISION.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.

Is this statement TRUE?

PS: I thought of putting my random technical thoughts here... keep looking for more...