Sunday, September 8, 2013

How to Leverage an API for Conferencing

What is an API?

An application-programming interface (API) is a set of programming instructions and standards for accessing a Web-based software application or Web tool. A software company releases its API to the public so that other software developers can design products that are powered by its service.
For example, Amazon.com released its API so that Web site developers could more easily access Amazon's product information. Using the Amazon API, a third party Web site can post direct links to Amazon products with updated prices and an option to "buy now."
An API is a software-to-software interface, not a user interface. With APIs, applications talk to each other without any user knowledge or intervention. When you buy movie tickets online and enter your credit card information, the movie ticket Web site uses an API to send your credit card information to a remote application that verifies whether your information is correct. Once payment is confirmed, the remote application sends a response back to the movie ticket Web site saying it's OK to issue the tickets.
As a user, you only see one interface -- the movie ticket Web site -- but behind the scenes, many applications are working together using APIs. This type of integration is called seamless, since the user never notices when software functions are handed from one application to another [source: TConsult, Inc.]
An API resembles Software as a Service (SaaS), since software developers don't have to start from scratch every time they write a program. Instead of building one core application that tries to do everything -- e-mail, billing, tracking, etcetera -- the same application can contract out certain responsibilities to remote software that does it better.­
Let's use the same example of Web conferencing from before. Web conferencing is SaaS since it can be accessed on-demand using nothing but a Web site. With a conferencing API, that same on-demand service can be integrated into another Web-based software application, like an instant messaging program or a Web calendar.
The user can schedule a Web conference in his Web calendar program and then click a link within the same program to launch the conference. The calendar program doesn't host or run the conference itself. It uses a conferencing API to communicate behind the scenes with the remote Web conferencing service and seamlessly delivers that functionality to the user.
Now we'll explain some of the technology that makes conferencing APIs work.

Tuesday, June 4, 2013

C++ PROGRAM TO CONVERT DECIMAL NUMBER INTO BINARY


#include <iostream.h>
#include <conio.h>
void main()
{
    long dec,rem,i=1,sum=0;
    cout<<"Enter the decimal to be converted:";
    cin>>dec;
    do
    {
        rem=dec%2;
        sum=sum + (i*rem);
        dec=dec/2;
        i=i*10;
    }while(dec>0);
    cout<<"The binary of the given number is:"<<sum<<endl;
    cin.get();
    cin.get();

    getch();
}


OUTPUT:
Enter the decimal to be converted:16
The binary of the given number is:10000

Tuesday, May 14, 2013

Learning C++ Pointers for REAL Dummies # 4


How do I point to the neighbor?

What if we have a pointer pointing to some address, but we want to know what are the values around it. You might be thinking, "Why would we want to do that?" Well, let's say we declared an array. And we wanted to point to the second element. But, then, farther down we wanted to point to the third element. This is how we would do it:
int a[5] = {1,2,3,4,5};
int *p1;
p1 = &a[1]; // gets address of this element
printf("*p1 = %d\n", *p1);
p1++; // point to the next element
printf("*p1 = %d\n", *p1);
Click here to see the answer. And if we wanted to go back an element it would be:
p1--;
Remember, that the position of the (++) and (--) operators in respect to the variable matters. For example, if I wrote:
int *p2;
p1 = &a[1];
p2 = p1++;
p2 would not point to the third element, but actually to the second element since the (++) operator is after the variable it is done after the assign (=) operator. So *p1 would equal 3 while *p2 would equal 2.
You might now be thinking, "Well if I wanted to point two elements down, I would have to do 'p1++' twice?" And I would say, "That is a very good question. The answer to your question is no."
Pointers are able to do math. Continuing from the first example:
p1 = &a[1];
printf("*p1 = %d\n", *p1);
p1 = p1+2;
printf("*p1 = %d\n", *p1);
This would print out:
*p1 = 2
*p1 = 4
The pointer knows to go down two houses. Pointers can also get the value of an address for another variable, report it, but still point to the same place. Let's see an example:
p1 = &a[1];
int dave;
dave = *(p1+2);
printf("*p1 = %d\n", *p1);
printf("dave = %d\n", dave);
What do you think is printed out. Click here to see the answer.
As you probably can already tell, arrays and pointers seem to be almost brothers. See You guys are brothers? for a better explanation of how arrays and pointers are related.

Learning C++ Pointers for REAL Dummies # 3


I am pointing here! Where are you pointing?

Now that we know how to make a pointer we have to initialize it. We have actually done this before. We use the (&) symbol to get the address of the variable we want to point to and store in that variable. Such as:
int paul = 21;
int *melissa;
melissa = &paul;
So here we move paul into his house, of size int, and store 21 in it. We then declare that melissa will be a person that only points to houses of size int. We then tell melissa to point to paul's house. And that is it! We have done it before, just had to put it all together. We can also tell the pointer to point to the same thing someone else is pointing to. For example:
int paul = 21;
int *melissa, *dave;
melissa = &paul;
dave = melissa;
This will create two people who point, melissa and daveMelissa will store the value of the address of paul, as seen on line 3. But then dave will also store the value of paul, because he gets it from melissa. So, we now have two people pointing to the same house. Cool, huh?
Ok, so let's put it all together and try a complete example:
int a = 5, b = 10;
int *p1, *p2;
p1 = &a;
p2 = &b;
*p1 = 10;
p1 = p2;
*p1 = 20;
printf("a = %d\n", a);
printf("b = %d\n", b);
So, what will be printed out? Click here to see the answer.

Learning C++ Pointers for REAL Dummies # 2


What you got in your house? (*)

Previously in Where do you live?, we set up an example where we put paulinto a house located at 1500 Computer Lane storing the value 21. Then, we put melissa into a house storing the address of paul's house, 1500.
Now, what if we wanted to know what was the value stored at the house in which melissa was pointing at. To do this we would use the reference operator (*). This could be thought of as saying, "value pointed by". For example:
dave = *melissa;
This will store 21 in dave's house. To follow our simile, dave will askmelissa what value she is storing. She will say, "1500." Dave will then go to address 1500 and ask the person living there what is stored in their house. That person, who we know is paul, will say, "21." So, dave will know to store 21 in his house. Graphically it would look something like this:
For a Flash version, click here.
So from this example, if we printed out the value of dave, it would print out 21. We could also type in:
*melissa = 30;
This would read, "The value pointed by melissa equals 30." So, paul will equal 30, but dave will not equal 30 since he does not get updated. He stores what he originally stored and does not change.
Until now, I have glossed over the detail on how melissa is created. The next section explains how to declare a pointer of a certain type.

Learning C++ Pointers for REAL Dummies


Where do you live? (&)

Following along with our smilie, when we declare a variable a person is put into the house so we can access what is stored there.
But, what if we wanted to know where this person lives. This is done by preceding the variable indentifier with an ampersand sign (&), which means "address of." For example:
melissa = &paul;
This line would store the address of paul into melissa's house.
Now, let's suppose paul's address is 1500.
paul = 21;
tom = paul;
melissa = &paul;
So, for this example, the first line will store 21 into paul's house. The second line will store the value 21 inside tom's house. So far no different then what we have usually done. The third line, though, will store the address of paul, 1500, into melissa's house.
The following diagram might help to understand this example:
For a Flash version, click here.
The variable melissa is what we call a pointer. We have not gotten to how we declare a pointer, since it has certain qualities that we will discuss in Don't point, it's rude!

Thursday, March 7, 2013

Pass/Fail using Logical Operators


Write a program for Pass/Fail using logical operators

#include <iostream.h>
#include <conio.h>
void main ()
{
int marks;
cout<<"Enter marks: ";
cin>>marks;
cout<<(marks>=33? "Pass" : "Fail");
getch();
}