3 Sept 2013

Why Web Services?

Interoperability has Highest Priority

When all major platforms could access the Web using Web browsers, different platforms couldn't interact. For these platforms to work together, Web-applications were developed.
Web-applications are simply applications that run on the web. These are built around the Web browser standards and can be used by any browser on any platform.

Web Services take Web-applications to the Next Level

By using Web services, your application can publish its function or message to the rest of the world.
Web services use XML to code and to decode data, and SOAP to transport it (using open protocols).
With Web services, your accounting department's Win 2k server's billing system can connect with your IT supplier's UNIX server.

Web Services have Two Types of Uses

Reusable application-components.
There are things applications need very often. So why make these over and over again?
Web services can offer application-components like: currency conversion, weather reports, or even language translation as services.
Connect existing software.
Web services can help to solve the interoperability problem by giving different applications a way to link their data.
With Web services you can exchange data between different applications and different platforms.

Local and Global Variables

Local and Global Variables

Local Variables

All the variables we have used thus far have been local variables.  A local variable is a variable which is either a variable declared within the function or is an argument passed to a function.  As you may have encountered in your programming, if we declare variables in a function then we can only use them within that function.  This is a direct result of placing our declaration statements inside functions.
Consider a program that calls a swap() function.
#include <iostream.h>
void swap(int x, int y) {
  int temp = x;
  x = y;
  y = temp;
}
int main()
{
  int A, B;
  cin >> A >> B;
  cout << "A: " << A << "." << endl;
  cout << "B: " << B << "." << endl;
  swap(A, B);
  cout << "A: " << A << "." << endl;
  cout << "B: " << B << "." << endl;
  return 0;
}
Consider variables which are in scope (DEF: portion of a program in which a
variable is legally accessible) in the main() and swap() functions:

Function
Accessible variables
main
A, B
swap
temp, x, y
If you attempted to use A was in swap(), a compilation error would result ("undeclared identifier") since it is a local variable in only main().

Global Variables

A global variable (DEF) is a variable which is accessible in multiple scopes.  It is important to note that global variables are only accessible after they have been declared.  That is, you can use a variable is is declared below its usage in the text.  For instance, if we consider this simple program, we have one global variable, w.
#include <iostream.h>
double w;
void Z() {
  w = 0;
  return;
}
void Q() {
  int index;
  w = 2;
  return;
}
int main() {
  int i;
  w = 4;
  return 0;
}
w is a global variable which is in scope in all three functions in this program: Z(), Q(), and main().  This program also has local variables: index is local to Q(), and i is local to main().
Scoping can viewed easily in the following table.
 

Function
Accessible Variables
main
w, i
Z
w
Q
w, index

Another example.

#include <iostream.h>
int sum;
void Z(int alpha) {
  sum += 1;
  alpha *= 3;
  return;
}
double total;
void Q() {
  int index;
  total = index;
  return;
}
int main() {
  int i;
  int w = 10;
  sum = 0;
  total = 0;
  return 0;
}
We construct the scoping table.
 
Function
Accessible Variables
main
sum total, i, w
Q
sum, total, index
Z
sum, alpha
Note that since the variable total is declared below Z() in the text, total is not in scope in Z().
 

WARNING

Global variables are not generally used.  It is a contradiction of modularity to have variables be accessible in functions in which they are not used.  In the previous example, sum is not used in Q() even though it is in scope.  If there is a situation where one can justify using a global variable, then it is acceptable.

how to create variable in jquery

var name = 'india';
alert(name);

var name = $("#txtname").val();
alert(name);

How to create variable in c#

A variable can be compared to a storage room, and is essential for the programmer. In C#, a variable is declared like this: 

<data type> <name>; 

An example could look like this: 

string name; 

That's the most basic version. Usually, you wish to assign a visibility to the variable, and perhaps assign a value to it at the same time. It can be done like this: 

<visibility> <data type> <name> = <value>; 

And with an example:
private string name = "John Doe";
The visibility part is explained elsewhere in this tutorial, so let's concentrate on the variable part. We will jump straight to an example of actually using a couple of them:
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string firstName = "John";
            string lastName = "Doe";

            Console.WriteLine("Name: " + firstName + " " + lastName);

            Console.WriteLine("Please enter a new first name:");
            firstName = Console.ReadLine();

            Console.WriteLine("New name: " + firstName + " " + lastName);

            Console.ReadLine();
        }
    }
}
Okay, a lot of this has already been explained, so we will jump directly to the interesting part. First of all, we declare a couple of variables of the string type. A string simply contains text, as you can see, since we give them a value straight away. Next, we output a line of text to the console, where we use the two variables. The string is made up by using the + characters to "collect" the different parts. 

Next, we urge the user to enter a new first name, and then we use the ReadLine() method to read the user input from the console and into the firstName variable. Once the user presses the Enter key, the new first name is assigned to the variable, and in the next line we output the name presentation again, to show the change. We have just used our first variable and the single most important feature of a variable: The ability to change its value at runtime. 

What is Variables?

A variable is just a named area of storage that can hold a single value (numeric or character). The C language demands that you declare the name of each variable that you are going to use and its type, or class, before you actually try to do anything with it.
The Programming language C has two main variable types
  • Local Variables
  • Global Variables

Local Variables

  • Local variables scope is confined within the block or function where it is defined. Local variables must always be defined at the top of a block.
  • When a local variable is defined - it is not initalised by the system, you must initalise it yourself.
  • When execution of the block starts the variable is available, and when the block ends the variable 'dies'.
Check following example's output


main()
   {
      int i=4;
      int j=10;
   
      i++;
   
      if (j > 0)
      { 
         /* i defined in 'main' can be seen */
         printf("i is %d\n",i); 
      }
   
      if (j > 0)
      {
         /* 'i' is defined and so local to this block */
         int i=100; 
         printf("i is %d\n",i);      
      }/* 'i' (value 100) dies here */
   
      printf("i is %d\n",i); /* 'i' (value 5) is now visable.*/
   }
   
   This will generate following output
   i is 5
   i is 100
   i is 5

Here ++ is called incremental operator and it increase the value of any integer variable by 1. Thus i++ is equivalent to i = i + 1;
You will see -- operator also which is called decremental operator and it idecrease the value of any integer variable by 1. Thus i-- is equivalent to i = i - 1;

Global Variables

Global variable is defined at the top of the program file and it can be visible and modified by any function that may reference it.
Global variables are initalised automatically by the system when you define them!
Data TypeInitialser
int0
char'\0'
float0
pointerNULL
If same variable name is being used for global and local variable then local variable takes preference in its scope. But it is not a good practice to use global variables and local variables with the same name.


   int i=4;          /* Global definition   */
   
   main()
   {
       i++;          /* Global variable     */
       func();
       printf( "Value of i = %d -- main function\n", i );
   }

   func()
   {
       int i=10;     /* Local definition */
       i++;          /* Local variable    */
       printf( "Value of i = %d -- func() function\n", i );
   }

   This will produce following result
   Value of i = 11 -- func() function
   Value of i = 5 -- main function

i in main function is global and will be incremented to 5. i in func is internal and will be incremented to 11. When control returns to main the internal variable will die and and any reference to i will be to the global.

How to Create WEBSITE DESIGN

Way2finder Technologies is a web design studio that offers corporate web design and custom web design. Our website designers offer cheap w...