ConfigurationManager.AppSettings Caching

A quick test seems to show that these settings are only loaded at application startup. //edit the config file now. Console.ReadLine(); Console.WriteLine(ConfigurationManager.AppSettings[“ApplicationName”].ToString()); Console.WriteLine(“Press enter to redisplay”); //edit the config file again now. Console.ReadLine(); Console.WriteLine(ConfigurationManager.AppSettings[“ApplicationName”].ToString()); Console.ReadLine(); You’ll see that all outputs remain the same.

X-Cache Header Explanation

CDN (Content Delivery Network) adds X-cache header to HTTP Response. X-cache:HIT means that your request was served by CDN, not origin servers. CDN is a special network designed to cache content, so that usr request served faster + to unload origin servers.

Force browser to reload index.htm

OK, apparently no-cache was not enough. The following does the trick: <meta http-equiv=”cache-control” content=”no-cache, must-revalidate, post-check=0, pre-check=0″ /> <meta http-equiv=”cache-control” content=”max-age=0″ /> <meta http-equiv=”expires” content=”0″ /> <meta http-equiv=”expires” content=”Tue, 01 Jan 1980 1:00:00 GMT” /> <meta http-equiv=”pragma” content=”no-cache” />

Android take screen shot programmatically

Here you go…I used this: View v = view.getRootView(); v.setDrawingCacheEnabled(true); Bitmap b = v.getDrawingCache(); String extr = Environment.getExternalStorageDirectory().toString(); File myPath = new File(extr, getString(R.string.free_tiket)+”.jpg”); FileOutputStream fos = null; try { fos = new FileOutputStream(myPath); b.compress(Bitmap.CompressFormat.JPEG, 100, fos); fos.flush(); fos.close(); MediaStore.Images.Media.insertImage( getContentResolver(), b, “Screen”, “screen”); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); … Read more

How do you set the expiry date or a maximum age in the HTTP headers for static resources in IIS

Leverage browser caching: Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network. http://code.google.com/speed/page-speed/docs/caching.html#LeverageBrowserCaching To set an expiry date or a maximum age in the HTTP headers for static resources Open IIS manager-> Click … Read more

Force refresh of cached CSS data

TL;DR Change the file name or query string Use a change that only occurs once per release File renaming is preferable to a query string change Always set HTTP headers to maximize the benefits of caching There are several things to consider and a variety of ways to approach this. First, the spec What are … Read more

Rails.cache error in Rails 3.1 – TypeError: can’t dump hash with default proc

This might be a little verbose but I had to spend some time with the Rails source code to learn how the caching internals work. Writing things down aids my understanding and I figure that sharing some notes on how things work can’t hurt. Skip to the end if you’re in a hurry. Why It … Read more