Cross-Domain requests in Javascript

August 28, 2017 Leave a comment


If you are developing a modern web-based application, chances are you:

  1. Are using javascript on the client side.
  2. Need to integrate with services that are not completely under your control (or that reside in a different “origin”).
  3. Have been confronted by this error message in your browser’s console:

XMLHttpRequest cannot load http://external.service/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.

Every time I need to integrate a web app with some external service or some server-side API I have no complete control over, I bump into this error. Google has not yet provided me with a concise description of the problem or an overview of alternatives to perform Cross-Domain requests, so this post will serve as a personal future reference.

View original post 1,911 more words

Categories: Tips & Tricks

Updatepanel triggers another updatepanel

August 18, 2017 Leave a comment


By default, every UpdatePanel will be refreshed during every asynchronous post back.

Some important remarks about Update Panel

When an UpdatePanel control is not inside another UpdatePanel control, the panel is updated according to the settings of the UpdateMode and ChildrenAsTriggers properties, together with the collection of triggers. When an UpdatePanel control is inside another UpdatePanel control, the child panel is automatically updated when the parent panel is updated.

The content of an UpdatePanel control is updated in the following circumstances:

  • If the UpdateMode property is set to Always, the UpdatePanel control’s content is updated on every postback that originates from anywhere on the page. This includes asynchronous postbacks from controls that are inside other UpdatePanel controls and postbacks from controls that are not inside UpdatePanel controls.
  • If the UpdatePanel control is nested inside another UpdatePanel control and the parent update panel is updated.
  • If the UpdateMode property is set to Conditional, and one of the following conditions occurs:
    • You call the Update method of the UpdatePanel control explicitly.
    • The postback is caused by a control that is defined as a trigger by using the Triggers property of the UpdatePanel control. In this scenario, the control explicitly triggers an update of the panel content. The control can be either inside or outside the UpdatePanelcontrol that defines the trigger.
    • The ChildrenAsTriggers property is set to true and a child control of the UpdatePanel control causes a postback. A child control of a nested UpdatePanel control does not cause an update to the outer UpdatePanel control unless it is explicitly defined as a trigger.


Following is the example of code with UpdateMode property set to Conditional.


Hope it helps !


C# 7.0

July 27, 2017 2 comments

C# History

In all previous versions of C# (with the exception of C# 6.0 maybe) new features have revolved around a specific theme:

  • C# 2.0 introduced generics.
  • C# 3.0 enabled LINQ by bringing extension methods, lambda expressions, anonymous types and other related features.
  • C# 4.0 was all about interoperability with dynamic non-strongly typed languages.
  • C# 5.0 simplified asynchronous programming with the async and await keywords.
  • C# 6.0 had its compiler completely rewritten from scratch, and introduced a variety of small features and improvements that were easier to implement now.

C# 7.0 is no exception to this rule. The language designers were focusing on three main themes:

  • Working with Data – Increased usage of web services is changing the way data is being modelled. Instead of designing the data models as a part of the application, their definition is becoming a part of web service contracts. While this is very convenient in functional languages, it can bring additional complexity to object oriented development. Several C# 7.0 features are targeted at making it easier to work with external data contracts.
  • Improved Performance – Increased share of mobile devices is making performance an important consideration again. C# 7.0 introduces features that allow performance optimizations, which were previously not possible in the .NET framework.
  • Code simplification – Several additional small changes built on the work done for C# 6.0 to allow further simplification of the code written.

Using the code

Tuples (with types and literals)

Return multiple values from a method is now a common practice, we generally use custom datatype, out parameters, Dynamic return type or a tuple object but here C# 7.0 brings tuple types and tuple literals for you it just return multiple values/ multiple type inform of tuple object. see below snippet

( string, string, string, string) getEmpInfo()
    //read EmpInfo from database or any other source and just return them
    string strFirstName = "abc";
    string strAddress = "Address";
    string strCity= "City";
    string strState= "State";
     return (strFirstName, strAddress, strCity, strState); // tuple literal

//Just call above method and it will return multiple values 
 var empInfo= getEmpInfo();
WriteLine("Emp info as  {empInfo .Item1} {empInfo .Item2} {empInfo .Item3} {empInfo .Item4}.");

In above sample we can easily retrieve multiple values from tuples, but Item1, Item2 name are bit ir-relevant so let’s assign some meaningful names before return, see below sample

(string strFName, string strAdd, string strC, string strSt) getEmpInfo()
    //code goes here

//Now when you call method get values with specific name as below 
var empInfo= getEmpInfo();
WriteLine("Emp info as {empInfo.strFName} {empInfo.strAdd} {empInfo.strC} {empInfo.strSt}.");

Additionally you can return their name directly in tuple literal as below

return (strFName: strFirstName, strAdd: strAddress, strCity: strC, strState: strSt);

Tuples are very useful thing where you can replace hash table or dictionary easily, even you can return multiple values for a single key, Additionally you can use it instead of List where you store multiple values at single position.

.NET also has a Tuple type (See here) but it is a reference type and that leads to performance issue, but C# 7.0 bring a Tuple with value type which is faster in performance and a mutable type.


Most of the time we don’t want to access whole tuple bundle or we just need internal values then we can use Deconstruction features of C# 7.0, we can easily de-construct a tuple and fetch values that we need, following snippet will clear your doubt

( string strFName,  string strAdd,  string strC, string strSt) = getEmpInfo(); 
Console.WriteLine($"Address: { strAdd }, Country: { strC }");

Record Type

C# support record type, which is nothing but a container of a properties and variables, most of the time classes are full with properties and variables, we need lot of code to just declare them but with the help of Record Type you can reduce your effort, see below snippet

class studentInfo
    string _strFName;
    string _strMName;
    string _strLName;
    studentInfo(string strFN, string strMN, string strLN){
        this._strFName = strFN;
        this._strMName = strMN;
        this._strLName = strLN;
    public string StudentFName {get{ return this._strFName;}}
    public string StudentMName {get{ return this._strMName;}}
    public string StudentLName {get{ return this._strLName;}}

In above code we have a class with property, constructor and variable, so access and declare variable i need to write more code.

To avoid it i can use  Record Type in C#, see below snippet

class studentInfo(string StudentFName, string StudentMName, string StudentLName);

That’s it and we have Done !

above snippet produce same output as earlier snippet.


Minimizing OUT

Out parameter is very popular when we want to return multiple values from method, By nature out parameters are ref type and works as an argument, we can use it easily but the only condition is out variable should be initialized before it passed. see below snippet

class SetOut
    void AssignVal(out string strName)
        strName = "I am from OUT";
    static void Main()
        string strArgu;
        AssignVal(out strArgu);
        // here contents of strArgu is "I am from OUT"

C# 7.0 reduce your pain of writing extra code and you can just pass argument without initialize them, see below snippet


  static void Main()
        AssignVal(out string szArgu);
        // here contents of szArgu is "I am from OUT"

You can either use var as argument type instead to declare them.

Note that variable are used here, are in limited scope only, thus we can not use them outside method

Since we can define variable as argument directly, C# 7.0 gives us freedom to declare them as var also. so you don’t need to worry about datatype, see below snippet

  static void Main()
        AssignVal(out var szArgu);
        // here contents of szArgu is "I am from OUT"


Non-‘NULL’ able reference type

Null reference is really a headache for all programmers, it is a million dollar exception. If you don’t check them you got runtime exception or if you check them for each object then your code goes long and long, To deal with this problem C# 7.0 come with non-nullable reference types

**I think syntax for it yet not fixed still they have release following syntax

?‘ is for nullable value-type and ‘!‘ is for non-nullable reference type

int objNullVal;     //non-nullable value type
int? objNotNullVal;    //nullable value type
string! objNotNullRef; //non-nullable reference type
string objNullRef;  //nullable reference type

Now look at the following complier effect after we run this snippet

MyClass objNullRef;  // Nullable reference type
MyClass! objNotNullRef; // Non-nullable reference type
objNullRef = null;   // this is nullable, so no problem in assigning
objNotNullRef = null;   // Error, as objNotNullRef is non-nullable
objNotNullRef = objNullRef;      // Error, as nullable object can not be refered
WriteLine(objNotNullRef.ToString()); // Not null so can convert to tostring
WriteLine(objNullRef.ToString()); // could be null
if (objNullRef != null) { WriteLine(objNullRef.ToString); } // No error as we have already checked it
WriteLine(objNullRef!.Length); // No error


Local Methods/Functions


Local methods and functions is already there in current version of C# (Yes, we can achieve them using Func and Action types, see here Func  and Action), but still there are some limitations to local method, we can not have following features in it

  • Generic
  • out parameters
  • Ref
  • params

Now with C# 7.0 we can overcome this problems, see below snippet

private static void Main(string[] args)
    int local_var = 100;
    int LocalFunction(int arg1)
        return local_var * arg1;

in above snippet we have define ‘LocalFunction’ as local function which is inside Main Function ‘Main’, here we can use out or ref in it.

Readability Improvement with Literals

Many times we use literals in code, if they are too long then we might loose Readability,   to sort out such issues C# 7.0 comes with some improvement in Literals. Now C# allows ‘_‘ (underscore) in Literals for betterment of understand, it does not effect on its value. see below snippet

 var lit1 = 478_1254_3698_44;
 var lit2 = ab0Xab_bc47at_XY;

//C# also come with binary literal for bunary values

 var binLit = 1100_1011_0100_1010_1001;

**Literals are nothing but a constant value (hard-coded value) which may be with predefined meaning. (Litearls in C#)

Pattern matching

C# 7.0 allows user to use pattern in IS statement and with SWITCH statement, so we can match pattern with any datatype, patterns can be constant patterns, Type patterns, Var patterns. following sample snippet will clear your concepts, let’s start with IS pattern

 public  void Method1( object obj)
    //following null is constant pattern
     if (obj  is null)  return;
    //datatype pattern, string is datatype that we check directly     
     if (obj  is  string st)
    { //code goes here }

Switch pattern helps a lot as it uses any datatype for matching additionally ‘case’ clauses also can have its pattern so it bit flexible implementation

see below snippet

class Calculate();
class Add(int a, int b, int c) : Calculate;
class Substract(int a, int b) : Calculate;
class Multiply(int a, int b, int c) : Calculate;
Calculate objCal = new Multiply(2, 3, 4);
switch (objCal)
    case Add(int a, int b, int c):
        //code goes here
    case Substract(int a, int b):
        //code goes here
    case Multiply(int a, int b, int c):
        //code goes here
        //default case

in above sample switch case checks pattern and call ‘Multiply’ method

‘return’ by Ref

Have you tried to return your variable from method/function as Ref ? Yes, C# 7.0 allows you to do that. Infect you can pass a variable with Ref return them as Ref  and also store them as Ref, isn’t it amazing.

see below snippet

ref string getFromList(string strVal, string[] Values)
 foreach (string val1 in Values)
     if (strVal == val1)
        return ref val1; //return location as ref not actual value

string[] values = { "a", "b", "c", "d" };
ref string strSubstitute = ref getFromList("b", values);
strSubstitute = "K"; // replaces 7 with 9 in the array
System.Write(values[1]); // it prints "K"

In above sample we have find and replace a string, by return a Ref from method.

Throw Exception from Expression

You read it right, in C# 7.0 Now you can throw exception from your expression directly. see below snippet

public string getEmpInfo( string EmpName)
        string[] empArr = EmpName.Split(",");
        return (empArr.Length > 0) ? empArr[0] : throw new Exception("Emp Info Not exist");

In above snippet we can directly throw exception from return statement, isn’t it really good !

Point to be Notice

All above features are expected to be a part of C# 7.0, yet Microsoft has release some of it with Visual studio 2015 Release 4.

Hope you enjoy these new features of C# 7.0.

Categories: ASP.NET Tags: , ,

Outlook: Internet Security Warning

Problem :

When I start Outlook, I get an “Internet Security Warning” dialog box with the message;

The server you are connected to is using a security certificate that cannot be verified.
The target principal name is incorrect.

I clicked on “View Certificate” and installed the certificate, but I still get this dialog each time I start Outlook.

Clicking “Yes” each time allows me to use Outlook as normal but how can get rid of this dialog?

Usually you get this error when you are using a shared hosting account with your own domain and connect via SSL. Another common cause is that your ISP has changed the name of their mail server and is redirecting you from the old server name to the new one and the name of the old server isn’t on their new SSL certificate.

Internet Security Warning - The server you are connected to is using a security certificate that cannot be verified. The target principal name is incorrect - View Certificate - Do you want to continue using this server? - Yes - No
Looking at the certificate usually provides the answer.

Name on the certificate should match the name of the mail server

The solution is quite simple; click on the “View Certificate…” button and look at the “Issued to” name. This is usually the name that you’ll need to specify for your incoming and/or outgoing server in your account configuration.

In some cases, this still won’t work when the certificate holds multiple names. You can then select the “Details” tab and see if the certificate holds a field called “Subject Alternative Name”. If so, then you’ll find other names that you could try behind the “DNS Name=” value.

If none of those names work either, contact your ISP and ask for the correct name of the mail server that you should use. Another (less secure) alternative would be to disable the use of SSL for your mail account.

No need to install the certificate

As long as the name on the certificate doesn’t match the name specified in your account settings, you’ll get this warning message. Installing the certificate will not help in any way and isn’t needed either.

The only case in which installing the certificate is needed, is when the names do match and the certificate isn’t issued (trusted) by a Certificate Authority. These are so called “Self-Signed Certificates”. In that case, only install the certificate if you trust the domain that is specified on the certificate and if the administrator responsible for that domain has instructed you to do so.

Background information

Many shared hosting solutions or ISPs are now offering secure access to your mailbox via Secure Sockets Layer (SSL). In order to make an SSL connection, a security certificate is required on the mail server. The name on this certificate should match the name that you use to connect to this server. For instance;

With shared hosting solutions, your mailbox is hosted on a mail server which also hosts mailboxes for other people’s/company’s domains. This means that the mail server often can be reached not only via but also via

As SSL certificates usually aren’t free and updating and maintaining them for each shared account in a cost effective way is near impossible, the mail server is usually only reachable via SSL via the name of If you use any other name, you’ll get this security warning message.

The issue is similar for other ISPs, especially when they merge or change their infrastructure. This sometimes goes together with a name change of the mail server. They then usually redirect the old name of the mail server to the new name so you still can access your mail, but the SSL certificate of the new server no longer contains the old name. The result is that you get this warning dialog and you’ll have to update your account settings for the new server name.

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

May 23, 2017 1 comment

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 !