Skip to main content

Posts

AGILE Principles

AGILE Principles   Our highest priority is to satisfy the customer through early and continuous delivery of valuable software.   Welcome changing requirements, even late in development. Agile processes harness change for the customer's competitive advantage. Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter timescale Business people and developers must work together daily throughout the project Build projects around motivated individuals. Give them the environment and support they need, and trust them to get the job done.  The most efficient and effective method of conveying information to and within a development team is face-to-face conversation. Working software is the primary measure of progress. Agile processes promote sustainable development. The sponsors, developers, and users should be able to maintain a constant pace indefinitely. Continuous attention to technical excellence and good d...

Error Handling in Javascript try catch

Error Handling in Javascript <div class="jumbotron">     <button class="btn btn-danger" onclick="myFunc()">Click Me</button> </div> /* var myFunc=function()     {         var a = 100;         var b = 0;         try         {             throw("Divide by zero");             var c = a / b;         }         catch(e)         {             alert(e);         }         finally {             alert("in finally");         }     }*/     window.onerror=function(msg,url,ln)     {         alert(msg);         alert(url);       ...

Extension Method for returning default values

Extension Method for returning default values static class ExtensionsThatWillAppearOnEverything { public static T IfDefaultGiveMe < T >( this T value , T alternate ) { if ( value . Equals ( default ( T ))) return alternate ; return value ; } } var result = query . FirstOrDefault (). IfDefaultGiveMe ( otherDefaultValue ); Or we can use the one shown below ,though its not an extension method. var result = query . FirstOrDefault () ?? otherDefaultValue ;

Extension Methods in C#

Extension Methods in C# using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ExtensionMethodsSample {     using MyExtensionMethod;     class Program     {          static void Main(string[] args)         {             string firstName = "Anish";             var res = firstName.MySampleExtensionMethod();             Console.ReadLine();         }     } } namespace MyExtensionMethod {     public static class MyExtensionMethod {          public static string MySampleExtensionMethod(this string inputString)         {             return inputString.ToUpperInvariant();         }     } ...

Grouping and joining in LINQ

Grouping and joining in LINQ foreach ( var line in data . GroupBy ( info => info . metric ) . Select ( group => new { Metric = group . Key , Count = group . Count () }) . OrderBy ( x => x . Metric ) dept needOn status foo 5 / 1 / 2011 closed foo 5 / 1 / 2011 closed foo 5 / 1 / 2011 open foo 5 / 1 / 2011 open Output Required dept needOn status count foo 5 / 1 / 2011 closed 4 foo 5 / 1 / 2011 open 2 Solution: var query3 = from q3 in query2 group q3 by new { q3 . Dept , q3 . NeedOnWeek , q3 . Status } into g select new { dept = g . Key . Dept , needOnWeek = g . Key . NeedOnWeek , status = g . Key . Status , count = g . Count () ...