Tuesday, October 20, 2015

Web site performance caching

                  

web cache (or HTTP cache) is for the temporary storage (caching) of web documents, such as HTML pages and images, to reduce bandwidth usage, server load, and perceived lag.

The ability to cache and reuse previously fetched resources is a critical aspect of optimizing for performance.

There are 2 types of cache scenario

Empty cache scenario and Primed cache scenario
























Monday, October 19, 2015

Web Site Performance Compression

                  

When we talk about web site compression. we are actually referring to HTTP compression.

HTTP Compression : Is a capability that can be built into web servers and web clients to improve transfer speed and bandwidth utilization.
  • Http data is compressed before it is actually sent from the server
  • Compliant browsers will announce what method are supported before downloading the correct format





















  • Browsers that do not support compliant compression method would actually download uncompressed data
  • Additional CPU is used on both server and browser to compress and uncompress the content. Bytes saved over the network make this trade worthwhile. Usually we have CPU available on both end.
















The most common compression scheme include GZIP, Deflate






Enable IIS to compress content

The server handles 2 types of compression
Static Content --> html, javascript and css
                             By default this is checked.

Note:1)  IIS has a threshold of no of times the file has to be requested in a given period of time before it would compress the file. By default it is 2 times within a 10 sec period. Reason to save CPU time.   

If the files are requested frequently then it might not compress the file

         2) IIS would only compress a file over a specific size


Dynamic Content --> Aspx, Cshtml, JSON 



  •      Need to install dynamic compression module in IIS . We can use platform installer
  How to check if Dynamic Content compression is enabled?





C:\Windows\System32\inetsrv\config folder where we have IIS configuration file












Note

1):By default no compression is done for JSON and XML. We need to enable it
in the config file








2) We need to make sure that the mime type is supported by the client












Thumb rule for compression:

If it is text based content then we can compress

Angular two way binding

                       

Two way data binding:  When the view changes model changes and when the model changes view                                        changes
Note: In angular we do not need observable as we need in Knockout

Thursday, October 15, 2015

Tuesday, October 13, 2015

Excel export from JSON

                               

I have a previous posts on generating Excel file from a table. Unfortunately they do not work in IE. We can generate Excel file from a JSON file as shown below

What do we need?

  • JSONtoCSVConverter javascript file.
  • JSON Data
  • Jquery 
This line is important
 JSONToCSVConvertor(data, "Blog Report", true);

Wednesday, October 7, 2015

Java script cheat sheet

                                        Java script cheat sheet

Replace a character

$scope.SelectedUsers.selected.Text.replace("– ", "-- ")

Monday, October 5, 2015

Why Protractor?

                           
Use : End to End testing

Advantages
  • Test like a user
  • Improve test efficiency
  • Pain point in testing is it is repetitive. It takes care of it
  • It always remembers to check everything
  • Protractor runs while we are working
  • It would interact with the browser faster then humans
  • It would enter data faster then humans
Note: It is built on selenium

For more information :
https://docs.angularjs.org/guide/e2e-testing

Sunday, October 4, 2015

Angular - Export to table (XML, PDF, JSON..)

       
we can export data from a table into various format including 
Json, Xml, Pdf .....

What do you need
  • Angularjs
  • Jquery.js
  • Files referenced below

Note: This example would not run in IE 


Angular export to Excel


Note: You can refer to my other post where it would support different flavors like Excel, Pdf
Edit in plunker new

Note: For excel it does not allow "-" character. We have to use replace function


$scope.SelectedUsers.selected.Text.replace("– ", "-- ")