Thursday 27 November 2014

C# Basic Concept and Tutorial

Static Classes

A class can be declared static, which indicates that it contains only static members. It is not possible to use the new keyword to create instances of a static class. Static classes are loaded automatically by the .NET Framework common language runtime (CLR) when the program or namespace that contains the class is loaded.
Use a static class to contain methods that are not associated with a particular object. For example, it is a common requirement to create a set of methods that do not act on instance data and are not associated to a specific object in your code. You could use a static class to hold those methods.
Following are the main features of a static class:
·         They only contain static members.
·         They cannot be instantiated.
·         They are sealed.
·         They cannot contain Instance Constructors (C# Programming Guide).
Creating a static class is therefore basically the same as creating a class that contains only static members and a private constructor. A private constructor prevents the class from being instantiated.
The advantage of using a static class is that the compiler can check to make sure that no instance members are accidentally added. The compiler will guarantee that instances of this class cannot be created.
Static classes are sealed and therefore cannot be inherited. They cannot inherit from any class except Object. Static classes cannot contain an instance constructor; however, they can have a static constructor. For more information

Static Members

A static method, field, property, or event is callable on a class even when no instance of the class has been created. If any instances of the class are created, they cannot be used to access the static member. Only one copy of static fields and events exists, and static methods and properties can only access static fields and static events. Static members are often used to represent data or calculations that do not change in response to object state; for example, a math library might contain static methods for calculating sine and cosine.
Static methods can be overloaded but not overridden.
Static class members are declared by using the static keyword before the return type of the member, for example:

Wednesday 26 November 2014

C# Programming Practical Questions


Question : Write a program which accept input of full path of a file and produce following output?
Input : C:/Users/Public/Pictures/SamplePictures/Desert.jpg
Output :
Extension : jpg
File Name : Desert
Path : C:/Users/Public/Pictures/SamplePictures


Solution :


import java.util.*;
public class Main
{


       public static void main(String[] args)
    {
        String str;
        Scanner sc=new Scanner(System.in);
        System.out.print("Enter your name>> ");
        str=sc.nextLine();


        int ep,sp;
        ep=str.indexOf(".");
        sp=str.lastIndexOf("\\");
        System.out.print("\nExtention  is "+str.substring(ep+1,str.length()));
        System.out.println("\nFile Name is "+str.substring(sp+1,ep));
        System.out.println("\npath is "+str.substring(0,sp));




    }
}



C# Tutorial and Notes

Static Classes

A class can be declared static, which indicates that it contains only static members. It is not possible to use the new keyword to create instances of a static class. Static classes are loaded automatically by the .NET Framework common language runtime (CLR) when the program or namespace that contains the class is loaded.
Use a static class to contain methods that are not associated with a particular object. For example, it is a common requirement to create a set of methods that do not act on instance data and are not associated to a specific object in your code. You could use a static class to hold those methods.
Following are the main features of a static class:
·         They only contain static members.
·         They cannot be instantiated.
·         They are sealed.
·         They cannot contain Instance Constructors (C# Programming Guide).
Creating a static class is therefore basically the same as creating a class that contains only static members and a private constructor. A private constructor prevents the class from being instantiated.
The advantage of using a static class is that the compiler can check to make sure that no instance members are accidentally added. The compiler will guarantee that instances of this class cannot be created.
Static classes are sealed and therefore cannot be inherited. They cannot inherit from any class except Object. Static classes cannot contain an instance constructor; however, they can have a static constructor. For more information

Static Members

A static method, field, property, or event is callable on a class even when no instance of the class has been created. If any instances of the class are created, they cannot be used to access the static member. Only one copy of static fields and events exists, and static methods and properties can only access static fields and static events. Static members are often used to represent data or calculations that do not change in response to object state; for example, a math library might contain static methods for calculating sine and cosine.
Static methods can be overloaded but not overridden.
Static class members are declared by using the static keyword before the return type of the member, for example:

Tuesday 25 November 2014

File Management in C Languge

Formatted Input in a file

#include<stdio.h>
#include<conio.h>
void main()
{
int roll,i;
char nm[10],ct[10];
FILE *ft;
clrscr();
ft=fopen("abc.doc","w");
for(i=1;i<=3;i++)
{
printf("Enter %d'st roll>> ",i);
scanf("%d",&roll);
fflush(stdin);
printf("Enter %d'st name>> ",i);
gets(nm);
fflush(stdin);
printf("Enter %d'st City>> ",i);
gets(ct);
fprintf(ft,e"%d\t%s\t%s\n",roll,nm,ct);
}
}

Sunday 2 November 2014

Output Device

CRT

The cathode ray tube (CRT) is a vacuum tube containing an electron gun (a source of electrons or electron emitter) and a fluorescent screen used to view images. It has a means to accelerate and deflect the electron beam(s) onto the fluorescent screen to create the images. The image may represent electrical waveforms (oscilloscope), pictures (television, computer monitor), radar targets and others. CRTs have also been used as memory devices, in which case the visible light emitted from the fluoresecent material (if any) is not intended to have significant meaning to a visual observer (though the visible pattern on the tube face may cryptically represent the stored data)

LCD



A liquid-crystal display (LCD) is a flat panel display, electronic visual display, or video display that uses the light modulating properties of liquid crystals. Liquid crystals do not emit light directly.

Saturday 1 November 2014

Input Device


In computing, an input device is any peripheral (piece of computer hardware equipment) used to provide data and control signals to an information processing system such as a computer or other information appliance. Examples of input devices include keyboards, mice, scanners, digital cameras and joysticks.
Input Devices Before computers, the phrase "input device" probably was not on the tip of anyone's tongue. It has a dry and impersonal sound, sorta technical - rather like computer talk, don't you think? The phrase is easy to define because a "device" is an instrument that performs a simple task. "Input" is also easy - something put into a system. So in the technology world...
an input device is any tool that feeds data into a computer. For example, a keyboard is an input device, whereas a display monitor is an output device. Mice, trackballs, and light pens are all input devices. Isn't it amusing that under the dry title of "input devices," we get such fun words as mice, joystick, trackball, touch pad, light pen, and puck?

Keyboards

The input of information into your computer is generally done through your keyboard and your mouse or mouse substitute. The keyboard has the distinction of being the standard input device.
The variety of keyboards is almost staggering. No one has to stick with the standard keyboard that comes with the computer. Ergonomically designed keyboards often have unusual sculpted or contoured shapes and a space age look. These keyboards are designed to help avoid repetitive stress injury to the wrists. Some of these keyboards come with foot pedals to spread the work to other limbs. Some keyboards are even designed to take advantage of the strength in the thumbs.
Other keyboards come with extra large keys to help users with sight or hand coordination problems. Wireless keyboards can offer the freedom from being tethered to the computer. In keyboards, if you shop around, you will find that there really is something for everyone.
Your choice of keyboard, like your choice of any input device, is a very personal matter. If only we could test each type of keyboard or mouse for an extended period of time before buying one, but that just doesn't happen in today's marketplace. Computer users should research the many different products offered. Make sure you know if and how you can customize the input device for your own use. Only you can decide which kind of device is most comfortable for you. And that applies to all input devices.