USAePay Token error: 23 Specified source key not found

Hello friends

If you are facing above error message while testing USAepay payment integration than following is the reason and solution

That error means you are not sending it to the correct URL. If utilizing a sandbox source key make sure you are sending it to a sandbox URL and if using a production source key you have to send it to a production URL.

Hope it helps !


Categories: ASP.NET

C Programming Introduction

Importance of Subject 


  • ‘C is the base language of any​ other programming language.​
  •  To be a Good Programmer one ​must know fundamentals of C​ programming language.

History of ‘C’


  • ​Root of the morden language is ​ALGOL 1960. It’s first ​computer language to use block ​ structure.​ It gave concept of structured​ programming.​
  • In 1967, Martin Richards developed ​a language, BCPL (Basic Combined Programming Language)
  • In 1970,by Ken Thompson created a language called as ‘B’.​ It used to create early version of Unix.
  • In 1972,by Dennis Ritchie introduced new language called as ‘C’ .​


Features Of ‘C’


  • It is a robust language.​
  • Programs written in ‘C’ are efficient and fast.​(Because of variety of data types and powerful ​operators)​
  • Highly Portable. (related to OS)​
  • Well suited for structured programming.​
  • Ability to extend itself. ​

Program & Programming Language

Program:- A Set of instructions which ​carried out by processor for some ​Specific input, generates specific output. ​​

Programming language:- A specific ​manner of writing a program with some ​Predefined rules, symbols & their use as ​a part of language.​  i.e. Pascal, C, C++, VC++, JAVA, VB.


Basic structure of ‘C’


[1] Documentation Section 

  • It has set of comment lines(name of program, author details).​

What is Comment line??​

  • To guide a programmer. To write a note for ​function,operation,logic in between a program.​
  • Non-executable statement.​
  • Can’t be nested.

 e.g.    /* Hello /* abc */ Hi */      ​

[2] Link Section

  • It provides instructions to the compiler to link ​function from the system library.
  • # include  Directive
    • To access the functions which are stored in the​ library, it is necessary to tell the compiler , ​about the file to be accessed.​
    • Syntax:-​ #include<stdio.h> // stdio.h is header file

[3] Definition Section

  • It defines all symbolic constants.​
  •  #define instuction defines value to a symbolic constant.​
  •  #define:-​
    • It is a preprocessor compiler directive, not a statement.​
    • Therefore it should not end with a semicolon.​
    • Generally written in uppercase.​


  • Some variables that are used in more than on function, such variables (global variables) declared in the global declaration section.​
  • It also declares all the user-defined function.

[5] Main() function section

  • Every ‘C’ program must have one main() function section.​
  • It contains two parts​
    • Declaration part:​ It declares all variables used in the executable part.​
    • Executable part:​ It has atleast  one statement.​


Link Section

Definition Section

Global Declaration Section

main() function section


Declaration part

Executable part


 Subprogram section


Function2 …         

User defined function



  • There are two ways to run programs written in a high-level language. ​
  • ​The most common is to compile the program​
  • The other method is to pass the program through an interpreter.


Why compiler is require ?​

As machine (a processor) can operate​ On binary code instruction only…..​

If we use higher level language then …For execution of the program we must ​Convert it to lower level / machine level​ Code means, ​

A program that translates source code into object code.

The compiler derives its name from the way it works, looking at the entire piece of source code and collecting and reorganizing the instructions.​

Advantage of compiler​:

  • Programs produced by compilers run much faster than the same programs executed by an interpreter.


which analyzes and executes each line of source code without looking at the entire program. ​

Advantage of interpreter:​

  • It can execute a program immediately. ​
  • Compilers require some time before an executable program emerges. ​

C  Compiler  ​

  • Checks for syntax errors if any​ – on success  coverts ‘C source code​ into object code form –​ which is nearer to machine

Types of languages


(1) Lower level languages:-​

Languages which are very near to ​machine…. I.e. machine language, ​

Assembly language.​

(2) Higher level languages:-​

Languages which are very near to ​programmer rather than to machine….​

I.e. C++,Visual C++,Visual basic,Java.


Data Types in C


Each variable in C has an associated data type. Each data type requires different amounts of memory and has some specific operations which can be performed over it. Let us briefly describe them one by one:

Following are the examples of some very common data types used in C:

char: The most basic data type in C. It stores a single character and requires a single byte of memory in almost all compilers.
int: As the name suggests, an int variable is used to store an integer.
float: It is used to store decimal numbers (numbers with floating point value) with single precision.
double: It is used to store decimal numbers (numbers with floating point value) with double precision.

Different data types also have different ranges upto which they can store numbers.

These ranges may vary from compiler to compiler. Below is list of ranges along with the memory requirement and format specifiers on 32 bit gcc compiler.



We can use the sizeof() operator to check the size of a variable. See the following C program for the usage of the various data types:

#include <stdio.h>
int main()
    int a = 1;
    char b ='G';
    double c = 3.14;
    printf("Hello World!\n");
    //printing the variables defined above along with their sizes
    printf("Hello! I am a character. My value is %c and "
           "my size is %lu byte.\n", b,sizeof(char));
    //can use sizeof(b) above as well
    printf("Hello! I am an integer. My value is %d and "
           "my size is %lu  bytes.\n", a,sizeof(int));
    //can use sizeof(a) above as well
    printf("Hello! I am a double floating point variable."
           " My value is %lf and my size is %lu bytes.\n",c,sizeof(double));
    //can use sizeof(c) above as well
    printf("Bye! See you soon. :)\n");
    return 0;


Hello World!
Hello! I am a character. My value is G and my size is 1 byte.
Hello! I am an integer. My value is 1 and my size is 4 bytes.
Hello! I am a double floating point variable. My value is 3.140000 and my size i
s 8 bytes.
Bye! See you soon. 🙂




  • C variable is a named location in a memory where a program can manipulate the data. This location is used to hold the value of the variable.
  • The value of the C variable may get change in the program.
  • C variable might be belonging to any of the data type like int, float, char etc.


Rules for Variable name

  • Variable name must begin with letter or underscore.
  • Variables are case sensitive
  • They can be constructed with digits, letters.
  • No special symbols are allowed other than underscore.
  • sum, height, _value are some examples for variable name


  • Variables should be declared in the C program before to use.
  • Memory space is not allocated for a variable while declaration. It happens only on variable definition.
  • Variable initialization means assigning a value to the variable.
Variable declaration
data_type variable_name;
Example: int x, y, z; char flat, ch;
Variable initialization
data_type variable_name = value;
Example: int x = 50, y = 30; char flag = ‘x’, ch=’l’;


  1. Local variable
  2. Global variable
  3. Environment variable


Variable declaration
Variable definition
Declaration tells the compiler about data type and size of the variable.
Definition allocates memory for the variable.
Variable can be declared many times in a program.
It can happen only one time for a variable in a program.
The assignment of properties and identification to a variable.
Assignments of storage space to a variable.

Input and Output



  • scanf(“%d”,&a);
  • Gets an integer value from the user and stored it under the name a (variable)


  • printf(“%d”,a);
  • Prints the value present in variable a on the screen


C Programming Operators


An operator is a symbol which operates on a value or a variable. For example: + is an operator to perform addition.

C programming has wide range of operators to perform various operations. For better understanding of operators, these operators can be classified as:

  • Arithmetic Operators
  • Increment and Decrement Operators
  • Assignment Operators
  • Relational Operators
  • Logical Operators
  • Conditional Operators
  • Bitwise Operators
  • Special Operators


C Arithmetic Operators


An arithmetic operator performs mathematical operations such as addition, subtraction and multiplication on numerical values (constants and variables).

Operator Meaning of Operator
+ addition or unary plus
subtraction or unary minus
* multiplication
/ division
% remainder after division( modulo division)


Example #1: Arithmetic Operators

// C Program to demonstrate the working of arithmetic operators
#include <stdio.h>
int main()
    int a = 9,b = 4, c;
    c = a+b;
    printf("a+b = %d \n",c);

    c = a-b;
    printf("a-b = %d \n",c);
    c = a*b;
    printf("a*b = %d \n",c);
    printf("a/b = %d \n",c);
    printf("Remainder when a divided by b = %d \n",c);
    return 0;

Read more…

Can not find ConfigurationManager class in class library C#

To use ConfigurationManager class in Classlibrary use following

ConfigurationManager class lies in System.Configuration namespace and assembly System.Configuration.

To use this please add reference of System.Configuration. Go to Framework tab in Add references and select System.Configuration


Hope it helps!


UpdatePanel and triggers from a repeater control

If you want to backstop on some controls click you must need to specify triggers in UpdatePanel

For example:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
       <%# Eval("Name") >%>
       <asp:Button ID="Button1" runat="server" Text="Button" />
   <asp:PostBackTrigger ControlID="Buton1" />

You will face following error message with above code

A control with ID ‘Button1’ could not be found for the trigger in UpdatePanel ‘UpdatePanel1’.

Here is simple solution for above problem

 <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
 <!--when cick the button1, it will fire the btnDummy-->
   <asp:Button ID="Button1" Text="Click"
   OnClientClick="$get('btnDummy').click();return false;"
   runat="server" />

 <!--Make a hidden button to treat as the postback trigger-->
 <asp:Button ID="btnDummy" runat="server" Style="display: none" Text="HiddenButton" />

Get Row Number in MySQL

SQL Server

To return a row number with record we have ROW_NUMBER() in SQL which  returns the sequential number of a row within a partition of a result set, starting at 1 for the first row in each partition.


OVER ( [ PARTITION BY value_expression , … [ n ] ] order_by_clause )


Here I am explaining how to return row number in my sql

For Example we have following table

  fruit  VARCHAR(32),
  amount DECIMAL

(NULL, 'apple', 12.75), 
(NULL, 'orange', 1.89), 
(NULL, 'pear', 19.23),
(NULL, 'banana', 4.25), 
(NULL, 'cherry', 123.75), 
(NULL, 'plum', 23.15);
SELECT fruit, amount FROM tblSales ORDER BY amount DESC;

If we run this query it will result like
| fruit  | amount |
| cherry |    124 |
| plum   |     23 |
| pear   |     19 |
| apple  |     13 |
| banana |      4 |
| orange |      2 |

Now here is the query with ranking

SET @rank=0;
SELECT @rank:=@rank+1 AS rank, fruit, amount FROM tblSales
 ORDER BY amount DESC;

| rank | fruit  | amount |
|    1 | cherry |    124 |
|    2 | plum   |     23 |
|    3 | pear   |     19 |
|    4 | apple  |     13 |
|    5 | banana |      4 |
|    6 | orange |      2 |
Hope it helps!

Create duplicate row in AngularJS

Hello Friends here I am explaining an example of how to add duplicate row in AngularJS

Please check below link for complete example

Hope it helps !



Modify Collection while Iterating C#

May 10, 2017 1 comment

The general rule is that you can’t modify a collection/array/list while iterating over it.

If you are trying to modify loop while iterating you will get following error message

List strList = new List();


foreach(string str in strList)


System.InvalidOperationException: Collection was modified; 
enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at Rextester.Program.Main(String[] args)

Here is the simple solution

int listLength = strList.Count();

for(int i=0; i<listLength; i++)

//Add New Element
if(i == 0)//Some codition when you want to add new element to list/array


Hope it helps !