Friday, October 24, 2008

Tips for designing a good web site

All the web designer works on their way to develop the fast loading site. These are the common observation while we do web page design
1. Minimize the use of images.
2. Optimize images for the web
3. Use Tables creatively
4. Cut down the use of animated gifs
5. Design simple icons
6. Use background images instead of big images whenever possible
7. Try out CSS Styles
8. Use Flash sparingly
9. Design most of site contents in HTML.
Keep checking your load time - Check its load time on
NetMechanic. This site gives you a free analysis of your web site, which is extremely useful.


Asp.net Server Side coding tips

ASP.NET has been developed with lots of features, which makes developer life easy. Start from ViewState, PostBack, Server Controls , User Controls and etc. All of them can make your web development experience fun and easy, but improper use of them can cause your site performance slowdown.
1.Avoid unnecessary round trips to the server. Use IsPostBack property effectively.
2.Enabled ViewState only if needed.
3.Leave buffering on unless we have a specific reason to turn it off.
4.Use the Server.Transfer method from the Server object or cross-page posting to redirect between ASP.NET pages in the same application
5.Disable session state when you are not using it.( <
%@ Page EnableSessionState=false%> ) When required choose the correct session-state provider depends on the design.
6.Use SQL Server and stored procedures for data access. Use the SQLClient class and SqlDataReader class for a fast forward-only data cursor.
7.Cache data and page output whenever possible.
8.Avoid using view state encryption unless necessary.
9.Run Web applications out-of-process on Internet Information Services 5.0.
10.Recycle processes periodically.
11.Adjust the number of threads per worker process for your application if necessary.
12.For applications that rely extensively on external resources, consider enabling Web gardening on multiprocessor computers.
13.Disable debug mode, deploy only Release version. Use Pre-compiling deployment.
14.Avoid single-threaded apartment (STA) COM components.( include the ASPCompat=true attribute in the @ Page directive in the .aspx)
15.Handle exceptions wisely.

Monday, October 20, 2008

To debug JavaScript in VS.NET

  1. Open Microsoft Internet Explorer.
  2. On the Tools menu, click Internet Options.
  3. On the Advanced tab, locate the Browsing section, and uncheck the Disable script debugging check box, and then click OK.
  4. Close Internet Explorer.
    In your JavasSript function add the keyword debugger . This causes VS.NET to switch to debug mode when it runs that line.
    Run your ASP.Net application in debug mode.
    That's all there is to it.

Working with large XML files in asp.net

When we work with larger XML files(2GB), if we use XMLDocument object which takes the whole document into the memore to traverse. It will create lot of performance issues in large environment.
So in such cases if we use XMLReader or XMLTextReader objects, for 2GB document will take only few KB's in memory.
Comparison from Microsoft

Monday, October 6, 2008

Distinct of Data based on a particular Column-TSQL

When we want a distinct of data from a huge DB table (In my case I have 2 lakhs records (0.2 million))

Here ColA has duplicate records based on the ColB data.
We want distinct of ColA and one ColB data. We cannot use the following query.
SELECT DISTINCT ColA, ColB FROM tableA.
Else we have to separately store the distinct values in a DS and then loop through the table again for ColB.
Instead we can use the simple GROUP BY clause
"SELECT tableA.ColA,min([tableA.ColB])FROM tableA GROUP BY [tableA.ColA]"

Load Balancing Web Applications

Some good articles on Load balancing
1.http://www.onjava.com/pub/a/onjava/2001/09/26/load.html
2.http://www.webtechniques.com/archives/1998/05/engelschall/

Sunday, October 5, 2008

Favicon's in a SharePoint Master Page

Favicon's are 'Custom Icon for your websites'. When you hit your portal address on the browser the favicon file appears in the address bar.A Favicon is a multi-resolution image included on nearly all professional developed. Now, how do you do this in SharePoint? Here are my steps

  1. Create a image of size 16x16 using any icon creator tool.
  2. Drag a favicon.ico file to the Images directory of your MOSS site with SharePoint designer.
  3. Add the following line to your Master Page at the bottom of the head section right before the /head tag: (link rel="shortcut icon" href="/images/favicon.ico")
  4. Check-in, publish, and approve your Master Page so that anonymous folks can see the change.
  5. Refresh the site, and you should see the favicon
  6. This site will create a .ico image for you.For more details:http://www.chami.com/html-kit/services/favicon/