ThinkDigit.com - Think Digital

Posted by DreamBig | 11:09 PM

ThinkDigit.com - Your Online Technology Navigator

ThinkDigit.com - managed by 9dot9 Media is one of the hottest Tech Sites around.

For any of your tech related issues like software/hardware reviews,updates,issues,downloads & etc..,ThinkDigit.com is the place to be. The site includes various sections like Product Reviews,discussion forums,blog watch,downloads,free classified ads,videos,tech Q&A,iPoll & Subscribe.

Out of all this sections I personally would recommend you to visit the Product Reviews sections - which has some excellent hardware & software products reviews - Be it laptops,mobiles,digicams,CPUs,Motherboards, or anything you can get a perfect review for it.

Another must visit section are the discussion forums - For any of your tech queries the entire online tech community is there to help you - Like a hardware or software problem,buying tips,etc..

Visit the discussion forums here - http://http://www.thinkdigit.com/forum/

The best of the lot is the Classifieds sections where anyone can post free classified ads - for buying or selling products new & used like laptops,mobiles,digicams,Desktop PCs,Memory cards,CPU's & anything techy..

Visit the free classified ads section here - http://www.thinkdigit.com/digital_market.php

It also includes an introductory advertising offer:

Introductory classifieds advertising offer:

1. Online advertising offer for Rs. 5,000:
a. 125 x 125 pixels banner ad in the classifieds section of thinkdigit.

2. Combo Pack advertising offer(thinkdigit and in Digit Magazine) for Rs. 8,000:
a. 125 x 125 pixels banner ad in the classifieds section of thinkdigit.
b. 6 x 9 cm ad spot in the Digit magazine in either of the two sections:
i. Classified
ii. Web-Watch (Classified section for online businesses)

For any advertising enquiries in print or online, please contact us at business@thinkdigit.com

A great way to promote your products & services.

Also you can directly subscribe to the Digit Magazine online from the Subscribe section.

Although the site is cool but one improvement If I had to suggest would be that It's a Tech site so they should be more futuristic with their wes site design & approach & use the latest technology.

Other than that the information that ThinkDigit is providing is awesome...

So all you guys out there...dont miss to visit & register to ThinkDigit.com

Read More...

Forum NOKIA DEVELOPER CONFERENCE '2009, INDIA

Posted by DreamBig | 8:43 PM






It's back...Forum Nokia Developer Conference 2009, in Bangalore on January 20th, 2009..

Nokia Developer Conference 2009 is a movement by Forum Nokia to share and demonstrate the technological advancements & opportunities in the field of Mobile VAS.

With the rapid expansion of mobile phones, tele-density and Next Generation Network (NGN) services many more such novelties are in store for Indian population with mobile phone services and broadband services at the centre of innovation. Telecommunications had traditionally been a voice communication service. The services today have moved beyond their fundamental role of voice communications to a spectrum of non-core services, which in telecommunication parlance is called Value Added Services (VAS).

While we are witnessing an unprecedented growth in the Mobile space, the time is conducive for the developers (Mobile & IT) to dream, leverage the growth by creating applications that benefits millions. Dream. Create. Benefit

In all, Nokia Developer Conference 09 promises to bring developers a Forum where best minds in the industry meet and discuss the evolution of the MOBILE VAS INDUSTRY and what the future holds. Hence, from trends to technology to developer evangelization, you can expect all at the Nokia Developer Conference 2009.

So, whether you are a IT or Mobile Application developer, an aggregator, an operator, a content provider, a game developer, an IT or Internet company, a publisher, a retailer or even an analyst, You can’t afford to miss the Infinite Possibilities at Nokia Developer Conference 2009.


Meet the industry experts and have a networking lunch with your peers at Nokia Developer Conference 2009. You even stand a chance to win cool mobile and other gifts from Forum Nokia.

Register Now to avail special discounts and be a part of INFINITE POSSIBILITIES.


It's time to dream big and explore infinite possibilities — and it's time to benefit from these possibilities. Register at Nokia Developer Conference 2009 for technology presentations, solutions to mobile application developers challenges, insights from industry experts, growth projections for the mobile industry, and more. Nokia Developer Conference 2009 is where real stories and original thinking will be shared, where collaborations can lead to innovation, and where you can bond with like-minded peers, create partnerships, and benefit in a big way.

There will be sessions on whole lot of topics which include Mobile VAS Industry & its future.
Also the evolution of Mobile Technology like the technology used by mobile application developers (Java,Symbian,OpenSource & others) ,its advents & what all applications can be developed using them, with industry experts & experienced developers showcasing their talent & expertise. On the whole a lot of things that no one can miss it.

So be there to experience it.

Click to Register & know the details.

Visit http://www.nokiadevcon.in & http://www.nokiadevcon.in/session.html for further details.

Read More...

New official .net logo: "wave"

Posted by DreamBig | 11:22 PM


Reading Scott Hanselman's post I've learned that, during PDC 2008, the 8-year old .net logo was updated.

I think "the wave" is very cool!

NewDotNetLogo

Read more on why did they do it?

Now It's time to update all business cards with the brand new logo.

Read More...

Get free Microsoft software, DreamSpark India Open

Posted by DreamBig | 8:34 PM

DreamSpark is an excellent initiative by Microsoft to enable students access premium Microsoft software at no charge. We have already seen its roll out in other countries.

DreamSpark India is live and kicking now. It allows students in India to download Microsoft developer and design tools at no charge. Students can access software like: Microsoft Visual Studio 2008, Windows Server 2003, SQL Server 2005, Microsoft Expression Studio.

Here is simple procedure to get going:

  • Select and Visit partner location near your place.
  • Show your college ID card & collect software DVD.
  • Then get verified & enter 25 digit key found on the DVD.
  • Login using Live ID and complete verification process.
  • Download License keys from DreamSpark website.

DreamSpark is great opportunity to get Microsoft software free and play around with it on your home computer. You might just find something real interesting while working with the software. This may even define your future career / profession, all this will cost just $0 (oops - Rs0)!


Read More...

Two approaches to redirection in ASP.NET

Posted by DreamBig | 9:23 PM

Directing a user to another page or resource is a common aspect of a web application. The user may initiate the transfer to another page any number of ways, including clicking a button or link or selecting a value in a drop-down list.

ASP.NET provides a few ways to move to different pages. Here's a look at these options, along with commentary on when you should use which approach.

Client vs. server

A key aspect of the various ways to send a user to another page within an ASP.NET application is where the transfer occurs; that is, it is handled within the client browser or on the web server. The following list outlines options for controlling page navigation.

  • Response.Redirect: the Redirect method of the Response object provides a way to implement client-side redirection.
  • Server.Transfer: the Transfer method of the Server object performs redirection using the server and avoiding HTTP requests.
  • Server.Execute: the Execute method allows you to call another URL without actually navigating to the page. The page is executed and control returns to the current page when finished.

Let's take a closer look at each approach.

Response.Redirect
The default behaviour of the Response.Redirect method is execution of the current page halts, and the user is sent to the new URL. The web server issues HTTP headers and sends a 302 response to the client browser; this instructs the client to make redirected calls to the target URL. The result is two server requests for each redirection: the original and redirected requests. The following C# snippet shows it in action:

Response.Redirect("http://www.news.com");

Now, the Redirect method has two signatures with the second format accepting another Boolean parameter that signals whether execution of the current page should terminate (the default behaviour). We could tell the system to continue execution of the current page while redirecting the user to the News.com site with the following snippet:

Response.Redirect("http://www.news.com", false);

Server.Transfer
The Server.Transfer method transfers the execution of a target URL to the server and halts execution of the current page. The result is only one request (as opposed to the two involved with the Response.Redirect method) since the server does not notify the client browser of the change. The experience can be a little disconcerting for users since the page address does not change in the browser. This C# snippet shows how you may use this method.

Server.Transfer("/default.aspx");

When using Server.Transfer, the target URL must be a virtual path on the same server since the web server's worker process is used, so you can't use an address containing "http" or "https". It has three signatures, with a second variation allowing you to transfer control to an IHttpHandler and the third adding a second parameter to the first version; whereas, the second value is a Boolean signalling whether the current form's querystring and Form collections are preserved.

The PreviousPage property of the Page class provides code access to properties of the previous page in the browsing session, so Form and querystring variables are persisted between pages whereas they are not when using Response.Redirect.

Server.Execute
The Server.Execute is a bit antiquated, as there are other ways to accomplish the task, but it basically allows you to execute a resource request without leaving the current page. It has five signatures, but the basic version accepts a path to a resource as the following snippet displays:

Server.Execute(ResourcePath);

Pros and cons of each approach

Redirecting a user to another web resource is feasible in ASP.NET using one of the techniques discussed. However, you may be wondering why you would choose one approach over the other. The following list covers some of the advantages or disadvantages of Server.Transfer and Response.Redirect.

  • AJAX usage: the lack of browser interaction with the Server.Transfer method means it may break some AJAX and/or JavaScript functionality.
  • Bookmarking: since Server.Transfer does its work on the server, the address within the client browser is not updated. The user sees the previous page's address while viewing a new page. Consequently, the user is unable to bookmark certain pages.
  • Page refreshes: there is an issue when a true value is used with the second parameter of the Server.Transfer method. When users refresh a page located via this approach, it can trigger an invalid ViewState error message. This can be alleviated by disabling the enableViewStateMac property on a page, but this isn't the best approach to security.
  • Performance: Response.Redirect introduces an extra call while making the round trip between client and server; since there is only one call with Server.Transfer, it offers better performance.
  • Scalability: the extra round trips associated with using Response.Redirect are often stated as a drawback with using it. However, I have seen it used in large applications without experiencing any performance issues.
  • Errors: while Server.Transfer can cause some user confusion as the URL displayed in the browser address bar, it can also lead to some confusion with error logging, as the page URL recorded during logging will display incorrectly.
  • Basic security: an interesting twist with using Server.Transfer is the ability to send data to another page without the user seeing it. This is enabled via the use of the QueryString, which is appended to the end of the target address. This new address will not show in the browser address bar with Server.Transfer, so it offers a simple layer of security. Of course, the Response.Redirect approach makes the QueryString visible to the user.

Usage depends on the situation

ASP.NET offers plenty of options when tackling a development task. The Response.Redirect and Server.Transfer methods provide two ways to redirect users to new URLs. Each method offers its own set of positive attributes, so deciding which one to use is really up to the developer's preference.

Which approach do you prefer when implementing such functionality in your applications? Have you had situations in which Server.Transfer caused problems with the user community? Share your thoughts with the Web Developer community.

Read More...

I m now a MCPD...

Posted by DreamBig | 4:43 AM

Just last week I completed the MCPD Certification for Web Application Developer.

It was gr8 learning....

If anybody need help feel free to ask...


Read More...

Microsoft .NET Terminologies at a Glance

Posted by DreamBig | 9:57 PM

This article defines many important terminologies that are related to Microsoft .NET so as to enable the reader to have a ready guide to the technical terms. Terminologies related to Microsoft .NET Framework, ASP.NET, ADO.NET, XML, Biztalk Server, etc. are covered. This will also help readers prepare themselves to go into interviews confidently.

Overview

My objective in designing this article is to put an end to the arduous struggle of an IT professional seeking an understandable resource for the core terminologies of Microsoft.NET. Let me save you valuable time and energy by providing you with an article that gives you many of the important terminologies in Microsoft .NET and its related technologies. This article discusses most of the important terminologies related to Microsoft .NET Framework, ASP.NET, ADO.NET, Remoting and Web Services. The terminologies are not organized in an alphabetical order, rather they are organized in the order of the categories that they belong to.

The Common Language Specification

This is a subset of the Common Type System (CTS) and defines a set of conventions that are targeted at language interoperability of all the languages that run within the .NET environment.

The Common Type System

The Common Type System (CTS) is a standard that defines the necessary rules for type interoperability for the languages targeting the .NET environment. The common type system supports the following types.

· Value Types

· Reference Types

.NET Framework Class Library

The .NET Framework Class Library (FCL) is a set of managed classes that are responsible for providing access to the system services in the managed environment of Microsoft.NET.



The Common Language Runtime

The CLR is a runtime execution engine of .NET that provides an environment to execute programs that are targeted at the .NET platform. It provides memory allocation, security, code verification, type verification, exception handling and garbage collection in the managed environment.

Common Language Infrastructure

The Common Language Infrastructure or the CLI provides support for language interoperability in the .NET managed environment. It is comprised of the following features.

· A File Format (PE)

· Metadata

· MSIL

· Base Class Library

Assembly

An assembly is a group of resources and types, along with the metadata about those resources and types, deployed as a single unit.

Just In Time Compiler

The Just In Time Compiler or the JIT is responsible for compiling units of code and caching them at runtime as and when they are needed. Since the compilation occurs at runtime, it is known as a Just In Time Compilation.

MSIL

A program compiled in the .NET managed environment generates an intermediate code to support platform independence. This is called the MSIL or Microsoft Intermediate Language.

Strong Name

A Strong Name is a unique identifier given to an assembly using cryptography and a digital signature that is used to identify a particular assembly. An assembly is provided a strong name using the utility called sn.exe.

A strong name consists of the following.

· Name of the Assembly

· Digital Signature

· Version Number

· Culture Information

Global Assembly Cache

The Global Assembly Cache is a system wide storage of shared assemblies. Assemblies can be stored or moved to and from the Global Assembly Cache using a tool called GacUtil.

Managed Code

A managed code is one that provides restricted access to the system’s resources and can be executed only in a managed environment that is provided in Microsoft .NET by the Common Language Runtime.

Un-Managed Code

An Un-Managed code is one that executes outside of the Common Language Runtime environment and can perform unsafe operations.

Managed Data

Managed Data refers to the objects that are created by the Common Language Runtime environment and can be garbage collected implicitly by the Garbage Collector.

Shared Assembly

A Shared Assembly is one that can be referred by more that one application. All shared assemblies should contain a strong name and should be located in the Global Assembly Cache (GAC).

Private Assembly

A Private Assembly is one that is private to one application. In other words, it can be accessed by the containing application only.

Satellite Assembly

When you wish to localize the application, it can be written in culture-neutral code and can distribute the localized modules in separate assemblies called satellite assemblies.

Assembly Manifest

The Assembly Manifest contains the information about an assembly. This includes the version number of the assembly, the list of the files that comprise the assembly, etc. An assembly manifest is contained in the dll file or the exe file itself.

Resource

A resource refers to an addressable unit of data that is available for use by an application. It consists of one or more of the following.

· Texts

· Files

· Documents

· Images

· The .NET tool called resgen.exe is used to create resource files from the resource information that is stored in text or XML files.

Localization

Localization is the practice of designing and developing software that will properly use all of the conventions defined for a specific locale. An assembly that is used to provide localization feature in ASP.NET applications is referred to as a Satellite Assembly.

Native Image Generator

This is a .NET tool that is used to compile a managed assembly to the native code and then store that in the local assembly cache. The name of this tool is Ngen.exe.

Value Type

A value type is one that contains the value rather than the reference and is stored in the stack memory. Examples of value types are integers, floats, doubles, structures, etc.

Reference Type

A reference type contains a reference to the actual object in memory and is stored in the managed heap. Objects of classes are good examples of reference types.

Boxing

Boxing refers to the conversion of a value type to a reference type. Value types are stored in the stack and reference types are stored in the managed heap.

Un-Boxing

This refers to the conversion of a reference type to a value type.

Garbage Collection

Garbage Collection is a technique introduced in Microsoft .NET that manages memory cleanup implicitly. This implicit reclaiming of memory in the .NET managed environment is handled by the Common Language Runtime.

Dispose Method

The Dispose method can be used in an unsealed class to cleanup resources explicitly. It should be noted that both the Dispose and the Finalize methods should make a call to their parents' respective methods after they have disposed or finalized their own members. A class that needs to have this method implemented should implement the IDisposable interface.

Finalize Method

The finalize method is a protected member of the Object class and is implicitly called at the runtime to cleanup unmanaged resources before the object is destroyed.

Code Verification

This is a feature that enforces type safety or type security by checking the code prior to its execution in the run time environment. Therefore, it does not allow malicious code to get executed in the managed environment.

Authentication and Authorization

This is a security measure that is used to specify the user’s identity and authorization in ASP.NET. The process of authorization determines whether an authenticated user has access to a specific resource. Authentication and Authorization details of an ASP.NET application are specified in the web.config file. There can be three types of authentication in ASP.NET.

· Forms Authentication

· Windows Authentication

· Passport Authentication

Web.Config File

The web.config file is the configuration file for an ASP.NET web application. Typically, the following information is stored in a web.config file.

· Database Connection Strings

· Security

· Session States

· Impersonation

· Error handling

Machine.Config File

The machine.config file contains the configuration settings for the entire application and is located in the Config sub-folder of the Microsoft .NET installation directory.

ASP.NET

ASP.NET is a language neutral, interoperable, server-side technology that allows creation, execution and deployment of scalable Web Applications and Services.

Caching

Caching is a feature that stores the data in the memory for serving the incoming requests from the memory itself. Caching in ASP.NET can be of three types.

· Page Output Caching

· Page Fragment Caching

· Data Caching

Singleton Pattern

A singleton pattern states that we can have a singleton class that can be instantiated only once in the application domain and provides a global point of access to it.

Application Domain

An application domain refers to the logical and physical boundary created around every .NET application. An application domain is created by the Common Language Runtime and supports execution of multiple .NET applications in the same process by isolating them in different application domains.

View State

This is a client-side state management technique that continues the state of server controls by maintaining the state of pages across postbacks. The view state is an encoded hashed string and is stored in a hidden field called __VIEWSTATE.

Session State

A session is the period of a connection between a server and a client. The Session State allows storage of objects in a user’s session. A session can be stored in one of the following ways.

· InProc

· State Server

· SQL Server

Application State

This is a state management technique that allows objects to be stored and then globally accessed or shared by multiple modules of the application. In ASP.NET, application state is maintained by the class HttpApplicationState.

Interface Definition Language (IDL)

The Interface definition Language (IDL) defines a protocol between the server and the client so that they can communicate in heterogeneous environments.

Universal Description, Discovery and Integration (UDDI)

Universal Description, Discovery and Integration is a platform independent, XML based, distributed directory that allows the enterprises to list themselves over the internet. The UDDI business registration contains the following features.

· Green Pages

· White Pages

· Yellow Pages

Web Service Description Language (WSDL)

The Web Service Description Language (WSDL) defines XML based contract services for describing the network services as a collection of communication end points. A WSDL document contains the following.

· Messages

· Operation

· Types

· Service

· Port and its type

Simple Object Oriented Protocol (SOAP)

This is an XML-based protocol that is used to exchange structured data and type information in a distributed environment.

Web Services

A web service is SOAP based, platform–independent software component that exposes itself through open communication channels of the web applications running on potentially different platforms.

Remoting

Remoting allows two processes, a Server and a Client, to inter-communicate in the same system, the same network or across networks. In Remoting, a server and client communicate using a Channel.

Service Oriented Architecture

Service Oriented Architecture is an architecture that provides a seamless Enterprise Information Integration between loosely coupled distributed applications or services over the network.

Service

A service is an implementation of a well-defined, self-contained, independent business functionality that accepts one or more requests and returns one or more responses through a well-defined, standard interface.

Smart Client Architecture

The Smart Client Architecture is a deployable, multi-platform architecture that allows local application to connect to a server based application using web services. It provides an adaptive and rich user interactive experience by using local resources. A Smart Client application can work in both connected and disconnected modes.

ADO.NET

ADO.NET is an object oriented data access technology that enables you to access data from a managed environment. It is essentially a collection of some classes used to communicate between an application and a database.

Connection Pool

A Connection Pool is a pool of available or ready-to-use connections. When a new connection is requested it is served from the connection pool if one exists. If not, a new connection is created. Connection Pooling improves the performance of applications to a large extent.

DataProvider

A DataProvider encapsulates the protocols that ADO.NET uses to interact with different types of databases.

DataSet

The DataSet is an in–memory, disconnected, XML compliant representation of the data. Data in a DataSet can be changed, unlike a DataReader which is read only.

DataReader

A DataReader is a connected, forward only, read only stream of data that is retrieved from the database.

DataAdapter

The DataAdapter is a bridge between the DataSet and the underlying database. It provides a set of methods and properties to move data between a database and its in-memory representation, the DataSet.

DataView

A DataView is a class that provides a customized view of the DataSet. It is typically used to sort or filter the rows.

Command

The Command object is used to send the SQL Statements to the database. Commands are used to insert data, retrieve data and execute stored procedures in the database.

Connection

The Connection object establishes a connection to the database using the user name, password and the database name as parameters.

Transactions

A transaction is a block of statements that guarantees that all or none of the statements in the block are executed. In ADO.NET, a transaction can be started by using the BeginTransaction() method on the currently active Connection. To commit the transaction, the method CommitTransaction() is used. In order to abandon the transaction, the method Rollback() is executed.

Serialization

This refers to the storage of an object into a persistent storage medium in a stream of bytes. The opposite is de-serialization and is used to retrieve a serialized object from a storage medium.

Reflection

This is a feature that allows us to inspect the metadata of an assembly at runtime. Reflection can be used to retrieve metadata information, such as the following.

· Classes

· Methods

· Properties

· Events

Biztalk Server

This is a set of Microsoft Server Applications that allow integration, automation and management of different server applications.

Exchange Server

This is a set of Microsoft Server Applications that are responsible for integrating messaging and data storage technologies.

Commerce Server

This is Microsoft’s Business Server that is used for managing and developing business web sites.

Array

An array is a collection of homogenous objects. It is a group of elements of the same type that share a common name. The size of an array is fixed and cannot be changed at runtime.

ArrayList

An ArrayList is a collection of heterogeneous elements- elements of different types. Unlike an array, its size can be changed dynamically.

HashTable

A HashTable is a collection of heterogeneous objects that can be referred using either an index or a key. Elements of an ArrayList can be referred to using an index only.

COM+

COM+ or COM Plus is a distributed, transactional, component-based technology that can be used in a multi-tiered architecture and provides support for Object Pooling.

Delegate

A delegate is a managed function pointer that refers to a method. A multi-cast delegate is one that points to and can eventually fire off different methods. A delegate is used to implement event handling in Microsoft .NET.

Event Handler

An event handler is a method that is executed in response to an event.

Exception

An exception is an event that is generated as a result of a runtime error. An exception is handled using the exception blocks. An exception that cannot be handled is referred to as a fatal exception and causes the flow of execution of the current program to terminate unexpectedly.

Try/Catch Block

A try/catch block is used in exception handling and provides a mechanism to trap runtime errors that can occur on execution of the application. A try block contains the code that can generate a runtime error. The catch block contains statements that are executed once the appropriate exception has occurred. A try block can contain one or more catch blocks or a finally block.

Finally Block

A finally block is one that is executed irrespective of whether an exception occurs or not. Typically, it is used in Exception Handling mechanism to release resources.

Namespace

A namespace refers to a logical grouping of types or identifiers used in a program.

References

An Insight into ADO.NET

Remoting in .NET

Understanding Assemblies

Caching in ASP.NET

Microsoft .NET Architecture

Service Oriented Architecture

Conclusion

Microsoft .NET is a vast technology and it is rather impossible to discuss all the terminologies in a single article. This article has highlighted the most important ones that are commonly faced in an interview. Please post your comments and suggestions. Happy reading!


Read More...

I am now MCP & MCTS

Posted by DreamBig | 4:46 AM

I cleared my MCP & MCTS exam last month. Learned a lot of new things.
The main benefit I got are :

Understanding the different new concepts that usually do not come in practice.
but if you know you will like to use it in regular programming.

While reading the MS self paced book i got clear view of


· Developing applications that use system types and collections.
· Implementing service processes, threading, and application domains in a .NET Framework application.
· Embedding configuration, diagnostic, management, and installation features into a .NET Framework application.
· Implementing serialization and input/output functionality in a .NET Framework application.
· Improving the security of .NET Framework applications by using the .NET Framework security features.
· Implementing interoperability, reflection, and mailing functionality in a .NET Framework application.
· Implementing globalization, drawing, and text manipulation functionality in a .NET Framework application.

Read More...

6 Useful Visual Studio Tweaks You Need To Know

Posted by DreamBig | 3:22 AM

Here is a list of 6 Visual Studio tweaks you can do to make your development experience much better:

Show shortcut keys in screen tips:

Go to Tools->Customize and choose the Toolbars Tab. This screen pops up-

image

check the “Show Shortcut Keys in Screen Tips” Checkbox.



Now, when you put your mouse on a toolbar button, a tooltip with the operation shortcut appears. This is very useful since you can see what the keyboard shortcuts are and you don’t have to remember all of them by heart (read about 10 Visual Studio Shortcuts You Must Know). This is how it looks:

image

Show line numbers:

If you want to see your code with line numbers, go to Tools->Options->TextEditor->C# and check the “Line Numbers” checkbox.



image

Put conditions on breakpoints:

There is a possibility to tell the debugger not to stop on a breakpoint every time. You can add a condition to the breakpoint and the debugger will stop there only when this condition is met. This is very useful when debugging a code that is continuously called (by a timer, …). All you need to do is right click on a specific breakpoint, choose Condition and the following window appears:

image

As you can see there are two radio button options:

  • Is true: You can write any code that would compile inside an If statement and the debugger will stop only when this code returns true.
  • Has changed: The debugger will stop only when the specified variable has changed.

Locate in solution explorer:

When your solution contains many projects with many files, it may be difficult to locate the edited file in the solution explorer. By default, there is no selected item in the solution explorer. To change that default behavior, go to Tools->Options->Projects and Solutions and check the “Track Active Item in Solution explorer” checkbox.

Open XAML instead of designer:

When opening windows forms file- the designer is opened, when opening XAML (WPF) file- the designer and the XML editor are opened with half and half layout. In Visual Studio 2005, you may find the WPF designer very annoying (it may be very slow and it doesn’t function properly) and you want only the XML editor to open when a XAML file is loaded. What do you do? right click on the file in the solution explorer, choose the “Open with” menu item. Choose XML Editor option and click on the Set As Default button:

image

Show output window when build starts:

In order to have the output window opened every time a build starts, go to Tools->Options->Projects and Solutions and check the “Show Output window when build starts” checkbox:

image

That’s it, I hope you found this list interesting and helpful. Do you know more Visual Studio tweaks? That would be great if you could add your comments and extend this list for the usage of us all… What do you say?


Read More...

Upgrade yourself from the world of coding

Posted by DreamBig | 1:51 AM

How does one build a successful technical career?

THE other day, I met a bright young engineer in MindTree and asked him what his ambition was. He was very clear. "I want to be an architect". My next question to him was, what does he read? He looked surprised and then replied that he does not read much outside what appears on a computer screen. My next question to him was whom all does he admire in MindTree among the three best architects? He named the predictable three. Then I told him what the fundamental gap was between him and the best three. It was about the ability to make intelligent conversation about any subject under the sun - a capability borne out of serious reading habits.

The next thing I asked him

to do was to poll these three on what were the six books they had read last. The result was amazing. The three named eighteen books in all - of which at least six were common. Ninety percent of the books had nothing to do with information technology. The exercise proves a key point - to be a great nerd, one has to have inteerests outside writing code. However, many engineers think that the path to a great technical career is about technical skills alone.

Long back, Bell Labs conducted an interesting study - closely watching the common characteristics among a group of technical professionals who rose to the top. The exercise revealed nine key factors outside just technical competence that differentiated brilliant technical folks from the masses. The study was conducted by Robert Kelly of Carnegie Mellon and Janet Caplan of Williams College. As I see the Indian industry today, I think the study done at Bell Labs remains relevant in every detail.

The Bell Labs engineers who did extremely well for themselves - as they progressed in their career, showed the following qualities that differentiated them from their peers: taking initiative, cognitive ability, networking, leadership, teamwork, followership, perspective, organisation savvy and show-and-tell capability. Let us look at each of these and see what lies underneath.

1) Taking initiative

This is about accepting responsibility above and beyond your stated job. It is about volunteering for additional activities and promoting new ideas. None of these will jump out as apparent as a young engineer gets in to her first job. She will tend to think that her career progress is really dependent only on the ability to write code. The concept of initiative begins by looking for technical and other opportunities in the organisation and volunteering for them. The idea of volunteering is little understood - both by organisations and individuals. In the days to come, it will gain increasing prominence in our professional lives.

Initiative is also about two other things - dealing constructively with criticism and planning for the future. The latter is a function of many things - a good starting point is to start mappinng the environment, learning to understand how the future is unfolding and then stepping back to ask, how am I preparing myself?

2) Cognitive abilities

The concept of cognitive development is about understanding the interplay of technology and trends in how they are getting deployed. It is also about recognising the business eco-system in which technology works. It is about situational understanding and consequence thinking. The importance of consequence thinking is very critical. It asks us to look beyond the immediate deliverable of a task and it is about asking who will be impacted by my work, what is the end state? People in our industry just think in terms of modules and seldom ask where is it going, who is my customer and more importantly - who is my customer's customer? Cognition is a key faculty that determines how much we are able to read patterns, make sense of things. Refining cognitive skills helps us to go beyond stated needs of our customers to explore unstated needs.

3) Networking

We tend to think of networking in a social sense. As one grows higher in life, we are often as powerful as is our network. Building a professional network requires us to step out of the comfort zone to look at whom can I learn from. Quite often, and more as one progresses in life, the learning has to come from unusual sources. At MindTree, we expose our people to social workers, architects, graphic designers, teachers, people who lead government organisations, leaders from client organisations. The interesting thing about benefiting from a network is that it works like a savings bank. I need to deposit in to it before I withdraw. We all have heard about how important internal and external knowledge communities are. Again, in MindTree, we encourage people to belong to 26 different knowledge communities that run on a non-project based agenda and are vehicles of learning. These create networking opportunities and open many doors.

4) Leadership

Next to networking is development of leadership skills. Many technical people associate it with "management" and shy away from developing key leadership skills like communication, negotiation, influencing, inter-personal skills, business knowledge, building spokespersonship and so on. Take for instance negotiating as a skill. Imagine that you are an individual professional contributor. Why should you learn to negotiate? Tomorrow, your organisation becomes member of a standard body and you have to represent the organisation as a technical expert. You will find yourself needing to negotiate with powerful lobbies that represent a competing viewpoint or a rival standard. Unless you have honed your capability alongside your hacking skills, you will be at a complete loss. Yet, you do not discover your negotiating capability one fine morning. You need to work on it from an early stage. Negotiating for internal resources is becoming another critical need. You can choose to remain an individual professional contributor but from time to time, you have to create mind share in the organisation where resources are limited and claimants are many. Establishing thought leadership is another key requirement of growth and independent of whether I want to be a technical person or grow to be a manager, I need to develop as a leader who can influence others.

5 ) Teamwork

Our educational system does not teach us teamwork. If you ever tried to solve your test paper "collaboratively" - it was called copying. You and I spent all our school and college life fiercely competing to get the engineering school and seat of our choice. Then comes the workplace and you suddenly realise that it is not individual brilliance but collective competence that determines excellence. Collaboration is the most important part of our work life. Along with collaboration come issues of forming, norming, storming, performing stages of team life. Capability to create interdependencies, capability to encourage dialogue and dissension, knowledge sharing become critical to professional existence. All this is anti-thesis of what we learn in the formative years of life. Add to it, our social upbringing - our resource-starved system tells us to find ways and means to ensure self-preservation ahead of teamwork. In Japan, the country comes first, the company (read team) comes next and I come last. In India, it is the other way round.

6) Followership

The best leaders are also great followers. We can be great leaders if we learn and imbibe the values of followership. Everywhere you go - there are courses that teach leadership.

Nowhere you will find a business school teaching you followership. Yet, when solving complex problems in life, we have to embrace what is called "situational leadership". I have to be comfortable being led by others, I must learn to trust leadership. Many people have issues reporting to a test lead as a developer, or being led by a business analyst or a user interface designer. In different parts of a project life cycle, people of varied competence must lead. I must be comfortable when some one else is under the strobe light. I must have the greatness to be led by people younger than I, people with a different background or a point of view. That is how I learn.

7 ) Perspective

This is the hardest to explain. It begins with appreciating why I am doing what I am doing. Quite often, I find people having a very narrow view of their tasks; many do not see the criticality of their task vis-à-vis a larger goal. So, a tester in a project sees his job as testing code or a module designer's worldview begins and ends with the module. He does not appreciate the importance of writing meaningful documentation because he thinks it is not his job or does not realise that five years from now, another person will have to maintain it.

I always tell people about the story of two people who were laying bricks. A passer by asked the first one as to what he was doing. He replied, "I am laying bricks".
He asked the second one. He replied, "I am building a temple". This story explains what perspective is and how the resultant attitude and approach to work can be vastly different.

8) Organisational savvy

As technical people grow up, they often feel unconnected to the larger organisation. Some people develop a knack of exploring it, finding spots of influence, tracking changes, creating networks and in the process they learn how to make the organization work for them. The organisation is not outside of me. If I know it well, I can get it to work for me when I want. Think of the difference between one project manager and another or one technical lead from another.
One person always gets the resources she needs - the other one struggles. One person knows who is getting freed from which client engagement and ahead of time blocks the person. One person reacts to an organisational change and finds himself allocated to a new project as a fait accompli - another person is able to be there ahead of the opportunity. Larger the organisation, higher is the need to develop organisation savvy. It begins with questioning ones knowledge about the larger business dynamic, knowing who does what, tracking the work of other groups, knowing leaders outside of my own sphere and a host of other things. Importantly, it is also about tracking what the competitors of the organization are doing and keeping abreast of directional changes.

9) Show and tell

This is the bane of most Indian software engineers. We all come from a mindset that says; if you know how to write code, why bother about honing communication skills? Recently, we asked a cross section of international clients on what they think is the number one area of improvement for Indian engineers? They replied in unison, it is communication. Show and tell is about oral and written communication. Some engineers look down upon the need for communication skills and associate it with people who make up for poor programming prowess. It is the greatest misconception. Think of the best chief technology officers of companies like Microsoft, Oracle, IBM Global Services or Sun. Their number one job is evangelizing.

If they cannot forcefully present their technologies, nothing else will matter. So, every engineer must pay attention to improving the ability to present in front of people, develop the ability to ask questions and handle objections. In a sense, if you cannot sell the technology you create, it has no value. So, building salespersonship is a key requirement for technical excellence.

The foregoing points are not relevant if you have already filed your first patent at the age of eighteen.

Everyone else, please take note.

Read More...

Introduction to 3-Tier Architecture

Posted by DreamBig | 9:25 PM

Introduction

As a developer, the .NET framework and Visual Studio present many choices for choosing the right architecture, from placing the data access code directly in the UI through datasets and data source controls, to creating a data access layer that talks to the database, all the way to creating an n-tier architecture approach that consists of multiple layers, and use data-transfer objects to pass data back and forth.

If you’ve ever wondered why you should use layers and what the benefits are, this article is for you. This article delves into the use of layers and how they can benefit any application.

What is a Layer?

A layer is a reusable portion of code that performs a specific function. In the .NET environment, a layer is usually setup as a project that represents this specific function. This specific layer is in charge of working with other layers to perform some specific goal. In an application where the presentation layer needs to extract information from a backend database, the presentation would utilize a series of layers to retrieve the data, rather than having the database calls embedded directly within itself. Let’s briefly look at the latter situation first.

Two-Tier Architecture



When the .NET 2.0 framework became available to the world, there were some neat features that allowed the developer to connect the framework’s GUI controls directly to the database. This approach is very handy when rapidly developing applications. However, it’s not always favorable to embed all of the business logic and data access code directly in the web site, for several reasons:

  • Putting all of the code in the web site (business logic and data access) can make the application harder to maintain and understand.
  • Reusing database queries in the presentation layer often isn’t done, because of the typical data source control setup in the ASP.NET framework.
  • Relying on the data source controls can make debugging more difficult, often due to vague error messages.

So in looking for an alternative, we can separate the data access code and business logic into separate “layers”, which we’ll discuss next.

The Data Layer

The key component to most applications is the data. The data has to be served to the presentation layer somehow. The data layer is a separate component (often setup as a separate single or group of projects in a .NET solution), whose sole purpose is to serve up the data from the database and return it to the caller. Through this approach, data can be logically reused, meaning that a portion of an application reusing the same query can make a call to one data layer method, instead of embedding the query multiple times. This is generally more maintainable.

But the question is how is the data returned? Multiple frameworks employ different techniques, and below is a summary:

  • ADO.NET – Built into the .NET framework, ADO.NET contains a mechanism to query data out of the database and return it to the caller in a connected or disconnected fashion. This is the most common approach to working with data, because it’s already readily available. See more at: http://en.wikipedia.org/wiki/ADO.NET.
  • Table Adapters/Strongly-Typed Datasets – Strongly-typed datasets and table adapters provide a similar means to querying the data through ADO.NET, but add strong-typing features, meaning custom objects are generated for you to work with. See more here.
  • Enterprise Library – Enterprise library Data Access Application Block provides a flexible way to connect to databases of multiple types, without having to know anything about that database, through an abstract approach. See more at: http://msdn2.microsoft.com/en-us/magazine/cc188705.aspx (read part one first).
  • LINQ-to-SQL – LINQ to SQL is an ORM tool that uses a DataContext object as the central point to query data from the database. See more here. (read parts one through eight first).
  • Auto-Generated Code – Tools like CodeSmith Studio automatically generate the code for you based upon a database schema. Simply writing a script to output the code you want to use and the backend is generated in a short amount of time. See more at: http://community.codesmithtools.c om/blogs/tutorials/archive/2006/02/13/nettiers.aspx.

Most (if not all) options above take advantage of the CRUD (create, read, update, or delete) operations that databases support, so all of that is available as shown above. There are plenty of resources online to help you get started. To see an overview of some of the options, please read this.

Business Layer

Though a web site could talk to the data access layer directly, it usually goes through another layer called the business layer. The business layer is vital in that it validates the input conditions before calling a method from the data layer. This ensures the data input is correct before proceeding, and can often ensure that the outputs are correct as well. This validation of input is called business rules, meaning the rules that the business layer uses to make “judgments” about the data.

However, business rules don’t only apply to data validation; these rules apply to any calculations or any other action that takes place in the business layer. Normally, it’s best to put as much logic as possible in the business layer, which makes this logic reusable across applications.

One of the best reasons for reusing logic is that applications that start off small usually grow in functionality. For instance, a company begins to develop a web site, and as they realize their business needs, they later decide to add a smart client application and windows service to supplement the web site. The business layer helps move logic to a central layer for “maximum reusability.”

Presentation Layer

The ASP.NET web site or windows forms application (the UI for the project) is called the presentation layer. The presentation layer is the most important layer simply because it’s the one that everyone sees and uses. Even with a well structured business and data layer, if the presentation layer is designed poorly, this gives the users a poor view of the system.

It’s best to remove as much business logic out of the UI and into the business layer. This usually involves more code, but in my mind, the excess time (which ranges from minimal to moderate, depending on the size of the application) pays off in the end.

However, a well-architected system leaves another question: how do you display it in an ASP.NET or windows application? This can be more of a problem in ASP.NET, as the controls are more limited to the type of inputs they can receive. If you use certain architectures, like passing datasets from the data to the presentation layer, this isn’t as much of a challenge; however, the challenge can come with business objects that support drill-through business object references.

Why Separating Logic Is Useful

You may wonder why it is important to move as much logic outside the presentation layer and into the business layer. The biggest reason is reuse: logic placed in a business layer increases the reusability of an application. As applications grow, applications often grow into other realms. Applications may start out as a web application, but some of the functionality may later be moved to a smart client application. Portions of an application may be split between a web site and a web or windows service that runs on a server. In addition, keeping logic helps aid in developing a good design (sometimes code can get sloppier in the UI).

However, there are some caveats to this: it takes a little longer to develop applications when most of the logic resides in the business layer. The reason is this often involves creating several sets of objects (data layer and access code, plus business objects) rather than embedding it in the application. The extra time that it takes to do this can be a turnoff for some managers and project leads, especially because it often requires you to be knowledgeable about object-oriented programming, more than most people are comfortable with.

Although embedding code in the UI is easier, in most cases I don’t believe it’s the best approach. A layered approach is often a better approach because it pays dividends down the road. This is because as more and more code is developed, the following happens:

  • Code is copied and pasted frequently, or code is reused in classes that could easily be moved to a business layer.
  • Code that is very similar is often copied and pasted with slight modification, making duplication harder to track down.
  • It’s harder to maintain; even though applications with business objects are larger applications, they usually are structured better.
  • Code is harder to unit test, if unit testing is available at all. Web applications and windows forms projects are hard to use unit testing with.

A good architecture is often harder to implement, but is easier to maintain because it often reduces the volume of code. This means that hours spent supporting an application are reduced.

Distributed Applications

Using a separation of layers can aid in development of distributed applications. Because the code is broken up into layers, a layer that facilitates the use of remoting or web services can be added to the project, with a minimal amount of work.

Development Techniques

When developing a business object architecture, it’s good to know about the many design patterns that are out there. There are many websites, blogs, and books related to the subject of design patterns. One of the more well-known books on the subject is titled “Design Patterns,” whom the authors are often referred to as the Gang of Four.

Another useful development technique is called Refactoring, or improving the quality of your code by making small changes to the way it works. This involves moving code into a method, or moving a method from one object to another, in a systematic, logical way. Martin Fowler has written a great book on this subject, called “Refactoring, Improving the Design of Existing Code.” There are plenty of books on the subject; this one is the source that helped me to understand refactoring the most.

There are also tools on the market that can help you refactor in a faster way. One of those tools is Resharper by Jet Brains, which looks for a lot of code patterns and refactors them in a way that is useful. Some of the other refactoring tools that I heard about are Refactor Pro by DevExpress (free for VB.NET and ASP.NET), Visual Assist X by Whole Tomato Software, and Just Code by OmniCore.

Conclusion

This article reviewed the use of layers in an application, and discussed the fundamentals of their use. It also discussed the purpose of each layer, why using layers is important, and some other techniques useful for developing applications.


Read More...

Contact Me

Posted by DreamBig | 3:52 AM

If you have something which you wish to ask me about, use the form below to reach me. Alternatively, you can email me at dreambigtechnologies@gmail.com Do give me some time to reply through.



























Your Name :
Your Email :
Subject :
Message :
Image (case-sensitive):





Read More...

Common ASP.NET Performance Myths

Posted by DreamBig | 2:26 AM

One of the most common myths is that C# code is faster than Visual Basic code. There is a grain of truth in this, as it is possible to take several performance-hindering actions in Visual Basic that are not possible to accomplish in C#, such as not explicitly declaring types. But if good programming practices are followed, there is no reason why Visual Basic and C# code cannot execute with nearly identical performance. To put it more succinctly, similar code produces similar results.

Another myth is that


codebehind is faster than inline, which is absolutely false. It doesn't matter where your code for your ASP.NET application lives, whether in a codebehind file or inline with the ASP.NET page. Sometimes I prefer to use inline code as changes don't incur the same update costs as codebehind. For example, with codebehind you have to update the entire codebehind DLL, which can be a scary proposition.

Myth number three is that components are faster than pages. This was true in Classic ASP when compiled COM servers were much faster than VBScript. With ASP.NET, however, both pages and components are classes. Whether your code is inline in a page, within a codebehind, or in a separate component makes little performance difference. Organizationally, it is better to group functionality logically this way, but again it makes no difference with regard to performance.

The final myth I want to dispel is that every functionality that you want to occur between two apps should be implemented as a Web service. Web services should be used to connect disparate systems or to provide remote access to system functionality or behaviors. They should not be used internally to connect two similar systems. While easy to use, there are much better alternatives. The worst thing you can do is use Web services for communicating between ASP and ASP.NET applications running on the same server, which I've witnessed all too frequently.

Read More...

Asynchronous Pages in ASP.NET 2.0

Posted by DreamBig | 12:54 AM

ASP.NET 2.0 is replete with new features ranging from declarative data binding and Master Pages to membership and role management services. But my vote for the coolest new feature goes to asynchronous pages, and here's why.
When ASP.NET receives a request for a page, it grabs a thread from a thread pool and assigns that request to the thread. A normal, or synchronous, page holds onto the thread for the duration of the request, preventing the thread from being used to process other requests. If a synchronous request becomes I/O bound—for example, if it calls out to a remote Web service or queries a remote database and waits for the call to come back—then the thread assigned to the request is stuck doing nothing until the call returns. That impedes scalability because the thread pool has a finite number of threads available. If all request-processing threads are blocked waiting for I/O operations to complete, additional requests get queued up waiting for threads to be free. At best, throughput decreases because requests wait longer to be processed. At worst, the queue fills up and ASP.NET fails subsequent requests with 503 "Server Unavailable" errors.
Asynchronous pages offer a neat solution


to the problems caused by I/O-bound requests. Page processing begins on a thread-pool thread, but that thread is returned to the thread pool once an asynchronous I/O operation begins in response to a signal from ASP.NET. When the operation completes, ASP.NET grabs another thread from the thread pool and finishes processing the request. Scalability increases because thread-pool threads are used more efficiently. Threads that would otherwise be stuck waiting for I/O to complete can now be used to service other requests. The direct beneficiaries are requests that don't perform lengthy I/O operations and can therefore get in and out of the pipeline quickly. Long waits to get into the pipeline have a disproportionately negative impact on the performance of such requests.
The ASP.NET 2.0 Beta 2 async page infrastructure suffers from scant documentation. Let's fix that by surveying the landscape of async pages. Keep in mind that this column was developed with beta releases of ASP.NET 2.0 and the .NET Framework 2.0.

Asynchronous Pages in ASP.NET 1.x
ASP.NET 1.x doesn't support asynchronous pages per se, but it's possible to build them with a pinch of tenacity and a dash of ingenuity. For an excellent overview, see Fritz Onion's article entitled "Use Threads and Build Asynchronous Handlers in Your Server-Side Web Code" in the June 2003 issue of MSDN®Magazine.
The trick here is to implement IHttpAsyncHandler in a page's codebehind class, prompting ASP.NET to process requests not by calling the page's IHttpHandler.ProcessRequest method, but by calling IHttpAsyncHandler.BeginProcessRequest instead. Your BeginProcessRequest implementation can then launch another thread. That thread calls base.ProcessRequest, causing the page to undergo its normal request-processing lifecycle (complete with events such as Load and Render) but on a non-threadpool thread. Meanwhile, BeginProcessRequest returns immediately after launching the new thread, allowing the thread that's executing BeginProcessRequest to return to the thread pool.
That's the basic idea, but the devil's in the details. Among other things, you need to implement IAsyncResult and return it from BeginProcessRequest. That typically means creating a ManualResetEvent object and signaling it when ProcessRequest returns in the background thread. In addition, you have to provide the thread that calls base.ProcessRequest. Unfortunately, most of the conventional techniques for moving work to background threads, including Thread.Start, ThreadPool.QueueUserWorkItem, and asynchronous delegates, are counterproductive in ASP.NET applications because they either steal threads from the thread pool or risk unconstrained thread growth. A proper asynchronous page implementation uses a custom thread pool, and custom thread pool classes are not trivial to write (for more information, see the .NET Matters column in the February 2005 issue of MSDN Magazine).
The bottom line is that building async pages in ASP.NET 1.x isn't impossible, but it is tedious. And after doing it once or twice, you can't help but think that there has to be a better way. Today there is—ASP.NET 2.0.

Asynchronous Pages in ASP.NET 2.0
ASP.NET 2.0 vastly simplifies the way you build asynchronous pages. You begin by including an Async="true" attribute in the page's @ Page directive, like so: <%@ Page Async="true" ... %>
Under the hood, this tells ASP.NET to implement IHttpAsyncHandler in the page. Next, you call the new Page.AddOnPreRenderCompleteAsync method early in the page's lifetime (for example, in Page_Load) to register a Begin method and an End method, as shown in the following code: AddOnPreRenderCompleteAsync (
new BeginEventHandler(MyBeginMethod),
new EndEventHandler (MyEndMethod)
);
What happens next is the interesting part. The page undergoes its normal processing lifecycle until shortly after the PreRender event fires. Then ASP.NET calls the Begin method that you registered using AddOnPreRenderCompleteAsync. The job of the Begin method is to launch an asynchronous operation such as a database query or Web service call and return immediately. At that point, the thread assigned to the request goes back to the thread pool. Furthermore, the Begin method returns an IAsyncResult that lets ASP.NET determine when the asynchronous operation has completed, at which point ASP.NET extracts a thread from the thread pool and calls your End method. After End returns, ASP.NET executes the remaining portion of the page's lifecycle, which includes the rendering phase. Between the time Begin returns and End gets called, the request-processing thread is free to service other requests, and until End is called, rendering is delayed. And because version 2.0 of the .NET Framework offers a variety of ways to perform asynchronous operations, you frequently don't even have to implement IAsyncResult. Instead, the Framework implements it for you.
The codebehind class in Figure 1 provides an example. The corresponding page contains a Label control whose ID is "Output". The page uses the System.Net.HttpWebRequest class to fetch the contents of http://msdn.microsoft.com. Then it parses the returned HTML and writes out to the Label control a list of all the HREF targets it finds.
Since an HTTP request can take a long time to return, AsyncPage.aspx.cs performs its processing asynchronously. It registers Begin and End methods in Page_Load, and in the Begin method, it calls HttpWebRequest.BeginGetResponse to launch an asynchronous HTTP request. BeginAsyncOperation returns to ASP.NET the IAsyncResult returned by BeginGetResponse, resulting in ASP.NET calling EndAsyncOperation when the HTTP request completes. EndAsyncOperation, in turn, parses the content and writes the results to the Label control, after which rendering occurs and an HTTP response goes back to the browser.

When a synchronous page is requested, ASP.NET assigns the request a thread from the thread pool and executes the page on that thread. If the request pauses to perform an I/O operation, the thread is tied up until the operation completes and the page lifecycle can be completed. An asychronous page, by contrast, executes as normal through the PreRender event. Then the Begin method that's registered using AddOnPreRenderCompleteAsync is called, after which the request-processing thread goes back to the thread pool. Begin launches an asynchronous I/O operation, and when the operation completes, ASP.NET grabs another thread from the thread pool and calls the End method and executes the remainder of the page's lifecycle on that thread.

Read More...

ASP.NET 2.0 Session State Partitioning

Posted by DreamBig | 9:42 PM

SqlSessionStateStore supports a key scalability feature of ASP.NET 2.0 known as session state partitioning. By default, all sessions for all applications are stored in a single SQL Server database. However, developers can implement custom partition resolvers—classes that implement the IPartitionResolver interface—to partition sessions into multiple databases. Partition resolvers convert session IDs into database connection strings; before accessing the session state database, SqlSessionStateStore calls into the active partition resolver to get the connection string it needs. One use for custom partition resolvers is to divide session state for one application into two or more databases. Session state partitioning helps ASP.NET applications scale out horizontally, by eliminating the bottleneck of a single session state database. For an excellent overview of how partitioning works, and how to write custom partition resolvers, see "Fast, Scalable, and Secure Session State Management for Your Web Applications."


ASP.NET 2.0 provides a solution to the problems encountered when scaling up by enabling horizontal scale-out of session state stores through its state partitioning feature. State partitioning enables the session data and the associated processing load to be divided between multiple out-of-process state stores, allowing the session state load to scale as the Web farm grows and the number of concurrent sessions increases. It works by supplying a custom partitioning algorithm to SessionStateModule, which uses the algorithm to determine the state store connection string to be used for the current request based on the session ID. Both the SQLServer and the StateServer providers will then use the appropriate connection string to fetch and save the session.

You can implement a partitioning scheme by deriving a class from the System.Web.IPartitionResolver interface, and building the session ID-to-connection string mapping inside the ResolvePartition method. The basic implementation shown in Figure 5 creates an array of hardcoded connection strings corresponding to available state store partitions in the Initialize method. In the ResolvePartition method, the resolver hashes the session ID string into one of the buckets corresponding to one of the loaded connection strings, and selects the resulting connection string.

Ideally, you will want to implement either a configuration collection for specifying the available partitions that you will load in the Initialize method, or obtain the collection from a centralized location over the network on a Web farm. The simple uniform hashing implementation results in a relatively even distribution of sessions to stores over time because the session IDs are generated randomly. However, you may want to implement a load-balancing scheme where you dynamically determine the partition in which to place a given session based on current partition load. To do this, you will need to encode the partition ID into the session ID by using a custom SessionIDManager derivation together with the PartitionResolver to determine the partition for a new session, create the session ID with the partition ID encoded, and then determine the partition ID in future requests by pulling it out from the session ID in the partition resolver.
The partition resolver implementation can be deployed in the App_Code application directory, or it can be compiled into an assembly and deployed in the \Bin application directory or installed into the GAC. Finally, the resolver type has to be added to the session state configuration by specifying its fully qualified name in the partitionResolverType attribute.

Note that the partition resolver can only be used when session state is using the SQLServer or StateServer modes, and no connection string can be specified using the sqlConnectionString or stateConnectionString attributes.

Session state also provides an alternative approach for Web farm session state management, which allows the application to harness the speed of distributed InProc state storage (or out-of-process state storage for reliability purposes) provided that a session ID-encompassing affinity scheme can be used on the Web farm. The affinity scheme needs to ensure that all requests with a given session ID are passed to the same Web server, in which case each Web server can maintain its own session state store without sharing it with other Web servers.

The affinity scheme needs to be based on session IDs or other characteristics of the request that guarantee all requests containing a given session ID will be directed to the same Web server. Such schemes can be based on client IP network ranges (keeping in mind that clients may be coming from dynamically assigned Web proxies) or user agent headers. The problems with implementing such affinity schemes include the fact that they are not readily available on hardware load-balancing systems as they require HTTP-level routing of the requests (as opposed to the more common IP or TCP-level connection routing). In addition, these schemes prevent you from doing any real load balancing because routing needs to be deterministic with respect to session ID to state store mappings to preserve state.

Figure 5 Session Partitioning

public class PartitionResolver : System.Web.IPartitionResolver
{
private String[] partitions;

public void Initialize()
{
// create the partition connection string table
partitions = new String[] {
"tcpip=192.168.1.1:42424",
"tcpip=192.168.1.2:42424",
"tcpip=192.168.1.3:42424" };
}
public String ResolvePartition(Object key)
{
String sid = (String)key;
// hash the incoming session ID into
// one of the available partitions
int partitionID = Math.Abs(sid.GetHashCode()) % partitions.Length;
return partitions[partitionID];
}
}

Read More...