Tuesday, December 30, 2008

Polymorphism

namespace ConsoleApplication2
{
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

Singleton - Construction should be private. Should allow to create instance using members method(CreateInstance):

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

Web.config
<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.CONFIG
<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

Rediff Newsletter
August 13, 2007

Cricket

 India-England, Day 4 pics
 Photograph: Getty Images
England can chase 500, feels Chandu Borde
The Indian team manager's reasoning that teams batting last have done well also contradicts the team's decision of not imposing the follow on.

· Scorecard: India vs Eng, 3rd Test
· Images: India vs Eng, 3rd Test, Day 4
· Daily roundup: Shying away from success
· Kumble surpasses McGrath's wicket tally
· Know Anil Kumble, the batsman
· Statistical tidbits from Oval Test
· India in the United Kingdom 2007
· Forthcoming cricket fixtures
· Rediff Editor's Choice blog

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

Rediff Newsletter
August 11, 2007

Sports

 Mahesh Bhupathi
Bhupathi-Vizener beat Paes-Damm
Leander Paes and Martin Damm were playing their first match in the hard court tournament after getting a bye in the first round and a walkover in the second round of the $2.20 million Rogers Cup in Montreal, Canada.

· Sania-Bethanie bow out of East West Bank Classic
· Distracted Jankovic books Ivanovic clash
· Sharapova battles through to Petrova semi in LA
· Federer, Nadal move closer to showdown
· Ecclestone keen to buy Arsenal
· Rediff readers with the Premiership trophy
· English Premier League: Complete Coverage
· Brazil defender Alex signs for Chelsea
· Tevez completes move to Manchester United
· Wenger says Arsenal can surprise critics
· Chess: Harikrishna beats Yifan for first win
· Shooting: Harveen Srao beats Olympic champion
· Tennis: Aqeel, Madkekar to meet in final
· English Premier League: Complete Coverage
· Formula One World Championship 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

Rediff Newsletter
August 11, 2007

News

Heavy rains bring Karachi to a standstill
Photograph: AFP/Getty Images


Assam: 14 Hindi-speaking people slain
Suspected militants with automatic rifles opened fire on two families. Six of those killed were children.

· Pak govt opens cases against Sharif: report
· Kolkata: Immigration officials deport 12-year-old
· Fire in JK arms depot; villagers flee area
· Haneef's colleague of greater interest to Aus cops
· Bihar: Brahmins bar Dalit woman from cooking mid-day meal
· What will happen to Pak's nukes if Musharraf falls?
· Pak courts can 'decide' Musharraf's fate
· 2005 Ayodhya attack mastermind killed
· PM 'dares' Left to withdraw support; Left mum
· Update voters' list in 30 days: Pak SC
· Rice may have prevented Pak emergency: Report
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

Rediff Newsletter
August 11, 2007

Cricket

 India-England, Day 3 pics
 Photograph: Getty Images
'With advancing age Tendulkar has become more solid'
Don't criticise Sachin Tendulkar, says former West Indies fast bowler Ian Bishop. 'Nobody can play the same at the start, in the middle and at the end of their career.'

· Match report: India vs England, 3rd Test, Day 3
· Images: India vs England, 3rd Test, Day 3
· Statistical tidbits from Oval Test
· Kumble's feats
· Century is very special: Kumble
· Congratulate Kumble
· Kumble has a ball with bat
· 'You took time, but did it'
· India set records at the Oval
· Yousuf 'seriously' considering ICL offer
· India in the United Kingdom 2007
· Forthcoming cricket fixtures
· Rediff Editor's Choice blog

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

Rediff Newsletter
August 10, 2007

News

A flood-hit village at Ghanshyampur in Bihar's Darbhanga district. More than 100 people have been killed and 2 million were displaced in what the United Nations called the 'worst floods in living memory'.
Photograph: AFP/Getty Images


Hamid Ansari elected vice-president
He secured 455 votes while NDA candidate Najma Heptulla got 22 votes.

· 'Nuclear deal won't affect foreign policy'
· Foreign students in Bangalore will feel the heat
· Train runs over two elephants in Assam
· N-deal row: Left threatens govt with 'serious action'
· Govinda fails to turn up for VP poll
· Maoists attack MLA's house in Chhattisgarh
· Geelani put under house arrest
· Voting ends in vice-presidential poll
· Osama bin Laden is a voter in Bihar's Jehanabad district
· Flood-hit Bihar to seek World Bank help
· Katara case: HC allows all defence witnesses
· Parliament to discuss N-deal on Aug 14, 16
· SC to hear Dutt bail plea on Aug 20
· Parliament pays tributes to Chandra Shekhar, adjourns
· Pak govt to file 'exile deal' with Sharifs in SC
· SC refuses bail to Dutt associate
· Schoolboy kidnapped in Patna, second in a week
· Asok, the first Indian comic character to win hearts all over
· What China is doing for a sunny Olympics
· Musharraf will be re-elected by present Assemblies: Pak PM
· I have no intention of leaving India: Taslima Nasreen
· Shiv Sena likely to back Najma in vice-prez poll
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...

Rediff Newsletter
August 10, 2007

Sports

 David Beckham
 Photograph: Getty Images
Beckham makes low-key MLS debut
The star mid-fielder made his debut for Los Angeles Galaxy against Washington DC on Thursday night.

· Ferguson expecting a better United this season
· English Premier League: Complete Coverage
· Paes, Bhupathi on collision course
· Nadal survives Mathieu scare
· Sania goes down to Razzano
· Khel Ratna for shooter Manavjit
· Indian boxers win three bronze
· Formula One World Championship 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...

Rediff Newsletter
August 10, 2007

Cricket

 Dinesh Karthik
 Photograph: Getty Images
'I was sure I would come back'
Zaheer Khan says the thought of not being selected again never crossed his mind.

· India have a great chance to be No.2
· Scorecard: India vs Eng, 3rd Test
· Predict & Win: India - Eng, 3rd Test
· Tale of two 'keepers rules headlines
· Ganguly at cricket photo exhibition
· Karthik misses ton as India cruise
· Ignore jellybeans incident: SRK
· Spotted: Ganguly, Sachin, Dravid, Laxman
· Harbhajan bowls Surrey to victory
· Inzamam wants to play in ICL
· Bangladesh axe Rafique, Nafees
· Ashley Giles forced to retire at 34
· India have a chance to be No.2
· Rediff ODI rankings
· India in the United Kingdom 2007
· Forthcoming cricket fixtures
· Rediff Editor's Choice blog

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

Rediff Newsletter
August 9, 2007

Cricket

 Zaheer Khan
 Photograph: Getty Images
'Bowling in short spells has worked for me'
Zaheer Khan on his return to form that shaped India's escape at Lord's and victory over England at Trent Bridge.

· Scorecard: India vs Eng, 3rd Test
· Predict & Win: India - Eng, 3rd Test
· Fab four set for history
· Shoaib Akhtar fined for misconduct
· Fleming left out of New Zealand Twenty20 squad
· Harbhajan claims high-five for Surrey
· India in the United Kingdom 2007
· Forthcoming cricket fixtures
· Rediff Editor's Choice blog

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

Rediff Newsletter
August 9, 2007

Sports

 Roger Federer
 Photograph: Getty Images
Federer celebrates birthday with a win
Images from the Rogers Cup in Montreal and WTA Los Angeles Classic.

· Sania-Bethanie in Los Angeles quarters
· Nadal tames Safin in Montreal
· Davydenko upset by betting row
· Premiership stars set to shine
· Chess: India lead despite defeat
· Rossi faces tax evasion probe
· Sunderland sign Gordon in British record deal for keeper
· Milan coach says Ronaldo will be fit
· Formula One World Championship 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