July 2005 Entries

Windows Vista - the official name for “Longhorn”

Windows Vista - the official name for “Longhorn”

Microsoft Corporation unveiled the Official Name for "Longhorn" on July 22, 2005 at its Head Quarters, Redmond, Washington. More information and the announcement Video is available at Microsoft Press Release

The official name for "Longhorn" is Windows Vista and the Logo has been released, as above.

Beta 1, targeted at developers and IT professionals, will be available by August 3, 2005.

The name looks Good and Stylish and LongHorn is expected to have a lot of advantageous features which comprises of Avalon, XAML etc., XAML, combined with Microsoft's Avalon Graphics Engine, is one of the primary pillars in WinFX; the next generation of Graphics and Internet Services Technology.

I am now waiting to get my hands on Windows Vista Beta 1.

Cheers and Happy Windowing !!!

Tech Ed 2005 Photos !!! - Finally

I have uploaded some of the Tech Ed 2005 Photos, thanks to Abhishek, my MVP Program Manager. The first snap is me (left), Subashini, my MVP Lead (center) and GG Arun, an MVP and a best friend of mine. The second snap (below) is taken during the MVP Dinner at the Taj Residency, where there are lots of MS Folks sitting along with MVPs . The Dinner was exclusively for MVPs and comprised of more than 15 participants. Cheers and Happy Viewing !!!

ASP.NET 2.0 : Tired with Sessions? - Use the new Profile property to store user information.

All of us who write web application enforce some mechanism by which we store a user's information for the period he is accessing the application. This may be from simply storing the User's ID to say a Welcome <username> to maintaining his preferences, shopping cart etc.,

So far, the Session object has been pretty useful to accomplish this task. With Whidbey (ASP.NET 2.0), there is a new feature Profile which allows us to store per-user settings to be used throughout the application. Settings can also be stored in an anonymous profile while users are not logged in, and then migrated to a logged-in user profile at a later time.

The major difference between Profile and Session objects are

1. Profile object is persistent whereas Session object is non-persistant.

2. Profile object uses the provider model to store information whereas Session object uses the In Proc, Out Of Process or SQL Server Mode to store information.

3. Profile object is strongly typed whereas Session object is not strongly typed.

The similarity between them is that Each user will automatically have a profile of his own similar to Sessions where each user will have his own Session State.

A user's profile is a collection of properties that define information you want to store for your web site's users. The user's profile is defined using a simple XML syntax in a configuration file (machine.config and/or web.config). Within your page, you reference a user's profile information with the Profile property. ASP.NET reads the schema defined in configuration, and automatically generates a class that is accessible from the Profile property on a page. You access properties on the Profile just as you would access properties on any other class.

Although the most common use of the Profile feature is storing data for authenticated users, the Profile feature also supports storing information for anonymous users. Storing profile information for anonymous users depends on the Anonymous Identification feature. The Profile and Anonymous Identification features work together to enable the use of the Profile property for anonymous users. The samples included in the QuickStart demonstrate using the Profile feature with both authenticated and unauthenticated users.

Prior to the start of the page lifecycle, ASP.NET ensures that the Profile is available for use by the page. Similarly, at the end of the ASP.NET page lifecycle, ASP.NET automatically saves the Profile to the underlying data store(s). As with other features such as Membership and Role Manager, the Profile feature has been designed with a provider-based model. Providers abstract the physical data storage for a feature from the classes and business logic exposed by a feature. The Profile feature ships with a provider for Microsoft™ SQL Server. You can create your own custom providers and configure them to work either the Profile feature. Pages that use the Profile feature will continue to work unchanged with your custom providers.

In addition to the Profile property, the Profile feature provides support for administration of profiles (both for authenticated users and anonymous users) with the ProfileManager. Common tasks that you perform with the ProfileManager include:

Searching for statistical information about all profiles, profiles for authenticated users, and profiles for anonymous users

Determine the number of profiles that have not been modified in a given period of time

Deleting individual profiles as well as deleting multiple profiles based on a profile's last modification date

We will examine the ways of Defining / Managing and Deleting Profiles in the Next Article(s).

Cheers and Happy Programming !!!

Data Concurrency in ADO.NET - Part II

If you are reading this article without reading the first part, please check Data Concurrency in ADO.NET - Part I

Version Number Approach

In the version number approach, the record to be updated must have a column that contains a date-time stamp or version number. The date-time stamp or a version number is saved on the client when the record is read. This value is then made part of the update.

One way to handle concurrency is to update only if value in the WHERE clause matches the value on the record. The SQL representation of this approach is:

UPDATE Table1 SET Column1 = @newvalue1, Column2 = @newvalue2
WHERE DateTimeStamp = @origDateTimeStamp

Alternatively, the comparison can be made using the version number:

UPDATE Table1 SET Column1 = @newvalue1, Column2 = @newvalue2
WHERE RowVersion = @origRowVersionValue

If the date-time stamps or version numbers match, the record in the data store has not changed and can be safely updated with the new values from the dataset. An error is returned if they don't match. You can write code to implement this form of concurrency checking in Visual Studio .NET. You will also have to write code to respond to any update conflicts. To keep the date-time stamp or version number accurate, you need to set up a trigger on the table to update it when a change to a row occurs.

Saving All Values Approach

An alternative to using a date-time stamp or version number is to get copies of all the fields when the record is read. The DataSet object in ADO.NET maintains two versions of each modified record: an original version (that was originally read from the data source) and a modified version, representing the user updates. When attempting to write the record back to the data source, the original values in the data row are compared against the record in the data source. If they match, it means that the database record has not changed since it was read. In that case, the changed values from the dataset are successfully written to the database.

Each data adapter command has a parameters collection for each of its four commands (DELETE, INSERT, SELECT, and UPDATE). Each command has parameters for both the original values, as well as the current (or modified) values.

Note Adding new records (the INSERT command) only requires the current values since no original record exists and removing records (the DELETE command) only requires the original values in order to locate the record to delete.

The following example shows the command text for a dataset command that updates a typical Customers table. The command is specified for dynamic SQL and optimistic concurrency.

UPDATE Customers
SET CustomerID = @currCustomerID,
CompanyName = @currCompanyName,
ContactName = @currContactName,
ContactTitle = currContactTitle,
Address = @currAddress,
City = @currCity,
PostalCode = @currPostalCode,
Phone = @currPhone,
Fax = @currFax
WHERE (CustomerID = @origCustomerID) AND (Address = @origAddress OR @origAddress IS NULL AND Address IS NULL) AND (City = @origCity OR @origCity IS NULL AND City IS NULL)
AND (CompanyName = @origCompanyName OR @origCompanyName IS NULL AND CompanyName IS NULL) AND (ContactName = @origContactName OR @origContactName IS NULL AND ContactName IS NULL) AND (ContactTitle = @origContactTitle OR @origContactTitle IS NULL AND ContactTitle IS NULL)
AND (Fax = @origFax OR @origFax IS NULL AND Fax IS NULL) AND (Phone = @origPhone OR @origPhone IS NULL AND Phone IS NULL) AND (PostalCode = @origPostalCode OR @origPostalCode IS NULL AND PostalCode IS NULL);
SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City,
PostalCode, Phone, Fax
FROM Customers WHERE (CustomerID = @currCustomerID)

Note that the nine SET statement parameters represent the current values that will be written to the database, whereas the nine WHERE statement parameters represent the original values that are used to locate the original record.

The first nine parameters in the SET statement correspond to the first nine parameters in the parameters collection. These parameters would have their SourceVersion property set to Current.

The next nine parameters in the WHERE statement are used for optimistic concurrency. These placeholders would correspond to the next nine parameters in the parameters collection, and each of these parameters would have their SourceVersion property set to Original.

The SELECT statement is used to refresh the dataset after the update has occurred. It is generated when you set the Refresh the DataSet option in the Advanced SQL Generations Options dialog box.

By default Visual Studio will create these parameters for you if you select the Optimistic Concurrency option in the DataAdapter Configuration Wizard. It is up to you to add code to handle the errors based upon your own business requirements.

For more information on Tackling Data Concurrency Exceptions Using the DataSet Object check
This article

Cheers and Happy Programming !!!

Data Concurrency in ADO.NET - Part I

When multiple users attempt to modify data at the same time, controls need to be established in order to prevent one user's modifications from adversely affecting modifications from simultaneous users. The system of handling what happens in this situation is called concurrency control.

Lets examine a Real World Scenario to better understand the problem.

If you have a Sales Application and a Salesman A is updating the record of a Customer's purchases into the Sales Table. Simultanenously, if Sales Man B is querying the Sales Table for the Customer's record to perform some other operation, the record that Sales Man B gets is not stable since it has been changed by Sales Man A. This kind of scenario is what leads to concurrency issues in a Database Management System.

The resolution to resolve this kind of an issues is to enforce Locks on the Data. Locks are basically a control over the Data such that no two applications/users modify the same record, simultaneously.

In general, there are three common ways to manage concurrency in a database:

Pessimistic concurrency control - a row is unavailable to users from the time the record is fetched until it is updated in the database.

Optimistic concurrency control - a row is unavailable to other users only while the data is actually being updated. The update examines the row in the database and determines whether any changes have been made. Attempting to update a record that has already been changed results in a concurrency violation.

"Last in wins" - a row is unavailable to other users only while the data is actually being updated. However, no effort is made to compare updates against the original record; the record is simply written out, potentially overwriting any changes made by other users since you last refreshed the records.

ADO.NET and Visual Studio .NET use optimistic concurrency, because the data architecture is based on disconnected data. Therefore, you need to add business logic to resolve issues with optimistic concurrency.

There are two ways to handle the issues with optimistic concurrency. They are:

The Version Number Approach
Saving All Values Approach

We will examine each of these methods in
Part II of this article.

Cheers and Happy Programming !!!a

MSN Messenger 7.0 ... not simply an instant messenger

I usually dont write about Instant Messengers and Email Accounts, but the New MSN Messenger is irresistible and I can't help from writing about some of the cool features which are not aware to many of the users.

First of all the new MSN Messenger 7.0, looks Glossy, Cool and with the XP Style for the curves and edges.

The MSN Today is much improved and suprisingly, it shows your associated Hotmail Inbox in one of three Tabs. This is very useful and it practically helped me by reminding me to reply to a mail. When I just logged in to MSN Messenger, the MSN Today appeared and when I switched to the Email Tab, I noticed an important email for which I had to respond but overlooked due to other mails. I would have never gone to my Hotmail Inbox unless I received a new Email. This is a very useful feature along with the MSN Today News and other information that appears in the MSN Today Tab. Many of us, close it without even reading it. But just wait for a moment and you can find how much useful MSN Today can be.

The Cool Tree View (+) link next to your Groups make it easy and gives a robust look to the Contacts lists.

The miniature image of the actual Display picture that your contacts have put up, looks cute and it actually differentiates the contacts a little bit for you, to identify easily.

The New Information Star which appears next to your contacts is one of the very useful and cool features.

MSN Messenger automatically associates with your MSN Spaces account and keeps a track of the updates you make to your MSN Spaces account.

If you are new to MSN Spaces, well it is a free service provided by MSN to maintain your blogs and photos. It provides a cool set of UI and sections to Blog and share your photos. For more information check MSN Spaces

Whenever you update your Blog or add some photos, it recognizes the change and displays a Golden Star next to your Name as listed in the Contacts List for your Buddies. Thereby, they can click on the Star and it shows the link for your MSN Spaces in your contact card. On clicking on the link, it takes them to your MSN Spaces for viewing the updated information.

Well, this is one of the useful features since you dont need to remind your friends / relatives / buddies to visit your MSN Spaces, each time you update the same with new photos / articles.

Needless to say MSN Messenger 7.0 has really cool as well as useful features which provides you more than just instant messaging.

Already, MSN Messenger is being officially used by Companies for communication with Clients / Fellow Employees based out at different locations. The advantage MSN Messenger has is the richness of the UI.

You can download MSN Messenger from

Cheers and Happy Messaging !!!