Skip to main content

Posts

Showing posts from June, 2015

How To Optimize Your Site With HTTP Caching

For web sites, speed may be feature #1.  Users hate waiting , we get frustrated by buffering videos and pages that pop together as images slowly load. It’s a jarring (aka bad) user experience. Time invested in site optimization is well worth it, so let’s dive in. What is Caching? Caching is a great example of the ubiquitous time-space tradeoff in programming. You can save time  by  using space  to store results. In the case of websites, the browser can save a copy of images, stylesheets, javascript or the entire page. The next time the user needs that resource (such as a script or logo that appears on every page), the browser doesn’t have to download it again.  Fewer downloads means a faster sites, happier users. Here’s a quick refresher on how a web browser gets a page from the server: Browser: Yo! You got index.html? Server: (Looking it up…) Sever: Totally, dude! It’s right here! Browser: That’s rad, I’m downloading it now and showing the user. (The actual  HTTP 

How To Optimize Your Site With GZIP Compression

Compression is a simple, effective way to save bandwidth and speed up your site. I hesitated when recommending gzip compression when  speeding up your javascript  because of problems in older browsers . But it’s the 21st century. Most of my traffic comes from modern browsers, and quite frankly, most of  my users  are fairly tech-savvy. I don’t want to slow everyone else down because somebody is chugging along on IE 4.0 on Windows 95. Google and Yahoo use gzip compression. A modern browser is needed to enjoy modern web content and modern web speed — so gzip encoding it is. Here’s how to set it up. Wait, wait, wait: Why are we doing this? Before we start I should explain what content encoding is. When you request a file like http://www.yahoo.com/index.html , your browser talks to a web server. The conversation goes a little like this: Browser: Hey,  GET  me /index.html Server: Ok, let me see if index.html is lying around… Server: Found it! Here’s your response code (200 OK)

Managing Large Web Server Farms: Microsoft's AutoPilot

Whenever you read stories about how Web companies like Facebook have  10,000 servers including 1800 database servers  or that  Google has one million servers , do you ever wonder how the system administrators that manage these services deal with deployment, patching, failure detection and system repair without going crazy? This post is the first in a series of posts that examines some of the technologies that successful Web companies use to manage large Web server farms. Last year,  Michael Isard  of Microsoft Research wrote a paper entitled  Autopilot: Automatic Data Center Management  which describes the technology that Windows Live and Live Search services have used to manage their server farms. The abstract of his paper is as follows Microsoft is rapidly increasing the number of large-scale web services that it operates. Services such as Windows Live Search and Windows Live Mail operate from data centers that contain  tens or hundreds of thousands of computers , and it is essen

Encrypt and Decrypt Data

There are many instance where we need to encrypt and decrypt data. Here is a class which does the job.     public class CryptographyHelper     {         static byte [] entropy = Encoding .Unicode.GetBytes( "Salt Is Not A Password" );         public static string EncryptString(System.Security. SecureString input)         {             byte [] encryptedData = System.Security.Cryptography. ProtectedData .Protect(                 System.Text. Encoding .Unicode.GetBytes(ToInsecureString(input)),                 entropy,                 System.Security.Cryptography. DataProtectionScope .CurrentUser);             return Convert .ToBase64String(encryptedData);         }         public static SecureString DecryptString( string encryptedData)         {             try             {                 byte [] decryptedData = System.Security.Cryptography. ProtectedData .Unprotect(                     Convert .FromBase64String(encryptedDa