Sunday, May 15, 2011

Sessions in ASP.NET

Session :
1. mode  :
  InProc
  StateServer
  SQLServer
  Off
  Custom
2. timeout  :
 default is 20  mins.
 max for StateServer and InProc is 1 yr  => 525,600 min

3. stateConnectionString :
 default is  "tcpip=127.0.0.1:42424"
4. cookieName : The default is "ASP.NET_SessionId".

5. cookieless : The default is the UseCookies value.
 AutoDetect
 UseCookies
 UseDeviceProfile
 UseUri

Saturday, May 14, 2011

Can you have a private constructor ?

Yes . See the concept of Singleton pattern.

Note that a private constructor cannot be used by any other class. Only class itself can use it.

This is used excellently to limit the number of instances, for example if you want to create a singleton.

second largest salary without using TOP

SELECT Emp_Name,Emp_Salary FROM Employee e1WHERE
 2 = (SELECT COUNT(DISTINCT (e2.Emp_Salary))FROM Employee e2 WHERE e2.Emp_Salary >= e1.Emp_Salary)



select b.Emp_Salary from
(
(select distinct Emp_Salary from employee) a,select distinct Emp_Salary from employee) bwhere a.Emp_Salary>b.Emp_Salarygroup by b.Emp_Salaryhaving

count(b.Emp_Salary)=2

JOB SITES

Friday, May 13, 2011

WCF Bindings Needed For HTTPS

http://weblogs.asp.net/srkirkland/archive/2008/02/20/wcf-bindings-needed-for-https.aspx


The solution is to define a custom binding inside your Web.Config file and set the security mode to "Transport".



<system.serviceModel>
<behaviors>    
<endpointBehaviors>
<behavior name="TestServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="TestService">
<endpoint address="" behaviorConfiguration="TestServiceAspNetAjaxBehavior"
binding="webHttpBinding" bindingConfiguration="webBinding" contract="TestService" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webBinding">
       <security mode="Transport">
       </security>
     </binding>
</webHttpBinding>
</bindings>
</system.serviceModel>

Tuesday, May 10, 2011

ROLLBACK TRANSACTION


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



If a ROLLBACK TRANSACTION is issued in a trigger:
  • All data modifications made to that point in the current transaction are rolled back, including any made by the trigger.
  • The trigger continues executing any remaining statements after the ROLLBACK statement. If any of these statements modify data, the modifications are not rolled back. No nested triggers are fired by the execution of these remaining statements.
  • The statements in the batch after the statement that fired the trigger are not executed.
@@TRANCOUNT is incremented by one when entering a trigger, even when in autocommit mode. (The system treats a trigger as an implied nested transaction.)
ROLLBACK TRANSACTION statements in stored procedures do not affect subsequent statements in the batch that called the procedure; subsequent statements in the batch are executed. ROLLBACK TRANSACTION statements in triggers terminate the batch containing the statement that fired the trigger; subsequent statements in the batch are not executed.

Access specifiers in .NET


http://stackoverflow.com/questions/2521459/what-are-the-default-access-modifiers-in-c
http://msdn.microsoft.com/en-us/library/ba0a1yw2.aspx
http://msdn.microsoft.com/en-us/library/ms173121.aspx
==================================================================



http://stackoverflow.com/questions/2521459/what-are-the-default-access-modifiers-in-c


top level class: internal
method
: private
members
(unless an interface or enum): private (including nested classes)
members
(of interface or enum): public
constructor
: protected delegate: internal interface: internal
explicitly implemented
interface member: public! 



Class and Struct Accessibility
Internal is the default if no access modifier is specified.
Class and Struct Member Accessibility
Class members (including nested classes and structs) can be declared with any of the five types of access. Struct members cannot be declared as protected because structs do not support inheritance.
The accessibility of a member can never be greater than the accessibility of its containing type
User-defined operators must always be declared as public. For more information, see operator (C# Reference).
Destructors  and namespaces cannot have accessibility modifiers.
Other Types
Interfaces declared directly with a namespace can be declared as public or internal and like classes and structs, interfaces default to internal access.
Enumeration members are always public, and no access modifiers can be applied.
By default, delegates have internal access.



Non-nested (may only have internal or public accessibility) types, enumeration and delegate accessibilities
                     | Default   | Permitted declared accessibilities ------------------------------------------------------------------ 
namespace            | public    | none (always implicitly public) 
 enum                 | public    | none (always implicitly public) 
 interface            | internal  | public, internal 
 class                | internal  | public, internal 
 struct               | internal  | public, internal 
 delegate             | internal  | public, internal 
Nested type and member accessiblities
                     | Default   | Permitted declared accessibilities ------------------------------------------------------------------ 
namespace            | public    | none (always implicitly public) 
 enum                 | public    | none (always implicitly public) 
 interface            | public    | none 
 class                | private   | All¹ 
 struct               | private   | public, internal, private² 
 delegate             | private   | All¹ 
 
constructor          | protected | All¹ 
 interface member     | public    | none (always implicitly public) 
 
method               | private   | All¹ 
 
field                | private   | All¹ 
 
user-defined operator| none      | public (must be declared public) 
¹ All === public, protected, internal, private, protected internal
² structs cannot inherit from structs or classes (although they can, interfaces), hence protected is not a valid modifier

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

Only one access modifier is allowed for a member or type, except when you use the protected internal combination.
Access modifiers are not allowed on namespaces. Namespaces have no access restrictions.



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

Interfaces declared directly within a namespace can be declared as public or internal and, just like classes and structs, interfaces default to internal access. Interface members are always public because the purpose of an interface is to enable other types to access a class or struct. No access modifiers can be applied to interface members.
Enumeration members are always public, and no access modifiers can be applied.
Delegates behave like classes and structs. By default, they have internal access when declared directly within a namespace, and private access when nested.


The protected internal accessibility level means protected OR internal, not protected AND internal. In other words, a protected internal member can be accessed from any class in the same assembly, including derived classes. To limit accessibility to only derived classes in the same assembly, declare the class itself internal, and declare its members as protected.

Comparing features of LangGraph vs CrewAI

LangGraph Orchestration vs CrewAI Orchestration The following table compares LangGraph and CrewAI orchestration across their menta...