Skip to content

Date archive for: August 2015

Implementing a heartbeat pattern with AJAX and ASP.NET

Problem So I’m working on a web application, where I needed a way to detect when a user has closed their browser. Javascript’s onunload event looked promising. However, it is unable to differentiate between a browser closing, a postback, and a page refresh. After talking (i.e. complaining) to Kyle, he suggested this Stack Overflow solution on implementing a heartbeat pattern, letting the server know when the client was no longer active. Heartbeat Pattern In the heartbeat pattern (where you can read more about here), the client will send a signal to the server indicating that it’s still alive every 10 minutes (or…

Continue reading Implementing a heartbeat pattern with AJAX and ASP.NET

Your code is bad… Take care of it

  Refactoring is often not done. “There is not enough time”.  “Its not your responsibility”.  Look. Refactoring can only *help* you. You don’t need to devote hours and hours to it. Just make small changes. And over time your code will improve. And for the most part. Most of us are not writing NEW code. We are maintaining code. (And you probably should not be trying to write MORE code, but that’s another story). And its likely you will be working in the same code base for the duration of your employment, or will eventually be called to return to it.…

Continue reading Your code is bad… Take care of it