Friday, December 28, 2007

How Compilers Work?

If you ask software engineers about how the compiler works? Most of them give you an alien look.

Here is how the compiler works :

How to: Get Table names and column names in SQL Server

1. Following Query displays all the table names.


Query : select name from sys.objects where type='u' ;

2. Following Query displays all the columns in a table

Query : select Table_Name,Column_Name from INFORMATION_SCHEMA.COLUMNS ;

Thursday, December 27, 2007

Displaying "Last updated" date on websites

Use this javascript code to display "Last Updated" date.

document.write("Last Updated on:") ;
document.write(document.lastmodified) ;

Difference between Visibility & Display in CSS

CSS has two properties for hiding the contents. Those are

1. Visibility
values: inherit visible hidden ;
2. Display
values: block none inline list-item ;

Both Visibility and Hidden are used to hide the information, but when you use Visibility to hide, browser still takes up the space in layout and displays blank space.

Whereas if you use Display to hide the information, browser will removes the element completely from the document and it doesn't show any blank space in that location, even though the HTMl for it is still in the source.


Use : Using these properties you can create effects of collapsible panel.

Wednesday, December 19, 2007

Natural Language Programming?

http://blogoscoped.com/archive/2007-12-10-n69.html

Google directory assistance

You might have heard about Google's Service Called Directory Assistance 1-800-GOOG-411 service] .

The main intention of this services is to collect a bunch of different speech samples. This is used in Speech to Text Conversion, which simplifies the task for video search and audio search.

For more details read the following article posted on http://blogoscoped.com/archive/2007-12-17-n30.html

Thursday, December 13, 2007

Reindexing the entire sql server database

How To: Re index Entire database

Applies to : SQL Server 2000/ 2005

Recently i moved some database to new server and wanted to reindex entire Sql Server database, as people were complaining about slow response for our .NET WinForms application.

I thought it might save some body's hours of time who is searching for the solution.
Problem :
You want to increase the performance of your database so you move Sql Server from one machine to another machine which has higher capacity than the older one. But after migration users start complaining that their application response is slow.

Soultion :
This is what i done to solve the above problem. I read somewhere that re indexing and reorganizing will help to improve some performance. So here is how to do it.

System Stored Provedure : sp_MSforeachtable

This proc returns one or more rows for each table (optionally, matching @where), with each table defaulting to its own result set.

EXEC [sp_MSforeachtable] @command1="DBCC DBREINDEX('?')"

To see progress messages while it is running, try this version:

EXEC [sp_MSforeachtable] @command1="RAISERROR('DBCC DBREINDEX(''?'') ...',10,1) WITH NOWAIT DBCC DBREINDEX('?')".

You can Re index the Live Databases as well.
Each table will be locked up for the duration of the reindexing. Users will be locked out if they are hitting that table.

If you know any other solution to such problems then please share it here so that it helps people to solve such problems.

Wednesday, December 05, 2007

C# : Interview Questions

This is second in series of Interview Questions for .NET Application developer position.

C#

* Does C# supports multiple inheritence?
* What is a delegate?
* What are setallite assemblies?
* Differences between Namespace, Class, Assembly?
* What is the difference between managed and unmanaged code?
* What is serialization?
* What’s a bubbled event?
* What is garbage collection? How dot net handles the garbage collection?
* Can we force garbage collector to run ?
* What is concept of Boxing and Unboxing ? Do we have the same problem in c# 2.0? if no how it is resolved? What are generics?
* What happens in memory when you Box and Unbox a value-type?
* What are the ways to deploy an assembly?
* What is the difference between the value type and reference type? Do we have value type in dot net?
* What different types of JIT compliler do we have?
* What’s a multicast delegate?

C# 2.0

* What are the partial classes? Where we can use them?
* Any idea of LINQ project?
* What are generics?


C# Distributed Application

* What different option do we have for creating distributed applications in dot net?
* What is a thread? What is multithreading?
* What is deadlock? How we can elimate the risk?
* This data structure is "Thread Safe" what does that mean?
* What are locks and why we need them? When working with shared data in threading how do you implement synchronization ?
* What are sockets? What is the difference between TCP and UDP sockets?
* Any idea of Windows Communication Foundation?
* What is the difference between a thread and a process? Can a process have multiple threads?
* How we can communicate betweem two processes?
* What is the procedure of communicating between two threads?
* What's Thread.Join() in threading ?
* What are the different states of a thread?

ASP.NET : Interview Questions

Following are the ASP.NET interview questions usually asked for experienced people.
* What is View State? Can you read the View State?
-- It is ASP.NET State Management Technique to persist changes to the state of a Web Form across post backs. It stores the data in the form of Dictionary (i.e., in Key /Value Pair).
--The Control.ViewState property is associated with each server control in your web form and provides a dictionary object for retaining values between such multiple requests for the same page.
--This is the method that the page uses to preserve page and control property values between round trips.
-- You can use ViewState to store any object as long as it is serializable .
-- Data is stored in Base 64 Encoding
--It is not encrypted by default.
-- The view state of a page is, by default, placed in a hidden form field named __VIEWSTATE.
* Can we disable the view state application wide? Can we disable it on page wide?
-- Yes, in web.config file add this line
<configuration>
  <system.web>
    <pages enableViewState="false" />
  </system.web>
</configuration>



* Can we disable it for a control?
-- Yes, set enableViewState=false for the control.
* What is Serialization ?
-- Serialization is the process of storing an object's data and other information necessary to reconstruct the object later.
* What is the difference between encoding and encryption? Which is easy to break?
Encoding --the process of converting a digitized file into a streaming format. or the activity of converting from plain text into code or is the process of transforming information from one format into another.
Encryption-- is the process of transforming information (referred to as plaintext) using an algorithm (called cipher) to make it unreadable to anyone except those possessing special knowledge, usually referred to as a key.
Encoding is easy to break.
* What are the Data Access Components provided by Microsoft?
-- SqlProvider , OledbProvider, odbcProcvider, oracleProvider
* Any idea of Enterprise library?
-- Enterprise library is a set of tools developed by Microsoft for enterprise development using .NET.
* What is web service?
-- Web Service is a software system designed to support interoperable Machine to Machine interaction over a network. Web services are frequently just Web API’s that can be accessed over a network, such as the Internet, and executed on a remote system hosting the requested services.
* What is WSDL?
-- Web Services Description Language.
-- is an XML-based language that provides a model for describing Web services.
* Can a web service be only developed in ASP.NET?
-- No.
* Can we use multiple web services from a single application?
--
Yes, you can use.
* Can we call a web service asynchronously?
-- Yes. Web Services support both synchronous and asynchronous communication between the client application and the server hosting the service.
* Can a web service be used from a windows application?
- Yes.
* What do we need to deploy a web service?
-- WSDL, SOAP, UDDI.
* What is the significance of web.config?
--- It is a ASP.NET Configuration file
--- File format is XML so it is stored as text and it is easy to modify.

* Can we have multiple web.config files in a sigle web project?--- Yes but not in single folder.
* Type of ASP.NET Authentications?
-- Windows, Forms, Passport, Custom.
--
Windows authentication: - In this methodology ASP.NET web pages will use local windows users and groups to authenticate and authorize resources.

Forms Authentication: - This is a cookie based authentication where username and password are stored on client machines as cookie files or they are sent through URL for every request. Form-based authentication presents the user with an HTML-based Web page that prompts the user for credentials.

• Passport authentication :- Passport authentication is based on the passport website provided
by the Microsoft .So when user logins with credentials it will be reached to the passport website ( i.e. hotmail,devhood,windows live etc) where authentication will happen. If Authentication is successful it will return a token to your website.

Anonymous access: - If you do not want any kind of authentication then you will go for Anonymous access.

* Can we have multiple assemblies in a single web project?
--- Yes.
* What is GAC?
--- Global Assembly Cache
---- Shared assemblies are stored here
---- You can access it in this path C:\WINNT\assembly or C:\WINDOWS\assembly
* What is machine.config?
--- It is a Machine Wide ASP.NET Configuration File.
--- It is stored in C:\WINNT\Microsoft.NET\Franework\[Framework Version\CONFIG or C:\windows\Microsoft.NET\Franework\[Framework Version\CONFIG

* What different types of session state Management we have in asp.net?
--- InProc, StateServer, SQLServer
* What are cookies?
--- It is a small text file stored in Browser Cache.
---- cookies are used for authenticating, tracking, and maintaining specific information about users, such as site preferences or the contents of their electronic shopping carts.

* What is Cache?
-- A web browser or web server feature which stores copies of web pages on a computer's hard disk.
* What is AJAX?
--- Asynchronous JavaScript and XML
--- It is a Set of interrelated Technologies mainly consisted of xHTML, JavaScript, XML,
* Is
AJAX a language?
--- No, it is a set of interrelated technologies.
* What is an Assembly?
-- Single Deployable unit
-- EXE or DLL.
--- Unit of Execution
--- is a partially compiled code library for use in deployment, versioning and security.
--- It can consist of one or more files.
* Can an assembly contain more then one class?
-- Yes
* What is strong name?
-- A strong name consists of the assembly's identity—its simple text name, version number, and culture information (if provided)—plus a public key.

* What is the difference b/w client and server side?
-- Client Side :Code is executed in Client Machine
--- Server Side: Code is executed at Server Side.

* What is the purpose of IIS?
-- IIS is a Web Server, which handles HTTP Requests and helps in authentication.
* Difference between http and https?
--- HTTP is not secured HTTPS is secured.
* What is purpose of aspnet_wp.exe?
-- aspnet_wp.exe is a ASP.NET worker process whose role is to process requests, such as processing requests to return a ASP.NET page, invoking an ISAPI extension or filter.

* What do you mean by HTTP Handler?
--- They are used to handle different types of page extensions.
* What is the purpose of Global.asax?
--- It is used to handle application wide events.
* What is the difference between the inline and code behind?
--- inline: You can write your server side code and UI in same file.
--- code behind: Contains logic of the application.

* What is side by side execution?
-- You can run two versions of application simultaneously.
* Can we have two different versions of dot net frameworks running on the same machine?
--- Yes.
* What is CLR?
--- Common Language Runtime
--- It is .NET Run time environment, which has features such as Automatic Memory Management, Garbage Collection, Versioning, Security.
* What is CLI?
--- Common Language Infrastructure
-- It is an open specification (published under ECMA-335 and ISO/IEC 23271) developed by Microsoft that describes the executable code and runtime environment that form the core of a number of runtimes including the Microsoft .NET Framework, Mono, and Portable.NET.
* What is CTS?
-- Common Type System
--- CTS cover the range of topics related to type handling. These topics include type safety, cross-language sharing of typed data, type behavior and features, and performance.

* What is .resx file meant for?
-- This is a Resource File.
--- It is an XML based file, with key value pair.
-- It is used in Localization and Globalization
* Any idea of aspnet_regiis?
-- It is a ASP.NET registration

* Any idea of
ASP NET State Service?
--- It is an Out of Process Session State management.
--- Session state is stored in separate process (i.e, aspnet_state.exe).

* What is the difference between stroed procedure and stored function in SQL?
-- Both functions and stored procedures can be custom defined and part of any application. Functions, on the other hand, are designed to send their output to a query or T-SQL statement. For example, User Defined Functions (UDFs) can run an executable file from SQL SELECT or an action query, while Stored Procedures (SPROC) use EXECUTE or EXEC to run.
Stored procedures are designed to return its output to the application. A UDF returns table variables, while a SPROC can't return a table variable although it can create a table. Another significant difference between them is that UDFs can't change the server environment or your operating system environment, while a SPROC can. Operationally, when T-SQL encounters an error the function stops, while T-SQL will ignore an error in a SPROC and proceed to the next statement in your code (provided you've included error handling support).
If you have an operation such as a query with a FROM clause that requires a rowset be drawn from a table or set of tables, then a function will be your appropriate choice. However, when you want to use that same rowset in your application the better choice would be a stored procedure.
* Can we have an updateable view in SQL?
-- Views in SQL Server are usually thought of as read-only select statements; however it is actually possible to build a view to be updatable as well. This allows you to modify the data in the tables the view is based on through insert, update and delete statements on the view. Normal views provide the ability to abstract the physical data model (table) into a logical data model (view); updatable views take this one step further by allowing all CRUD data access to be done though one interface (updatable view).

* What is connection pooling? how can we acheive that in asp.net?
-- Connection pooling behavior is controlled by the connection string parameters. The following are four parameters that control most of the connection pooling behavior:
* Connect Timeout - controls the wait period in seconds when a new connection is requested, if this timeout expires, an exception will be thrown. Default is 15 seconds.
* Max Pool Size - specifies the maximum size of your connection pool. Default is 100. Most Web sites do not use more than 40 connections under the heaviest load but it depends on how long your database operations take to complete.
* Min Pool Size - initial number of connections that will be added to the pool upon its creation. Default is zero; however, you may chose to set this to a small number such as 5 if your application needs consistent response times even after it was idle for hours. In this case the first user requests won't have to wait for those database connections to establish.
* Pooling - controls if your connection pooling on or off. Default as you may've guessed is true.
* What is DataSet?
-- is an in-memory cache of data retrieved from a data source,
-- is a major component of the ADO.NET architecture.

* What is the difference between typed and untyped dataset?

* What is the difference bewteen accessing the data throgh the dataset and datareader?
-- Data Reader is forward only, read only access method and it is faster compared to dataset.
-- Dataset is a in memory representation of Database, accessing it is slower compared to dataset.

I request those who read this to send the interview questions which they feel should be included. And also request all to add good answers to the questions.
Keywords to find this page from Google: .net interview questions,.net interview multiple choice,.net experinced interview questions,c# interview questions,asp.net interview questions,asp.net session interview questions,c# . net + interview questions for experienced hand,c# generics interview question,c# interview questions box unbox,c# software developer interview questions,c# web interview,common it interview question .net,dot net interview questions

Monday, December 03, 2007

Identity

For much of history, people lived in small communities, where everyone knew them, and they knew everyone. Identity was largely inherited and imposed, and the ability of people to re-invent themselves was quite limited. You were father, farmer, drunkard, and everyone knew it.

The big city changed all that, by offering anonymity and choice. Against the background of anonymity, people can choose their identity, or choose multiple identities, often by choosing the community of other people with whom they live, work or play. In the city, you can choose to cultivate multiple identities: to mingle with bankers or toddlers by day, to play rugby or poker by night, to socialize with rabbis or lesbians, and to do all this while choosing how anonymous to remain. Maybe you’re happy to use your real name with your bank colleagues, but delight in the anonymity of a large nightclub. And you can share different parts of your identity with different communities, and none of them need to know about the other parts, if you don’t want them too: work and home, family and friends, familiarity and exploration, the city allows you to create your identity against a background of anonymity.

Like the city, but on a much, much bigger scale, the Web allows people to create multiple digital identities, and to decide whether to use their “real” identity, or pseudonyms, or even complete anonymity. With billions of people online, and with the power of the Internet, people can find information and create virtual communities to match any interest, any identity. You may join a social networking site with your real names or your pseudonyms, finding common interests with other people on any conceivable topic, or exploring new ones. You may participate in a breast cancer forum, by sharing as much or as little information about yourself as you wish. You may explore what it means to be gay or diabetic, without wanting anyone else to know. Or you may revel in your passion to create new hybrids of roses with other aficionados. The Web is like the city, only more so: more people, more communities, more knowledge, more possibility. And the Web has put us all in the same “city”, in cyberspace.

Life is about possibilities: figuring out who you are, who you want to be. Cities opened more possibilities for us to create the identities we choose. The Web is opening even more.