Wednesday, February 19, 2014

.NET Framework 4 Features

Background garbage collection:
  • Provides background garbage collection 
  • Provide better performance.
  • It replaces concurrent garbage collection.
ETW (event tracing for windows):
  • This determines processor usage and memory usage estimates per app domain.

DLR (dynamic language run-time):
  • Support with System.Dynamic namespace. 
  • DLR built on top of CLR
  • DLR supports dynamic languages (IronPython, IronRuby)

Parallel programming:
  • Parallel programming is introduced
  • PLINQ
  • AsParallel 

Tuple:
  • Data structure consists of multiple parts
  • System.Tuple
  • Maximum of 8 items supported

BigInteger: is introduced with 8 byte storage size. int is 4 byte.


Reference: core new features and improvements


ASP.NET:


New Chart control
:


Routing:
  • Built-in support for routing. 
  • No need to specify physical file names.
Session:
  • Introduced compression option for out-process session state (state server/ SQL Server)

JQuery:
  • is included in script folder


Tuesday, October 8, 2013

Tuesday, March 12, 2013

Windows Service observations

Scenario: A windows service actively monitor the replication status in StatusDB. On status change, windows service open the configuration file of QuickSet service/Standard webservice and modify it. Windows service will also restart the IIS in order to reflect the configuration file changes immediately. This helps Quickset service/Standard web services in pointing to StandbyDB/LiveDB automatically.


Note:

  • Debugging windows service is a real bottleneck.
  • Use Microsoft event log for logging purpose. Event viewer helps to navigate through logs.
  • Test the code in console application, then move it to windows service
  • It is better to use SQL server authentication when connecting from windows service to SQL Server. 
  • If windows service runs under Local System, then it won't be able to create instance of SQL server connection. Service property > Log on > Select a network account.
  • Polling has to be done in a different thread.

Reference:  

Thursday, December 6, 2012

Method overloading in ASMX service

·         Method overloading (polymorphism) is not supported by default

·         But can be achieved using MessageName property of WebMethod attribute.

·         Reference:  http://forums.asp.net/t/1162934.aspx/1

 

[WebService(Namespace = "http://tempuri.org/")]

//[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

[WebServiceBinding(ConformsTo = WsiProfiles.None)]

// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.

// [System.Web.Script.Services.ScriptService]

public class Service : System.Web.Services.WebService

{

    public Service () {

 

        //Uncomment the following line if using designed components

        //InitializeComponent();

    }

 

    [WebMethod]

    public string HelloWorld()

    {

        return "Hello World";

    }

 

    [WebMethod(MessageName = "HelloWorldwithParam")]

    public string HelloWorld(string message)

    {

        return message;

    }

   

}

 

 




DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.

Wednesday, November 28, 2012

Self join: Employee - Manager


ID   Name        ManagerID

1 Balaji NULL
2 Ashish 1
3 Divya 1
4 Nidhish 2


Write a query to display ManagerName (ManagerID is foreign key to ID)/



SELECT     e.ID, e.Name, mgr.Name AS ManagerName
FROM         Employee AS e LEFT OUTER JOIN
                      Employee AS mgr ON e.ManagerID = mgr.ID

Result:


1 Balaji NULL
2 Ashish Balaji
3 Divya Balaji
4 Nidhish Ashish


SQL Sample question





1.       Find out Name of customer who has maximum number of product?
2.       Find out Name of customer who does not have product.

/*find customer who has maximum product*/
select top 1 c.Name , COUNT(c.ID) as CustomerCount from Customer c left outer join CustomerProduct cp
      on c.ID = cp.CustomerID
            group by c.ID ,c.Name
            order by CustomerCount desc



/*find all customers who does not have any product*/
select c.Name  from Customer c left outer join CustomerProduct cp
      on c.ID = cp.CustomerID
     
            where cp.CustomerID is null