Sunday, December 28, 2008

jQuery - The cool stuff

The introduction of jQuery and its support in Microsoft's visual studio gonna revolutionize the programmer world with its easy to use interface, built-in features to support cross-browser issues, CSS3 compliance etc., I realized the meaning of "The write less, Do More" after playing around with the jquery package :) . watch for More posts on this cool stuff - !!!!

Tuesday, October 7, 2008

WSE - Web Service Enhancements in VS2008

Web service Enhancements in Visual Studio 2008

Web Service Enhancements
It is a class library primarily focused on building the message-level security using the latest protocols, that includes security, trust and addressing. These capabilities can be added to the application at design time using code or at runtime using the policy file.

WSE in Visual Studio 2003
The addition of WSE to the visual studio 2003 project is straight forward.
• Create a project in Visual Studio 2003.
• Create the Web service reference in Visual Studio 2003.
• Right click on the project and select “WSE settings 2.0”

• Check the option “Enable this project for Web Service Enhancements”

• Notice the reference class file being generated with the WSE class members.

WSE in Visual Studio 2008
Visual studio 2008 doesn’t support or implement WSE in any way. The best way to get around this problem is
• Create a web reference in Visual studio 2008 (it doesn’t implement WSE).
• Copy the content of the web reference folder created in 2003. (Follow the steps mentioned under the section “WSE in Visual Studio 2003”)
• Paste it in the web reference folder of the VS2008 project.
• Refresh the VS2008 project.

Improving Website Performance - Part 3

Retrieve multiple resultsets from database
Design the app in such a way that the requestpath to database is very minimal. Each of the roundtrip decreases the number of requests per second the app can serve. Make sure to return the multiple resultset in single database request. It will enhance the performance as well as the scalability of the application.

Restrict the amount of data retrieved
The sql query or the stored procedure can be designed to restrict the number of results retrieved from the database. In other words the business logic should reside in the stored procedure or Sql query which might constraint a number of results returned from database.

Friday, October 3, 2008

Improving Website Performance - Part 2

Make Use of Repeater control
The ASP.NET controls datagrid, datalist and dataview are heavy on the HTML and doesn't provide scalable performance benefit. Repeater controls provide a better performance over the other ASP.NET controls.

Build the project in Release mode
While building a project make sure to set up the build in release mode. The build in debug mode creates PDB's which overloads the server performance.

Avoid strings and use StringBuilder
The performance of stringbuilder.append is better than string + string. StringBuilder can be a good choice if the concatenation count is more than 3.

Use Server.transfer
server.transfer - sends the request directly to server
response.redirect - sends the response header to client and client in turn sends the request for redirection causing multiple request path.

Monday, September 29, 2008

Improving Website Performance

Following are the few tips to improve the performance of the website.

1. In ASP.NET applications, minimize the usage of ViewState by turning it off. It adds an additional load to the page and so does to the server.

2. Add Javascripts at the end of the web page. This will ensure that the content are loaded first. If we add the javascript at the begining of the page, the browser will start downloading the script without continuing to download the content.

Tuesday, May 6, 2008

SQL Server to Oracle Linking - Part 3 (Contd..)

In the previous blog I wrote about executing oracle table commands from SQL server. The ugly part is passing the input parameter to the oracle queries. This can be restructred and optimized as below,

Select
SET @OracleSqlStatement = 'SELECT UserEmail FROM OPENQUERY(Link_Server,,''select eMail from TestTableA''where UserID = '''''+ @ UserID +''''' '')' can be written as

EXEC(‘SELECT UserEmail From TestTableA where UserId=?’, @UserIdInput) AT Link_Server

Insert

SET @OracleSqlStatement1= 'insert into openquery(Link_Server,''select * from TestTableA'')(UserID, eMail) values ('''+ @UserID +''', '''+ @UserEmail +''')'
can be written as

EXEC(‘Insert Into UserEmail(UserID, emailed) values(?,?), @UserIdInput, @emailInput) AT Link_Server


This resolves the issues with the linked server having synonym for the database schema.

Sunday, May 4, 2008

SQL Server to Oracle Linking Part 2(Contd..)

This post is the continuation of my previous posting about SQL Oracle linking. There were several issues associated with the SQL and external database linking.

Performance is very poor when the external database call has Joins and Where clauses.


Invoking calls to tables which have synonym set up requires manual configuration for distributed schema. (i.e. Applications will have different schema names in different environments like Dev/Test and Prod. Querying the tables with different schema names requires change in schema names in the different environments)



These issues can be resolved through OpenQuery class of SQL Server. The OpenQuery executes a query on the linked server. Although the ‘Query’ returns multiple rows, the OpenQuery returns only the first row.
OPENQUERY ( linked_server ,'query' ).

The DML statements can be invoked as given below.
Declare @ OracleSqlStatement1 Varchar(Max)
Select
SET @OracleSqlStatement = 'SELECT UserEmail FROM OPENQUERY(Link_Server,,''select eMail from TestTableA''where UserID = '''''+ @ UserID +''''' '')'
Insert
SET @OracleSqlStatement1= 'insert into openquery(Link_Server,''select * from TestTableA'')(UserID, eMail) values ('''+ @UserID +''', '''+ @UserEmail +''')'

Update
SET @OracleSqlStatement1= 'update openquery(Link_Server,''select * from TestTableA where UserID = '''''+ @ UserID +''''' '')
SET EMAIL = '''+ @UserEmail +''' '
Delete
DELETE OPENQUERY (Link_Server, ''SELECT name FROM TestTableA WHERE UserID = '''''+ @ UserID +''''' '');

The OpenQuery defined above can be executed by calling a SQL method EXEC

Thursday, May 1, 2008

SQL Server to Oracle linking

One of the greatest features of SQL is linking to heterogeneous database like ORACLE, DB2 etc., The link can be established by executing an in-built stored procedure as below.

EXEC sp_addlinkedserver 'ServerName', 'ProductName', 'ProviderName', 'DATABASE=[dbname];SERVER=ServerID;PORT=XXXXXXXX;

The server linking information will be available in sys.servers view. Once the linking has been established, querying the destination database is pretty straightforward. The key to note is referencing the table name with the linkname and schema through .. (dots).

Select * from ServerLinkName..SchemaName.Destination_Tables

The advantage of establishing the link from SQL to Destination server is
1. Decreases the build/compilation of code. Any updates/changes to DML statements can be done just by modifying the stored procedures.
2. Decreases the overhead of maintainance – The other means of establishing connection to Oracle is through SQLCLR which is maitainance intensive.

The main disadvantage of using the linked server and referencing the destination table using dot operator is the poor performance and resonse times for executing queries. The articles on the same will be available in my successive posts.

Tuesday, April 22, 2008

ASP.NET Data connection performance considerations

“Plan for the performance from the beginning of the development life cycle”.
“Don’t add performance as a post step”
“Design the application for better performance”
The development team must be stressed to focus on the application performance from the beginning not at the end of the life cycle. Some of the recommendations for better data management are

> Open Connections late and close them early.
> Get rid of the connection if it’s not in use.
> Reuse the connection optimally
> Close the connections explicitly
> Use single connection string as different connection string can generate multiple connection pools
> Return what we need from the database

Sunday, April 20, 2008

My Golf experience

My Friend Dr.Raj has been coaching me on Golf fundamentals. I was given instructions to practice easy swing with shoulder movement. On the first day i was practicing to hit nice and easy swing shots covering 80-100 yards. On the second day, Raj gave me the instructions to do putting and chipping. The third day, i was graduated to hit on the 9 hole course with 87-120 yards. I got a par on 110 yards, a birdie on 90 yards and rest of them are boogies. I was so excited when I got birdie on 90 yards. My shots were so powerful that I was able to reach 110 yards with pitching wedge. Since I was hitting 10 yards extra with the regular clubs, Raj advised me to take one club less to reach the target green.

Sunday, April 13, 2008

ASP.NET retain scroll position on Post back

This post is about retaining the scroll position on the ASP.NET page on Post Back. There are few ASP.NET in built features like smartNavigation ,MaintainScrollPosition (2.0 and above) available. But these features have its own drawbacks like tampering the View State, improper page redirects, breaking the css links etc. Here is an approach to retain scroll position in ASP.NET page.

Include a hidden variable in the web page: The hidden variable is added to the web page to save the current position of the window. The hidden variable can be included inside the form tag.



Capture the current scroll position: The javascript injected on the HTML captures the current scroll position. The following document events trigger the function call which will capture the current position.

window.onscroll = saveScroll;
window.onresize = saveScroll;

The script above will trigger the saveScroll method when the window is scrolled or resized. The current position is saved in the hidden variable in the saveScroll method. The definition of saveScroll function is as follows.

function saveScroll()
{
var sScroll;
if (document.documentElement && document.documentElement.scrollTop)
sScroll = document.documentElement.scrollTop;
else if (document.body)
sScroll = document.body.scrollTop;
else
{
sScroll = 0;
}
document.getElementById('__SAVESCROLL').value = sScroll;
}
Restore The Scroll: The scroll position has to be restored when the page post back happens. The following document event triggers the function call which will restore the scroll position.
window.onload = restoreScroll;
The window.onload event will fire after the web page finishes loading. Once the web page finishes loading, the hidden variable where we save the previous scroll position will be available get and restore the scroll back to the same location. The definition of restoreScroll method is given below.

function restoreScroll()
{
var sScroll = document.getElementById('__SAVESCROLL').value;
if (sScroll > 0)
{
if (document.documentElement)
document.documentElement.scrollTop = sScroll;
else if (document.body)
{
if (window.navigator.appName == 'Netscape')
window.scroll(0, sScroll);
else
document.body.scrollTop = sScroll;
}
else
{
window.scroll(0, sScroll);
}
}
}

Tuesday, March 25, 2008

Clearing StringBuilder

There are 3 ways to clear the string builder object.
They are

1. dummyStringBuilder.Remove(0,dummyStringBuilder.Length);
2. string theString = dummyStringBuilder.ToString();
dummStringBuilder.Replace(theString,"");
This method of clearing the string builder is expensive.
3.dummyStringBuilder.Length = 0;

Sunday, March 2, 2008

.NET 3.5 Features

I was reading the blogs on various features of .NET 3.5. SCOTT GU has published a posting on his blog about LISTVIEW control of ASP.NET. The posting covers almost all of the ASP.NET 3.5 features. Please follow this link for the posting.

The posting explains briefly about some of the latest features of ASP.NET 3.5 like

1. CSS manager
2. ListView Control
3. DataPager

Coaching - Identification of Coaching Needs

In an industrialized world, it had become responsibilities of the supervisors to coach the employees to achieve their full potential. Coaching should bring out the inherent potential of the employee and maximize their performance.

The coach/supervisor has to understand and gauge the performance of the employee and derive a suitable coaching/training plan that will enable the employee to efficiently perform the job assigned. The success of the coaching process depends on various parameters like,

1. What would be the return on investment(ROI) of coaching
2. How well the supervisor weighs the employee’s performance
3. How well the supervisor understands where the employee needs to improve the skill sets.
4. What are the potential benefits achieved by coaching/training the employee
5. How well the coach stresses on the purpose of coaching is to improve the skill set. A fairly equal amount of stress should be given to point out errors/mistakes and provide guidance to correct them.

"Employees at Nortel Networks estimate that coaching earned the company a 529 percent "return on investment and significant intangible benefits to the business," according to calculations prepared by Merrill C. Anderson, a professor of clinical education at Drake University." -Psychology Today

Thursday, February 21, 2008

Following posts on Coaching

I am going to widen my writing about coaching. I will be writing about the principles of coaching, effective coaching, differences between coaching and guidance etc., in my future blogs.

To start with few definitions on coaching from my perspective,

COACHING is the process that enables Learning and development to occur thus improve the performance.

Sunday, February 10, 2008

ASP.NET security basics

In the internet world, the content and data has to be secured through user authentication & authorization. The mere difference between authentication and authorization is former validates to check whether the users identity, but the later checks to see what the user can view. The user can be allowed to see a website ( Authenticated). An article from microsoft's website clearly explains about the basics of ASP.NET security. Here is the link for the same

Thursday, February 7, 2008

ASP.NET 2.0 Custom Site Map provider Issues

Custom site map provider of ASP.NET 2.0 does not allow multiple sitemap files in conjunction with a site map provider. But there is a work around by specifying the provider name at the sitemap level or adding sitemap node to point to different sitemap. Please see this link for more info on Issues with multiple Site Map providers

Friday, February 1, 2008

10 ASP.NET performance Improvements

Omar al Zabir had posted an article which speaks about improving the performance of ASP.NET 2.0 Applications. Here is the link.

Monday, January 21, 2008

Employee satisfaction (Contd...) – work life balance

Employees should have an attitude of balancing work and personal life. Organizations provide holidays to employees for managing their personal life. Companies understand that if an employee is happy, he/she will be more productive. Most of the companies have vacation policies to enable employees to take paid time off from work and spend quality time with family and friends.
Here is the link to few strategies for work life balance.

Thursday, January 10, 2008

Employee satisfaction (Contd..) - Managers role

One of my friends had posted a comment in my previous blog about the employee satisfaction. He said “An employee does not leave organization, but they leave because of their managers”. I have read many articles in the past which stresses the same statement.

The role of the managers doesn’t stop in just getting the work done. Managers, with whom I have worked in the past, had an attitude of focusing on individual growth along with getting the work done.
Their planning included a work product delivery schedule as well as the plan for individual development in the organization. An employee will be more than happy to work with a manager who gives importance to his personal development. This enhances the morale of employee and ultimately leads to improvement in the productivity.

Monday, January 7, 2008

Employee satisfaction (Contd..) - impact on customer satisfaction

Keep your employees highly motivated for better customer satisfaction. Obviously employees will perform better and deliver the best if they are very happy at work. This is the secret to satisfy the customers. Perhaps this is the secret to the success of very great coffee chain shop, Starbucks. The company motivates each of its employees by appreciating their work. I appreciate the way they reward their employees. The reward varies from "Best of employee of the month" to "Best of employee of the week" to "Best Latte maker" to "Fastest till Handler". Their secret to success is, “Keep the customers happy”. We can notice the happiness in each of its employees.

If an employee is happy, he/she will keep the stakeholders happy. The link here sets the context for employee attitude towards customer satisfaction Employee attitude vs Customer satisfaction