Category Archives: Language

17

HTML – base tag example.

Description :

The base tag is a HTML tag. It specifies a base(default) URL for all link in the page.

Code :

<html>
<head>
<base href=”http://roseindia.net”&gt;
<title>HTML is a markup language</title>
</head>
<body>
<h1>HTML — base tag. </h1>
&nbsp;<a href=”/techindex/html/index.html”>See HTML Examples Code …….</a>
</body>
</html>

 

SHARE THE KNOWLEDGE


  

Splitter in C#……………….

It is placed after/before control. At run time if u keep mouse control at edge of control a small arrow appears using it you can increase/decrease size of the control. (Control which has expandability).

Procedure :

1)    Increase the form size to maximum, take treeview control, set its dock property to left.

2)    Take splitter

3)    Take listview control, increase the size according to form.

 

int a, b, c, d;

private void Form6_Load(object sender, EventArgs e)

{

a = treeView1.Width;

b = listView1.Left;

}

private void splitter1_SplitterMoved(object sender, SplitterEventArgs e)

{

c = treeView1.Width;

d = c – a;

listView1.Left = b + d;

listView1.Width = this.Width – listView1.Left;

}

SHARE THE KNOWLEDGE


  

Difference Between RAM and ROM…………

RAM is a volatile memory type, which means that it loses its content once power is removed. This is the reason why it cannot replace ROM, which retains its content even when not powered. The downside of ROM is its much slower speed. Using it to replace RAM would make a computer perform very slow.

Nowadays, RAM is seen mainly as the primary memory of computers and other gadgets like smartphones and tablets. In portable gadgets, the internal memory reserved for applications is often referred to as ROM. But in computers, ROMs retains its original meaning. The chip used to hold the BIOS is a ROM as it isn’t routinely written to; but it is sometimes updated. Optical drives are also called ROMS (i.e. CD-ROM and DVD-ROM) as they do read discs that cannot be written to; but most optical drives also have the ability to write to blank discs.

Summary:
ROM is used for storing programs while RAM is used by programs to hold temporary data
RAM is a type of memory that can be accessed non-sequentially while ROM is a type of memory that is only read in typical operation
ROM is non-volatile while RAM is volatile
RAM is considerably faster than ROM

SHARE THE KNOWLEDGE


  

How to create a SQL Connection in C Sharp……….

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Database
{
class Program
{
static void Main(string[] args)
{
// String copy in notepad from property windows
string conString = @”Data Source=.\SQLEXPRESS;AttachDbFilename=””D:\visual studio2010\Database\Database\emp.mdf””;Integrated Security=True;User Instance=True” ;

SqlConnection con = new SqlConnection(conString);
con.Open();

string sql = “select Fname,Lname,Email,Mobile from employee where IsActive = 1”;

//Fire Querry
SqlCommand cmd = new SqlCommand(sql,con);

//Get Result of Querry
SqlDataReader rd = cmd.ExecuteReader();

//Iterate over all result
while(rd.Read())
{
string msg = string.Format(“Fname = {0} Lname = {1} Email = {2} \n Mobile = {3}”,rd[“Fname”],rd[“Lname”],rd[“Email”],rd[“Mobile”]);

Console.WriteLine(msg);
}

rd.Close();
con.Close();
Console.Read();

}
}
}

SHARE THE KNOWLEDGE


  

Asynchronous JavaScript Technology and XML (Ajax)

Using JavaScript technology, an HTML page can asynchronously make calls to the server from which it was loaded and fetch content that may be formatted as XML documents, HTML content, plain text, or JavaScript Object Notation (JSON). The JavaScript technology may then use the content to update or modify the Document Object Model (DOM) of the HTML page. The term Asynchronous JavaScript Technology and XML ( Ajax ) has emerged recently to describe this interaction model.

Ajax is not new. These techniques have been available to developers targeting Internet Explorer on the Windows platform for many years. Until recently, the technology was known as web remoting or remote scripting. Web developers have also used a combination of plug-ins, Java applets, and hidden frames to emulate this interaction model for some time. What has changed recently is the inclusion of support for the XMLHttpRequest object in the JavaScript runtimes of the mainstream browsers. The real magic is the result of the JavaScript technology’s XMLHttpRequest object. Although this object is not specified in the formal JavaScript technology specification, all of today’s mainstream browsers support it. The subtle differences with the JavaScript technology and CSS support among current generation browsers such as Mozilla Firefox, Internet Explorer, and Safari are manageable. JavaScript libraries such as Dojo , Prototype , and theYahoo User Interface Library  have emerged to fill in where the browsers are not as manageable and to provide a standardized programming model. Dojo, for example, is addressing accessibility, internationalization, and advanced graphics across browsers — all of which had been thorns in the side of earlier adopters of Ajax. More updates are sure to occur as the need arises.

SHARE THE KNOWLEDGE


  

Difference between Dispose and Finallize method……

The .NET garbage collector manages the memory of managed objects (native .NET objects) but it does not manage, nor is it directly able to clean up unmanaged resources. Managed resources are those that are cleaned up implicitly by the garbage collector. You do not have to write code to release such resources explicitly. In contrast, you must clean up unmanaged resources (file handles, database collections, etc.) explicitly in your code.

There are situations when you might need to allocate memory for unmanaged resources from managed code. As an example, suppose you have to open a database connection from within a class. The database connection instance is an unmanaged resource encapsulated within this class and should be released as soon as you are done with it. In such cases, you’ll need to free the memory occupied by the unmanaged resources explicitly, because the GC doesn’t free them implicitly.

Briefly, the GC works as shown below:

It searches for managed objects that are referenced in managed code.
It then attempts to finalize those objects that are not referenced in the code.
Lastly, it frees the unreferenced objects and reclaims the memory occupied by them.
The GC maintains lists of managed objects arranged in “generations.” A generation is a measure of the relative lifetime of the objects in memory. The generation number indicates to which generation an object belongs. Recently created objects are stored in lower generations compared to those created earlier in the application’s life cycle. Longer-lived objects get promoted to higher generations. Because applications tend to create many short-lived objects compared to relatively few long-lived objects, the GC runs much more frequently to clean up objects in the lower generations than in the higher ones.

SHARE THE KNOWLEDGE


  

Arrays in C# .NET

The variables you have been working with so far have only been able to hold one value at a time. Your integer variables can only hold one number, and your strings one chunk of text. An array is a way to hold more than one variable at a time. Think of a lottery programme. If you’re just using single variables, you’d have to set up your lottery numbers like this:

lottery_number_1 = 1;
lottery_number_2 = 2;
lottery_number_3 = 3;
lottery_number_4 = 4;
etc

Instead of doing that, an array allows you to use just one identifying name that refers to lots of numbers.

How to set up an Array

You set up an array like this:

int[ ] lottery_numbers;

So you start with the type of array you need. In the line above, we’re telling C# that the array will hold numbers (int). After the array type, you need a pair of square brackets. There should be no space between the array type and the first bracket. After the square brackets then type a space, followed by the name you want to use for your array,lotter_numbers in our case.

If your array needs to hold floating point numbers, you’d set your array up like this:

float[ ] my_float_values;

An array that needs to hold text would be set up like this:

string[ ] my_strings

So it’s pretty much just like setting up a normal variable, except you type a pair of square brackets after int, or float, or string.

The next thing you need to do is to tell C# how big your array will be. The size of an array is how many items it is going to hold. You do it like this:

lottery_numbers = new int[49];

So the name of your array goes before an equals sign ( = ). After the equals sign, you type the word new. This tells C# that it is a new object. After a space, you need the array type again (int for us). Next comes some square brackets. This time, however, you type the size of the array between the brackets. In the code above, we’re saying that the array will hold 49 numbers.

So the two lines would be:

int[ ] lottery_numbers;
lottery_numbers = new int[49];

If you prefer, you can put all that on one line:

int[ ] lottery_numbers = new int[49];

But you’re doing two things at once, here: before the equals sign, you’re telling C# that you want to set up an array; after the equals sign, you’re creating a new array object of a particular size.

Assigning values to your arrays

So far, you have just set up the array, and created an array object. But the array doesn’t yet hold any values. (Well it does, because C# assigns some default values for you. In the case of int arrays, this will be just zeros. But they’re not your values!)

To assign a value to an array, you use the square brackets again. Here’s the syntax:

array_name[ position_in_array ] = array_value;

So you start with the name of your array, followed by a pair of square brackets. In between the square brackets, you need a position in your array. You then type an equals sign, and the value that is going in that position. Here’s an example using our lottery numbers:

lottery_numbers[0] = 1;
lottery_numbers[1] = 2;
lottery_numbers[2] = 3;
lottery_numbers[3] = 4;

First of all, note that the first position in a C# array is zero, and not 1. This is slightly confusing, and can trip you up! But we’re telling C# to assign a value of 1 to the first position in the array, a value of 2 in the second position, a value of three in the third, and so on. Just bear in mind that array positions start at 0.

Another way to assign values in array is by using curly brackets. If you only have a few values going in to the array, you could set it up like this:

int[] lottery_numbers = new int[4] { 1, 2, 3, 4 };

So we’ve set up the array the same way as before – all on one line. This time, we have a pair of curly brackets at the end. In between the curly brackets, type the values for your array, and separate each value with a comma.

In the next lesson, you’ll see how to work with arrays and loops.

SHARE THE KNOWLEDGE


  

Difference between c++ and java………

1) C++ supports pointers whereas Java does not

2) C++ supports operator overloading,multiple inheritance but java does not.

3) Java is platform independent language but c++ is depends upon operating  system, machine etc.

4) Java uses compiler and interpriter both and in c++ their is only compiler

5) C++ is more nearer to hardware then Java

6) java has premitive data type like boolean which are not available in c++

SHARE THE KNOWLEDGE


  

Media descriptors in HTML………

screen :-Intended for non-paged computer screens.

tty :- Intended for media using a fixed-pitch character grid, such as teletypes,

terminals, or portable devices with limited display capabilities.

tv :- Intended for television-type devices (low resolution, color, limited scrollability).

projection:- Intended for projectors.

handheld :- Intended for handheld devices (small screen, monochrome, bitmapped

graphics, limited bandwidth).

print :- Intended for paged, opaque material and for documents viewed on screen in

print preview mode.

braille :- Intended for braille tactile feedback devices.

aural :- Intended for speech synthesizers.

all :- Suitable for all devices.

SHARE THE KNOWLEDGE


  

Delegates in C#……………………

A delegate in C# allows you to pass methods of one class to objects of other classes that can call those methods. You can pass method m in Class A, wrapped in a delegate, to class B and Class B will be able to call method m in class A. You can pass both static and instance methods. This concept is familiar to C++ developers who have used function pointers to pass functions as parameters to other methods in the same class or in another class. The concept of delegate was introduced in Visulal J++ and then carried over to C#. C# delegates are implemented in .Net framework as a class derived from System.Delegate. Use of delegate involves four steps.

1. Declare a delegate object with a signature that exactly matches the method signature that you are trying to encapsulate.
2. Define all the methods whose signatures match the signature of the delegate object that you have defined in step 1.
3. Create delegate object and plug in the methods that you want to encapsulate.
4. Call the encapsulated methods through the delegate object.

SHARE THE KNOWLEDGE


  

%d bloggers like this: