Posts

Cannot delete folder

"Make sure the disk is not full or write-protected and that the file is not currently in use" Familiar? Here's an amazing little app for this long standing Windows annoyance.

ie8 dns cache clear

Basically IE8 was giving a "cannot display the webpage" for old sites and Outlook 2007 was down too. Firefox was working fine. IE8 seems to do some kind of DNS caching of its own and the only way out seems to be to "reset" advanced settings. Outlook 2007 seems to somehow depend on IE8 for connections too and once this was done, they both worked.

Multiplication tables with one loop/variable

// Multiplication tables int  n = 3; //Basic two loop code for  ( int  a = 1; a <= n; a++)      for  ( int  b = 1; b <= n; b++)          Console .WriteLine( "{0} x {1} = {2}" , a, b, a * b); //One loop variation for  ( int  a = 0; a < n * n; a++)      Console .WriteLine( "{0} x {1} = {2}" , (a / n) + 1, (a % n) + 1, ((a / n) + 1) * ((a % n) + 1));             

Fibonacci solutions :)

///  Impressive solution static   void  Main2( string [] args) {      int  t1 = 0, t2 = 0, i = 0, j = 1, count = 15;      Console .WriteLine(i);      Console .WriteLine(j);      for  ( int  a = 1; a < count; a++)     {          int  localval;          if  (a == 1)         {             t1 = i;             t2 = j;         }          else         { ...

Treat Warnings as Errors

Tip: Treat Warnings as Errors Another neat day-one rule, along with DB sessions and ZERO error handling to ensure that your .Net code is as bug free as possible. The mantra during development has to be to break the app as much as possible, not supress errrors. Ban try-catch blocks! :) [update] The sooner you fall behind, the more time you will have to catch up "an informal slogan of the on-board shuttle group [that] captures the essence of keeping focused on the process" (Focus on breaking) "Gen-Xers sporting T-shirts and distracted looks, squeezing too much heroic code writing into too little time; rollerblades and mountain bikes tucked in corners; pizza boxes and Starbucks cups discarded in conference rooms... It's not the story of the on-board shuttle group" "How do they write the right stuff? The answer is, it's the process" "Software for Grown-Ups"

Control design and empty catch{} blocks

1. All code that is in the control should be reusable. Please don't put anything specific to your pages in the control For ex: Can gvTasks_RowDataBound, PopulateCaseGrid etc be reused by search too? 2. Three properties of _gvCases are already exposed as properties. If you need to do more manipulation of _gvCases in your pages, please expose the whole grid and remove these properties You can then directly work with the grid in your pages (this is not good design but it's better than putting custom code in the control) 3. Please avoid empty catch{} blocks at all costs! Like in gvTasks_RowDataBound This is the most common way to have the code ignore bugs and cause unpredictable, difficult-to-track behavior.

Web Forms Page Processing and Control Execution Lifecycle

I'm giving both a quick reference as well as the MSDN links to the full information here. Web Forms Page Processing ASP.NET Page Framework Initialization The page's Page_Init event is raised, and the page and control view state are restored. User Code Initialization The page's Page_Load event is raised. Validation The Validate method of any validator Web server controls is invoked to perform the control's specified validation. Event Handling If the page was called in response to a form event, the corresponding event handler in the page is called during this stage. Cleanup The Page_Unload event is called because the page has finished rendering and is ready to be discarded. Control Execution Lifecycle Initialize Load view state Process postback data Load Send postback change notifications Handle postback events Prerender Save state Render Dispose Unload