Simplest way for Cache Busting in NodeJS/Express

Caching in Web browsers is important. Without caching page performance is hurt as each page navigation requires the same set of JavaScripts and CSS files to be re-fetched. We can achieve caching by setting Cache-Control header’s max-age in the HTTP response headers. In NodeJS/Express stack, you do this done by passing options map to express.static() middle-ware.

However, the challenge is to discard or bust this client cache for new code deployments. As HTTP is a stateless protocol, there is no way server can tell clients to ignore old caches and request again. If you do set max-age:0 then we shall not arrive in this situation at all. However, we want to achieve caching and refresh this cache with new code deployments.

Read more

Inline jQuery misses CSS change event in IE10

The goal is to achieve slow rotation of an image infinitely. So, the trick i thought of using two CSS classes. First class is a base css. Another defines rotation and transform delay. Here are these two: .image_basic { overflow:hidden; } .image_rotate { -webkit-transform:rotate(3600deg); -moz-transform:rotate(3600deg); -ms-transform:rotate(3000deg); -o-transform:rotate(3600deg); transform:rotate(3600deg); -webkit-transition-duration: 400s; -moz-transition-duration: 400s; -ms-transition-duration: 400s; -o-transition-duration: 400s; transition-duration: 400s; transition-timing-function:ease-out ; transition-delay:0.2s; -webkit-transition-property: -webkit-transform; -moz-transition-property: -moz-transform; -ms-transition-property: -moz-transform; -o-transition-property: -o-transform; transition-property: transform; overflow:hidden; } It’s a transform for ten rotation over 400 seconds. This roughly gives you slow rotation indefinitely (assuming 400 seconds ~ 6 mins is enough time to stay…

Read more

ProxySwitcher – My First Firefox Extension

At IITK we have two Internet proxy-servers. Sometimes, one server goes down and we are required to switch to another by navigating to Tools > Options > Advanced > Network > Settings. With Firefox, I tried to simplify this effort with following extension – one click proxy switcher! Once installed, you will see IITK’s Proxy Switcher in Tools menu. This extension switches between direct connection, bsnlproxy and vsnlproxy. It only modifies server-address and leaves PORT number as it is.

Read more

Fun with Yahoo Media Player!

A quick way to insert music in your site: Create hyper-links for few MP3 files Insert following script code to your page <script type=”text/javascript” src=”http://mediaplayer.yahoo.com/js”></script> You are done! Yahoo! Media Player will be loaded and it will make all media links clickable 🙂 Here are few of my favorite tracks. Use the play button to listen. Thanks to RadioReloaded.com. Tere Naina, Chandi Chowk To China (2009) Jaane Kyun Log Pyar Karte Hein, Dil Chahta Hai (2001) Akela hoon Mein, Raeth Gum Sum Ho Kyun, Aksar Ye Jo Mohabbat Hai, Dil Vil Pyar Vyar (2002) Mumma, Dasvidaniya (2008) Tujh Mein Rab…

Read more