Posts

Showing posts from May, 2011

How to hide generated javascript file in visual studio code

In this post I am going to show you a cool trick in visual studio code. Let's suppose you are writing typescript code in visual studio code and you want to hide generated javascript code.

Create .vscode folder in your folder and then create settings.json file and paste following code

{ "files.exclude": { "node_modules":true, "**/.git": true, "**/.DS_Store": true, "**/*.js.map": true, "**/*.js": {"when": "$(basename).ts"}     } }

Best Practices for Speeding Up Your Web Site

Today I found a greate article for  best practices for making web pages fast.The list includes 34 best practices divided into 7 categories.

 1) Content

    * Minimize HTTP Requests
    * Reduce DNS Lookups
    * Avoid Redirects
    * Make Ajax Cacheable
    * Post-load Components
    * Preload Components
    * Reduce the Number of DOM Elements
    * Split Components Across Domains
    * Minimize the Number of iframes

2) Server

    * Use a Content Delivery Network
    * Add an Expires or a Cache-Control Header
    * Gzip Components
    * Configure ETags
    * Flush the Buffer Early
    * Use GET for AJAX Requests

3) CSS

    * Put Stylesheets at the Top
    * Avoid CSS Expressions
    * Choose over @import
    * Avoid Filters

4) Javascript

    * Put Scripts at the Bottom
    * Make JavaScript and CSS External
    * Minify JavaScript and CSS
    * Remove Duplicate Scripts
    * Minimize DOM Access
    * Develop Smart Event Handlers

5) Cookie

    * Reduce Cookie Size
    * Use Cookie-free Domains for Components

6) Imag…

How to Programmatically add JavaScript File to Asp.Net page?

Image
In this post I will show you how to add JavaScript files programmatically  to your asp.net page. 

Just add this code to the Page_Init event handler on your page:




<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Blog_Tips.aspx.cs" Inherits="Blog_Tips" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title></title></head><body><formid="form1"runat="server"><div>             How to Programmatically add JavaScript File to Asp.Net page?         </div></form></body></html>


using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; publicpartialclass Blog_Tips…