Friday, February 29, 2008

.NET-interview question

What is the base class of .NET?
Base class provides a base set of methods that all derived classes can use

Explain assemblies.
Answer 1:
Assemblies are similar to dll files. Both has the reusable pieces of code in the form of classes/ functions. Dll needs to be registered but assemblies have its own metadata.

Answer 2:
Assembly is a single deployable unit that contains information about the implementation of classes, structures and interfaces. it also stores the information about itself called metadata and includes name and verison of the assembly, security information, information about the dependencies and the list of files that constitute the assembly.
Assembly also contains namespaces. In the .Net Framework, applications are deployed in the form of assemblies.

Answer 3:
An assembly is a single deployable unit that contains all the information about the implementation of :
- classes
- structures and
- interfaces

An assembly stores all the information about itself. This information is called METADATA and include the name and the verison number of the assembly, security information, information about the dependencies and a lost of files that constitute the assembly.
All the application developed using the .NET framework are made up of assemblies.
Namespaces are also stored in assemblies

Answer 4:
In the Microsoft .NET framework an assembly is a partially compiled code library for use in deployment, versioning and security. In the Microsoft Windows implementation of .NET, an assembly is a PE (portable executable) file. There are two types, process assemblies (EXE) and library assemblies (DLL). A process assembly represents a process which will use classes defined in library assemblies. In version 1.1 of the CLR classes can only be exported from library assemblies; in version 2.0 this restriction is relaxed. The compiler will have a switch to determine if the assembly is a process or library and will set a flag in the PE file. .NET does not use the extension to determine if the file is a process or library. This means that a library may have either .dll or .exe as its extension.

The code in an assembly is partially compiled into CIL, which is then fully compiled into machine language at runtime by the CLR.

An assembly can consist of one or more files. Code files are called modules. An assembly can contain more than one code module and since it is possible to use different languages to create code modules this means that it is technically possible to use several different languages to create an assembly. In practice this rarely happens, principally because Visual Studio only allows developers to create assemblies that consist of a single code module.

Name some of the languages .NET support?
Some of the languages that are supported by .NET
1. Visual Basic.NET
2. Visual C#
3. Visual C++

ADO.NET features? Benefits? Drawbacks?
Answer 1:
1. Data will be retrieved through Datasets
2. Scalability

Answer 2:
1. Disconnected Data Architecture
2. Data cached in Datasets
3. Data transfer in XML format
4. Interaction with the database is done through data commands

How many types of exception handlers are there in .NET?
Answer 1:
From
MSDN>gt; “How the Runtime Manages Exceptions”
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconexceptionsoverview.asp
The exception information table represents four types of exception handlers for protected blocks:
A finally handler that executes whenever the block exits, whether that occurs by normal control flow or by an unhandled exception.
A fault handler that must execute if an exception occurs, but does not execute on completion of normal control flow.
A type-filtered handler that handles any exception of a specified class or any of its derived classes.
A user-filtered handler that runs user-specified code to determine whether the exception should be handled by the associated handler or should be passed to the next protected block.

Answer 2:
1. Unstructured Exception Handling
2. Structured Exception Handling

Difference between Panel and GroupBox classes?

Security Tip

Use Firefox instead of Internet Explorer and PREVENT Spyware !


Firefox is free and is considered the best free, safe web browser available today
Get Firefox with Google Toolbar for better browsing

Answer 1:
Panel and Group box both can used as container for other controls like radio buttons and check box.
the difference in panel and group box are Panel
1) In case of panel captions cannot be displayed
2) Can have scroll bars.

Group box
1) Captions can be displayed.
2) Cannot have a scroll bar

Answer 2:
Panel is scrollable. In panel you can’t set caption like Group box.

What is the base class of Button control?
Listing from visual studio .net > Button Class
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ButtonBase
System.Windows.Forms.Button

What is Response object? How is it related to ASP’s Response object?
Response object allows the server to communicate with the client(browser). It is useful for displaying information to the user (or) redirecting the client.
Eg: Response.Write(”Hello World”)


hat is IIS? Have you used it?
IIS - Internet Information Server
IIS is used to access the ASP.Net web applications
Yes, I used in ASP.NET web applications.

Main differences between ASP and ASP.NET.
Answer 1:
1. ASP: Code is Interpreted
ASP.NET: Code is Compiled

2. ASP: Business Logic and Presentation Logic are in a single file
ASP.NET: Business Logic and Presentation Logic are in separate files (.cs or .vb) and (.aspx) respectively.
3. ASP: No Web Server Controls
ASP.NET: Web Server Controls supported by strong .NET Framework
4. ASP: No RAD in Classic ASP
ASP.NET: Supports RAD

Answer 2:
1.Asp is interpreted
Asp.net is compiled which is faster than asp.
2 Asp.net maintains its own CLR and is managed as it runs by CLR
Where as asp is unmanaged
3 We can mainatin sessions in state server and sql server which is Outproc,
where in asp sessions will be last if we restart webserver or make changes.
4 In asp.net we can configure each application using web.config file which is availble in application itself and we have machine.config wherer we can configure all applications.
In asp we cannot configure single aplication
5 Asp.net we have autopostback event which is not in asp
6 In asp.net we have global.asax where can hadle some global things which is not in asp.
7 We have well built GUI to work in asp.net
8 We have ado.net and as well as disconnected architecture in asp.net
9 We have Xcopy deployment in asp.net
10. We can work with any language as code behind technique in asp.net that supports .net frame work

Answer 3:
a) asp.net is compiled but ASP is a interpretor or script only.
b) asp.net is supported more control then the asp.
c) asp.net is more supported even control then the asp.
d) In asp.net if update any component then no need to shutdown the computer but in asp if loaded any component then need tobe shutdown the computer.
d) So lastly an asp.net is faster then asp .

C# - interview questions

How many classes can a single.NET DLL contain?
Answer2:
One or more

What are good ADO.NET object(s) to replace the ADO Recordset object?
The differences includes
In ADO, the in-memory representation of data is the Recordset.
In ADO.net, it is the dataset

A recordset looks like a single table in ADO
In contrast, a dataset is a collection of one or more tables in ADO.net

ADO is designed primarily for connected access
ADO.net the disconnected access to the database is used

In ADO you communicate with the database by making calls to an OLE DB provider.
In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source.

In ADO you cant update the database from the recordset. ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the database.


On order to get assembly info which namespace we should import?
System.Reflection Namespace

How do you declare a static variable and what is its lifetime? Give an example.

The static modifier is used to declare a static member, which belongs to the type itself rather than to a specific object. The static modifier can be used with fields, methods, properties, operators, events and constructors, but cannot be used with indexers, destructors, or types. In C#, the static keyword indicates a class variable. In VB, the equivalent keyword is Shared. Its scoped to the class in which it occurs.

Example
a. Static int var //in c#.net
b. static void Time( ) //in c#.net

How do you get records number from 5 to 15 in a dataset of 100 records? Write code.
Answer1
DataSet ds1=new DataSet();
String strCon=”data source=IBM-6BC8A0DACEF;initial catalog=pubs;integrated security=SSPI;persist” +” security info=False;user
id=sa;workstation id=IBM-6BC8A0DACEF;packet size=4096?;

String strCom1=”SELECT * FROM employee”;
SqlDataAdapter sqlDa1=new SqlDataAdapter(strCom1,strCon);
ds1.Tables.Add(”employee”);
sqlDa1.Fill(ds1,40,50,ds1.Tables[”employee”].TableName);
DataGrid dg1.DataSource=ds1.Tables[”employee”].DefaultView;
dg1.DataBind();


Answer2
OleDbConnection1.Open()
OleDbDataAdapter1.Fill(DataSet21, 5, 15, “tab”)
This will fill the dataset with the records starting at 5 to 15

How do you call and execute a Stored Procedure in .NET? Give an example.
Answer1
ds1=new DataSet();

sqlCon1=new SqlConnection(connectionstring);

String strCom1=”byroyalty”;

sqlCom1=new SqlCommand(strCom1,sqlCon1);
sqlCom1.CommandType=CommandType.StoredProcedure;
sqlDa1=new SqlDataAdapter(sqlCom1);
SqlParameter myPar=new SqlParameter(”@percentage”,SqlDbType.Int);
sqlCom1.Parameters.Add (myPar);
myPar.Value=40;
sqlDa1.Fill(ds1);
dg1.DataSource=ds1;
dg1.DataBind();

Answer2
Yes

Dim cn as new OleDbConnection ( “Provider=Microsoft.Jet.OLEDB.4.0;”+ _
“Data Source=C:\Documents and Settings\User\My Documents\Visual Studio Projects\1209\db1.mdb”+ _
“User ID=Admin;”+ _
“Password=;”);
Dim cmd As New OleDbCommand(”Products”, cn)
cmd.CommandType = CommandType.StoredProcedure

Dim da As New OleDataAdapter(cmd)
Dim ds As New DataSet()
da.Fill(ds, “Products”)
DataGrid1.DataSource = ds.Tables(”Products”)

What is the maximum length of a varchar in SQL Server?
Answer1
VARCHAR[(n)]
Null-terminated Unicode character string of length n,
with a maximum of 255 characters. If n is not supplied, then 1 is assumed.

Answer2
8000

Answer3
The business logic is the aspx.cs or the aspx.vb where the code is being written. The presentation logic is done with .aspx extention.

How do you define an integer in SQL Server?
We define integer in Sql server as
var_name int

How do you separate business logic while creating an ASP.NET application?
There are two level of asp.net debugging
1. Page level debugging
For this we have to edit the page level debugging enable the trace to true in the line in the html format of the page.

%@ Page Language=”vb” trace=”true”AutoEventWireup=”false” Codebehind=”WebForm1.aspx.vb” Inherits=”WebApplication2.WebForm1?>

2. You can enable the debugging in the application level for this
Edit the following trace value in web.config file

Enable trace enabled=true.

If there is a calendar control to be included in each page of your application, and and we do not intend to use the Microsoft-provided calendar control, how do you develop it? Do you copy and paste the code into each and every page of your application?
Create the Calendar User Control
The control we will create will contain a calendar control and a label which has the corresponding date and time written
Steps are:-

Creating a CalenderControl
1) To begin, open Visual Studio .NET and begin a new C# Windows Control Library.
2) You may name it whatever you like, for this sample the project name will be CalenderControl

Using the Calender Control in a Windows Application
It’s just like adding any other control like a button or a label.
1) First, create a new Windows Application project named: CustomControl.
2) Add a reference to the Calender Control DLL named: CalenderControl.dll.
3) Now you a can customize the Toolbox:
Right-Click the Toolbox> .NET Framework Components> Browse> select the CalenderControl.dll.
4)The Calender Control is now added to the Toolbox and can be inserted in Windows Form as any other control. The control itself will take care of the date display

Insert Stored Procedure using C#

If you are fresher to C# coding and SQL Procedure,this article will be a great useful for you to enchance your knowledge and getting ideas on how a simple application being developed.Source code for this application available for Code behind method as well as straight forward method.

Step #1,

Start your SQL SERVER on your local computer.
Goto -> Enterprise Manager - Locate your desired database or create new database

Create New Table and give the name "Secure "
add columns username and password.make it username as primary key.
Now you need to create StoredProcedure for this table for inserting record through C#.
Click on Database node,it will expand and shows its object,right click on 4th Object,storedprocedure - > New StoredProcedure -it will open up the Pop up window,type it exactly like this below

CREATE PROCEDURE InsertSP
@username varchar(12),
@password varchar(10)
AS
Begin
Insert into Secure values(@username,@password)
End
GO

and make sure all syntax are spelled correctly by clicking"Check syntax " button.

Step # 2,
In visual studio open your existing website or create new one.
Add a new form and make sure the language for the page will be "C#"

Add 2 textboxes and naming them user_name and pass_word and a button
Double click on this button,on click event handler write these code in order to execute the StoredProcedure for inserting the user input in to your database.

protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection sc = new SqlConnection("Data Source=(Local);Initial Catalog=Login;user id=sa;pwd=yourpassword");
sc.Open();
//Response.Write(sc.State);
SqlCommand smd = new SqlCommand("InsertSP", sc);
smd.CommandType = CommandType.StoredProcedure;
smd.Parameters.Add("@username", SqlDbType.VarChar).Value = Request.Form["user_name"];
smd.Parameters.Add("@password", SqlDbType.VarChar).Value = Request.Form["pass_word"];
try
{
int r = smd.ExecuteNonQuery();
if (r == 1)
{
Literal1.Visible = true;
Literal1.Text = "Successfully added!!";
}
}
catch
{
Literal1.Visible = true;
Literal1.Text = "user name already exist !";
}
smd.Dispose();
sc.Close();
}
}






Thursday, February 28, 2008

You Tube on your Smart Phone

When i am digging my Nokia E61i for new features,I found Flash player.But when I am trying to run the website http://www.thedesignzone.in/ where I made a simple flash work but i cant achieve it.
My Nokia E61i doesnt support the flash website on my browser or might be I dont know how do setting them.
Recently I came across Google's mobile blog and how do run the Youtube.com on your mobile.Amazing and unbelievable to see them on Nokia's smart phone series.
Soon I am going to make my mobile blog.
Watch this Video,Mr.Desai explain how do use mobile blog on Nokia Phones.

MSSQL - Do's and Don'ts

SQL Server DO's and DON'TsSo, you are now the leader of a SQL Server based project and this is your first one, perhaps migrating from Access. Or maybe you have performance problems with your SQL Server and don't know what to do next. Or maybe you simply want to know of some design guidelines for solutions using SQL Server and designing Database Access Layers (DAL): this article is for you.
Even if you are not using SQL Server, most of these design guidelines apply to other DBMS, too: Sybase is a very similar environment for the programmer, and Oracle designs may benefit from this too. I won't show here how to use specific T-SQL tricks, nor won't give you miracle solutions for your SQL Server problem. This is by no means a complete, closed issue. What I intend to do is give you some advices for a sound design, with lessons learned through the last years of my life, seeing the same design errors being done again and again.
DO know your tools.Please, don't underestimate this tip. This is the best of all of those you'll see in this article. You'd be surprised of how many SQL Server programmers don't even know all T-SQL commands and all of those effective tools SQL Server has.
"What? I need to spend a month learning all those SQL commands I'll never use???" you might say. No, you don't need to. But spend a weekend at MSDN and browse through all T-SQL commands: the mission here is to learn a lot of what can and what can't be done. And, in the future, when designing a query, you'll remember "Hey, there's this command that does exactly what I need", and then you'll refer again to MSDN to see its exact syntax.
In this article I'll assume that you already know the T-SQL syntax or can find about it on MSDN.
DON'T use cursorsLet me say it again: DON'T use cursors. They should be your preferred way of killing the performance of an entire system. Most beginners use cursors and don't realize the performance hit they have. They use memory; they lock tables in weird ways, and they are slow. Worst of all, they defeat most of the performance optimization your DBA can do. Did you know that every FETCH being executed has about the same performance of executing a SELECT? This means that if your cursor has 10,000 records, it will execute about 10,000 SELECTs! If you can do this in a couple of SELECT, UPDATE or DELETE, it will be much faster.
Beginner SQL programmers find in cursors a comfortable and familiar way of coding. Well, unfortunately this lead to bad performance. The whole purpose of SQL is specifying what you want, not how it should be done.
I've once rewritten a cursor-based stored procedure and substituted some code for a pair of traditional SQL queries. The table had only 100,000 records and the stored procedure used to take 40 minutes to process. You should see the face of the poor programmer when the new stored procedure took 10 seconds to run!
Sometimes it's even faster to create a small application that gets all the data, proccess it and update the server. T-SQL was not done with loop performance in mind.
If you are reading this article, I need to mention: there is no good use for cursors; I have never seen cursors being well used, except for DBA work. And good DBAs, most of the time, know what they are doing. But, if you are reading this, you are not a DBA, right?
DO normalize your tablesThere are two common excuses for not normalizing databases: performance and pure laziness. You'll pay for the second one sooner or later; and, about performance, don't optimize what's not slow. Often I see programmers de-normalizing databases because "this will be slow". And, more frequent than the inverse, the resulting design is slower. DBMSs were designed to be used with normalized databases, so design with normalization in mind.
DON'T SELECT *This is hard to get used, I know. And I confess: often I use it; but try to specify only the columns you'll need. This will:
Reduce memory consumption and network bandwidth Ease security design Gives the query optimizer a chance to read all the needed columns from the indexesDO know how your data will be/is being acessedA robust index design is one of the good things you can do for your database. And doing this is almost an art form. Everytime you add an index to a table, things get faster on SELECT, but INSERT and DELETE will be much slower. There's a lot of work in building and mantaining indexes. If you add several indexes to a table to speed your SELECT, you'll soon notice locks being held for a long time while updating indexes. So, the question is: what is being done with this table? Reading or Updating data? This question is tricky, specially with the DELETE and UPDATE, because they often involve a SELECT for the WHERE part and after this they update the table.
DON'T create an index on the "Sex" columnThis is useless. First, let's understand how indexes speed up table access. You can see indexes as a way of quickly partitioning a table based on a criteria. If you create an index with a column like "Sex", you'll have only two partitions: Male and Female. What optimization will you have on a table with 1,000,000 rows? Remember, mantaining an index is slow. Always design your indexes with the most sparse columns first and the least sparse columns last, e.g, Name + Province + Sex.
DO use transactionsSpecially on long-running queries. This will save you when things get wrong. Working with data for some time you'll soon discover some unexpected situation which will make your stored procured crash.
DO beware of deadlocksAlways access your tables on the same order. When working with stored procedures and transactions, you may find this soon. If you lock the table A then table B, always lock them in this very same order in all stored procedures. If you, by accident, lock the table B and then table A in another procedure some day you'll have a deadlock. Deadlocks can be tricky to find if the lock sequence is not carefully designed.
DON'T open large recordsetsA common request on programming forums is: "How can I quickly fill this combo with 100,00 items?". Well, this is an error. You can't and you shouldn't. First, your user will hate browsing through 100,000 records to find the right one. A better UI is needed here, because you should ideally show no more that 100 or 200 records to your users.
DON'T use server side cursorsUnless you know what your are doing. Client side cursors often (not always) put less overhead on the network and on the server, and reduce locking time.
DO use parametrized queriesSometimes I see in programming forums, questions like: "My queries are failing with some chars, e.g. quotes. How can I avoid it?". And a common answer is: "Replace it by double quotes". Wrong. This is only a workaround and will still fail with other chars, and will introduce serious security bugs. Besides this, it will trash the SQL Server caching system, which will cache several similar queries, instead of caching only one. Learn how to use parameterized queries (in ADO, through the use of the Command Object, or in ADO.NET the SqlCommand) and never have these problems again.
DO always test with large databasesIt's a common pattern programmers developing with a small test database, and the end user using large databases. This is an error: disk is cheap, and performance problems will only be noticed when it's too late.
DON'T import bulk data with INSERTUnless strictly necessary. Use DTS or the BCP utility and you'll have both a flexible and fast solution.
DO beware of timeoutsWhen querying a database, the default timeout is often low, like 15 seconds or 30 seconds. Remember that report queries may run longer than this, specially when your database grows.
DON'T ignore simultaneous editingSometimes two users will edit the same record at the same time. When writing, the last writer wins and some of the updates will be lost. It's easy to detect this situation: create a timestamp column and check it before you write. If possible, merge changes. If there is a conflict, prompt the user for some action.
DON'T do SELECT max(ID) from Master when inserting in a Detail table.This is another common mistake, and will fail when two users are inserting data at the same time. Use one of SCOPE_IDENTITY, IDENT_CURRENT, and @@IDENTITY. Avoid @@IDENTITY if possible because it can introduce some nasty bugs with triggers.
DO Avoid NULLable columnsWhen possible. They consume an extra byte on each NULLable column in each row and have more overhead associated when querying data. The DAL will be harder to code, too, because everytime you access this column you'll need to check
I'm not saying that NULLs are the evil incarnation, like some people say. I believe they can have good uses and simplify coding when "missing data" is part of your business rules. But sometimes NULLable columns are used in situations like this:
CustomerName1CustomerAddress1CustomerEmail1CustomerName2CustomerAddress2CustomerEmail3CustomerName1CustomerAddress2CustomerEmail3
This is horrible. Please, don't do this, normalize your table. It will be more flexible and faster, and will reduce the NULLable columns.
DON'T use the TEXT datatypeUnless you are using it for really large data. The TEXT datatype is not flexible to query, is slow and wastes a lot of space if used incorrectly. Sometimes a VARCHAR will handle your data better.
DON'T use temporary tablesUnless strictly necessary. Often a subquery can substitute a temporary table. They induce overhead and will give you a big headache when programming under COM+ because it uses a database connection pool and temporary tables will last forever. In SQL Server 2000, there are alternatives like the TABLE data type which can provide in-memory solutions for small tables inside stored procedures too.
DO learn how to read a query execution planThe SQL Server query analyzer is your friend, and you'll learn a lot of how it works and how the query and index design can affect performance through it.
DO use referential integrity

This can be a great time saver. Define all your keys, unique constraints and foreign keys. Every validation you create on the server will save you time in the future.

Monday, February 18, 2008

Benefits of procedures and triggers

Benefits of procedures and triggers
--------------------------------------------------------------------------------
Definitions for procedures and triggers appear in the database, separately from any one database application. This separation provides a number of advantages.
Standardisation

Procedures and triggers standardize actions performed by more than one application program. By coding the action once and storing it in the database for future use, applications need only call the procedure or fire the trigger to achieve the desired result repeatedly. And since changes occur in only one place, all applications using the action automatically acquire the new functionality if the implementation of the action changes.

Efficiency
Procedures and triggers used in a network database server environment can access data in the database without requiring network communication. This means they execute faster and with less impact on network performance than if they had been implemented in an application on one of the client machines.

When you create a procedure or trigger, it is automatically checked for correct syntax, and then stored in the system tables. The first time any application calls or fires a procedure or trigger, it is compiled from the system tables into the server's virtual memory and executed from there. Since one copy of the procedure or trigger remains in memory after the first execution, repeated executions of the same procedure or trigger happen instantly. As well, several applications can use a procedure or trigger concurrently, or one application can use it recursively.
Procedures are less efficient if they contain simple queries and have many arguments. For complex queries, procedures are more efficient.
Security
Procedures and triggers provide security by allowing users limited access to data in tables that they cannot directly examine or modify.

Triggers, for example, execute under the table permissions of the owner of the associated table, but any user with permissions to insert, update or delete rows in the table can fire them. Similarly, procedures (including user-defined functions) execute with permissions of the procedure owner, but any user granted permissions can call them. This means that procedures and triggers can (and usually do) have different permissions than the user ID that invoked them.

MS-SQL Server 2000 - Triggers

A trigger is a database object that is attached to a table. In many aspects it is similar to a stored
procedure. As a matter of fact, triggers are often referred to as a "special kind of stored procedure." The main difference between a trigger and a stored procedure is that the former is attached to a table and is only fired when an INSERT, UPDATE or DELETE occurs. You specify the modification action(s) that fire the trigger when it is created.
The following shows how to create a trigger that displays the current system time when a row is inserted into the table to which it is attached.
SET NOCOUNT ON
CREATE TABLE Source (Sou_ID int IDENTITY, Sou_Desc varchar(10))
go
CREATE TRIGGER tr_Source_INSERT
ON Source
FOR INSERT
AS
PRINT GETDATE()
go
INSERT Source (Sou_Desc) VALUES ('Test 1')
-- Results --Apr 28 2001 9:56AM
________________________________________________________________________________________
AFTER Triggers
The type of trigger that gets executed automatically after the statement that triggered it completes is called an AFTER trigger. An AFTER trigger is a trigger that gets executed automatically before the transaction is committed or rolled back.

A table can have several AFTER triggers for each of the three triggering actions i.e., INSERT, DELETE and UPDATE. Using the below script, we shall create a trigger on the table User_Master for the INSERT triggering action.

CREATE TRIGGER trgInsert2
ON User_Master
FOR INSERT
AS
BEGIN
Print ('AFTER Trigger [trgInsert2] – Trigger executed !!')
END
GO

Saturday, February 16, 2008

C# - Assembly Questions

1. How is the DLL Hell problem solved in .NET? Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.
2. What are the ways to deploy an assembly? An MSI installer, a CAB archive, and XCOPY command.
3. What is a satellite assembly? When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.
4. What namespaces are necessary to create a localized application? System.Globalization and System.Resources.
5. What is the smallest unit of execution in .NET?an Assembly.
6. When should you call the garbage collector in .NET?As a good rule, you should not call the garbage collector. However, you could call the garbage collector when you are done using a large object (or set of objects) to force the garbage collector to dispose of those very large objects from memory. However, this is usually not a good practice.
7. How do you convert a value-type to a reference-type?Use Boxing.
8. What happens in memory when you Box and Unbox a value-type?Boxing converts a value-type to a reference-type, thus storing the object on the heap. Unboxing converts a reference-type to a value-type, thus storing the value on the stack.

C# - ADO.NET and Database Questions


1. What is the role of the DataReader class in ADO.NET connections?

It returns a read-only, forward-only rowset from the data source. A DataReader provides fast access when a forward-only sequential read is needed.
2. What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?

SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix. OLE-DB.NET is a .NET layer on top of the OLE layer, so it’s not as fastest and efficient as SqlServer.NET.
3. What is the wildcard character in SQL? Let’s say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve ‘La%’.
4. Explain ACID rule of thumb for transactions.A transaction must be:1. Atomic - it is one unit of work and does not dependent on previous and following transactions.2. Consistent - data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t.3. Isolated - no transaction sees the intermediate results of the current transaction).4. Durable - the values persist if the data had been committed even if the system crashes right after.
5. What connections does Microsoft SQL Server support? Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and password).
6. Between Windows Authentication and SQL Server Authentication, which one is trusted and which one is untrusted?

Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.
7. What does the Initial Catalog parameter define in the connection string?
The database name to connect to.
8. What does the Dispose method do with the connection object?
Deletes it from the memory.To Do: answer better. The current answer is not entirely correct.
9. What is a pre-requisite for connection pooling?
Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings. The connection string must be identical.

C# - Debugging and Testing Questions

1. What debugging tools come with the .NET SDK?
1. CorDBG – command-line debugger. To use CorDbg, you must compile the original C# file using the /debug switch. 2. DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR.
2. What does assert() method do?

In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.
3. What’s the difference between the Debug class and Trace class?

Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.
4. Why are there five tracing levels in System.Diagnostics.TraceSwitcher?

The tracing dumps can be quite verbose. For applications that are constantly running you run the risk of overloading the machine and the hard drive. Five levels range from None to Verbose, allowing you to fine-tune the tracing activities.
5. Where is the output of TextWriterTraceListener redirected?

To the Console or a text file depending on the parameter passed to the constructor.
6. How do you debug an ASP.NET Web application?

Attach the aspnet_wp.exe process to the DbgClr debugger.
7. What are three test cases you should go through in unit testing?

1. Positive test cases (correct data, correct output).2. Negative test cases (broken or missing data, proper handling).3. Exception test cases (exceptions are thrown and caught properly). Can you change the value of a variable while debugging a C# application? Yes. If you are debugging via Visual Studio.NET, just go to Immediate window.

C# - Event,Delegates & XML

1. What’s a delegate?
A delegate object encapsulates a reference to a method.
2 What’s a multicast delegate?
A delegate that has multiple handlers assigned to it. Each assigned handler (method) is called.
3. Is XML case-sensitive? Yes.
4. What’s the difference between // comments, /* */ comments and /// comments? Single-line comments, multi-line comments, and XML documentation comments.
5. How do you generate documentation from the C# file commented properly with a command-line compiler? Compile it with the /doc switch.

C# - Method and Property Questions

1. What’s the implicit name of the parameter that gets passed into the set method/property of a class? Value. The data type of the value parameter is defined by whatever data type the property is declared as.
2. What does the keyword “virtual” declare for a method or property? The method or property can be overridden.
3. How is method overriding different from method overloading? When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class.
4. Can you declare an override method to be static if the original method is not static? No. The signature of the virtual method must remain the same. (Note: Only the keyword virtual is changed to keyword override)
5. What are the different ways a method can be overloaded? Different parameter data types, different number of parameters, different order of parameters.
6. If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

Friday, February 15, 2008

C# - Class related interview questions

1. What is the syntax to inherit from a class in C#? Place a colon and then the name of the base class.Example: class MyNewClass : MyBaseClass
2. Can you prevent your class from being inherited by another class? Yes. The keyword “sealed” will prevent the class from being inherited.
3. Can you allow a class to be inherited, but prevent the method from being over-ridden?Yes. Just leave the class public and make the method sealed.
4. What’s an abstract class?A class that cannot be instantiated. An abstract class is a class that must be inherited and have the methods overridden. An abstract class is essentially a blueprint for a class without any implementation.
5. When do you absolutely have to declare a class as abstract?1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden. 2. When at least one of the methods in the class is abstract.
6. What is an interface class?Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes.
7. Why can’t you specify the accessibility modifier for methods inside the interface?

They all must be public, and are therefore public by default.
8. Can you inherit multiple interfaces?Yes. .NET does support multiple interfaces.
9. What happens if you inherit multiple interfaces and they have conflicting method names?It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate
10. What’s the difference between an interface and abstract class?In an interface class, all methods are abstract - there is no implementation. In an abstract class some methods can be concrete. In an interface class, no accessibility modifiers are allowed. An abstract class may have accessibility modifiers.
11. What is the difference between a Struct and a Class?Structs are value-type variables and are thus saved on the stack, additional overhead but faster retrieval. Another difference is that structs cannot inherit.

Thursday, February 14, 2008

LG to roll out Android phone by early 2009



LG Electronics plans to start selling a phone model running on Android, the highly anticipated mobile phone operating system, at the start of next year at the latest, a senior official said.
"We will bring it out late in 2008 or early 2009," Chang Ma, LG's vice president for marketing strategy told Reuters in an interview at the Mobile World Congress trade show.
LG is part of a group of about 30 companies that said they would support Google's operating system, which is based on Linux, an open-source software platform.
Service provider Deutsche Telekom's T-Mobile and Taiwanese phone maker High Tech Computer have both said they plan to sell phones based on Android this year.

Novel technology doubles cell phone memory through software alone

Washington, Sept 28 (ANI): Computer engineers at Northwestern University and NEC Laboratories America, Inc. have jointly developed a technology that doubles the usable memory on cell phones and other embedded systems without any changes to hardware or applications.
Embedded systems are computers within devices not generally considered to be computers, such as cell phones, cars, iPods, medical devices and digital cameras.


The scientists made the improvement in the operating system software alone.
"All the things you do with a cell phone or personal digital assistant require memory. The technology we've developed automatically takes data and reduces it to less than half its original size without losing any information while the embedded system is running," said Robert P. Dick, assistant professor of electrical engineering and computer science in Northwestern's Robert R. McCormick School of Engineering and Applied Science.


"It is like putting twice as much memory in the phone without increasing it's cost or power consumption," he said.

In early 2004, NEC Labs researchers conceived the concept of integrating compression technologies into the operating system itself to provide compression as an operating system service.

Finally, the researchers were successfully able to complete the design of CRAMES (compressed RAM for embedded systems), a software-only compression infrastructure technology that has minimal performance and power consumption penalties.

The team's approach was to divide the memory in the system into two different regions, one regular and one where the data is greatly compressed.

A very simple example of data compression is converting a list of 50 individual "A"s into the phrase "50 As", which takes up less space but communicates the same information. Later on this can be converted back to an identical copy of the original text.

The software applications run along normally, but whenever an application needs data from the compressed region, the hardware pauses the software to allow the operating system to access the data, uncompress it and put it into the regular region where the application can access it.
According to the researchers, the application continues running without ever knowing the data it needed was compressed. (ANI)

Wednesday, February 13, 2008

I justify " Raj Thackeray " was correct.But not his action.!

I justify " Raj Thackeray " was correct.But not his action.!
Please readout this point mindfully.
1,Maharashtra Navnirman Sena (MNS) leader Raj lashed out at Amitabh for his loyalty to Uttar Pradesh. Addressing a function at Dharavi, Asia’s biggest slum, on Friday night, he said the actor took more interest
in UP rather than Mumbai (Maharashtra) where he achieved superstardom.
Is it true ? if anyone(including Raj Thackeray) lashed out against Amitabh that will be considered as attack or remark against the North Indians ?
2,"I heard that Raj Thackeray owns huge properties in Maharashtra...In Mumbai...Kohinoor Mills.its statement uttered by Jaya bachhan.
As "Raj Thackerey replied to " that She (Jaya Bachaan aware the core real estate value on Kohinoormill and aware of who it was belonged to ? ")
Still I am wonder any one who intent to land aquisition or purchasing them before doesn't know about A to Z of the land and its owner?
Amithab's conscience will never spare him,the farmer's land acqusition in Maharastra and Utter pradesh and trying to enjoy the previlages under " Farmers " category..World knows this great sitcom.
Really Jaya bachaan doesn't know who is "RaJ Thackeray " ?
I am sure she was uttered this statment to insult Raj Thackeray.! World I mean,Indians[North Indian & South Indian] know the meaning of this .
But these are should be considered as the personal vendetta between her family Vs Raj Thackeray.
She should not think her personal issue with Raj Thackeray as tussel with Maharastrian Vs Immigrants(North Indians either South Indians).
She shouldn't have played her card with Samajwadi Party's behalf.It caused common man has to severly(taxi drivers,veg.vendors and etc..)
As our great politician " Lalu Prasad Yadav " mentioned "Raj was a lad in political game " . yes !Of course I accept he was a child...But He will become a great leader soon in Maharastra.
Personally I suggest Raj Thackeray played his card wisely and with little care on Amitabh's matter,he should drag this scnario as his personal war where as not tussel between Maharastrians and North Indians and and strongly opposed personelly..
If he does,there will be handfull support from NCP and some segment of Congress.
Anyhow its does not matter,Raj Thackeray stamped his role verily strong in Maharastra's political.
Think Big Raj Thackeray in coming election(s)...

The next best thing to winning is losing! At least you've been in the race.



10 smarter ways to use your smart phone

10 smarter ways to use your smart phone Wed, Feb 6 01:27 PM
By Kishore Bhargava Livemint.com
Mobile phones have come a long way since 1973 when Motorola's Martin Cooper made the world's first mobile phone call to an AT&T Bell Labs researcher walking on the streets of New York. The prototype Motorola DynaTac, from which the call was made, then weighed almost a kilogram. In the mid-1980s, the first generation mobiles that proliferated the markets were almost the size of a suitcase, were designed more for cars, and were too costly.
Today's cellphones are no longer just communication devices, but truly converged gadgets that come loaded with a long list of applications: from a high-resolution camera to an audio player, digital diary, and even a radio in the basic configuration. Very often you don't even know all the goodies that are loaded into your phone. If you have a smart phone and want to use it more smartly, read on.
1. Sync over the Internet
Are you one of those who is perpetually worried about losing your cellphone one day, and with it all the contact details in it? If so, you can use the PC Suite that comes with most phones these days to manage contacts on your PC. With in-built Bluetooth or infrared in the phone, you don't even need the cable for this. You can also manage your contact details online. Check out two such sites:
www.mobical.net and www.zyb.com.
2. Internet phone calls
VOIP (Voice over Internet Protocol) has been around for a long time. In its simplest form, all you need to make calls either from a PC-to-PC for free, or even PC-to-landline or PC to mobile for nominal rates is a PC, Internet connection, a headset and a microphone. So what has all this got to do with your cellphone?
Many smart phones now come equipped with a SIP stack: these are built-in software to make PC-to-PC calls. Once configured, you just treat your cellphone as one PC and make your calls. The address book in many phone models also has an option called “Internet telephone"" So, adding your contacts is not difficult either. Now, to make PC-to-landline or PC-to-mobile calls, all you need to do is to subscribe to a service. Check out one of the SIP providers at
www.voipbuster.com.
3. Mobilized content
A smart way to use your phone for reading content on the Internet is to use RSS feeds and widgets. Many sites today automatically detect the browser or the device type, and display content accordingly. You can also install a few widgets on your phone.
The good thing is that many cellphone manufacturers are waking up to the fact that they need to create specialized content for their phones and setting sites to cater to this requirement. Check out
www.widgets.com and www.mosh.nokia.com.
4. SMS conversations
Power email users always want to see the entire message as a thread, and that too neatly displayed. A similar feature has made its way into cellphones. Normally, termed conversations, you can see the entire thread of what you send and receive. It is very neat and well organized.
5. Groups
One of the many gems on most smart phones today is the group feature. It's often ignored, but if put to use, it can be extremely useful and time saving. You need to create a group and a single SMS, with a unique ringtone, will go to all the team members. You can even initiate a conference call with the team by calling the group.
And finally, once the providers introduce the push-to-talk facility, you can define a group for that too.
6. Visual radio
The built-in FM Radio on cellphones has certainly revived radio in many ways. But when you add to it "visual" radio, it is a totally new experience. Visual radio essentially is a data stream supporting the radio channel. It has photos of the RJ, artists, quizzes and other interactive activities to enhance your listening experience. Visit
www.visualradio.com for more information on how to set-up your handset.
7. Presentation remote
With the right software on your phone, you can now use it as a remote control for your presentations. No mouse or the laptop required to change the slides. All you need is to download the software and start using your phone as the remote. In fact, you can also use your phone as a universal remote for a host of other devices, including the home theatre system, air conditioner, music system, TV and much more. Log on to
http://irremote.psiloc.com/ to download the remote software.
8. WorldMate
It is a must-have on your PDA. WorldMate has multiple clocks, a Weathercaster, a currency converter, flight schedules and even a suitcase packing list manager. Interestingly, the moment you are online, WorldMate automatically updates all of its offerings. WorldMate is now available on a number of phones and PDAs. Log on to
http://mobimate.com/.
9. Don't get lost
The next time you are lost, use the GPS navigation in your phone to find your way back home. The GPS on cellphones sometimes requires you to get an additional Bluetooth GPS device. But in some new phones, even this is built-in. The phones now also make use of the cell towers to get a more accurate reading of its global positioning: It is almost as accurate as 2m. Add to that a simple application such as GoogleMaps and you won’t need to ask for directions again.
10. Voice butler
Normally, you talk into your phone and hear only what the caller has to say. But what if your phone decided to start talking to you? From reading out your messages, phone numbers, menus on the screen it can handle it all.
The voices are still a little robotic but for someone who would prefer to listen to an SMS than read it, the possibility already exists.
The next time you want to make that call, just pick up the phone, speak out the name of the person you want to talk to and your phone will take care of the rest.

Monday, February 11, 2008

Domain registrant's fradulent.

To,
Cyber crime investigation officer,Mumbai

Respected Sir,

I am Murugesa Pandian.SP freelance web designer and programmer, Last year I register the domain name
www.redutkarsh.com with one reseller from Mahim.When I am looking to renewal of the same
domain, I came to know that reseller from Mahim was not available and untraceable.

Meanwhile I got a call from one guy from Nagpur and asked me to renewal of this domain.
When I am intend to pay the charges Rs 360 /- for one year extension.

He asked me to pay for Rs 500/-.Actually now a days domain available for Rs180 to 330.
I confront with him over this charge. While I converse with him over the phone he abused me as I am a mental and he was a CYBER LAWYER and owner of

http://www.nagpurtrade.com/
and
http://www.nagpurtrade.info/


his phone number is : 9881133100

When I am sending multiple emails to his all email ids,all of them bouncing.

I asked him not to renew the domain and let it expire itself. He black mailing me that I should pay Rs 360 for which I paid for one year while I am registered this domain.

And he could block my domain name and re-registering this domain on his name. He illegally take over the control of his reseller whom I register the domain last year. hats why he was talking rude and unprofessional manner.

Regarding this, if you require some information i am willing to come there.

I request your high command, Please do the justice..!

Yours sincerely,
SP.Murugesa Pandian.

Thursday, February 07, 2008

India's N-deal with US

US to continue cooperation with India to complete N-deal

Washington: The United States today said it will "continue cooperation" with India to achieve the goal of getting the Indo-US civilian nuclear agreement completed.White House Deputy Press Secretary Tony Fratto was asked in his briefing as to where the two sides stand on the accord given that Washington's pointsman for the deal, Under Secretary of State for Political Affairs Nicholas Burns, is scheduled to depart the State Department by the end of March.

"We'll continue our cooperation in order to achieve that goal of getting the agreement completed," Fratto said.Burns is stepping down from the Foreign Service at the end of March but US Secretary of State Condoleezza Rice said that he will continue in the capacity of an Envoy on the civilian nuclear deal.Political analysts here have cautioned that the deal is running out of time and that the ball is in India's court to move it along.

The warning to the Indian political establishment has also been that the civilian nuclear arrangement has its best chances in a Bush administration and the deal stands a very difficult time to get through a White House with a Democratic President and a fully Democrat-controlled Congress.

Tuesday, February 05, 2008

General Questions - C#

General Questions

1. Does C# support multiple-inheritance? No.

2. Who is a protected class-level variable available to?

It is available to any sub-class (a class inheriting this class).
3. Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.

4. Describe the accessibility modifier “protected internal”.
It is available to classes that are within the same assembly and derived from the specified base class.

5. What’s the top .NET class that everything is derived from? System.Object.

6. What does the term immutable mean?

The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.

7. What’s the difference between System.String and System.Text.StringBuilder classes?

System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

8. What’s the advantage of using System.Text.StringBuilder over System.String?StringBuilder is more efficient in cases where there is a large amount of string manipulation. Strings are immutable, so each time a string is changed, a new instance in memory is created.

9. Can you store multiple data types in System.Array?
No.

10. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?

The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array. The CopyTo() method copies the elements into another existing array. Both perform a shallow copy. A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array. A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object.

11. How can you sort the elements of the array in descending order?

By calling Sort() and then Reverse() methods. 12. What’s the .NET collection class that allows an element to be accessed using a unique key?HashTable.

13. What class is underneath the SortedList class?
A sorted HashTable.

14. Will the finally block get executed if an exception has not occurred?­Yes.

15. What’s the C# syntax to catch any possible exception?A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.

16. Can multiple catch blocks be executed for a single try statement?

No. Once the proper catch block processed, control is transferred to the finally block (if there are any). Explain the three services model commonly know as a three-tier application.Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources).

Saturday, February 02, 2008

Interuption on net connection next 10 - 15 days

Damage to the trans-Atlantic submarine (undersea) cables will continue to slow down Internet traffic and affect IT-BPO firms for another 10 to 15 days across India, even as Indian telecom operators say they are diverting traffic over alternate routes.

The voice operations (call centres) of IT-BPO firms —which comprise around 20-30 per cent of most firms in India — will be the most affected since the International Private Leased Circuits (IPLCs) are down. An IPLC is a point-to-point private line used by an organisation to communicate between offices that are dispersed throughout the world.

Submarine cables are laid beneath the sea to carry telephone and Internet traffic. They can be broken or damaged by fishing trawlers, anchoring, undersea avalanches and even shark bites. In 2006, an earthquake centred near Taiwan had severed several undersea cables, and Internet services slowed to a crawl across major parts of Asia. This time around, a storm struck the Egyptian coast on January 30, making it impossible for ships to dock at the Alexandria port.

This prompted some of the ships to anchor off seas, and it is believed a ship dropped its anchor right on the top of the submarine cable channel. The multi-country consortium cable SEA-ME-WE-4 (SMW-4) and Reliance Communications-owned Flag cable systems were mainly affected. Bharti Airtel and Tatas-owned Videsh Sanchar Nigam Ltd (VSNL) are Indian consortium partners and cable landing operators of SMW-4.

The companies admitted to the disruption, but added that traffic was being moved over to another consortium cable, SMW-3, which was put up by 90 countries. Other consortium cables like SAT-3 and SAFE were also believed to be affected.
Apart from India, Sri Lanka, the UK, Bangladesh and Pakistan, the Gulf countries (serviced mainly by Flag), and Europe (SMW-4) were also affected. Egypt was the most affected. In India, “there has been a 40 to 50 per cent cut in bandwidth,” according to Rajesh Chharia, president of the Internet Service Providers’ Association of India.

The big operators have transferred their broadband connectivity through the Pacific route, he said, adding: “there’s an urgent need to create more capacity so that these problems do not recur”. Smaller BPOs did admit they were badly affected but did not wish to go on record.

The larger ones said they have built-in redundancy that does not make them very vulnerable. For instance, Keshav R Murugesh, president and COO, Syntel, admitted that “there was some problem. But we have connections from both the Pacific and Atlantic routes so if one route is affected the load automatically gets transferred on the other route”.

Those firms that have delivery centres around the world will not be affected as much since they can divert some work to other centres. Moreover, a considerable amount of high-end analytics work can be done offline. Explained Integreon senior vice-president (knowledge operations), Lokendra Tomar: “We have four ISPs to cater to our requirements. This builds in redundancy. Besides, we have moved some of our work to our other delivery centres. Hence, we can mitigate the effect to quite an extent.” “While risk diversification on the Internet and IPCL connectivity is a costly option, this outage will particularly hit companies which have not prepared for such an eventuality,” noted Alok Shende, head (IT and telecom), Ovum India.

Repairing a broken undersea cable Find the location of the accident; drag the damaged part to the surface, and replace it with a new stretch of cable May also send light pulses along the fibers in the cable to determine the exact location A working fiber will transmit those pulses all the way across the ocean; a broken one will bounce it back The telecom operator then sends out a large cable ship with a few miles of fresh fibre-optic lines If the faulty part of the cable is less than about 4,000 feet down, a submersible robot can be sent The robot finds the right place; grabs hold of the cable; cuts out the malfunctioning section, and pulls the loose ends back up to the ship Robots do not work in very deep water.

In such cases, technicians use a grapnel to cut the cable and hold it A skilled technician (jointer) splices the glass fibers; uses adhesives to attach the new section of cable The repaired cable is then lowered back to the seabed on ropes