Sunday, March 24, 2013

Decision Analysis and Resolution Matrix Called as DAR


We heard lot of CAR analysis, Causal Analysis and Resolution, like we also have Decision Analysis and Resolution. In CAR we tend to find the root cause and then derive the resolution. Similarly in DAR we evaluates different factors or criterias against options available to derive to best possible solutions or resolutions.

For e.g we want to setup Virtualization so we have many options for us to evaluate before we decide on technology. Say for example..In case of VDI...virtual desktop environment, we have various options available such as Virtual machine based on Virtual pool, Remote desktop session based or virtual machine session based. Now if want to choose the best possible solution then we need to have a all relevant factors or parameter to evaluate against. Here in this case we can evaluate the options against scalability, availability, performance, maintenance, consistency, cost etc...

For any architect , it is very essential that one knows about such tools or methods to evaluate it. At the end steering or management committee needs statistics and full proof solution to support their decision even. What If I say something right? will that make sense to world ? The answer is Big 'NO'. The business is driven based on facts and figure.



Fig 1



DAR Matrix

Friday, March 22, 2013

Thursday, March 21, 2013

IIS 7.5 Load User Profile = true for Registry issue due Windows User Profile service

Today was strange day for me. It all started with trouble in the paradise. We recently did deployment of small changes in MS commerce server 2007 and EPI server. Now wcf service and website hosted in IIS 7.5. With main website having virtual directory pointing EPI server content management system.

Cut Long story short-
We checked the event log viewer for the root cause..And below was the whole script...
In the Application Event log, the following event was logged:
Log Name: Application
Source: Microsoft-Windows-User Profiles Service
Date: 2010/5/31 13:10:01
Event ID: 1530
Task Category: None
Level: Warning
Keywords:
User: SYSTEM
Computer: ComputerName
Description:
Windows detected your registry file is still in use by other applications or services. The file will be unloaded now. The applications or services that hold your registry file may not function properly afterwards.
The following information was included with the event:
2 user registry handles leaked from \Registry\User\S-1-5-21-3837118448-4114559512-2412068830-1006_Classes:
Process 1956 (\Device\HarddiskVolume2\Windows\SysWOW64\inetsrv\w3wp.exe) has opened key \REGISTRY\USER\S-1-5-21-3837118448-4114559512-2412068830-1006_CLASSES
Process 1956 (\Device\HarddiskVolume2\Windows\SysWOW64\inetsrv\w3wp.exe) has opened key
The problem was due...
If you have other application pools even they will use the same c:\windows\temp folder. If you set the option to load the user profile the temporary directory will be now change to use the profile’s temporary folder C:\Users\apppooluserid\AppData\Local\Temp.
If the profile is loaded you also have access to all the custom environment variables for that user.

Here’s a question what do you think will the temporary folder be when the Application Pool identity is set to Network Service and Load User Profile is set to True ?

It is not C:\Users\NetworkService\AppData\Local\Temp. but C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp
This event is letting us know that when the profile was being unloaded w3wp.exe with process id (PID) 1956 had a registry key handle to the profile hive for the user with SID S-1-5-21-2641105361-2081720548-7543625-1000.


According to kb947239, event 1530 occurs because Windows automatically closes any registry handle to a user profile that is left open by an application.

In previous versions of Windows, we need to download and install the User Profile Hive Cleanup Services (UPHClean) to ensure user sessions are completed terminated when a user logs off. So in Windows 2003 IIS6, UPHClean isn’t downloaded by default.


After Windows Vista, UPHClean utility is built into User Profile service which always runs. On Windows 2008, UPHClean removes access to files or directories data that was cached by the application for the file is lost. This could cause the process to fail because it cannot read from the file. This issue seems to be improved in UPHClean v2.0.

The solution to preventing this problem turns out to be a very simple configuration setting in IIS7's Application Pool Advanced Settings.

Lucky for us, the issue was resolved after enabling Load User Profile in Application Pool setting.

IIS doesn't load the Windows user profile, but certain applications might take advantage of it anyway to store temporary data. What this does is tell IIS to completely load the user profile for the entirety of the execution of the application.

Thank God...It just saved my day....

Wednesday, March 20, 2013

Its all about IIS 7.5 .You must know

We got two important parts in IIS 7.5
Integrated Mode : I called it as Http Module Pipeline
Classic Mode       :       More of ISAPI

Further isolation:

User Mode: IIS Log
Kernel Mode : Refer HTTErr log..in windows/system32/LogFiles/..

One can use log parser to analyse the logs and find the root cause of the problem.

Important App Pool Settings:

  1. Request Queue length Limit : Default 1000..
  2. Overlap App pool recycle.
  3. No of Worker processor.
  4. Switch off Asp.net debug mode off..
  5. Regular Interval of App Pool Recycle.



applicationHost.config file ( Found in location: C:\Windows\System32\inetsrv\config)

ApplicationHost.config is the root file of the configuration system when you are using IIS 7 and above. It includes definitions of all sites, applications, virtual directories and application pools, as well as global defaults for the web server settings (similar to machine.config and the root web.config for .NET Framework settings).

IIS Windows Process Activation Service (WAS)

Windows Process Activation Service (WAS) manages application pool configuration and the creation and lifetime of worker processes for HTTP and other protocols. The World Wide Web Publishing Service (W3SVC) and other services depend on WAS.

NameDescription
IIS Application PoolAn Internet Information Services (IIS) application pool is a grouping of URLs that is routed to one or more worker processes. Because application pools define a set of Web applications that share one or more worker processes, they provide a convenient way to administer a set of Web sites and applications and their corresponding worker processes. Process boundaries separate each worker process; therefore, a Web site or application in one application pool will not be affected by application problems in other application pools. Application pools significantly increase both the reliability and manageability of a Web infrastructure.
IIS Protocol AdapterAn Internet Information Services (IIS) protocol adapter is a Windows service that receives messages on a specific network protocol and communicates with The Windows Process Activation Service (WAS) to route incoming messages to the correct worker process.

http://msdn.microsoft.com/en-us/library/ee377050.aspx

Tuesday, March 19, 2013

JS 1.3 Cheat Sheet

Core


Selector


Attributes


Events

utilities


CSS





Tuesday, March 12, 2013

Virtual Desktop Infrastructure Windows 2012 Server Hyper-V Virtual Machine Installation and Setup



What we get?
  1.  Using virtual machine we can have independent isolated dev environment for each developer. Virtualize in terms of RAM and processor.
  2.  Easy to enable new Virtual machine through template or image file i.e VHD.
  3.  Easy to manage through system center 2012 i.e remote desktop services web enabled.
  4. Factors to be considered.
  5.  Windows update.
  6.  Anitvirus installation
  7.  Software Licencing
  8. Security patches
  9. Backup strategy
  10.  External data storage for developer. External drive to save file
Capacity planning

Primary Server
OS : Windows Server Core 2008 R2
16 GB Ram Processor 4 GHz speed
VM1: 4 GB /1 Processor
VM2: 4 GB/1 Processor
VM3/VM4

Alternative to VDI: Remote Development server Session based RDP.

Is to enable Remote Destop Session based user option. This comes handly and just require to add limit to session users. No installation at all. All users will be having same set of underlying software and feature. Any changes to environment will affect all users and environment. Good in response widely used and opted.

Monday, March 11, 2013

Quick 1 min Walkthrough on HTTP REQUEST HEADER.





Coding Tips and Tricks

Cyclic Constructor in C#
public class Car
    {
        //Private Member
        private int m_CarID=int.MinValue;
        private string m_CarType=string.Empty;
        private string m_CarName=string.Empty;
        private string m_Color=string.Empty;
        private string m_Model=string.Empty;

        //Constructor
        public Car()
        {
            //default Constructor
        }
       
        //Parameterized Constructor
        public Car(int carID, string carName)
        {
            m_CarID = carID;
            m_CarName = carName;
        }

        //Cyclic Constructor
        public Car(int carID, string carName, string carType,string carModel):this(carID,carName)
        {
            m_CarType = carType;
            m_Model = carModel;
        }

        //Cyclic Constructor
        public Car(int carID, string carName, string carType, string carModel,string color)
            : this(carID, carName,carType,carModel)
        {
            m_Color = color;           
        }   
    }

static void main()
{
    Car objCarA=new Car();
    Car objCarB=new Car(1,"matiz");
    Car objCarC=new Car(1,"matiz","SmallCar","2000");
    Car objCarD=new Car(1,"matiz","SmallCar","2000","Dark Green");
}

Validation to Check for Comma separated EmailIDs

Regular Exp Description:


List of Email ids separated with [,] Email ID may contain character set as [._-']

Regular Expression


^((\w+([-_.']\w+)*@\w+([-_.']\w+)*\.\w+([-_.']\w+)*)*([,])*)*$


Regular expression Rules:


Finite automata rule Values should proceed with email Ids with Comma Separated. No comma will precede the email IDs.

Matches:


abc.xyz@anonymous.com
abc.xyz@anonymous.com,abc-xyz@anonymous.com,abc_xyz@anonymous.com
abc.xyz@anonymous.com,com,D'Souza@anonymous.com

Non-Matches:


abc.xyz
,abc.xyz@anonymous.com
abc.xyz@anonymous.com,
abc

Javascript
function CheckForCommaSeperatedEmailIDs( fieldValue )  
       {      
     
         var regex = /^((\w+([-_.']\w+)*@\w+([-_.]\w+)*\.\w+([-_.]\w+)*)*([,])*)*$/;      
         if( !fieldValue.match( regex ) )      
           {         
             alert('The Email IDs Invalid');
            
                     return false;      
                       
            }     
               return true; 
         }




Validation to check UserID with Period/Dot seperated



Regular Expression Rules:

Finite automata rule, Values should precede with characters of set [A-Za-z] and followed with period(.) and character set [A-Za-z]

Regular Expression:

^[a-zA-Z]+(\.[a-zA-Z]+)+$


Matches



1) Ratan.Tata
2) Anil.Dhiru.Ambhani

Non-Matches



Ratan.
1) .Mukesh.
2) Amir.khan.

Regular Expression Logic in Javasctipt




function CheckForPeriodSeperatedUserID( fieldValue ) 
     {
        var regex = /^[a-zA-Z]+(\.[a-zA-Z]+)+$/;
        if( !fieldValue.match( regex ) ) 
        {
            alert('The UserID is not desired format,XXX.YYYY XXX.YYYY.ZZZZ');
            return false;
        }
        return true;
    }
Real Time Use Of Static Constructor
if you look at above class it is an Utility class and it is consume by Business entity class instance say object Date that has minute component in it.

If we have 10 screens that requires minutes to be displayed in dropdownlist in such cases rather then calling 10 calls to database or constructing this collection we prefer calling one instance at the very load of the application which in turns consume by all the pages and across all the users. In the process we have one instance available for all users and across pages. If one see in normal constructor ,one can notice it is invoked after instance is created whereas static constructor is invoked always first and when it is referenced.
use System.collection.generics;

public class Utility
{
public static IDictionary
m_Minute = null;
static Utility()
{
m_Minute=new IDictionary
();
m_Minute.Add(1,"00");
m_Minute.Add(2,"15");
m_Minute.Add(3,"30");
m_Minute.Add(3,"45");
}
public static IDictionary
GetMinute()
{
return m_Minute;
}
}




Validation to Check for special Character

Description :


Below javascript code function returns false for entered special character and true for non special character.



 
function CheckForSpecialCharacter( controlValue ) 
     {
        var regex = /^[a-zA-Z0-9\s]+$/;
        if( !controlValue.match( regex ) ) 
        {
            alert('Special Character is not allowed due potential security threat.');
            return false;
        }


Problem Statement:

We have scenario where we have data stored in arraylist collection and want to pass this as data as input to Webservice method in string array format.


Convert ArrayList() Collection to String [] Array

Namespace: System.collections




Solution:




private string[] ConvertArrayListToStringArray(ArrayList arrList)
{

 for (int iIter=0;iIter<5 br="" iiter=""> {
  arrList.Add("StringValue"+iIter);
 }
 return string[]arrList.ToArray(typeof(string)); 
}


 

Iterator,Delegate,Predicates,Anonymous method and Generics C#2.0

A perfect blend of Iterator,Delegate,Predicates,Anonymous method and Generics C#2.0. One can make use of these in real world scenario to save memory and increase performance of an application.

Delegates defines signature of any method that takes one input parameter and returns a single object of another type.



public delegate Tout Action(Tin element);
protected void Page_Load(object sender, EventArgs e)
{
    foreach (string str in GetFormatedCustomerName())
            Response.Write(str);
}
public IEnumerable GetFormatedCustomerName()
{ 
     List customerList=new List();
     customerList.Add(new Customer("001", "Santosh",3552));
     customerList.Add(new Customer("002", "Poojari", 42424));
     customerList.Add(new Customer("005", "Arjun", 42424));

     return BuildFormattedName(customerList,
     delegate(Customer objCustomer)
     {
          return string.Format("{0} - {1}
", objCustomer.CustomerId, objCustomer.CustomerName);
     });
}
public IEnumerable BuildFormattedName(IEnumerable list, Action handler)
{
    foreach (Tin entry in list)
           yield return handler(entry);
}        



Sunday, March 10, 2013

Your Last chance Microsoft Virtual Academy

Join microsoft virtual academy for free . It has lot of online training courses which will help you develop your technical skills ,at the same time help you prepare one.

Benefits:
  1. Indirect trainings to appear for microsoft certifications.
  2. You develop your skill. Prepare strong foundation and clear your concepts and fundamentals.
  3. You get to know latest technology trends trainings in Vmware, Hyper v, Virtualization, Html5, Windows 8, Html ,mvc , mobile technology and many more. IOS,Android, Windows ..etc..
  4. You accumulate points to redeem for books, certifications or any valuable vouchers.
  5. You know where you stand.
  6. You get authentic transcripts of your courses.

So hurry up!, You never know this may turns into paid one. Grab the opportunity and be one to rip benefit out of it. Share with this follow folks and friends . Help everyone.

Register now or never...

https://www.microsoftvirtualacademy.com/GetStarted.aspx







Tuesday, February 19, 2013

Javascript Basics Tutorial Part 8: Delegate Function

Delegate Function: A method declaration passed as a argument value in funtion.

Chapter 8
Output

Javascript Basics Tutorial Part 7: Module Design Pattern

Module Design Pattern: View code to understand the pattern.
Chapter 7:


Output
 

Javascript Basics Tutorial Part 6 : Nested Function

Nested Function---> Outer Inner function.

Semantics
function Outer(n)
{
      function Inner()
      {
          do something with (n);
          return n;
      }
      return Inner// Call Inner function;
}

Outer(10); //VALID  CALL
Inner(); //INVALID CALL.

Chapter 6:



























Output:



 

Javascript Basics Tutprial Part 5: Self Calling Or Immediate function.

Lets look at syntax representation of Self calling or Immediate function call.

Method 1
(
        function ()
       {
             something;
       }
)
( ) ;//This is self fn call

Method 2

(
      function ()
     {
          something;
      }

      ( )
) ;

Method 3
(
function  Anything()
{
something;
}

( )
) ;

The only difference is ( ) is inside or outside in the example above.
Chapter 5



Output

 

Monday, February 18, 2013

Javascript Basics Tutorial : Part 4 Var obj={};

Part 4 : var obj={};
Remember this semantics var X= {};

This chapter we will discuss how we can defined multiple methods and variable in OBJECT. The sample code describes the methods scope within OBJECTS and its declaration and semantics.
Understand diff between semantics and Syntax.

Chapter 4
Key notes here direct call to f1(), f2() and f() are INVALID. This is concepts of data encapsulation. Its implementations are hidden to outer world. Like we know how to drive car without knowing how it is internally deviced and operated.

Output


 

Javascript Basics Tutorial Part 3: Anonymous Methods

Anonymous Method Like C#.
Important Key notes:
  1. All Methods are funtions but funtions are not method.
  2. Methods can not be called before it is being defined. Unlike FUNCTIONS.
  3. Methods is represented as variable and function is assigned to it.
  4. Methods is variable and any var declaration must ends with semicolon.
  5. Methods can be declared as Anonymous with no name and can be declared with Named Expression.
var obj= function(){somthing;} ;

Chapter 3:

 Output
 

Javascript Basics Tutorial Part 2: Simple Function.

:In part 2 we are going to look into details of simple function declaration and its defination. We also look into function scope. Refer Part 1 for Objects and Array.

Function Scoping: Function can be called before it is defined. Look at below example.

Function : By default every function is like default constructor with inbuilt arguments.
We can also put debugger; to put a breakpoint and debug to step-in, step-out, step-over in vs 2010.

In short we can defined function with NO Input Argument but we can pass multiple input parameter values of any type while calling a function.
 
f2(17, 0.1, "Ninja", [], {});

function f2()
{
//Fn Responsibilty & Operations.
}
Interesting facts: Inside a function we can fetch the inputs values to the function through a array called arguments[].Internally it is stored in arguments[] array placeholder where we can reference and use the input values for the operations.




 Output

 

Javascript Basic Tutorial Part 1:Objects & Array

Here is the quick series of javascript begineer kit.
To make learning easy, below are the code demos with screenshot.
So lets get started

Objects & Array

All I have done is taken one default.aspx with all javascript references and one div tag to display results. We also have JQuery online reference just to have ready() function and few Jquery selector to create showresults() display panel.


Common Utility.JS

In order to simplify this kits, I have replaced alerts with ShowResults code snippet. There is a global array and global Method to display outputs. I'll be using ShowResults() Method to display output for each javascript demo.




Chapter 1. Objects & Array
  1. var obj={} represents objects
  2. var arr=[] represents array
The skeleton to define object are as given below. There are two ways to do it.
var dog={};
dog.breed='abc';
dog.bark= function(){
//some operations;
}

This defination involves comma separated property and method. The important note here is dog object is notated as a var defined as class with property and method. Always remember closure always ends with semicolon as it is assigned to var . Like
var animal= { something;};


var dog ={
breed:'abc', bark=function(){
}

}
};


Output