Writing Code is fun, see here :)

 

Some really nice comments I have picked during a peer review.

// Server Side Validation Functions 
private bool ValidateGeneralDOB(object fieldValue) 
{ 
  DateTime dt;

  if(fieldValue==null) 
    return false; // are you kidding me, you should be born :( 

  else if (!DateTime.TryParse(fieldValue.ToString(),out dt)) 
    return false; // you should be born on a valid date 

  else if(dt>DateTime.Now.AddYears(-20)) // to little :) 
   return false; 

  else if (dt < DateTime.Now.AddYears(-90)) // to old :| 
   return false;

 // your are the one we are looking for 
  return true; 
}

 

 

About CAE Solutions


Web: http://www.caesolutions.com/


Linkedin: https://www.linkedin.com/company/301183/


Sally Verrilli post on how CAE Solutions helped UnitedHealth Group with a system that is dying or dead: https://lnkd.in/eecCsuu


An extract from her post:


Who’s been here?

You work in a big company.

You lead a department that has a system that is dying or dead.
You don’t need the space shuttle.
You need something to keep you in orbit for a year or two.
Your system need isn’t big enough to merit capital.

This was my situation last year.  I had to have a system that worked within 1 year or I was screwed. My internal team was in transition and I didn’t know if they would be stable enough or able enough to get this done after I announced the death of the legacy system. (Back then, we were new to each other.  Now I know they CAN.)

My budget wasn’t big but I knew I had to do something.
I needed to up my odds of success.

The vendor that helped build my new, interim system is CAE Solutions. It wasn’t easy;  but it got done and done on time and on budget.  The new system has been up and running with great success for 11 months now, and we are headed into our second busy season with it.

I have no vested interest in CAE, and this is not a sales pitch.  I took a chance and it worked out.  System builds rarely have happy endings for many reasons.  This one did.  Call Anil Gupta at CAE solutions if you need help. It worked for me.

Design Patterns: a possible way to memorize all

When we starts for new coding/development/architecture design task, it comes handy if one have patterns on your finger tips, following is a possible way to starts with 🙂

Creational Patterns: Abram became first president of states

  1. Abram: Abstract
  2. became: builder
  3. first: factory
  4. president: prototype
  5. states: Singletion

Structural Patterns: ABCD Faces a Flying Proxy .

  1. A: Adaptor
  2. B: Bridge
  3. C: Composite
  4. D: Decorator
  5. Faces: Facade
  6. Flying: Flyweight
  7. Proxy : Proxy

Behavioral Patterns: MMIICC ON TVS

  1. M: Mediator
  2. M: Memento
  3. I: Iterator
  4. I: interpreter
  5. C: Chain of responsibly
  6. C: Command
  7. O: Observer
  8. N: Null Object
  9. T: Template
  10. V: Visitor
  11. S: States, Strategy

How to use ?? Operator in C# to assign a nullable type to a non nullable type?

Code example

int? nullableInt = null;
 int nonNullableInt = nullInt ?? 0;
 //sets the nullableInt's value to the nonNullableInt 
 // only when it has a value, else it will set 0.
 //in our case it will assign 0
 Console.WriteLine(notNullInt);
 //prints 0

This ?? operator can be used to save code that will test for null and then we will set the value.

What is ASP.NET Core 1.0 and .NET Core 1.0 and what is future of ASP.NET 5 and 4.6!

ASP.NET 5 is now ASP.NET Core 1.0.

.NET Core 5 is now .NET Core 1.0.

The name is has changed, nothing more than this!

Why new name 1.0?

Because the concept is new, its not having same architecture as previous version of ASP.net till 4.6.

However till now, the .NET Core 1.0 is not mature as earlier .NET Frameworks were, this is in testing and development phase. Earlier ASP.NET version are more mature and very well tested for developing a new project.

ASP.NET Core 1.0 is a 1.0 release which has Web API and MVC but not SignalR and Web Pages. It does not have VB and F# till now, they will be added in near future.

ASP.NET Core 1.0 a new framework, but earlier ASP.NET 4.6 version will remain there, and will be fully supported, but ASP.NET Core 1.0 is new, very new…