## Wednesday, September 17, 2014

Objective:
Write a program to find.
XA + YB
A. B
Test the program using A= (16, -6, 7), B= (4, 2,-3), X= 2, Y= -5

#include<iostream>
using namespace std;
class Vectors
{
public:
void GetVectorAB(int x, int y, int A[3], int B[3])
{
int XA[3];
int YB[3];
int ANS[3]={0};
int i;
for(i=0; i<3; i++)
{
XA[i]=x*A[i];
}
for(i=0; i<3; i++)
{
YB[i]=y*B[i];
}
for(i=0; i<3; i++)
{
ANS[i]=XA[i]+YB[i];
}

cout<<"XA+YB=(";
for(i=0; i<3; i++)
{
cout<<ANS[i]<<" ";
}
cout<<")"<<endl;
}

{
int dot[3];
int ab=0;
int i;
for(i=0; i<3; i++)
{
dot[i]=A[i]*B[i];
}

for(i=0; i<3; i++)
{
ab=ab+dot[i];
}

cout<<"A.B = "<<ab<<endl;

}
};

void main()
{
int n;
Abc:
cout<<"What expression you want to do???"<<endl;
cout<<"1:     XA+YB???"<<endl;
cout<<"2:     A.B????"<<endl;
cin>>n;

if(n==1)
{
int a,b;
int A[3]={0};
int B[3]={0};
cout<<"Enter vector A"<<endl;
for(int i=0; i<3; i++)
{
cin>>A[i];
}

cout<<"Enter vector B"<<endl;
for(int i=0; i<3; i++)
{
cin>>B[i];
}
cout<<"Enter a constant value for X"<<endl;
cin>>a;
cout<<"Enter a constant value for Y"<<endl;
cin>>b;
Vectors v1;
v1.GetVectorAB(a,b,A,B);
}
else
if(n==2)
{
int A[3];
int B[3];
cout<<"Enter vector A"<<endl;
for(int i=0; i<3; i++)
{
cin>>A[i];
}
cout<<"Enter vector B"<<endl;
for(int i=0; i<3; i++)
{
cin>>B[i];
}
Vectors v2;
}
else
{
cout<<"Enter a valid number\n\n";
goto Abc;
}
}

Find all pair of elements whose sum is 25.

#include<iostream>
using namespace std;
void main()
{
int abc[10];
int i;

cout<<"Enter values in array"<<endl;
for(i=0; i<10; i++)
{
cin>>abc[i];
}

for(i=0; i<10; i++)
{
for(int j=i; j<10; j++)
{
if((abc[i]+abc[j])==25)
{
cout<<"sum of  "<<abc[i]<<" and "<<abc[j]<<"is equal to"<<abc[i]+abc[j]<<endl;
}
}
}
}

# Software development process

It is a general phases that occurs in nearly any software development process. In software development process there are few steps that are described below here.
The first step is requirement. The Requirements phase focuses on what the system will do in an effort that views all stakeholders, including sponsors and potential users, as important sources of information.
The design phase takes as its initial input the requirements identified in the approved requirements document. For each requirement, a set of one or more design elements will be produced as a result of interviews, workshops, and/or prototype efforts. Design elements describe the desired software features in detail, and generally include functional hierarchy diagrams, screen layout diagrams, tables of business rules, business process diagrams, pseudo code, and a complete entity-relationship diagram with a full data dictionary.
The coding phase performs the task that translates this task into machine readable format. Different high level programming languages like C, C++,, C#, COBOL, Pascal, Java are used for coding. Programming tools like compilers, interpreters, debuggers etc… are used to translate the code into machine readable form.
The next phase is testing. In this phase the product is tested. There are several tools for testing.
After testing the product is implemented to the customer and training is given for safe use of the software.

## Agile Vs Plan Driven

Selection of Software Development Process is situational. You may choose Plan-Driven or Agile Method.

## Plan-Driven

Plan-driven development is a traditional development method. In plan driven method it has given more emphasize particularly on plan and architecture. The quality of software is based on attention and predictability of process. Plan-driven development precisely depends on clear procedures.

### Plan Driven Methodologies

It is a formal specific approach. Plan-driven methodologies are:
Ã˜  Personal Software Process (PSP)
Ã˜  Team Software Process (TSP)
Ã˜  Rational Unified Process (RUP)

### Steps in Plan-Driven Method

Ã˜  repeatability and predictability
Ã˜  a defined incremental process
Ã˜   extensive documentation
Ã˜  up-front system architecture
Ã˜  detailed plans
Ã˜  process monitoring
Ã˜  controlling and education
Ã˜  risk management
Ã˜  Verification and validation.

## Agile

Agile development is a Modern development method. It has given more emphasized particularly on Process and execution. Agile development does not depend on clear procedures.

## Agile Methodologies

Ã˜  Planning
Ã˜  Design
Ã˜  Programming practices

## Agile methodologies all incorporate:

Ã˜  Pre-Project
Ã˜  Feasibility Study
Ã˜  Functional Model Iteration
Ã˜  Design and Build Iteration
Ã˜  Implementation
Ã˜  Post-Project

# Plan-Driven Vs Agile

Plan-driven perspective
Ã˜  Formal, written documents
Ã˜  Executable models (RUP)
Agile perspective
Ã˜  Story cards – Project wall
Ã˜  Whiteboards
Ã˜  Tests – executable specifications

## .Net Remoting in C#

using System.Collections.Generic;
using System.Linq;
using System.Text;
using lab7_clas;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
namespace clientside
{
class Program
{
static void Main(string[] args)
{
ChannelServices.RegisterChannel(new TcpClientChannel());
Class1 obj = (Class1)Activator.GetObject(typeof(Class1), "tcp://localhost:3128/HelloWorld");
int count = 0;
for (count = 0; count < 5; count++)
{
obj.Helloworld();
}
}
}
}

 Client Server using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; using lab7_clas; namespace lab7_1 {     class Program     {         static void Main(string[] args)         {             TcpServerChannel channel = new TcpServerChannel(3128);             ChannelServices.RegisterChannel(channel);             RemotingConfiguration.RegisterWellKnownServiceType(typeof(Class1), "HelloWorld", WellKnownObjectMode.SingleCall);             Console.WriteLine("Press Enter to Stop Server");             Console.ReadLine();         }     } } Class using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace lab7_clas {     public class Class1 : System.MarshalByRefObject     {         public Class1()         {             Console.WriteLine("This is the Constructor of Myclass");         }         public void Helloworld()         {             Console.WriteLine("A big Hello to the world");         }     } }

## Wednesday, March 19, 2014

### Serialization And De-Serialization in C Sharp Using Arrays

Create a serializable class with two arrays. One for rate of the advertisement and other for running time of the advertisement. Serialize the object of this class to a stream using Soap formatter. Create a desktop application that asks the user for the start time and the number of minutes for which the advertisement has to be run. De-serialize the object from the stream and retrieve the values of the rates for specific time. Calculate the amount of money the user has to pay for running a particular advertisement.

using System;
usingSystem.Collections.Generic;
using System.IO;
usingSystem.Runtime.Serialization.Formatters.Soap;
usingSystem.Windows.Forms;
usingSystem.Xml.Serialization;

namespace WindowsFormsApplication2
{
[Serializable]
publicpartialclassTaxRate : Form
{
int[] array1 = newint[2];
int[] array2 = newint[2];
publicTaxRate()
{
InitializeComponent();}
int a = 0;
privatevoid button3_Click(object sender, EventArgs e)
{for (inti = 0; i< array1.Length; i++)
{
if (array1[i] == Convert.ToInt32(UserSalarytextBox.Text))
{a = array1[i] / 100 * array2[i];
}
}label4.Text = Convert.ToString(a);
}
inti = 0;
privatevoid button1_Click(object sender, EventArgs e)
{
array1[i] = Convert.ToInt32(SalarytextBox.Text);
array2[i] = Convert.ToInt32(TaxtextBox.Text);
i++;
}
privatevoid button2_Click(object sender, EventArgs e)
{for (inti = 0; i< array1.Length; i++)
{
}
for (inti = 0; i< array2.Length; i++){
privatevoid button4_Click(object sender, EventArgs e)
{
Stream stream1 = File.OpenWrite("D:\\binaryserialization1.txt");
Stream stream2 = File.OpenWrite("D:\\binaryserialization2.txt");
SoapFormattersf = newSoapFormatter();
sf.Serialize(stream1, array1);
sf.Serialize(stream2, array2);
stream1.Close();
stream2.Close();
}privatevoid button5_Click(object sender, EventArgs e)
{
FileStream stream1 = newFileStream("D:\\binaryserialization1.txt", FileMode.Open);
FileStream stream2 = newFileStream("D:\\binaryserialization2.txt", FileMode.Open);
SoapFormatterformate = newSoapFormatter();
array1 = formate.Deserialize(stream1) asint[];
array2 = formate.Deserialize(stream2) asint[];
for (inti = 0; i< array1.Length; i++)
{