Skip to main content

Posts

Showing posts from January, 2015

Featured Post

How to use Tabs in ASP.NET CORE

I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component  public class AllViewComponent : ViewComponent     {         private readonly UserManager<ApplicationUser> _userManager;         public AllViewComponent(UserManager<ApplicationUser> userManager)         {             _userManager = userManager;         }         public async Task<IViewComponentResult> InvokeAsync()         {             List<StudentViewModel> allUsers = new List<StudentViewModel>();             var items = await _userManager.Users.ToListAsync();             foreach (var item in items)             {                 allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email });             }            

Implementing Callback Functions in JQuery

Callback function reference will execute after the current effect/function/event finished completely. This type of function can be used after any event completion like to set an element’s value after execution of some function finished. In earlier article we have discussed about callback function execution after finishing effect. These functions executes after current effect have been finished. As the effect completed, the function reference specified as callback will be executed. Following code block will change the text field of element having id "testComment" as mentioned in the code. This whole process will take place after button (btnComment) click event done. $("#btnChange").click(function(){   $("#testComment").text(function(i,origText){     return "Old text: " + origText + " New text: Changed! on index: " + i;   }); }); A callback function is one which is passed as an argument in another function and which is invok

Implementation of pointer variable in Data Structures through C Language

            Implementation of pointer variable with example Pointer Operations One can do only possible two operations on pointers One is assignment and another one is simple addition or subtraction of values with pointer variables. No other operation is permitted to perform on the pointer variables because they simply contain the memory addresses or locations not the variables. Assignment operation:       The assignment operation is nothing but assigning a pointer variable with the memory address. The memory address must be known (static or dynamic). A pointer can be assigned with the address stored in another pointer variable. To perform assignment operation the two “pointer variables” must be of the same type. The pointer must point to memory locations that contain the similar type values like integers, floating-point number, characters etc. If ‘a’ is an integer variable then the address of ‘a’ can be assigned to any pointer variable of the type integer. Example: Void ma

Pointer and Dynamic memory Allocation in data structure through C Language

                                                            When the variables are declared in a program, usually the memory is allocated during the compilation that is statically. The memory referred by such variables is used to store the value (data) directly. Instead of data directly if another memory location is to be stored in the variables, then it should be a pointer variable. As we are already familiar with the dynamic memory allocation, and if it is to be implemented then without pointer variables it is not possible. During the execution of program dynamic memory is allocated, so there must be a variable that stores addresses of memory at that time. That is the reason why pointer variable is used. When pointer variables are declared no memory is allocated to store the data. The memory is allocated to them only to store the memory address not the data. Taking this as an advantage the pointer variable can be made to point dynamically allocated memory location. For example if

How to Validate DropDownList in ASP.NET

Introduction Various methods is available to validate the TextBox but very few methods is available to validate the Dropdownlist. Here i have two methods to validate it. In the first method i will use RequiredFieldValidator control with InitialValue property, in the second method i will use javaScript. for validation. I-Method In the first method, first to add some items in the dropdownlist . Now, take a RequiredFieldValidator control to validate the Dropdownlist. Set some required properties of validator control. These are: ControlToValidate="Id of Dropdownlist control" ErrorMessage=" Please select item from Dropdownlist " InitialValue = "Match with Text item which is available in Dropdownlist also you do not want to display. Like <asp:ListItem>select one</asp:ListItem>             <asp:ListItem>Apple </asp:ListItem>             <asp:ListItem>Mango</asp:ListItem>             <asp:ListItem>Orange&l

String Literals and Constants in C Language

There is no separate data type for strings in C language. In C language, a string is an array of characters and terminated by NULL character which is denoted by the escape sequence '0'. A NULL terminated string is the only type string defined using C language. A string is stored as a sequence of characters in an array terminated by \0. For example, consider the string "DOTPROGRAMMING". This string is stored in the form of an array as shown below: Note that the characters are stored from location zero. Each location holds one character string from 0 to 14. The string always ends with NULL. Character denoted by '\0'. Here, the string "DOTPROGRAMING" is called a string literal. String Literal or Constant A string literal or constant is a sequence of characters enclosed within double quotes. For example, "DOT PROGRAMMING", "DOT", "PROGRAMMING" are all string literals. When a string literal is defined, the C compi

What is Variable Length String Format in C Language

As the name implies, variable–length strings don’t have a pre-defined length. In this string, neither the precise length nor maximum length is known at the time of creating it. The array storage structure for a string can expand or shrink to accommodate any number of characters. But, there should be a mechanism to indicate the end of the string . The two common techniques to implement variable length strings are described in the article. Length Controlled String A length controlled string is a string whose length is stored as part of the string itself. This technique uses a count that specifies string length. The count is normally stored as the first byte followed by the string. This count is used by the string manipulation functions to determine the actual length of the string data. For example, the strings "DOT" and "PROGRAM" are stored using length controlled format are: Note: The first byte contains string length. Since its length is 1 byte (* bits) w

Bubble Sort Algorithm in C Language

More often in computer programming, programmers works with large amount of data and it may be necessary to arrange them in ascending or descending order. This process of arranging the given elements in a order is called sorting, the order may be ascending or descending. For example, consider the unsorted elements: 10, 60, 50, 20, 30, 70, 40 After arranging them in ascending order, the elements are rearranged as shown below: 10, 20, 30, 40, 50, 60, 70 After arranging them in descending order, the elements are rearranged as shown below: 70, 60, 50, 40, 30, 20, 10 The two important and simple sorting techniques are described below with example: Bubble sort This is the simplest and easiest sorting technique. In this technique, the two successive items or elements arr[i] and arr[i+1] are exchanged whenever the condition arr[i]>arr[i+1] will be true. For example, consider the elements shown below: In the first pass 50 is compared with 40 and they are exchanged since 50

STACK in C Language

It’s special data structure based on LIFO (Last In First Out Concept). It can be implemented using One dimensional Array as well as Singly linked list. TOP  is the external pointer points to last node element pushed. There are two operation which is performed on stack i.e., Push (Insertion) and Pop (Deletion). Push and Pop operation is performed through TOP end.( means insertion and deletion is restricted through one end i.e., TOP end) Write an algorithm to perform push operation. PUSH(TOP) [ PUSH is the name of algorithm and TOP is the external pointer points to last inserted node. ] NEW<--FREE FREE <--  FREE --> NEXT If NEW=NULL Then:     Write : ‘ Memory allocation errot’      Exit [ End of If] Read : NEW-->INFO NEW -->  NEXT <-- TOP TOP <--NEW END Write an algorithm to perform pop operation. POP(TOP) [ POP is the name of algorithm] If TOP = NULL Then:    Write: ‘ Stack is empty’    Exit [ End of If] I <-