Thursday 8 September 2016

EMS BRIDGES


What are Bridges:

Bridge as the name suggests will bridge the messages from one queue/topic to other queue/topic.
So bridge will just route the message within the ems server. We can make use of message selectors if we want to use some selection criteria. For example I received message on queue "CitizenInfo.q" and i want to send messages whose age<20 to "teen.q" and whose age>20 to "adult.q" then i will just use the message selector as age and use it while creating the bridge.

Syntax:

create bridge source=<queue/topic>:<queue/topic name> target=<queue/topic>:<queue/topic name> selector=<selection criteria>

Example:

By taking the above example:

Creating bridge:
create bridge source=queue:CitizenInfo.q  target=queue:teen.q selector="age<20"
create bridge source=queue:CitizenInfo.q  target=queue:adult.q selector="age>20"

Browsing bridge:
show bridge source=queue:CitizenInfo.q
or show bridges

Deleting bridge:
No need for specify selector while deleting

delete bridge source=queue:CitizenInfo.q  target=queue:teen.q
.
Note : If you want to update any bridge, you got to recreate

Thursday 11 April 2013

Program for character stuffing

import java.util.*;
class Char
{
    public static void main(String r[])
    {   
        Scanner sc=new Scanner(System.in);
        System.out.println("Enter number of characters: ");
        int n=sc.nextInt();
        String in[]=new String[n];
        for(int i=0;i<n;i++)
        {
            in[i]=sc.next();
        }
        for(int i= 0;i<n;i++)
        {
            if(in[i].equals("dle"))
            {
                in[i]="dle dle";
            }
        }
        System.out.println("Transmitted message is: ");
        System.out.print(" dle stx ");
        for(int i=0;i<n;i++)
        {
            System.out.print(in[i]+" ");
        }
        System.out.println(" dle etx ");
    }
}


Example:
Sample output:
Enter number of characters:
5
a b dle dle d e
Transmitted message is:
dle stxa b dle dle dle dle d dle etx

Program to concatinate two strings


Program to concatinate two strings in C

void main()
{
char a[]={"Hello"}; //declare first char array
char b[]={"Everyone"}; //declare second char array
char c[50];
int n,i,j,k=0;
clrscr();
n=sizeof(a)+sizeof(b)-2; //store the total size of both array
for(i=0;i<sizeof(a);i++) //storing first array in the resultant array
c[i]=a[i];
for(i=sizeof(a)-1;i<n;i++,k++) //storing the second array in the resultant array
c[i]=b[k];
for(i=0;i<n;i++)
printf("%c",c[i]); //displat the result
getch();
}

Monday 8 April 2013

New Page added "ASK"



In this page u can ask any question or query or code related to any of the programming language which may be of C,C++,JAVA.
The solution will be posted on the blog as soon as possible...
So don't hesitate and ask anything u want......

visit http://rrprograms.blogspot.in/p/blog-page.html

Thursday 21 March 2013

WAP TO REVERSE A GIVEN SENTENSE


JAVA Programs



import java.util.*;
public class ReverseSentense
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
String s;
System.out.println("Enter a sentense:");
s=sc.nextLine();
String temp[];
temp=s.split(" ");
for(int i=temp.length-1;i>=0;i--)
System.out.print(temp[i]+" ");
}
}

output:-
let the input be:
hello my name is rishabh
then the output will be:
rishabh is name my hello

Sunday 17 March 2013

Program for Bit Destuffing

//Removing a zero(0) after a series of 5 consecutive one's(1)


import java.util.*;
class BitDestuffing
{
public static void main(String args[])
{
Scanner input=new Scanner(System.in);
int []arr=new int[20];
int cnt=0;
int m=0;
System.out.print("Enter string length: ");

int a=input.nextInt();
System.out .print("Enter a string: ");

for(int i=0;i<a;i++)
{
arr[i]=input.nextInt();
}
for(int i=0;i<a;i++)
{
if(arr[i]==1)
cnt++;
else
cnt=0;

if(cnt==5)
{
if(arr[i+1]==0)
i=i++;
m=i+1;
cnt=0;
}
}

System.out.println("Your String is:");
for(int i=0;i<a;i++)
{
if(i==m)
{}
else
System.out.print(arr[i]);
}


}
}

Program of BitStuffing


//Inserting a zero(0) after a series of five consecutive one's(1)

import java.util.*;
class BitStuffing
{
public static void main(String args[])
{
Scanner input=new Scanner(System.in);
int []arr=new int[20];
int cnt=0;
System.out.print("Enter string length: ");

int a=input.nextInt();
System.out .print("Enter a string: ");

for(int i=0;i<a;i++)
{
arr[i]=input.nextInt();
}
for(int i=0;i<a;i++)
{
if(arr[i]==1)
cnt++;
else
cnt=0;

if(cnt==5)
{
arr[i]=10;
cnt=0;
}
}

System.out.println("Your String is:");
for(int i=0;i<a;i++)
{
System.out.print(arr[i]);
}


}
}