Saturday 28 November 2020

ASP.Net 404 page not found error handle

 



When a URL hits and if page is not found on the server then ASP.Net throws a 404 page not found exception. If 404 page not found exception handled properly then you will get the default error page by ASP.Net , Which doesn't looks good and user friendly. 404-page handling is considered as a good practice of web development. Paste the following code on Global asax file and you will be redirected to your custom error page. 

Tuesday 10 November 2020

Google Captcha for C# ASP.Net MVC

 

reCAPTCHA uses an advanced risk analysis engine and adaptive challenges to keep malicious software from engaging in abusive activities on your website. Meanwhile, legitimate users will be able to login, make purchases, view pages, or create accounts and fake users will be blocked.

Saturday 7 November 2020

HTML Table to Excel


jquery.table2excel.min.js is jquery library which has inbuilt functionality to expert any HTML table to Excel file by table id. This is one of the simplest solutions available on the internet totally free of cost. 


 <html>
<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Girfa HTML to Excel</title>

     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"> </script>

<script src="https://cdn.rawgit.com/rainabba/jquery-table2excel/1.1.0/dist/jquery.table2excel.min.js"> </script>

<script>  

  function tbltoexcel()

Monday 5 October 2020

Form post ASP.Net | C# | MVC

 


HTTP is a protocol that is used to provide a communication interface between server and client. HTTP sends data to the server and retrieved response to the client(Browser). HTTP has many methods for client/server communication.

HTTP GET and HTTP Post is the most common method used by HTTP. 

  • HTTP Get the return response from the server to  client.
  • HTTP Post send data client (Browser to the server) .
I am going to explain to you that how can you save data of a form using form post methods. I was a PHP developer when used the MVC C# form then I had to use ajax for data submission to the server which was very time taking and prone to error.


ASP.Net MVC C# has a built-in model attached view for form data submission and validation, which is good but not good as for users who are using simple posts form the method. So I will show you different ways to send data to the server using form method post like PHP.

Demo Table Name (Student)


SN

Field

Data Type

1

Roll

Int

2

Name

Varchar(50)

3

City

Varchar(50)

Store Procedure

Wednesday 16 September 2020

Column to row transform in SQL Server

 Q :  In an organization,  staff tasks had been assigned through CRM and task status (New, Complete, Pending) submitted to CRM back. Now Admin want to see the every staff task status New, Compare and pending order with staff name

Table Structure

Wednesday 9 September 2020

Get Date dd/mm/yy format using format string C# | ASP.Net

ASP.Net has reach variety of date processing techniques . If yoo want to date as in dd-mm-yy format then you can use format string which help you to set your date output as you want. Using format string increase your ourput by just a line of code.

DateTime dt = DateTime.Now;

string format = "ddmmyy";

string postfix = dt.ToString(format);    

Output : 110920        

Console.WriteLine(postfix);

You can use different versions of format string as per your requirement . 

string format = "dd-mm-yy";
Output : 09-11-20

string format = "DDD mm yy";
Output : Wed 09 20

Format string pattern

M display one-digit month number d display one-digit day of the month h display one-digit hour on 12-hour scale mm display two-digit minutes yy display two-digit year

Saturday 5 September 2020

Bind dynamic layout on a single view using C# | ASP.Net

 

ASP.Net MVC is a popular platform to design dynamic website and CRM etc. One I was stuck in a situation when I want to use a common view to different privileged users. So I had to bind multiple layouts on a single view as per the related users menu or sidebar. This post will help you to bind dynamic layouts on a single view.

  public ActionResult Task()

        {

File Resizing C# | ASP.NET | MVC

 

You can resize your image as per your requirement by using WebImage Class which implemented in System.Web.Helpers namespace and resizing is done by Resize and save method.

Namespace : using System.Web.Helpers;

[HttpPost]

        public JsonResult UploadCommonImage(string fnm, string pth,string w,string h)

        {

Sunday 30 August 2020

Alter Table SQL Server

 

The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.

The ALTER TABLE statement is also used to add and drop various constraints on an existing table.


ALTER TABLE - ADD Column

To add a column in a table, use the following syntax:

ALTER TABLE table_name
ADD column_name datatype;

The following SQL adds an "Email" column to the "Customers" table:

Example

ALTER TABLE Customers
ADD Email varchar(255);

Tuesday 25 August 2020

Zoom Anything on mouse over CSS

 

This post will help you to learn zoom something one your webpage like Image, div, table, or any HTML component in a simple way.

img

{

      width: 100%;

      transition: all 1s;

 }

Wednesday 19 August 2020

Descritive Answer : IT TOOLS & BUSINESS SYSTEMS Jan-2018 | NIELIT O Level

 Q. 5 (A) : Write the comparison Between Dot Matrix Printers & Laser Printers with respect to Print Quality, Speed, Noise and cost parameters.

Answer

Print Quality

A typical laser printer has a resolution of 1,200 dots per inch, or dpi. It achieves this level of detail through the use of microscopic toner powder, high-performance electronics and precision optics. Many laser printers have color capability at the same high resolution. Some dot matrix printers achieve 240 dpi by making repeated passes over the same printed area, though documents produced this way take at least twice as long to print as those printed at normal quality. As a dot matrix printer's output color depends on the ribbon, virtually none offer choices beyond black and red.

Speed

A typical desktop laser printer turns out about four full-color pages per minute; for black-and-white text, this rises to 25 pages per minute. Dot matrix printers are typically rated at between 200 and 600 characters per second, or about 50 pages per minute in draft mode. Some high-output dot matrix printers achieve 1,100 characters per second, or 100 pages per minute, although the print quality is low-resolution text.

Monday 10 August 2020

Process N record from each group | SQL Server

 


ROW_NUMBER() function in SQL Server is very useful special in case when you want to process N records from a specific group. This function has been around since SQL Server 2005 and at its core, provides a way to provide sequential numbering for rows returned by a query.

As well as sequential numbering, ROW_NUMBER() provides a way to partition the results returned so this suited me just fine

Table Structure 


Sunday 2 August 2020

Descriptive Answer : NIELIT IT Tools and Business Systems (July 2018)

Q. 5 (A) :  Write a short note on storage devices of computer.
Answer : 

Examples of Storage Device

Friday 31 July 2020

Answer : IT Tools and Business Systems (January 2019)


Q. 5 (A) : Explain about Multitasking operating system in detail.

Answer :


Multitasking, in an operating system, is allowing a user to perform more than one computer task (such as the operation of an application program) at a time. The operating system is able to keep track of where you are in these tasks and go from one to the other without losing information. Microsoft Windows 2000, IBM's OS/390, and Linux are examples of operating systems that can do multitasking (almost all of today's operating systems can). When you open your Web browser and then open Word at the same time, you are causing the operating system to do multitasking.

Saturday 25 July 2020

Descriptive Question Answer NIELIT (O-Level ) IT Tools and Business Systems (July 2019)



Answer IT Tools and Business Systems (July 2019)

Q 5 (A) . Define Computer. Explain the main characteristics of Computer.

Answer :

Computer

A computer is an electronic device that manipulates information, or data. It has the ability to store, retrieve, and process data. You may already know that you can use a computer to type documents, send email, play games, and browse the Web. You can also use it to edit or create spreadsheets, presentations, and even videos.

Thursday 23 July 2020

Dynamic Memory allocation | Input | Print Ascending Order program | C Language

 Q : Write a program using dynamic memory allocation to read numbers as input and display them in sorted order thereafter.

Answer :


#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
/*============================
     Girfa Student Help
     Dynamic array and ascending print
==============================*/
void main()
{

Wednesday 22 July 2020

String Concatenation without library function | C Language

Q : Write a program to concatenate two strings. (Do not use inbuilt string function).


Answer : 



#include<stdio.h>
#include<conio.h>
/*============================
     Girfa Student Help
     Concatenation string
==============================*/

Find Largest number from array using function program | C Language

Q : Write a program to input a set of numbers into an array. Pass the array to a function that finds and display the  largest number.?


Answer : 



#include<stdio.h>
#include<conio.h>
/*============================
     Girfa Student Help
     Find largest no. in array using function
==============================*/
void find(int ar[5]);

Tuesday 21 July 2020

Structure record input-read in file | C Langauge

Q : Write a program to write records of students in a file, where each record consists of student name, roll number, CGPA, and address. Read the records back from the file and display them.

Code : 

#include<stdio.h>

#include<conio.h>

/*============================

     Girfa Student Help

     Structure write back to file

==============================*/

Full Pyramid program | C Language

Full pyramid program and size is given by user



Code :


#include<stdio.h>
#include<conio.h>
/*============================
     Girfa Student Help
     Full pyramid program
==============================*/

Monday 20 July 2020

Table multiplication of given number

Q : Write program to generate multiplication table for first ‘n’  number, where ‘n’ is a user input.


Answer : 



#include<stdio.h>
#include<conio.h>
/*============================
     Girfa Student Help
     Multiplication table of given number
==============================*/

Sunday 19 July 2020

Extern Variable



External variables are used to make global variables. Extern variable defined outside the function. These variables are available globally throughout the function execution. The value of global variables can be modified by the functions. “extern” keyword is used to declare and define the external variables.

Cookies PHP


A cookies is a variable set on server normally used to identify a user.  A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. A cookie can only be read from the domain that it has been issued from.


Syntax 

setcookie(name, value, expire, path, domain, secure, httponly);


  1. Name: It is used to set the name of the cookie.
  2. Value: It is used to set the value of the cookie.
  3. Expire: It is used to set the expiry timestamp of the cookie after which the cookie can’t be accessed.
  4. Path: It is used to specify the path on the server for which the cookie will be available.
  5. Domain: It is used to specify the domain for which the cookie is available.
  6. Security: It is used to indicate that the cookie should be sent only if a secure HTTPS connection exists.

Saturday 18 July 2020

Macro C Language

 What is macro? Define a macro to compute maximum of two arguments passed to it.



macro is a fragment of code which has been given a name. Whenever the name is used, it is replaced by the contents of the macro. There are two kinds of macros. They differ mostly in what they look like when they are used. Object-like macros resemble data objects when used, function-like macros resemble function calls.
#include <stdio.h>

#define MAX(x,y) ((x>y)?x:y)
/*=======================
     Girfa Student Help
     Macro Demo
 ========================*/

fseek demo program

Q : Write a file statement to place a file pointer (fp) at the beginning of the record number (say R), where record size is B bytes.


Answer : 

#include<stdio.h>

#include<conio.h>

/*============================

     Girfa Student Help

     fseek demo

==============================*/

Friday 17 July 2020

Structure for Employee

A programmer wants to use two variables session and info. Variable session can take three values (morning, afternoon, evening) ly. Using variable info, the programmer wants to access information empname and empid of 30 employees. Name the appropriate data type used for each variable session and info and declare the variables.

Answer : 



#include<stdio.h>
#include<conio.h>
/*============================
     Girfa Student Help
     structure data type
==============================*/

Difference and similarity between continue and break | C Language

Write down one similarity and one dissimilarity between break and continue statements.


Similarity


The main difference between break and continue statements in C language is that a break origins the innermost enclosing loop or switch to be exited immediately. Whereas, the continue statement origins the next iteration of the enclosing for, while, or do loop to begin. The continue statement in while and do loops takes the control to the loop's test-condition immediately, whereas in the for loop it takes the control to the increment step of the loop.

Thursday 16 July 2020

Min Max find program 2d-array using function | C Language

Q : Write a function fnmat() which takes matrix, m, n as arguments where matrix is of size mXn with m as rows and n as columns. Function should return the maximum and minimum elements of the matrix. Elements of matrix are of integer type.


Answer : 


#include<stdio.h>
#include<conio.h>
#define ROW 5
#define COL 5
/*============================
     Girfa Student Help
     Find max,min 2d-array using function
==============================*/
void fnmat(int ar[ROW][COL],int,int);
void main()
{
     int ar[ROW][COL],r,c,i,j;
     clrscr();
     printf("Enter row & columns for array entry>> ");
     scanf("%d%d",&r,&c);
     if(r>ROW)
           printf("Given row is greater than row capacity of %d",ROW);
     else if(c>COL)
           printf("Given column is greater than column capacity of %d",COL);
     else
     {
           for(i=0;i<r;i++)
           {
                for(j=0;j<c;j++)
                {
                     printf("Enter number for ar[%d][%d]>> ",i+1,j+1);
                     scanf("%d",&ar[i][j]);
                }
           }
           clrscr();
           /* Printing array */
           for(i=0;i<r;i++)
           {
                for(j=0;j<c;j++)
                     printf("\t%d",ar[i][j]);
                printf("\n");
           }
           fnmat(ar,i,j);
     }
     getch();
}
void fnmat(int ar[ROW][COL],int r,int c)
{
     int i,j,min,max;
     min=max=ar[0][0];
     for(i=0;i<r;i++)
     {
           for(j=0;j<c;j++)
           {
                if(min>ar[i][j])
                     min=ar[i][j];
                else
                     max=ar[i][j];
           }
     }
     printf("\n\n\tMix=%d\n\tMax=%d",min,max);
}