vijay

welcome Netizen

Share Your Knowledge.It is a way to achieve immortality

Friday, December 28, 2012

Data Types in C#


Introduction
In C# every variable is associated with a data type. Data types specify the size and type of the values that can be stored.
The types in C# are divided into two types
1. Value types
2. Reference types
Both value types and reference types are differ in characteristic
Difference between value types and reference types

Value type:
Value type are stored on the stack and when a value of a variable is assigned to another variable, the value is actually copied i.e. two identical copies of the value are available in memory
Normally the value types are grouped in two categories...
User Defined types:
·         Enumeration
·         structures
Predefined types
·         Integers
·         Real Number
·         Boolean
·         Characters
Eg:
int m=10;
int n;
N=m; Here the value are actually copied.
Reference Type:
Reference type are stored on the heap and when a value of a variable is assigned to another variable, only the reference is copied, actual value remains in the same memory location i.e. two reference to a single value
  
 Reference types also divided into two groups
·         User Defined types
·         Predefined types
User defined types:
·         Classes
·         String
·         Delegates
·         Array
Predefined types
·         Object type
·         String type
Eg:
Object  m=10;
Object n;
N=m; Here only the reference has been copied, the value are stored same location,any changes on m also affect the changes on n.

If you like this article share this information with your friends
Post your comments here..

Wednesday, December 26, 2012

How to recover the data file from USB PEN Drive or Flash Drive


Hi...Here I would like to share some useful information about USB pen drive. Now a day’s mostly the USB Flash drive are used to save the data, because it’s very easy to carry and easy to transfer the data.
However everything has its  advantage and disadvantage, for USB causing virus is one of the major problem, because we used it at various system so it’s have more possibilities to get virus on pen drive result the data stored in the pen drive should loss the visibility i.e. data are not  shown on the pen drive.
When you see the properties it will show the size of the data. Now data has been present as hidden in the pen drive. To recover the data you need to follow the below steps
Steps:
1.       First insert the pen drive on your system
2.       Go to start->Run
3.       Enter cmd on Run window
4.       Now the black dos prompt will be open
5.       Then enter the USB pen drive letter for an example pen drive has e: drive
6.       Enter E:
7.       Enter the below command
attrib -h -s -r /s/d *.*
8.       Now press enter now you can open pen drive and check your lossed data is present in your pen drive


That’s it. If you think this would helpful then share this article with your friends….

Tuesday, December 25, 2012

Useful Shortcut key for windows XP


Now days most of the system survive only by using windows xp ,for that main reason is its very fast, easy to use and its working for even low configuration system’s .Normally in XP we use only mouse for all the operation. For an every movement in mouse also have shortcut key in keyboard.
Already we know some shortcut key in window xp.But knowing these shortcut key useful to use without mouse option
Shortcut key:

Windows key=Used to open start menu in taskbar
Windowskey+R=Used to open Run command prompt.
windowsKey+M=Used to minimize all the open windows.
WindowsKey+E=Used to open MyComputer
WindowsKey+F=Used to open search option in windows.
WindowsKey+D=Used to view desktop or to minimize all open windows
WindowsKey+Pause=Used to view system properties
Alt+SpaceBar+N=Used to minimize current program window
Alt+SpaceBar+R=Used to restore current program window
Alt+SpaceBar+C= Used to close current program window
Shift+Delete=Used to delete file without sending to Recycle Bin

I hope this shortcut should be useful to someone…

Friday, December 21, 2012

Encapsulation in C#


Main concept of encapsulation is data hiding or information hiding.
Encapsulation provides the ability to hide the internal details of an object from its users. The outside user may not able to change the state of the object directly. Inside the state of the object altered directly by using access modifier keyword public, private and protected.
Just I illustrate with one example.
Take once class, inside the class write the logic to check the enter age from the user. This logic has been implemented in the class the derived class may not know the logic i.e. called as data hiding.
Class A
   private String studname;
    private int studage;

    public string name
    {
        get
        {
            return studname;
        }
        set
        {
            studname = value;
        }
    }
    public int age
    {
        get
        {
            return studage;
        }
        set
        {
            if (value <= 18)
            {
                throw new Exception("Invalid age");
               
            }           
                studage = value;
                      
        }

    }

In an another class use the class A, when u enter the age less than 18 then it will throw the exception error

  try
        {
            ClassA obj = new ClassA();
            obj.age = 22;
            int rrr = obj.age;
            obj.name = "tr";
            Response.Write(rrr);
        }
        catch (Exception ex)
        {
            Response.Write(ex);
        }


 That’s it I hope you understood the concept behind on the encapsulation in oops
Post your feedback………

Monday, December 10, 2012

Type Indian rupee symbol on your keyboard


I would like to share the font to use indian rupee symbol on your keyboard. i hope it will be very useful those who work daily on currency text
 
For those who have not yet installed INDIAN RUPEE Symbol in their computers,
 
Now we have a Rupee Symbol to represent the Indian currency.
Downlaod  the attached Rupee Foradian.ttf file in following location C:\Windows\Fontsrun the file from that folder.
 
Usage - following key is used to type in the Rupee Symbol, 
For example, open word file Select the font "Rupee Foradian",,,,,,,
and type in using the button
 "cid:_1_0F8E52B00F8E4F780026E25865257765~", 

Tuesday, December 4, 2012

How to download videos from YouTube


Here I would like to share some easy way to download YouTube videos from YouTube website.
For downloading videos you don’t need install any new software instead you can use your Mozilla browser to download the videos from YouTube.
Follow the below steps to download videos from YouTube.
1. For download you need Mozilla FireFox browser, I hope everyone have the browser in your PC.
2. Now open Mozilla firefox Goto Tools and click Ad-ons
3. In the Add-ons manager window search and install easy YouTube video downloader plugin.
4. Once you downloaded the plugin the screen looks like below.

5. That’s it now open browser with YouTube website now you can get download button on the youTube website.you can easily download any videos with diffrent format from the YouTube Website

Windows screen look like below..


If you have any comments post here……….

Saturday, December 1, 2012

Difference between classes and struct(structures) in C#


In c# provides a unique way of packing together different data types called as struct.
Struct is a simple lightweight alternative to class,but struct are basically same as class even though they have some significant difference between struct and class.

Classes
Structs
Classes are declared using Class keyword
Struct are declared using Struct keyword
Its  a refrence type therefore its stored on the heap
It’s a value type and therefore stored on the stack
Support inheritance
Does not support inheritance
Default value of the class type is null
Default value is the value produced by ‘zeroing out’
Permit initialization of instance fields
Do not Permit initialization of instance fields
Permit declaration of parameterless constructors
Do not Permit declaration of parameterless constructors
Destructors is supported
Destructors is not supported
Assignment copies the reference
Assignment copies the vaues


Monday, November 26, 2012

Difference between C# and Java


C# and java was derived from c++ therefore they have similar roots.C# has borrowed some features from java. However, there exist a numbers of differences between c# and Java.



Java
C#

Java uses Static final to declare a class constant
C# uses CONST
Java does not support struct type
Its support struct type
Java does not support operator overloading
Its support operator overloading
Class members are virtual by default and a method name in a derived class overrides the base class member
In C# the base member is required to have the virtual keyword and the derived member is required to use the override keyword
In java parameters are always passed by value
It allows parameters to be passed by reference by using ref keyword
In java switch statement can have only integer expression
C# support either an integer or string expression
Java uses instanceof operator instead of  is operator in C#
C# uses is operator instead of instanceof operator in java
In java ,all c# data types are objects
C# has more primitive  data types
Java does not support directly on enumerations
C# supports enumerations



Monday, November 5, 2012

How to get the current system IP address in asp.net


Hi
Really am very proud to write the article with DotNetCode, they way to reach this article to help many people to save their time.
Article is about to client IP address from the machine, using C# code.i knew many people to search this code to find the system IP address.
Normally when we try to get the system IP its always return the server IP address instead of return the current  system IP address, here I solve the problem by the below code to get the current system IP address.
Code:

HttpRequest IPRrequest = HttpContext.Current.Request;
            string IPaddr= IPRrequest.ServerVariables["HTTP_X_FORWARDED_FOR"];

            if (IPaddr== null || IPaddr.ToLower() == "unknown")
                IPaddr= IPRrequest.ServerVariables["REMOTE_ADDR"];

            return IPaddr;


 Above code return the current system ip address eventhough the system connected on the network.
I hope you like this article..share this article with your friends.

Friday, November 2, 2012

Find out computer problem using beep sounds


This article is completely beyond to our platform. But they reason to write this article. In a daily life we are stick with computers, at least we must know the problem would arise in PC.

In an every computer they have default inbuilt speaker. By using speaker sound we can easily identity the problem occurs in Computer.
Here I have list out the common errors occurs in Computer. Also they way to find out the errors using Beep sounds.



Beep code
Beep Problem
No beep sound, system dead
Power supply bad,system not plugged in, or power not turned on
Continuous beeps
Power supply bad,not plugged into mother board correctly,or keyboard stuck
Repeating short beep sound
Power supply may be bad
1 short beep,nothing on the screen
Video card failure
1 short beep,video present,but system won’t boot
Bad cable,or controller
2 short beeps
Configuration error
1 long beep, 1 short beep
System board bad
1 long , 2 short
Video card failure

I hope you like this article…
If you want to share more……Post your comments here..

Monday, October 29, 2012

How to format string with leading zeros in C#


Here I share bit of useful code as we need to use normal project.
Consider a case we have string with single digit,we need to format string with adding leading zeros.
In that case you can use the below code to format string with leading zeros.
You can add leading zeros by using two different type of method code:

First Method:
   string srt = "45";
        //here i have string as two digit.now its going to format by adding zeros with 3 didgit
        Response .Write (srt.PadLeft  (3,'0'));

Output:
045

Second Method:
Same output we can get by using different code …
Response.Write (String.Format("{0:D3}",45));

Output:
045
Take another example to add leading zeros, consider we need to display  Time format.
We use Date time to get the current time.
Response.Write(String.Format("{0:D2}:{1:D2}:{2:D2}", DateTime.Now.Hour, DateTime.Now.Minute,DateTime.Now.Second));

Output:
09:07:44
I hope you like this article,Post your comments here..

Share this article with your friends using share button


Saturday, October 27, 2012

DataPager control in asp.net


The DataPager control is designed to display the navigation for paging to the end user and
to coordinate data paging with any databound control.

Normally datapager control can be used to display the page number size in listview or any data control.
It’s have more option to custumize the page, because it’s completely separate control give the total freedom over where to place it on your webpage.

For an example here I used datapager control for listview.Its completely separate control from listview.
So we need to provide the connection between ListView and Datapager control.For that in datapager control have an option PagedControlID ="ListView1".Here we mention the listview control name to use for paging.

In an previous article I wrote about listview controls.Here I just linked the two articles to give paging for ListView.



Code:
<div>
        <asp:DataPager ID="DataPager1" runat="server" PagedControlID="ListView1" PageSize="5"
            OnPreRender="paging_render">
            <Fields>
                <asp:NextPreviousPagerField ShowFirstPageButton="true" ShowLastPageButton="true" />
                <asp:NumericPagerField ButtonCount="3" />
            </Fields>
        </asp:DataPager>
    </div>

On prerender we need to mention function name to bind the data in datapager control.so I have written a function on server side in the name of paging_render.so I declared it on the datapager.
Server Code:
protected void paging_render(object sender, EventArgs e)
    {
        //Load data is nothing to bind the data from database to listview.
        //****www.Dotnetcode.in******
        loaddata();
    }


I hope you like ..Post your comments here