Friday links 134

  1. Microsoft OAUTH
  2. failed to load
  3. Portable databases: using SQLite with .NET
  4. Patterns for sharing code in Windows Phone and Windows 8 Applications | Kenneth Truyers
  5. The World’s Email Encryption Software Relies on One Guy, Who is Going Broke – ProPublica
  6. Custom Facebook, Twitter Share Functionality in ASP.Net
  7. Working with Favicons in ASP.NET MVC Applications and Visual Studio – Marius Schulz
  8. My 8 Favorite ReSharper Shortcuts – Marius Schulz
  9. A Little HtmlHelper for Implementing Adaptive HTML Images in ASP.NET MVC – Marius Schulz
  10. 6 Things They Don’t Tell You When You Leave the Big Corporate World for Your Own Business
  11. What Comes Next? – The American Interest
  12. Duolingo: The app teaching humans new languages while teaching machines how to learn | ZDNet
No Comments

Validation in .NET

For validating a simple class, you can add [Required] ( see

But how to validate same object depending on his state? For example, when it is new, the email is required. But after saving, the user mus also add FirstName( also think about workflows)

There is a simple solution in .NET : IValidatableObject
In this example , I validate differently based on the object is new or retrieved from database:

 internal class Person:IValidatableObject
        public int id { get; set; }
        public string Email { get; set; }

        public string FirstName { get; set; }

        /// <summary>
        /// MVC and EF are calling this if the class implements  IValidatableObject
        /// </summary>
        /// <param name="validationContext"></param>
        /// <returns></returns>
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)

            if (string.IsNullOrWhiteSpace(Email))
                yield return new ValidationResult("my Email is required");
            if (id == 0) //new
                yield break;

                yield return new ValidationResult("First name is required");


If you want to see in action , please see

No Comments

Friday links 133

  1. boxstarterAndrei
  2. How I Easily Got 25% More Views on My LinkedIn Profile
  3. How Amazon Tricks You Into Thinking It Always Has the Lowest Prices | Re/code
  4. ASafaWeb: Scan of – cursurile BNR
  5. Troy Hunt: Azure WebJobs are awesome and you should start using them right now!
  6. Troy Hunt: Your API versioning is wrong, which is why I decided to do it 3 different wrong ways
  7. P4V Visual Client | Perforce
  8. FEx – File Explorer Widget – CodeProject
  9. Replicated Data Consistency Explained Through Baseball – Microsoft Research
  10. 20 Facebook, Twitter, LinkedIn & Pinterest Features You Didn’t Know Existed (But Totally Should)
  11. A Beginner’s Guide to LinkedIn Showcase Pages
  12. DB2PORTAL Blog: The Twelve DBA Rules of Thumb… a summary
No Comments

Friday links 132

  1. Photos: The rise of social robots – TechRepublic
  2. MacroDroid makes Android automation easy – TechRepublic
  3. Recycle that old Android device into a web-based security camera – TechRepublic
  4. TYPE CAST EXCEPTION | ASP.NET Web Api 2.2: Create a Self-Hosted OWIN-Based Web Api from Scratch
  5. Paging in ASP.NET Web API: Introduction | Jerrie Pelser
  6. Supporting OData Query Options in ASP.NET Web API 2 | The ASP.NET Site
  7. TYPE CAST EXCEPTION | ASP.NET Web Api: Understanding OWIN/Katana Authentication/Authorization Part I: Concepts
  8. Microsoft
  9. Bad programmers create jobs | John D. Cook
  10. Microsoft mainstreams business intelligence with new and improved Power BI Preview – The Official Microsoft Blog
  11. Microservices in Bluemix
  12. Tutorial | ReactJS.NET
No Comments



Please read the code and answer question below:

class Program
        static void Main(string[] args)

            IEnumerable<int> myEnum = Data().Where(it => it < 5);

            string site = "";

            int[] arr = myEnum.ToArray();

            site +=" number is "+ myEnum.Count();
            site += " number is " + myEnum.Count();


        static IEnumerable<int> Data()

            int i = 5;

            yield return i;
            yield return (i+7);

How many times the breakpoint at

int i = 5;

will be hit ?


And if your answer is not 3, please look at

No Comments

Friday links 131

  1. Vunvulea Radu Tech Wall (Programing Issues): Comparison of different Azure messaging systems
  2. simple-test.jpg (453×1600)
  3. Agile Tour Bucharest 2013 |
  4. Locale::Maketext::TPJ13 –
  5. Async and Await
  6. Windows Azure Website: Uploading/Downloading files over FTP and collecting Diagnostics logs – Avkash Chauhan’s Blog – Site Home – MSDN Blogs
  7. Enable diagnostic logging – Azure Websites
No Comments

Friday links 130

  1. Microsoft OneDrive – Access files anywhere. Create docs with free Office Online.
  2. 12 opensource and free MVC gridview contols
  3. Telerik Extensions For ASP.NET MVC – Home
  4. Implementing RoleManager in ASP.NET MVC 5
  5. Performance – Stack Exchange
  6. Internet of Things: Programming IoT Devices, Web Services and IoT Clients – CodeProject
  7. ePub Bud – Sell your children’s books on the Apple iBooks store, Amazon Kindle, and Barnes and Noble!
  8. Google Porn Takedowns Carpet Bomb Github | TorrentFreak
  9. onions
  10. Release It!: Design and Deploy Production-Ready Software (Pragmatic Programmers): Michael T. Nygard: 9780978739218: Books
No Comments

Friday links 129

  1. 10 Articles Every Programmer Must Read – I am programmer
  2. The Netflix Tech Blog: Making the Netflix API More Resilient
  3. Circuit Breaking With Polly | jaywayco
  4. The Circuit Breaker – That Extra Mile
  5. Release It!: Design and Deploy Production-Ready Software (Pragmatic Programmers): Michael T. Nygard: 9780978739218: Books
  6. Visual Studio 2013 – Expand Visual Studio 2013 with Extensions
  7. Windows Visual Studio 2013 SDK Samples
  8. GitHub Student Developer Pack – GitHub Education
  9. Scripting Languages You May Not Know – Dice News
No Comments

Asynchronous code and exceptions

There are 2 kinds of coding when handling asynchronous code.

The first one is  calling Result:



The second is async /await

public async Task<bool> TwoTask() {


await Task.WhenAll(file, console);
return file.Result & console.Result;


As such, we will have 2 intercepting code.

For the first one we will catch AggregateException

            catch (AggregateException ex)
                Console.WriteLine("Aggregate number of exceptions :"+ex.InnerExceptions.Count);

For the second one we will catch the FIRST task  exception  ( or , more generic , Exception ) – and see what other tasks have been doing


                await Task.WhenAll(file, console);
                return file.Result & console.Result;
            catch (ArgumentException ex)
                Console.WriteLine("Exception is " + ex.Message);
                if (file.IsFaulted)
                    Console.WriteLine("file is faulted exceptions :" + file.Exception.InnerExceptions.Count);
                if (console.IsFaulted)
                    Console.WriteLine("console is faulted exceptions :" + console.Exception.InnerExceptions.Count);

Maybe it is better when you see a video demo: Async await and exceptions at

No Comments

Friday links 128

  1. 700 Free eBooks for iPad, Kindle & Other Devices | Open Culture
  2. Falsehoods programmers believe about addresses
  3. Uwe Hermann on Twitter: ""Falsehoods programmers believe" series:,,,"
  4. WebAPI Generic
  5. ASP.NET MVC 6 attribute routing – the [controller] and [action] tokens – StrathWeb
  6. Ten Tips to Being a Great VB Developer
  7. Big Data Knows When You’re Going to Quit Your Job Before You Do – Bloomberg
  8. KeLuKeLu Games on Twitter: "Job hunting as a software developer."
  9. Government fires employee who skipped work for 24 years
  10. philsquared/Catch
No Comments