March 21, 2011

ASP.NET Performance Tip4 - while using ajax updatepanel

If you have multiple update panels in web page, make sure that you put updatemode for update panel to ”Conditional” to prevent loading of other update panels in any asynchronous post back.

By default update panel will have the updatemode property to always means if any asynchronous pushback is done  for any of the update panel it loads all the update panels in the page.  This is against to partial post back rendering.

So it is always a best practice to set updatemode  property to conditional to optimize update panel performance wise and to load best results.

To observe this observe Trace  the Requests and Responses using httpwatchpreofessional 5.2

March 14, 2011

ASP.NET Performance Tip3 - Use using key word

The using keyword is basically a try - finally block, without a catch , where IDisposable.Dispose() is called in the finally .

Using block defines a scope, outside of which an object or objects will be disposed.

Use using keyword for the objects that  hold any resources other than managed memory.  For Example like files, sockets, database connections, or even GDI drawing handles.

We should  be using "using" whenever the class implements IDisposable. So use of using keyword will always help to avoid Garbage Collection call or explicitly calling garbage collector to

destroy objects.

For example

using(Dataset ds = new Dataset())
{
//code
}

We do not need to worry about destroying objects once the job is done. Garbage Collector will take care of it.


using(ClassName x = new ClassName())
{

     ...use x here...

}

This will automatically remove the resources occupied by the obejct x.

Another Example while working with database objects :

 

using ( SqlConnection connection = new SqlConnection(connectionString) )


{

      SqlCommand cmd = new SqlCommand(commandString, connection);


      connection.Open();


      using (SqlDataReader reader = cmd.ExecuteReader())


      {


         while (reader.Read())


         {

    listBox1.Items.Add(reader[0].ToString() + ", " + reader[1].ToString());
}
}
}
But normally we use try ,catch and dispose objects explicitly in Finally. Why to do this when we have the job that will be done by CLR through GC with the help of using keyword. A "using" statement can be exited either when the end of the "using" statement is reached or if an exception is thrown and control leaves the statement block before the end of the statement. Multiple Objects can be used with using statement as
using (Furniture chair = new Furniture(300, 400),
table = new Furniture(20, 100))
{
    // Use chair and table.
}

It is very important to know when to use what and implement best practices to achieve for performance , reliability

March 06, 2011

ASP.NET Performance Tip2

Read Tip1 Here

2.  Disable Session State

In ASP.NET Session State  is on by default for every page . So we need to disable Session State if we are not going to use it.  Sessions are created to  pass information from one page to other page per user. We do not require Session State when web pages are static or when there is no need to store information captured in the page.  Do not use sessions to store Global data that is specific to all users. Session is specific to single user.

We can this off for specific pages, as well as entire page depending on the requirement. Usage of sessions will significantly decrease the performance of the application .  So we need to try to minimize the use of  sessions in Web Applications.  If we are not using Sessions in the application it can be set off in the web.config that applies to entire application.

Otherwise it can be disabled in page level as

<%@ Page language="c#" Codebehind="Form.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.Form" EnableSessionState="false" %>


In web.config  we can turn off sessionstatemode under System.Web Section as follows.

<sessionState mode="off"></sessionState>

As all of us know,ASP.NET Manages session state automatically. But if we do not require Sessions, disabling it will help in boosting the performance of the application.

March 05, 2011

ASP.NET Performance Optimization Tips

I would like to write series of tips for my blog readers on ASP.NET Application performance and what kind of tips we need to follow to improve it .We design and develop web applications. Perfect. Works Fine in Development Server. We will not have huge data as we have in production environment in the development environment.

So everything goes well in development , QA Testing , Staging. But when it moves to production common problem is Performance . Each & Every Web Developer struggle to make their applications scalable.  When multiple users accessing the application simultaneously, or if we have larger data from years that has grown in the database what are the precautions we need to take?  General Question that sucks is What are the best practices to improve the performance of the application.? So Read on.. and stay tuned for daily updates

1. Disable View State if not used

2. Disable Session State if not required

3. Use using keyword to define scope for objects dispose

4. Set Updatepanel  updatemode to conditional

March 04, 2011

ASP.NET Performance Tip1

1. Disable View State

The view state is important for an ASP.NET page because it is mainly used to persist the state of the Web server controls. As ViewState has performance and security Hit it is important to use to properly and how to ?

ViewState is passed to the client during every postback as an hidden element.  Viewstate is stored in an encrypted format. You can view the view state in Page Source . As its added for every page  view state will definitely effect loading of page at the client side.

Disable ViewState when it is not required.or used.  

For ex: For a Grid that is just used to display records that acts as HTML table , not firing any GridView events or Sorting or paging it is best practice to always disable ViewState.

To add more to optimize webpage performance we need to disable ViewState in the following cases.

  • When a page do not postback to itself
  • When there are no dynamically set control properties
  • When the dynamic properties are set for each request of the page

ASP.NET4 comes with very interesting property called ViewStateMode.  ViewStateMode property is used to control the Viewstate at Control level or Page Level or application level in config File.

Why is this Property ? What is the significance of this?

You can Disable viewstate at page level and enable viewstate at control level using this viewstatemode property. This viewstatemode comes with 3 properties namely

1. Enabled

2. Disabled

3. Inherited  -  ViewStateMode gets inherits from parents control viewstatemode property. For ex. If we have a label inside a panel and label’s viewstatemode property set to inherit, then its viewstatemode property gets inherited from panel. As panel is parent control for label.

If we disable Viewstate at page level and enable viewstate at control level then there is no use as the page level settings override the control settings.

So with the help of this new property we can set viewstatemode to false at page level  and enable viewstatemode for individual controls at control level so that unnecessary viewstate can be avoided.

Note: Viewstatemode property can be used when viewstate is enabled which is set at page level by default.

February 28, 2011

Difference between encryption and encoding

 

Both are not same. But seems to be synonymous.

1. Encoding is to convert data by the use of a code.
2. Encrypting is to format (electronic data) according to a standard format

Encryption is secret . This can be achieved by converting string to cipher text using cryptographic algorithm and key. Encryption and decryption happens using this unique key. The cryptographic encryptioalgorithm and key are responsible for the encryption quality. Encryption involves encoding internally. encoding of the data takes place both before and after encryption.

To use encryption in .NET we need to import the name space  System.Security.Cryptography

Encoding is the way the data get formatted. Generally used in cryptography to mean that secrecy is not involved. If we know the format that is used to encode the data,the encoded data can be decoded by anonymous. So please do not use encoding to store passwords in database instead use encryption.

http://himabinduvejella.blogspot.com/2011/02/what-is-machine-key-in-webconfig.html

February 27, 2011

What is Machine Key in Web.Config

The <machineKey> attribute is used in web.config settings when encrypting and decrypting the data for the webapplication in ASP.NET. It is used to set Encryption algorithm for validation in general. Machine Key attribute can be used to set

1. Encryption of View State

2. Encryption for Forms authentication cookie data

In order to make view state tamper proof we use EnableViewStateMac = true .  This can be applied at page level too. MAC stands for Message Authentication Code. By setting this property to true Viewstate is encrypted in a cipher format .

If we encrypt Viewstate we must speicify validation and encryption method in machine key attribute of the web.config  as below.

Example

<system.web>
<pages buffer ="true" enableViewStateMac ="true" />
<machineKey validationKey="autogenerate | value" decryptionKey="autogenerate | value"
validation ="SHA1 | MD5 | 3DES" />
<httpRuntime maxRequestLength ="2048" />
</system.web>

So the application takes encryption validation method that is specified and validation key settings for the decryption.

For forms authentication ticket encryption, the <machineKey>  can be set as shown below.

<machineKey
  validationKey="AutoGenerate,IsolateApps"
  decryptionKey="AutoGenerate,IsolateApps"
  validation="AES"
  decryption="Auto" />

Why do we need to encrypt and decrypt the viewstate?

View State is not secured. It is good design practice to encrypt the View State and store due to security reasons. By default ASP.NET uses SHA1 algorithm to encrypt View State.When working with sensitive data, it is best practice to utilize encryption.

How to do it at Page Level or control Level?

ViewStateEncryptionMode is the attribute that is used for encrypting viewstate. It can be applied at page level or web.config level for the application. Below is the code how we use viewstateencryption mode attribute

<configuration>

<system.web>

<pages  ViewStateEncryptionMode="Always" />

</system.web> </configuration>

ViewStateEncryptionMode attribute has 3 properties as

  • Auto (deafult),
  • None( No Encryption for the control’s View State)
  • Always

If the mode is “Always” ASP.NET does not wait for a control in the page to request encryption. View State is always encrypted.

If the mode is “Auto” ASP.NET will encrypt the View State for a page if any control on the page requests it only. This is the default value.

If the mode is “None”, encryption is never done for View State  even though it is applied and controls on the page requested it.

What is Singleton Design Pattern? How did you implement it?

Singleton Design Pattern class and maintains that single instance throughout the lifetime of the program. It can easily access that single object instance without creating multiple instances. The single instance provides a global point of access to it.

You need to create a private constructor to implement it

class Singleton
{
//declare only once
private static Singleton Instance = new Singleton();
public static Singleton Ins()
{
//reuse declared instance
return Instance;
}

private Singleton()
{
//No public access allowed
//Private constructor
}
}

static means shared that help to create only one instance.

There are 2 tips in singleton design pattern implementation

1. Create private constructor

2.  Create static methods  to reuse single instance of the static object.

There are situations in real world where we need only to create  one instance of the object and shared  across the clients.

Where exactly it can be used in real time ?

Singleton design patter can be used in Banking, Financial or Travel based applications where the singleton object consists of the network related information.

if our application is an online store that allows each seller to have a customized store, if implementation of the store is a singleton object,  then the singleton instance will be created for each user . This  will  avoid a seller creating multiple stores,

An ASP.NET Web Farm (multiple server deployment) is also based on the Singleton pattern. In a Web Farm, the web application uses on several web servers. The session state ( OUTPROC) is handled by a Singleton object  in the form of exe file. This exe file interacts with the ASP.NET worker process(aspnet_wp.exe)  running on each web server. Even if one of the web servers shutting down, the singleton object still maintains the session state information across all web servers in the web farm.
Singleton pattern as a LoadBalancing object.  We  can have single instance per application, per user, per role or other criteria.

February 25, 2011

Dotnet Quiz - 2011 - Free online Technical Event

Participate in DotnetQuiz to Win an Apple IPAD .
I am organizing general dotnet quiz at Beyondrelational.com for the dotnettechnology.
This quiz contains questions related to VB.NET, C#, Entity Framework, ADO.NET, MVC, Design patterns, MVVM, Silverlight, WPF, WCF.

Test your DotNet knowledge from 31 reputed MVPS and Community Leaders who are passionate for the technology from all over the world win, Cool goodies as prizes. I am organizing online DotnetQuiz that includes MVPS from various streams and community leaders that tests your knowledge on different technologies. You can discuss, explain and understand the Concepts or misconceptions in the community in depth while trying to answer a question.

Dotnet Quiz consists of 31 questions, managed by 31 quiz masters who are experts in Dotnet. Each quiz master will ask one question and will moderate the discussions , answers will identify the winner of each quiz. Each answer that is correct will get a certain score (between 1 and 10, where 10 is the best) the scores of all the 31 questions will be added up to identify the final winner."
I have some of my favorite people as Quiz masters. This is the great chance to share and spread the knowledge in the community. Interested professionals in the particular area can participate in the quiz. Details are here.

Grab the questions and answer them before they get closed.

February 15, 2011

WCF Data Services Toolkit released

The intent of the toolkit is to make it easier to expose arbitrary data sources as OData services. Examples of such data sources might be:
An existing web API XML/CSV file(s)
Data stored within a proprietary software system
The toolkit also makes it easy to mash-up multiple data sources so that creating a "unified model" is possible, regardless how much disparate data you or your customers might have.

This project was created from the needs of our live partner services (e.g. eBay, Netflix, Facebook, Twitpic) and will continue to be iterated on as we discover new scenarios and needs during future partner engagements.
Read the following blog post to get an introduction on how to use the toolkit: Looking forward to seeing what the community does with the toolkit and are of course very open to feedback/suggestions/comments

February 11, 2011

Updates to the Microsoft Certified Master for SQL Server 2008 Program

Used to recognize and certify the top SQL Server talent in the world, Microsoft’s most advanced SQL Server certification is now more accessible than ever
Microsoft has made significant changes to the Microsoft Certified Master (MCM) program for SQL Server 2008, and these changes present a great opportunity for Partners to equip their technical staff with top tier SQL Server certification.


The SQL MCM program formerly required three weeks of training at Microsoft – a fact that put the certification out of the reach of many SQL Server experts worldwide, because of the time, travel and expense involved in achieving the certification. By eliminating the mandatory training requirement, plus consolidating the required exams into one knowledge exam (available now) and one lab exam (available soon) Microsoft can provide highly experienced SQL Server IT professionals worldwide with validation of their deep technical expertise, no matter their learning style and economic means.  With online exam prep materials, and exams available through select Prometric Testing centers worldwide, MCM for SQL Server 2008 is now within reach of more SQL Server professionals globally, while maintaining the integrity and value of this advanced certification.


Now more than ever, it’s a great time for Partners to sponsor their qualified SQL Server professionals to pursue MCM for SQL Server 2008.  Having MCMs on your staff sets you apart from your competition, and tells your customers that you can meet their most complex business requirements.  In fact, evidence has shown that customers have engaged with Partners based primarily on the fact that they have MCMs on their team. An investment in your employees is an investment in your company’s future, and can make for higher quality SQL Server deployments in mission critical environments. Find out more, and start making this investment today.

Resources:

      SQL Server MCM Program (program rules and details)  
      How do you know if you’re ready for SQL MCM? (Blog post)
      SQL MCM 2008 Readiness Videos  (for the full list of videos – click the “More” link at the bottom of the page)
      SQL MCM Question forum (Questions about the program from other SQL professionals)   
      Prometric Exam Locations for SQL MCM (Current approved Knowledge Exam centers, and location of information once the Lab Exam is available)

February 02, 2011

Windows Azure Platform Training Kit Update

MS has released January 2010 update to the Windows Azure Platform Training Kit & Training Course.The Windows Azure Platform Training Kit & Course includes a comprehensive set of technical content including hands-on labs, presentations, and demos that are designed to help you learn how to use the Windows Azure platform, including: Windows Azure, SQL Azure and the Windows Azure AppFabric.
Download the Windows Azure Platform Training Kit.
Visit the Windows Azure Platform Training Course on MSDN.
The January update provides new and updated demo scripts and a new Windows Phone 7 hands-on labs for the Windows Azure Platform. These new demo scripts demonstrate how to use Windows Azure Connect, Web and Worker Role Enhancements, Windows Azure Virtual Machine Roles, and the "Rafiki" application (a keynote demo at PDC10). Additionally, this kit includes an improved mechanism for installing Visual Studio code snippets.
Some of the specific changes with the January update of the training kit includes:
  • [New demo script] Windows Azure Connect

  • [New demo script] Web and Worker Role Enhancements

  • [New demo script] Windows Azure Virtual Machine Roles

  • [New demo script] “Rafiki” Application

  • [[New lab] Windows Phone 7 and The Cloud

  • [[New lab] Use Access Control Service to Federate with Multiple Business Identity Providers

  • [[Updated] All Identity HOLs have been refreshed

  • [[Improved] Visual Studio code snippets installation

  • [[Fixes] Several bug fixes in demos and labs


Release: January 2011 Update
Version: 2.3

January 31, 2011

Free Windows Azure Training Just Released!

Just before the Holidays, Microsoft hosted another new and exclusive Jump Start virtual training event, this time covering the Windows Azure Platform. What a success! “Building Cloud Applications using the Windows Azure Platform” was tailored for application architects and developers interested in leveraging the cloud.

While many of the attendees were already building a pilot project or planning to migrate an application, around 35% were searching for real-world answers as they consider whether or not the Windows Azure Platform fits their needs. They were in for a treat since all 12 hours of this training was led by two of the most respected authorities on Microsoft development technologies, David S. Platt and Manu Cohen-Yashar. Learn strategies for your cloud application lifecycle, know your options for storage in the cloud, understand the realities of Security using Azure and find out all your team should consider to truly design for scale and elasticity.

The feedback has been great, but due to the Holidays many of you weren’t able to join Microsoft back in December. So whether you were with them and want to refresh and reinforce what you learned, or you want to check it out for the first time, all 12 hours of the HD-quality videos were just released and are ready to go! Just browse this list and get started!

Session 01: Windows Azure Overview
Session 02: Introduction to Compute
Session 03: Windows Azure Lifecycle, Part 1
Session 04: Windows Azure Lifecycle, Part 2
Session 05: Windows Azure Storage, Part 1
Session 06: Windows Azure Storage, Part 2
Session 07: Introduction to SQL Azure
Session 08: Windows Azure Diagnostics
Session 09: Windows Azure Security, Part 1
Session 10: Windows Azure Security, Part 2
Session 11: Scalability, Caching & Elasticity, Part 1
Session 12: Scalability, Caching & Elasticity, Part 2, and Q&A
By the way, feel free to check out the course materials and code samples while you’re watching.


Get Access to the Windows Azure Platform for the Labs and learn about training & certification options by visiting the Windows Azure Online Portal.

October 04, 2010

SqlServer Quiz - Free Online Technical Event

Test your SQL Server knowledge from 31 reputed MS SQLServer MVPS from all over the world and win, Cool goodies as prizes. Beyond Relational is organizing online SQL Quiz that includes 31 MVPS, that tests your knowledge on various SQL Server topics. You can discuss, explain and understand the SQL Concepts in depth while trying to answer a question .


SQL Server quiz consists of 31 questions, managed by 31 quiz masters who are experts in SQL Server. Each quiz master will ask one question each and will moderate the discussions and answers will identify the winner of each quiz. Each answer that is correct will get a certain score (between 1 and 10, where 10 is the best) the scores of all the 31 questions will be added up to identify the final winner."

I have some of my favorite MVPs as Quiz master. This is the great chance to share and spread the knowledge in the community. Interested professionals in the particular area can participate in the quiz.  Details are here.

Please register and win prizes as Apple iPad, an Amazon Kindle, five Apple iPod Nanos, and lots of free software. The “Quiz Masters” include SQL Server MVPs, including Erland Sommerskarg, Itzik Ben-Gan, Andy Leonard, Louis Davidson, Arnie Rowland, Pinal Dave, Madhu Nair, Peter Larsson, Brad Schulz, Deepak Rangarajan, Greg Low, Rob Farley, Sankar Reddy, Alejandro Mesa, Glenn Berry, Jessica Moss, Madhivanan, David Barbarin, Aurelian Verla, Dinesh Asanka, Adam Haines, Jonathan Keyhayias, Vidya Sagar, Jacob Sebastian, Satya Jayanti, Michael Coles, Sugesh Kumar, Sugesh Kumar, Erik Jensen, Hilary Cotter, Allen White, and Paul Nielsen.

Beyond Relational is already famous for its T-Sql Challenges , now comes up with SqlServer Quiz,. I wish all the best for those who participates.

September 13, 2010

Application Level Data Binding in WPF

 

Open VS2010 Navigate to File->New Project ->Windows->WPF Application-> Give a name to the project. App.xaml and mainwindow.xaml files are created by default in the project.

WPF Project

Mainwindow.xaml.cs file is the main file where we write our code. App.xaml is used for storing the connection strings in the application.

XAML is Extensible Application Markup Language that is used for designing WPF, Silverlight applications .

Design the UI

This is the code to be written in XAML file

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid x:Name="ownerdetails" Background="Azure" >
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>         <TextBlock x:Name="txtCity" Margin="67,8,84,10" Grid.Row="2" TextWrapping="Wrap"  />
        <TextBlock x:Name="txtLName" Margin="67,8,84,10" Grid.Row="1" TextWrapping="Wrap"  />
        <TextBlock x:Name="txtFName" Margin="67,8,84,10" TextWrapping="Wrap"  />
        <TextBlock x:Name="txtDOB" Margin="67,8,84,10" Grid.Row="3" TextWrapping="Wrap" />
        <TextBlock x:Name="txtCountry" Margin="67,8,84,10" Grid.Row="4" TextWrapping="Wrap" />
        <TextBlock x:Name="txtOwnerID" Margin="67,8,84,10" Grid.Row="5" TextWrapping="Wrap"  />
        <TextBlock x:Name="valOwnerFName" Grid.Column="1" Margin="69,8,72,10" TextWrapping="Wrap" Text="First Name" />
        <TextBlock x:Name="valOwnerLName" Grid.Column="1" Margin="69,8,72,10" Grid.Row="1" TextWrapping="Wrap" Text="Last Name" />
        <TextBlock x:Name="valCity" Grid.Column="1" Margin="69,8,72,10" Grid.Row="2" TextWrapping="Wrap" Text="City" />
        <TextBlock x:Name="valOwnerBirthdate" Grid.Column="1" Margin="69,8,72,10" Grid.Row="3" TextWrapping="Wrap" Text="DOB" />
        <TextBlock x:Name="valownerbalance" Grid.Column="1" Margin="69,8,72,10" Grid.Row="4" TextWrapping="Wrap" Text="Owner Balance" />
        <TextBlock x:Name="valownerID" Grid.Column="1" Margin="69,8,72,10" Grid.Row="5" TextWrapping="Wrap" Text="Owner ID" />
        <Image  HorizontalAlignment="Left"  Name="image1" Stretch="Uniform"  VerticalAlignment="Bottom"  Grid.Column="1" Source="images/hima.jpg" Grid.Row="6" />
    </Grid>
</Window>

Create a class to define properties of object

Add new item (class) to the project and define userdetails class that implements following properties.

class UserDetails
    {
        public int OwnerID { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string Country { get; set; }
        public string ImageName { get; set; }
        public DateTime BirthDate { get; set; }
    }

Write the code in MainWindow.cs file

MainWindow.xaml.cs file define these following methods

//Define user Details

private void GetUserDetails()
       {
           userdetails = new UserDetails();
           userdetails.OwnerID = 12345;
           userdetails.FirstName = "hima";
           userdetails.LastName = "Vejella";
           userdetails.ImageName = "images/hima.jpg";
           userdetails.State = "AP";
           userdetails.City = "Hyderabad";
           userdetails.Country = "India";
           userdetails.BirthDate = new DateTime(08 / 28 / 1981);

       }

//Set the values
       private void SetValues()
       {

           txtCity.Text = userdetails.City.ToString();
           txtDOB.Text = userdetails.BirthDate.ToString();
           txtLName.Text = userdetails.FirstName;
           txtFName.Text = userdetails.LastName;
           txtOwnerID.Text = userdetails.OwnerID.ToString();
           txtCountry.Text = userdetails.Country.ToString();

       }

Call the above two methods in the Main window.

UserDetails userdetails;
       public MainWindow()
       {
           InitializeComponent();
           GetUserDetails();
           SetValues();           
       }

Output

you can view thw output in a window as follows.

Output 

September 08, 2010

SqlServer 2008 Performance Optimization Training

This 2 day seminar covers best of the best concepts and practices from popular courses offered by Solid Quality Mentors. Theoretically any one can go through the technical stuff and learn their own. The seminar focuses completely on providing real world experience by using practical demos and scenarios derived from customer engagements. The seminar is uniquely structured. Sessions are discussion based and designed to be an interactive between instructor and participants for an optimal learning experience.

Target audience

This seminar is intended for following audiences:

  • SQL Developers – Professionals responsible for writing optimal SQL Query
  • SQL DBA – Professionals responsible for performance of the server
  • Programmers – Any language programmer who deals with SQL Server

Yes. It is happening in major cities in India and all over the world . do not miss the opportunity.

Agenda

Day 1: Performance T-SQL with Solid Foundation

  • Don’t Lie to Me. O Liar!  – Resolutions to Popular Misconceptions

There are plenty of myths regarding SQL Server features, some of them were true at times and others were pure imaginations. This Myth Buster session will talk about myths and will bust them – Scientifically!

  • 5 Point Subquery – The Unknown Tricks and Tips of Subqueries

The age old topic of Subquery is in fact never old. Subqueries are most confusing to people who claim to know them well. This session talks about unknown tricks and tips that only advanced users would know. Learning them is like doing 6 digit multiplications without using paper or calculators.

  • Your Joins, My joins, Our Joins – The Relation between External and Internal Joins

The SQL Server Engine looks at the Join very differently from how we look at it. We think that there are Cross Join, Inner Join and Outer Join. SQL Server Engine thinks there are Loop Join, Merge Join and Hash Join. Learn where and how the bridge is completed.

  • 3 ‘Real’ Idiots of SQL – Triggers, Views and …!

Triggers and Views are very cool advanced features. When they get in the hands of the ‘not so smart’ developers, they have the potential of transforming into weapons of mass destructions. The reality of Trigger and Views are revealed here in this session. Hopefully, it will convince you to not use them in future coding.

  • SolidQ Quiz Hour – One Contestant (Instructor) and Multiple Quiz Masters (All of You)

Here is your chance to ask your questions to the instructor which are so far not covered in any of the sessions. You can ask as many questions as you like as well bring your real world problems. The instructor will guide you towards attaining resolutions to your problems.

Day 2: Performance Tuning T-SQL with Solid Advanced Technique

  • The Good, The Bad and The Ugly Side of Index – Evils of Index and Workarounds

The myth about Index is that it improves performance. The even bigger myth about Index is that it reduces performance. The reality is confusing and developers are lost trying to balance the performance of various queries involving multiple tables. In this session, learn what you should not do with Indexes. Once you master the wisdom of where and how to create them, the mystery of Indexes will be solved.

  • Blood veins and Heartbeats! – The Intelligence of Statistics

This session is the soul of these two days of training. The mystery of SQL Server Engine will be opened wide in front of us. We will go over each and every detail which leads engine to give optimal performance to the query. We will also answer few important questions about statistics and its optimal settings.

  • Sniffing Parameters is Injurious to Health! – Optimize Your Query for Unknown Values

Ever wondered why recompiling your query works faster? Ever wondered why restarting SQL Server Services improves the performance. Ever wondered how distribution of the data changes the cache plan. Here is your chance to learn the same and optimize any query for any of the unknown variable.

  • Fast, Faster and The Fastest! – Turbo Fast Queries Techniques

This is the grand finale of two days. We will take a query which is already running in zero (0) millisecond and optimize it further by three levels. Each level will be more difficult than others and the end result will be stunning. This unique session will teach you interesting lessons at each level of optimization and will run the query faster than its original seep of zero (0) millisecond.

  • SolidQ Quiz Hour – One Contestant (Instructor) and Multiple Quiz Masters (All of You)

This session will cover up any loose ends of the two days seminar. The best participant will also get a unique gift from the instructor.

To join the seminars drop an email to the following address. Himabvejella@gmail.com and IndiaInfo “at” SolidQ.com. If you specify MUGH in Title, you will avail special discount in overall rates on specified price. Yes, a more than 20% by using MUGH I promise. If you register using MUGH you will be eligible to win MS Freesoftwares, MSDN VS2010 license  and windows7 Ultimate DVD .

Current Schedule

  • Chennai, India: Sep 24-25, 2010
  • Colombo, Sri Lanka: Oct 4-5, 2010
  • TBD, USA: Nov 15-16, 2010
  • TBD, USA: Nov 17-18, 2010
  • Hyderabad, India: Nov 27-28, 2010
  • Pune, India: Dec 4-5, 2010

Complete Information in http://www.solidq.in/Training/DirectionsSeminar.aspx

If you have any questions please feel free to contact me . Please note that the lunch and snacks for the 2 days will be provided.
The Venue
Western Amrutha Castle, 5-9-16, Opp. Secretriat, Saifabad, Khairatabad, Hyderabad.
Hurry up the seats are limited only.

September 06, 2010

Implementing 301 Redirects for ASP Sites at the Application Level.

 

The easiest way is doing it in IIS Level. But if you have shared hosting, where you do not have control on the Web Server and your hosting provider didn’t agree to do it, you have no option other than doing it at the application level.

So you need to include the following code in all of your ASP pages

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "www.freemanortho/new-page.asp"
%>

Whereas this will not work in FireFox and the following error message is thrown.

“The page isn't redirecting properly .firefox has detected that the server is redirecting the request for this address in a way that will never complete. '”

What if you have 1000+ pages and it is difficult to change and hardcode in all the pages , that is time consuming and maintenance headache. What if a new page is created, then again you need to write this code too.

We need to write a best practice more generic approach that gives optimized output, better results with a minimum overhead

Instead of hard coding domain names and page names

Get Domain Name

Get Domain name using request.ServerVariables("HTTP_HOST"))

Get Path Name

The path of the pages can be dynamically get by = request.ServerVariables("PATH_INFO")

Get QueryString

If there is querystring append the querystring to the URL along with path name.

request.ServerVariables("QUERY_STRING")

We can even now  handle the querystrings if any in the live websites by appending pathname and querystring to the url.

Use the below code to redirect the pages dynamically.

<%

Domain_Name = lcase(request.ServerVariables("HTTP_HOST"))

if domain_name <> "www.freemanortho.com" Then

HTTP_PATH = request.ServerVariables("PATH_INFO")

QUERY_STRING = request.ServerVariables("QUERY_STRING")

theURL = "http://www.freemanortho.com" & HTTP_PATH

if len(QUERY_STRING) > 0 Then

theURL = theURL & "?" & QUERY_STRING

end if

Response.Clear

Response.Status = "301 Moved Permanently"

Response.AddHeader "Location", theURL

Response.Flush

Response.End

end if

%>

Create a file called Redirect.asp and

Now include this file in the include file in the header.asp .
<!-- #Include file="redirect.asp" -->

As the header.asp is the include file that is called in all the pages, the code gets called in all the pages.

Now our site, gets redirected to www.freemanortho.com instead of http://freemanortho.com throughout the site in any page

September 02, 2010

MS Expression Blend - Installation

When working with Silverlight or WPF the tool that you need to have is MS Expression Blend .The latest version of it is Expression Blend 4. This really helps in great design of UI and enhancing productivity. Blend helps in creating rich interfaces apart from VS2010 IDE. Blend is integrated to VS IDE ,in the sense you can open a VS IDE created File in Expression Blend and the XAML UI created by Blend will always supported by VS IDE. It should be a tool that every Silverlight developer need to have.

You can download 60 day trial version from the following link.

Installation Steps

Once you download the the tool from the link and run the exe file, an installation wizard prompts to accept the terms and conditions.

Step1

Blend-installtion

If you would like to join the customer experience program, you can check yes otherwise Check-No

Step3

Blend-step2

Check the components to be installed in Expression Studio Ultimate
Expression Blend, Studio Design & Encoder, and WPF Tool KIT.

Blend- finish

Click on finish to complete installation.

It can be integrated to TFS 2008 or TFS 2010 as well.

1. We need to make sure that TFS has correct permissions to handle the tasks . The permissions to create project is different from check out the files.

2. TFS can be connected using Team explorer.

3. We need to create a workspace that contains local  copies of source control files in TFS.

4. After the workspace is created files can be downloaded to the local folder from TFS.

5. Once the files get copied to local folder , now we can check-in, checkout or merge, compare files using TFS , from Blend or VS2010.

This way it acts exactly as collaboration tool for designers and developers.

 

September 01, 2010

Implementing 301 redirects for the Dotnet (ASPX) sites

In my previous post I have explained to implement 301 redirect at IIS Level . Now let us walk through how to implement it for ASPX/ DNN sites.

Implementing 301 redirection for ASPX sites at the application level can be done by rewriting the URL.URL Rewriting can be done by configuring HTTP Modules in the hosting website.

There are 3 simple steps to be done to implement 301 redirect for the DNN/ ASPX sites which I have implemented for my current project, Thought of sharing it with all of you .

1. Import UrlRewritingNet.UrlRewriter.dll in DNN Site Bin Folder - This is open source component dll. It can be downloaded from the following path http://urlrewriting.net/149/en/home.html

2. We need to change web.config settings for defining URL ReWrite Section, URL ReWrite Settings and ReWrite the HTTP Module

The following need to be added in config sections of Web.config

<!--1st Add URLRewrite Section -->

<section name="urlrewritingnet" requirePermission ="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter" />

<!--2nd UrlRewritingNet.UrlRewrite entry -->

<urlrewritingnet

rewriteOnlyVirtualUrls="true"

contextItemsPrefix="QueryString"

defaultPage = "default.aspx"

defaultProvider="RegEx"

xmlns="http://www.urlrewriting.net/schemas/config/2006/07" >

<rewrites>

<add name="KickIt" virtualUrl="^http\://mysite.com/(.*).aspx"

rewriteUrlParameter="ExcludeFromClientQueryString"

destinationUrl="http://www.mysite.com/$1.aspx"

redirect="Domain"

redirectMode="Permanent"

ignoreCase="true" />

</rewrites>

</urlrewritingnet>

<!--3rd Add URL Rewrite HTTPModule entry under HTTP Modules section -->

<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />

August 31, 2010

Working with Silverlight 4 – Applications

This blog post focuses on how to get started with Silverlight project and installation of Silverlight4 templates to Visual Studio 2010 RC. This covers the required installation steps and prerequisites to work for a Silverlight 4 project. Step by step procedure of installation of Silverlight development Kit is explained. So Read on…

Once you install VS2010 , you can get started with Silverlight application.

Navigate to the  File menu in VS2010 - > New Project-> Silverlight-> Silverlight Application .

Silverlight- project

Give meaningful name of the Silverlight project. Once the name is given, you need to create a website to host Silverlight application.

select-project Type-2

You can select the project type as Web Application, Web Site or ASP.NET MVC project to host the newly created Silverlight application.

You can work with Silverlight3 using VS2010 by default.  You need to Install Silverlight SDK to work on latest version of silverlight  ie (SL4)

SilverLight3 -dropdown - VS2010

To create SL4 app, VS2010 requires installing Silverlight4_Tools.exe .

Silverlight-installtion-Step1

This installation includes

· Silverlight 4

· Silverligh4 Development KIT

· WINDOWS COMMUNICATION FOUNDATION (WCF) RIA SERVICES

· KB976272, which is a supplement to MICROSOFT VISUAL STUDIO 2010

After you agree terms and conditions software check and system requirements are fine, then you will be redirected to the following step.

Sliverlight-installtionStep2

Click on finish once the installation is done.

After the installation is successful, Open VS2010 and create new Silverlight project, now you can see Silverlight4 in dropdown and the additional project templates that are installed.

silverlight4

You can notice that SL4 business applications and WCF RIA Services are now newly added templates.

silverlight-4projects

It will not take more than 30 minutes to download and install these Silverlight4 tools.

Silverlight4-project host

Note: Now there is an option to enable WCF RIA Services.

You need to have silverlight4 in order for the Silverlight4 application to run and show its rich UI.  It can be downloaded and installed in just 2 minutes on this official MS site