Posts

Showing posts from September, 2012

Asterisk Drivers

The ztdummy Driver In Asterisk, certain applications and features require a timing device in order to operate (Asterisk won’t even compile them if no timing device is found). All Digium PCI hardware provides a 1-kHz timing interface. If you lack the PCI hardware required to provide timing, the ztdummy driver can be used as a timing device. On Linux 2.4 kernel– based distributions, ztdummy must use the clocking provided by the UHCI USB controller. The driver looks to see that the usb-uhci module is loaded and that the kernel version is at least 2.4.5. Older kernel versions are incompatible with ztdummy. On a 2.6 kernel–based distribution, ztdummy does not require the use of the USB controller. (As of v2.6.0, the kernel now provides 1-kHz timing with which the driver can interface; thus, the USB controller hardware requirement is no longer necessary.) The default Makefile configuration does not create ztdummy. To compile ztdummy, you must remove a comment marker from the Mak...

PUZZLES & PROG in C++

// ***************************************** //             "Guess the number" // Briefing: //  The computer generates a random number //  between 1 and MAX_RANGE. The user must //  guess the number. Each time the user //  makes an attempt the computer tells if //  the number is greater or less than. // ***************************************** #include <iostream.h> #include <stdlib.h> #include <time.h> // Define the greatest possible value: #define MAX_RANGE 100 main () {   int counter=0;   long value,input;   srand ( time (NULL) );         // Initialize random generator   value = rand()%MAX_RANGE+1;    // Get random between 1 and MAX_RANGE   cout << "\nInsert a value between 1 and " << MAX_RANGE << " : ";   do {     cin >> input;  ...

Command Line Argument n C

First Programme The program execution begins by executing the function main (). #include <stdio.h> main(){   printf("Amber \n"); }   OUTPUT: Amber   C LANGUAGE KEY WORD auto         double      int           struct break       else          long         switch case         enum       register     typedef char         extern      return       union const       float        short         unsigned continue   for ...

Variable Pointer in C

//////////Variable Pointer///////////// Output value at the address #include <stdio.h> int  main( void ) {    int  number = 0;                    int  *pointer = NULL;              number = 10;   pointer = &number;              printf("\npointer's value: %p", pointer);  /* Output the value (an address) */   printf("\nvalue pointed to: %d\n", *pointer);       /* Value at the address */    return  0; } /////////Put values in the memory locations by using pointers//////// #include <stdio.h> main(){  ...

Bubble Sort in C

BUBBLE SORT #include <stdio.h> #define MAX 10 void swap(int *x,int *y) {    int temp;    temp = *x;    *x = *y;    *y = temp; } void bsort(int list[]) {    int i,j;    for(i=0;i<(MAX-1);i++){       for(j=0;j<(MAX-(i+1));j++){              if(list[j] > list[j+1]){                     swap(&list[j],&list[j+1]);              }       }    } } void printlist(int list[]) {    int i;    printf("The elements of the list are: \n");    for(i=0;i<MAX;i++)       printf("%d\t",list[i]); } void main() {    int list[MAX];    list[0] = 2; list[1] = 1; list[2] = 4; list[3] = 3; list[4] = 9;    li...

Operators in Asterisk with Linux

Operators When you create an Asterisk dialplan, you’re really writing code in a specialized scripting language. This means that the Asterisk dialplan—like any programming language—recognizes symbols called operators that allow you to manipulate variables. Let’s look at the types of operators that are available in Asterisk: Boolean operators These operators evaluate the “truth” of a statement. In computing terms, that essentially refers to whether the statement is something or nothing (non-zero or zero, true or false, on or off, and so on). The Boolean operators are: expr1 | expr2 This operator (called the “or” operator, or “pipe”) returns the evaluation of expr1 if it is true (neither an empty string nor zero). Otherwise, it returns the evaluation of expr2. expr1 & expr2 This operator (called “and”) returns the evaluation of expr1 if both expressions are true (i.e., neither expression evaluates to an empty string or zero). Otherwise, it returns zero. expr1 {=, ...

Variable in C

********** Variable Declaration******* :::::::VARIABLES::::::: 1-You can store values in variables. 2-Each variable is identified by a variable name. 3-Each variable has a variable type. 4-Variable names start with a letter or underscore (_), followed by any number of letters, digits, or underscores. 5-Uppercase is different from lowercase, so the names sam, Sam, and SAM specify three different variables. 6-The variables are defined at the begining of the block. The following is an example of some variable names: average            /* average of all grades */ pi                 /* pi to 6 decimal places */    number_of_students /* number students in this class */ The following are not variable names: 3rd_        /* Begins with a number */ all$        /* Conta...