Questions from a Noob.

Apr 11, 2009 at 3:05 AM
 Hi

I am new to this MbCompression and I am already pleased with the results that this has given me. So far I was able reduce one page loading time from 100 seconds down to 60seconds(this is at a speed of 56k). So I very happy like that since I have quite a few jquery plugins that I need to use and it made it that I was almost loading up like 700kb of javascript files and css files.

So I am not clear on a couple other things.

"Page compression module"

Does this compress the whole page? How about if I already used this library to compress the javascript files? Does it re compress it again?

I am also using this: http://www.stardeveloper.com/articles/display.html?article=2007110401&page=1

and I am wondering if thie Page compression does the same thing. If it does the same thing then I can get rid of this right?

"WebResourcce.axd compresion module"

I am not sure what this is sued for and I need to use this.

How can I tell how much cpu power is needed? I hear that compression can be cpu intensive.

When should I not be using compression? Like some Css files and there like at 1kb. So would it be worth compressions or would this be a waste of resources?

I have an antimated gif (ajax spinner) and it is like 162kb can I use this to compress that down?
 
I am kinda confused about some stuff in the read me(they could be a bit clearer in my <style> <!-- /* Font Definitions */ @font-face {font-family:"MS Mincho"; panose-1:2 2 6 9 4 2 5 8 3 4; mso-font-alt:"MS 明朝"; mso-font-charset:128; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:-1610612033 1757936891 16 0 131231 0;} @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:"\@MS Mincho"; panose-1:2 2 6 9 4 2 5 8 3 4; mso-font-charset:128; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:-1610612033 1757936891 16 0 131231 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"MS Mincho"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"MS Mincho"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:10.0pt; line-height:115%;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 72.0pt 72.0pt 72.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style> opinion).

1.
"Or, alternative way to register the file  /Scripts/utils.js this way:
<script type="text/javascript" src="Scripts/jslib.axd?d=~/Scripts/utils.js">"

why is there no closing tag?

I think you should also put point out that  both parts of the source how to point to the same directory(it was not clear at first that both "Scripts" had to be changed to your folder). I only changed the second one at first.

If I wanted to do it the C# way

where would I stick this code?

protected virtual void AddJavaScriptInclude(string path)
{
    HtmlGenericControl script = new HtmlGenericControl("script");
    script.Attributes["type"] = "text/javascript";

    // Change the 'src' to jslib.axd file, but keep the releative directory (for relative urls in the js file)
    script.Attributes["src"] = ResolveUrl(path).Replace(System.IO.Path.GetFileName(path), "jslib.axd?d=" + Server.UrlEncode(path));
    Page.Header.Controls.Add(script);
}

Would I have to call this on page_load? or does it just know to be loaded at some point in the page lifecycle?

Thanks