Tuesday, December 30, 2008
Polymorphism
{
class A
{
public virtual void Amethod( )
{
Console.Write( "A method" );
}
}
class Program : A
{
public override void Amethod( )
{
Console.WriteLine( "B method" );
}
public void Bmethod()
{
Console.WriteLine("C method");
}
static void Main( string[ ] args )
{
A objA = new Program();
//Program objA = new Program( );
objA.Amethod( );
}
}
}
Singleton Sample
namespace ConsoleApplication1
{
class Singleton
{
public static Singleton obj = null;
private Singleton( )
{
}
public static Singleton CreateInstance()
{
if ( obj == null )
obj = new Singleton( );
return obj;
}
}
class Class1
{
static void Main( string[ ] args )
{
Singleton obj1 = Singleton.CreateInstance( );
Singleton obj2 = Singleton.CreateInstance( );
if ( obj1 == obj2 )
Console.Write( "Objects are same" );
}
}
}
Dotnet Authentication, Authorization - Sample
<authentication mode="Forms" >
<forms name="login" loginUrl="login.aspx" defaultUrl="Default.aspx" >
<credentials passwordFormat="Clear" >
<user name="ram" password="ram" />
</credentials>
</forms>
</authentication >
Login.aspx.cs
if (FormsAuthentication.Authenticate("ram", "ram"))
FormsAuthentication.RedirectFromLoginPage("ram", true);
else
Response.Write("Not valid user");
Web.config
<authorization>
<allow roles="Admin" />
<deny roles="Sales" />
</authorization>
Default.aspx.cs
if (User.IsInRole("Admin"))
Response.Write ("You are an Administrator");
HttpContext.Current.User.Identity.IsAuthenticated
Set Up Dotnet build using cruisecontrol and Nant Build
<cruisecontrol>
<project name="Test Web Application">
<sourcecontrol type="svn">
<trunkUrl>http://172.16.0.54:81/svn-repos/CSI-Repository/trunk/</trunkUrl>
<workingDirectory>D:\CSI\test\trunk</workingDirectory>
<executable>C:\Program Files\VisualSVN Server\bin\svn.exe</executable>
<username>RamKumar</username>
<password>RamKumar</password>
<autoGetSource>true</autoGetSource>
<timeout>10000000000000</timeout>
</sourcecontrol>
<triggers>
<intervalTrigger seconds="10000" />
</triggers>
<tasks>
<!--<devenv>
<solutionfile>D:\CSI\test\trunk\CSI-Pilot\Csi.Rps.Pilot.sln</solutionfile>
<configuration>Debug</configuration>
<buildtype>Build</buildtype>
<executable>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com</executable>
--><!--<buildTimeoutSeconds>10000</buildTimeoutSeconds>--><!--
</devenv>-->
<nant>
<baseDirectory>D:\softwares\nant\bin</baseDirectory>
<!--<buildArgs>-D:directory.destination="C:\CC%20DEmo%20Extract" -D:svrUri="https://ddcd311.cptdomain.com:8443/svn/CSI-Trip/"</buildArgs>-->
<buildFile>D:\softwares\TestApplication.build</buildFile>
<targetList>
<target>build</target>
</targetList>
</nant>
<!--<nunit path="C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-console.exe">
<assemblies>
<assembly>C:\Documents and Settings\skrishnan\My Documents\Visual Studio 2005\Projects\WebApplication3\WebApplication1\bin\WebApplication1.dll</assembly>
</assemblies>
</nunit>-->
</tasks>
<publishers>
<xmllogger />
</publishers>
</project>
</cruisecontrol>
NANT BUILD
TestApplication.build
<?xml version="1.0" encoding="utf-8" ?>
<project name="TestApplicationProject" default="go">
<echo message="Go is called before"></echo>
<property name="nant.onfailure" value="Fail"></property>
<property name="build.dir" value="Build"/>
<property name="msbuild.configuration" value="debug" />
<property name="EMAILTO" value="ramkumar@changepond.com;ramanathan.al@changepond.com;tamilselvan.c@changepond.com;sathyaprasad@changepond.com;saimohan.c@changepond.com;santhanakrishnan@changepond.com" />
<property name="EMAILCC" value="" />
<property name="EMAILFROM" value="ramkumar@changepond.com" />
<tstamp property="Build.DateTime" pattern="yyyy-MM-dd.HHmm" verbose="true" />
<target name="Clean" description="Clean must be done b4 building">
<echo message="Clean is called"></echo>
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
</target>
<target name="Get" description="To get the source">
<echo message="Go is called"></echo>
<copy todir="${build.dir}">
<fileset basedir="D:\Users\WebApplication6">
<include name="**" />
<!--<exclude name="*.sln"></exclude>
<exclude name="**\*.cs"></exclude>
<exclude name="**\*.resx"/>
<exclude name="**\*.csproj"/>
<exclude name="**\*.vspscc"/>
<exclude name="**\*.scc"/>-->
</fileset>
</copy>
</target>
<target name="Version" description="To apply version to the source"></target>
<target name="Build" description="To build the source">
<echo message="Framework directory: ${framework::get-framework-directory(framework::get-target-framework())}"/>
<echo message="calling MSBuild. Expect .csproj to be in source directory"/>
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe">
<arg value="${build.dir}\WebApplication6.sln" />
<!-- verbosity of output [ The available verbosity levels are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] ]-->
<arg value="/verbosity:normal" />
<!-- configuration setting -->
<arg value="/property:Configuration=${msbuild.configuration}" />
</exec>
</target>
<!--<target name="Test" description="To test the build">
<nunit2>
<formatter type="Xml" usefile="true" extension=".xml" outputdir="E:\NAntWizard\Build\" />
<test assemblyname="E:\NAntWizard\Build\ClassLibrary1\bin\Debug\ClassLibrary1.dll"></test>
</nunit2>
</target>-->
<target name="Document" description="To document the result"></target>
<target name="Publish" description="To publish the result"></target>
<target name="Notify" description="To notify the result"></target>
<target name="go" depends="Clean,Get,Version,Build,Document,Publish,Notify"></target>
<target name="Help" descrption="This is for users a help"></target>
<target name="Fail" description="Failure will trigger this">
<echo message="An Error has occured!"></echo>
<echo message="${build.dir}"></echo>
<mail from="${EMAILFROM}" tolist="${EMAILTO}" cclist="${EMAILCC}"
subject="ApartmentGuide.com TRUNK Build Failed on ${Build.DateTime}"
message="The Automated build for Apartmentguide.com, TRUNK, Failed on ${Build.DateTime}. The log file is attached to this email."
mailhost="172.16.0.155">
<!-- Attach the log file to the email -->
<!--
<attachments>
<includes name="${Build.Failure.Log}" />
</attachments>-->
</mail>
</target>
<echo message="Creating Rps zip ${build.dir}\WebSite6.zip"/>
<zip zipfile=".\WebSite6.zip">
<fileset basedir="${build.dir}">
<include name="**"/>
<exclude name="**\*.sln"></exclude>
<exclude name="**\*.suo"></exclude>
<!--
<exclude name="*.resx"/>
-->
<exclude name="**\*.cs"></exclude>
<exclude name="**\*.csproj"/>
<exclude name="**\*.vspscc"/>
<exclude name="**\*.scc"/>
</fileset>
</zip>
</project>
Monday, August 13, 2007
England can chase 500, feels Chandu Borde...More
| | August 13, 2007 |
| | |
Our privacy policy explains how we use the personal information that you provide to us. If you have previously unsubscribed from this mailing list, but have received this mail, please note that it takes approximately 5 working days to process your request. To unsubscribe, click here. If you have any problem unsubscribing, send a mail to: rediffnews@rediff.co.in |
Saturday, August 11, 2007
Bhupathi-Vizener beat Paes-Damm...More
| | August 11, 2007 |
| | |
Our privacy policy explains how we use the personal information that you provide to us. If you have previously unsubscribed from this mailing list, but have received this mail, please note that it takes approximately 5 working days to process your request. To unsubscribe, click here. If you have any problem unsubscribing, send a mail to: rediffnews@rediff.co.in |
Bloodbath in Assam...More
| | August 11, 2007 |
Our privacy policy explains how we use the personal information that you provide to us. If you have previously unsubscribed from this mailing list, but have received this mail, please note that it takes approximately 5 working days to process your request. To unsubscribe, click here. If you have any problem unsubscribing, send a mail to: rediffnews@rediff.co.in |
'With advancing age Tendulkar has become more solid'...More
| | August 11, 2007 |
| | |
Our privacy policy explains how we use the personal information that you provide to us. If you have previously unsubscribed from this mailing list, but have received this mail, please note that it takes approximately 5 working days to process your request. To unsubscribe, click here. If you have any problem unsubscribing, send a mail to: rediffnews@rediff.co.in |
Friday, August 10, 2007
UPA-Left's Hamid Ansari is the vice president...More
| | August 10, 2007 |
| | |
Our privacy policy explains how we use the personal information that you provide to us. If you have previously unsubscribed from this mailing list, but have received this mail, please note that it takes approximately 5 working days to process your request. To unsubscribe, click here. If you have any problem unsubscribing, send a mail to: rediffnews@rediff.co.in |
Beckham makes low-key MLS debut...more...
| | August 10, 2007 |
| | |
Our privacy policy explains how we use the personal information that you provide to us. If you have previously unsubscribed from this mailing list, but have received this mail, please note that it takes approximately 5 working days to process your request. To unsubscribe, click here. If you have any problem unsubscribing, send a mail to: rediffnews@rediff.co.in |
I was sure I would come back: Zaheer...more...
| | August 10, 2007 |
| | |
Our privacy policy explains how we use the personal information that you provide to us. If you have previously unsubscribed from this mailing list, but have received this mail, please note that it takes approximately 5 working days to process your request. To unsubscribe, click here. If you have any problem unsubscribing, send a mail to: rediffnews@rediff.co.in |
Thursday, August 09, 2007
Bowling short spells has worked: Zaheer..more
| | August 9, 2007 |
| | |
Our privacy policy explains how we use the personal information that you provide to us. If you have previously unsubscribed from this mailing list, but have received this mail, please note that it takes approximately 5 working days to process your request. To unsubscribe, click here. If you have any problem unsubscribing, send a mail to: rediffnews@rediff.co.in |
Federer celebrates birthday with a win...more
| | August 9, 2007 |
| | |
Our privacy policy explains how we use the personal information that you provide to us. If you have previously unsubscribed from this mailing list, but have received this mail, please note that it takes approximately 5 working days to process your request. To unsubscribe, click here. If you have any problem unsubscribing, send a mail to: rediffnews@rediff.co.in |