tag:blogger.com,1999:blog-4759851390464431622020-02-28T23:31:52.928+05:30Ani's WeblogA place to learn, explore and share technologies.....Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.comBlogger47125tag:blogger.com,1999:blog-475985139046443162.post-60844658147139986642011-06-19T00:37:00.006+05:302011-06-19T00:47:28.520+05:30Finally we will have SharePoint 2010 Service Pack 1Yes, finally Microsoft is releasing Service Pack 1 for SharePoint 2010. It is expected to get release by June end 2011, when it will be available for download. <br /><br />People working on SharePoint 2010 are eagerly waiting for this with a hope that it will fix the bugs that they all encountered while working on SharePoint 2010. Though not all the lists of fixes are yet declared, but few additional functionality are already out of which the most interesting one will be Recycle Bin for Sites/Site Collections deletions. So keeping our finger crossed for this release.<br /><br />Reference: <a href="http://sharepoint.microsoft.com/blog/Pages/BlogPost.aspx?pID=973">http://sharepoint.microsoft.com/blog/Pages/BlogPost.aspx?pID=973</a>Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-46095257205646524252010-05-23T20:30:00.005+05:302010-05-23T20:41:13.300+05:30DataColumn.MaxLength not working in C#DataColumn.MaxLength<br /><br />Visual Studio Intellisense: Gets or Sets the maximum length of a text column.<br />MSDN: The maximum length of the column in characters. If the column has no maximum length, the value is –1 (default).<br /><br />But most of the developers didn't able to get the desired result. It always returns -1. Microsoft has confirmed that this is a bug in the Microsoft products. <br /><br />To resolve this, you need to set the "MissingSchemaAction" of "SqlDataAdapter" object. If you did not have it set, the ColumnLength property always returns -1.<br /><br />Reference: <a href="http://support.microsoft.com/kb/317175" target="_blank">http://support.microsoft.com/kb/317175</a><br /><br />Example:<br /><br /> string strQuery = "SELECT * FROM tbl_MyTable";<br /> objConn = new SqlConnection(strConnString);<br /> objConn.Open();<br /> objCmd = new SqlCommand(strQuery, objConn);<br /> objDA = new SqlDataAdapter(objCmd);<br /> <b>objDA.MissingSchemaAction = MissingSchemaAction.AddWithKey;</b><br /> objDS = new DataSet();<br /> int iCount = objDA.Fill(objDS);Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-51714373349746215692010-05-17T23:51:00.002+05:302010-05-17T23:54:28.917+05:30When the heart is more beautiful than the face!!!"One of my friend forwarded me an email with this beautiful story. It's awesome and so decided to share this through my blog."<br /><br />The rain pouring out heavily invited me for a rendezvous but then I had a session. Just as I checked the time on my cell, the knock at the door announced the arrival. <br /><br />The assistant informed me of the client and I asked her to send them in.. The couple in their late twenties. A second later the door opened again and I beckoned them to come in..<br /><br />This man came in … straight out of Bollywood or rather Hollywood.<br /><br />Accompanying this 6+ft guy was this lady… Very thin , and looking unwell.<br />I wondered what brought them here. They didn’t look like your usual battlefield couples that come for counseling. Generally when couples came in the first noticeable thing they did was pulling chairs apart. Here he pulled it closer. Asked her if she was fine. The body language suggested care and concern. I sat back amused and let them speak.<br /><br />This couple was married about 10 years back. A love marriage.. Intercaste marriage they braved many storms to be together .Then a couple of years back destiny struck. <br /><br />She was diagnosed with ovarian cancer..The disease took a toll on her, drained her physically and psychologically. Her husband stood like the rock of Gibralter.. A pillar of strength.<br /><br />Yet….<br /><br />She now feels inadequate for various reasons. One her inability now to conceive, Two her looks that she thought was her identity and description She could not come to terms with the way she looked now. Her health was bad enough and her depression she thought was contagious spreading all around wherever she went.<br />She thought him too young to be saddled with problems and wished him a better life. She wanted a separation. She wanted him to move on with life..<br />She didn’t want to be responsible for ruining his youth, his future. She said she loved him and wanted to let him go… to live better.<br /><br />The moment she said that I looked at her husband. He looked hurt. Deeply hurt. <br />This is what he had to say and this is what prompted me to write this blog:<br /><br />“ I love her for what she is. Yes I liked her looks when I first met her but that was because that was the first noticeable thing, As I got to know her I realized how much more beautiful she is on the inside. I can never love anyone after I have experienced this beauty. Everyone else fails in comparison. What I see her as is her real self and to see her for her beauty you need to look through my eyes and not the mirror. The mirror has its set of lies and one of that is about her looks. To know her, look through me. I do not want any other happiness, I promised to be with her through thick and thin and I will be there no matter what. I will never leave her. She can throw me out , but I will continue living on the doorstep. I need her to know that these suggestions by her are an insult to my love. Is love only about looks?. Is beauty just about skin? If I were to go through the same would she leave me? I would never be able to do that. For me she is highly fecund , producing a higher degree love everytime I look at her. I love her truly and deeply and this is why I’m here to take your help and let her know the value of a relationship that goes beyond all these fallacies of appearances.”<br /><br />What a magnanimous man!<br /><br />I wasn’t the only one with tears, there was this beauty in front of me crying yet unaware of it. I excused myself and walked out.. I was glad they came to me though honestly all I did was listen to them but I saw a lovely example of true love. Their coming here was important for them and for me. To witness such love is a blessing.<br /><br />These days when relations are so fragile and break at the slightest of excuses like:<br />She/ He is too fat<br />She can’t cook<br />She doesn’t work<br />He is hardly earning enough<br />We need space <br />He/She smokes/drinks <br />She isn’t glamourous enough<br />He/She can’t satisfy me<br />She/He doesn’t get along with inlaws , friends etc.<br /><br />And many such excuses so inane , obfuscating the whole concept of marriages,just desperately searching a way out. This person purely defined something so perfect. Perfect love that transcends all these fallacies of looks.<br /><br />This especially is so important when people marry only on the basis of looks. Yes the matrimonial columns are all about how slim and beautiful your bride needs to be. But then one must realize that EXTERNAL BEAUTY IS SO TEMPORARY. Beauty is just skin depth.. The true beauty lies within. Appreciate that and see love blossom.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-51110300658870365902010-05-16T23:49:00.004+05:302010-05-17T00:04:36.619+05:30How to rename SharePoint Server?Sometimes you may need to rename your Computer Name where SharePoint is installed. This also applies to Virtual Machines. I recently tried to do this, but after doing that, I found that SharePoint is not working. So I need to do few activities to bring it back, which I have been listed below:<br /><br />Step 1: Rename my Computer/Server from My Computer -> Properties -> Computer Name - Change... -> Restart<br /><br />Step 2: stsadm –o renameserver<br /><br />Step 3: stsadm –o updatefarmcredentials<br /><br />Step 4: Restart IIS<br /><br />Step 5: Update all identity accounts(basically machine names) in IIS<br /><br />Step 6: stsadm.exe -o setconfigdb<br /><br />Step 7: All Programs -> Microsoft Office Server -> SharePoint Product and Technologies Configuration Wizard<br /><br />Step 8 Open Central Admin and change Alternate Access Mappings, wherever applicable.<br /><br />You are done. I found few other steps also while goggling. But the above steps work for me. The following references may help in case there are some issues:<br /><br /><a href="http://blogs.sharepointlabs.com/Lists/Posts/Post.aspx?List=9312760c%2Dc235%2D4cc0%2Da25f%2D481a34785c3d&ID=6" target="_blank">http://blogs.sharepointlabs.com/Lists/Posts/Post.aspx?List=9312760c%2Dc235%2D4cc0%2Da25f%2D481a34785c3d&ID=</a>6<br /><br /><a href="http://moss-exchange.blogspot.com/2007/12/renaming-sharepoint-server.html" target="_blank">http://moss-exchange.blogspot.com/2007/12/renaming-sharepoint-server.html</a><br /><br /><a href="http://vspug.com/nrdev/2008/07/15/tip-how-to-rename-a-sharepoint-server-machine-name/http://vspug.com/nrdev/2008/07/15/tip-how-to-rename-a-sharepoint-server-machine-name/" target="_blank">http://vspug.com/nrdev/2008/07/15/tip-how-to-rename-a-sharepoint-server-machine-name/http://vspug.com/nrdev/2008/07/15/tip-how-to-rename-a-sharepoint-server-machine-name/</a>Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-88787658152827669772010-03-15T11:27:00.000+05:302010-03-15T11:28:15.454+05:30SharePoint SPSite.AllowUnsafeUpdatesThe Microsoft idea behind introducing the AllowUnsafeUpdates property is to protect you from cross-site scripting attacks.<br /><br />MSDN Definition: Gets or sets a Boolean value that specifies whether to allow updates to the database as a result of a GET request or without requiring a security validation. Setting this property to true opens security risks, potentially introducing cross-site scripting vulnerabilities.<br /><br />If you try to do any updates to lists, webs or any SharePoint objects that require an SPSite to be created first, you need to set AllowUnsafeUpdates to TRUE, otherwise it will through an error saying "System.Exception: Microsoft.SharePoint.SPException: The security validation for this page is invalid."<br /><br />In order for the AllowUnsafeUpdates to work, that the Update method of the SPSite object needs to be called as well:<br /><br />SPSite.AllowUnsafeUpdates = true;<br />SPSite.Update();<br /><br />Also, you may want to try using a POST, rather than a GET in order to avoid having to set this property. If your code is processing a POST request then make sure you call SPUtility.ValidateFormDigest() before you do anything else. This will ensure that the post request is validated (that it is not a cross-site scripting attack) and after that you will not have to worry about AllowUnsafeUpdates, because its default value will be “true” after the form digest is validated. <br /><br />If the HTTPContext.Current is null then AllowSafeUpdates will be always true. This is the case in rich clients where no cross-scripting is possible as there are simply no web requests.<br /><br />When any object that implements ISecurable (those are SPWeb, SPList and SPListItem) breaks or reverts their role definition inheritance. This means every time you call SPRoleDefinitionCollection.BreakInheritance(), BreakRoleInheritance(), ResetRoleInheritance() or set the value of HasUniquePerm the AllowUnsafeUpdates property of the parent web will reset to its default value and you may need to set it back to true in order to do further updates to the same objects. So always set AllowUnsafeUpdates back to true after you break inheritance in an environment with HTTPContext.<br /><br />Additional References:<br /><br />http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsite.allowunsafeupdates.aspx<br />http://hristopavlov.wordpress.com/2008/05/16/what-you-need-to-know-about-allowunsafeupdates/<br />http://hristopavlov.wordpress.com/2008/05/21/what-you-need-to-know-about-allowunsafeupdates-part-2/Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-70385440710050974602010-03-15T10:49:00.001+05:302010-03-15T10:51:42.506+05:30SharePoint SPWeb.EnsureUserMSDN Definition: Checks whether the specified login name belongs to a valid user of the Web site, and if the login name does not already exist, adds it to the Web site. <br /><br />This method can not be called by everyone, as it requires some high level permissions. Your solution is to wrap the EnsureUser within RunWithElevatedPrivileges call. <br /><br />According to the SharePoint SDK it should be enough to call in your code:<br /><br />using (SPSite site = new SPSite("http://mywebsite.com")) <br />{ <br /> using (SPWeb web = site.OpenWeb()) <br /> { <br /> string login = "MyUserName"; <br /> string groupName = "MyGroup"; <br /> SPUser user = web.EnsureUser(login); <br /> SPGroup group = web.Groups[groupName]; <br /> group.AddUser(user); <br /> } <br />}<br /><br />The above code works correctly: the EnsureUser method returns a valid SPUser object which can be added to the MyGroup group.<br /><br />If you run the above piece of code with Forms Based Authentication (FBA), all you see is an SPException: SharePoint cannot find the user.<br /><br />Surprisingly the same piece of code executed from a control or an Application Page runs correctly.<br /><br />At some point the Roles class tries to retrieve the system.web/roleManager configuration section. Because that section is available in the web.config of a Web Application with FBA configured, the code works properly. But for Console Applications it doesn't. What you can do is to create a config file like ConsoleApplication1.exe.config (assuming that ConsoleApplication1.exe is the name of your executable after building) and copy there that particular piece of configuration from your web.config. If you run your Console Application now, it should work perfectly.<br /><br />Note:<br /><br />To add an User to SharePoint Group, we need to add the User to the Site Collection. For instance if we write the following lines of code to add user to a group, if will throw error is user does not exist.<br /><br />group.Users.Add(item,"","",""); <br /><br />To resolve this, we can easily use the following line of code:<br /> <br />SPUser userTemp = web.EnsureUser(item);<br /><br />If the user is known on the site collection there are three ways to get it:<br /><br />1. Gets the collection of user objects that represents all users who are either members of the site or who have browsed to the site as authenticated members of a domain group in the site.<br /><br />SPUserCollection users = portalSite.RootWeb.AllUsers;<br /><br />2. Gets the collection of all users that belong to the site collection.<br /><br />SPUserCollection users = portalSite.RootWeb.SiteUsers;<br /><br />3. Gets the collection of user objects that are explicitly assigned permissions on the Web site.<br /><br />SPUserCollection users = portalSite.RootWeb.Users;<br /><br />Additional References:<br /><br />http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.ensureuser.aspx<br />http://blog.mastykarz.nl/inconvenient-programmatically-sharepoint-users-spweb-ensureuser/<br />http://vspug.com/mirjam/2007/12/20/using-spweb-ensureuser-loginname-to-add-a-new-spuser-to-a-web/Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-1485255258564529512010-02-25T11:31:00.002+05:302010-02-25T11:38:06.018+05:30How can we create a new SharePoint 2010 Site using Power Shell scripts?Step 1: We need to create a Power Shell script file, say, createsite.ps1<br /><br />Write-Host <br /># define variables for script<br />$SiteTitle = "My First Site using Power Shell"<br />$SiteUrl = "http://www.mydomain.com/sites/SiteName"<br />$SiteTemplate = "STS#1"<br /><br /># check to ensure Microsoft.SharePoint.PowerShell is loaded<br />$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}<br /><br />if ($snapin -eq $null) <br />{<br /> Write-Host "Loading SharePoint Powershell Snapin"<br /> Add-PSSnapin "Microsoft.SharePoint.Powershell"<br />}<br /><br /># delete any existing site found at target URL<br />$targetUrl = Get-SPSite | Where-Object {$_.Url -eq $SiteUrl}<br /><br />if ($targetUrl -ne $null) <br />{<br /> Write-Host "Deleting existing site at " $SiteUrl<br /> Remove-SPSite -Identity $SiteUrl -Confirm:$false<br />}<br /><br /># create new site at target URL<br />Write-Host "Creating new site at " $SiteUrl <br />$NewSite = New-SPSite -URL $SiteUrl -OwnerAlias Administrator -Template $SiteTemplate -Name $SiteTitle<br />$RootWeb = $NewSite.RootWeb<br /><br /># display site info<br />Write-Host <br />Write-Host "A new SharePoint Site has been created successfully" -foregroundcolor Green<br />Write-Host "-------------------------------------" -foregroundcolor Green<br />Write-Host "Site URL:" $RootWeb.Url -foregroundcolor Yellow<br />Write-Host "Site ID:" $RootWeb.Id.ToString() -foregroundcolor Yellow<br />Write-Host "Site Title:" $RootWeb.Title -foregroundcolor Yellow<br />Write-Host "-------------------------------------" -foregroundcolor Green<br /><br />Step 2: To execute this script, you can create a bat file, say, setup.bat and execute the batch file<br /><br />powershell -Command "& {Set-ExecutionPolicy bypass}" -NoExit<br />powershell -Command "& {.\createsite.ps1}" -NoExit<br />pauseAnihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-16270658752317369022010-02-24T10:15:00.003+05:302010-02-24T10:17:45.485+05:30Free SharePoint 2007 Video TutorialsToday I was googling to find some video tutorials so that the begenners can have some initial understandings on SharePoint and found the following sites really helpful. And above all they are absolutely free to access.<br /><br /><a href="http://sptraining.sharepointsite.net/" target='_blank'>http://sptraining.sharepointsite.net/</a>Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-67191616175852115292010-02-18T18:41:00.002+05:302010-02-18T23:59:45.775+05:30How to add dynamic silverlight controls in runtime?In Silverlight, While it is possible to create all your controls and objects in code, best practices dictate that it is usually better to do so in Xaml. The most compelling reason is that Xaml is highly "toolable" - that is, it lends itself to round-trip modification in tools such as Visual Studio and Expression and thus is easier to scale, modify and maintain. <br /><br />On the other hand, there are times that you can't know at design time which or how many objects you'll need, and the ability to create objects dynamically can be a fundamental requirement. <br /><br />So let's create a Silverlight page and add the following:<br /><br /><Canvas x:Name="myCanvas"> <br /><Button x:Name="myButton" Content="Hello" Canvas.Left="10" Canvas.Top="10"/> <br /><Button x:Name="Another" Content="Add Another" Canvas.Left="10" Canvas.Top="50" /> <br /></Canvas><br /><br />The objective is to add a button to the page with the words "Add Another." When the user clicks on this button, we want to add a button to the UI and we want that button to have its own size, position and behavior. We do all of that in the code behind.<br /><br />The first thing to do is to add an event handler for the new button in the Page Load event, <br /><br />Another.Click += new RoutedEventHandler(Another_Click); <br /><br />And to add its implementation, in which you'll create a new button and set its properties,<br /><br />void Another_Click(object sender, RoutedEventArgs e) <br />{ <br /> Button b = new Button(); <br /> b.Content = "I live!"; <br /> b.SetValue(Canvas.LeftProperty, 10.0); <br /> b.SetValue( Canvas.TopProperty, <br /> this.newButtonPosition); <br /> this.newButtonPosition += 30.0; <br /> b.Width = 100; <br /> b.Height = 20; <br /> b.Click +=new RoutedEventHandler(new_button_click); <br /> myCanvas.Children.Add(b); <br />} <br /><br />void new_button_click(object sender, RoutedEventArgs e) <br />{ <br /> Button btn = sender as Button; <br /> btn.Content = "Don't do that!"; <br /> btn.IsEnabled = false; <br />} <br /><br />Because the canvas's Left and Top are not actually properties of the Button (but are extended properties) you set them with the SetValue method, which takes two parameters. The first is the actual name of the property you want to set (Canvas.LeftProperty and Canvas.TopProperty) which is not difficult to find as Intellisense will supply it) and the second is the value (in this case a double).<br /><br />Also we have added an event handler registration to the button. This means that every button that is added is registered to call new_button_click when it is clicked. As the buttons are clicked, they change their message and become disabled.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-59154859565308889912010-02-04T10:46:00.001+05:302010-02-04T10:46:33.144+05:30Anonymous TypesThe ability to create new types 'on the fly' is done using Anonymous Types.<br /><br />All of this happens at compile time, so anonymous types are still strongly typed. In reality, the compiler automatically creates a class that represents the anonymous type.<br /><br />Example: var product = new {Name = "C# Rocks!", Price = 3};<br /><br />-> When an anonymous type is assigned to a variable, that variable must be initialized with the var construct.<br /><br />-> Anonymous types are reference types that derive directly from object.<br /><br />-> If two or more anonymous types have the same number and type of properties in the same order, the compiler treats them as the same type and they share the same compiler-generated type information.<br /><br />-> Anonymous types cannot contain unsafe types as properties.<br /><br />Note: While anonymous types might not seem all that useful on the surface, they are the cornerstone for LINQ. Without anonymous types, LINQ would not be able to create types dynamically. This is what allows LINQ to query for an arbitrary set of data, without first having the structure declared.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-36101058393723829532010-02-04T10:30:00.001+05:302010-02-04T10:30:49.128+05:30Implicitly typed local variable in C#Implicitly typed local variable is a variable that can be declared without specifying the .NET type explicity. The type of that variable will be inferred by the complier from the expression on the right side of initialization statement.<br /><br />Examples:<br /><br />var i = 5;<br /><br />When the compiler sees this in the code, it tries to figure out the type of the variable based on the value you assigned it. Hence, if you call GetType() on i, the type returned is actually System.Int32. <br /><br />The following will give you an error because the compiler can't figure out what type the variable is:<br /><br />var i = null;<br /> <br />You have to initialize the variable with something that the compiler understands so it can figure out the type. Calling GetType() on firstName here would give you System.String:<br /><br />var firstName = "David";<br /><br />Limitations:<br /><br />-> The declarator must include an initializer. Unlike normal declarations, you can’t declare the implicitly type variable without initializing. <br /><br />-> The compile-time type of the initializer expression cannot be the null type. <br /><br />-> If the local variable declaration includes multiple declarators, the initializers must all have the same compile-time type.The implicitly-type local variable cann’t be initialized with different types more than one time. You can’t assign the string to varaible “test” after initializing with integer value “1". <br /><br />-> Cannot initialize an implicitly-typed local variable with an array initializer like var test = { 1, 2, 3 }; Can only use array initializer expressions to assign to array types, like a new expression var test1 = new[] { 1, 2, 3 };<br /><br />-> an implicitly typed local variable cannot be Nullable variable which means the following syntax to create a Nullable variable in C# will not work with implicitly typed variables - var? age = null;<br /><br />-> Implicit Typed Variable cannot be used as class members such as field. They can only be used as local variables inside methods.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-66753174154405886282010-02-04T10:07:00.000+05:302010-02-04T10:08:17.120+05:30Extension MethodsIt is a special kind of static method that allows you to add new methods to existing types without deriving, recompiling or modifying the original type. The extension methods are called as if they were instance methods from the extended type.<br /><br />public static class MyExtensionClass<br />{ <br /> public static int Multiply(this int num) <br /> { <br /> return num * num; <br /> } <br />}<br /><br />class Program <br />{ <br /> static void Main(string[] args) <br /> { <br /> int i = 3; <br /> Console.WriteLine(i.Multiply()); <br /> Console.ReadLine(); <br /> } <br />} <br /><br />Here are the few things we should keep in mind while using Extension Methods:<br /><br />-> This keyword has to be the first parameter in the extension method parameter list. The type of the first parameter will be the type that is extended.<br />-> Extension methods can't access the private methods in the extended type. <br />-> Extension methods can be defined only in a static class.<br />-> If you want to add new methods to a type, you don't have the source code for it, the ideal solution is to use and implement extension methods of that type. <br />-> If you create extension methods that have the same signature methods inside the type you are extending, then the extension methods will never be called. Extension methods cannot be used to override existing methods. <br />-> If the class is sealed than there in no concept of extending its functionality. For this a new concept is introduced i.e. extension methods.<br />-> The concept of extension methods cannot be applied to fields, properties or events.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-87857441414614266222009-11-19T23:42:00.004+05:302009-11-19T23:47:46.838+05:30Microsoft SharePoint Server 2010 Beta is now availableNow you can evaluate the Beta product to simplify your IT environment and give you more control. <br /><br />There are two versions of SharePoint Server 2010 Beta. Installation of the SharePoint Server 2010 Beta requires one of the following product keys: <br /><br />1. <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=77c30c6c-47fc-416d-88e7-8122534b3f37&DisplayLang=en&displaylang=en" target="_blank">SharePoint Server 2010 (Enterprise Client Access License features)</a><br />2. <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=77195785-0282-4acc-b6f4-7569e1011581&DisplayLang=en&displaylang=en" target="_blank">SharePoint Server 2010 for Internet Sites, Enterprise</a><br /><br />The SharePoint Server 2010 Beta software is available in the following languages: <br />Chinese (Simplified), English, French, German, Japanese, Russian and Spanish <br /><br />Note: Don't forget to check the "<a href="http://technet.microsoft.com/en-us/library/cc262485(office.14).aspx" target="_blank">System Requirements</a>" before downloading.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-57988458829569755092009-11-19T23:19:00.006+05:302009-11-19T23:51:20.582+05:30Microsoft Office 2010 Beta is available nowMicrosoft Office Professional Plus 2010 Beta is now available for Tech enthusiasts to download. Office 2010 lets you work how, when, and where you want, letting you get things from a PC, the Web, and even a smartphone. It includes the following:<br /><br />Word, OneNote, InfoPath, PowerPoint, Access, SharePoint Workspace, Outlook, Publisher, Communicator and Excel.<br /><br />It is around 685 MB download and here is the link:<br /><br /><a href="http://www.microsoft.com/office/2010/en/download-office-professional-plus/default.aspx" target="_blank">Microsoft Office Professional Plus 2010 Beta</a><br /><br />Before downloading, you should review the <a href="http://technet.microsoft.com/hi-in/library/ee624351(en-us,office.14).aspx" target="_blank">System requirements for Office 2010</a>.<br /><br />Other Microsoft Beta products available:<br /><br /><a href="http://www.microsoft.com/office/2010/en/visio/download.aspx" target="_blank">Microsoft Visio 2010</a><br /><br /><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=77c30c6c-47fc-416d-88e7-8122534b3f37&DisplayLang=en&displaylang=en" target="_blank">Microsoft SharePoint Server Enterprise 2010 Beta</a><br /><br /><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=77195785-0282-4acc-b6f4-7569e1011581&DisplayLang=en&displaylang=en">Microsoft SharePoint Server for Internet Sites Enterprise 2010 Beta</a>Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-56878375917768907562009-10-22T01:07:00.000+05:302009-10-22T01:10:12.601+05:30Visual Studio 2010 launching on March 22, 2010Microsoft on 20th October 09 announced Visual Studio 2010 will officially launch on March 22, 2010.<br /><br />Same day Microsoft announced the release of second Visual Studio 2010 beta and .NET Framework 4 beta to MSDN subscribers with everyone else getting code on October 21. <br /><br />Here is the link from where you can download BETA 2 versions:<br /><br />http://msdn.microsoft.com/en-in/vstudio/dd582936(en-us).aspx<br /><br />Before these, Microsoft already released "Visual Studio 2010 and .NET Framework 4 Training Kit". You can download it from this link:<br /><br />http://www.microsoft.com/downloads/details.aspx?familyid=752CB725-969B-4732-A383-ED5740F02E93&displaylang=en<br /><br />Some of the new features include:<br /><br />-> Windows 7 and SharePoint 2010 tools, <br />-> drag-and-drop bindings with Silverlight and Windows Presentation Foundation, <br />-> the inclusion of the Dynamic Language Runtime (DLR) for programming with scripting languages, and <br />-> support for parallel programming.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-26700148935523665572009-06-25T16:00:00.003+05:302009-06-25T16:00:08.007+05:30Partial in c#<strong>Introduction:</strong><br /><br />In a nutshell, partial classes mean that your class definition can be split into multiple physical files. <br /><br />So it is possible to split the definition of a class or a struct, an interface or a method over two or more source files. Each source file contains a section of the type or method definition, and all parts are combined when the application is compiled.<br /><br />To split a class definition, use the partial keyword modifier, as shown here:<br /><br />public partial class Employee<br />{<br /> public void DoWork()<br /> {<br /> }<br />}<br /><br />public partial class Employee<br />{<br /> public void GoToLunch()<br /> {<br /> }<br />}<br /><br />The partial keyword indicates that other parts of the class, struct, or interface can be defined in the namespace. <br /><br /><strong>Features:</strong><br /><br />1. All the parts must use the partial keyword. <br />2. All the parts must be available at compile time to form the final type. <br />3. All the parts must have the same accessibility, such as public, private, and so on.<br />4. If any part is declared abstract, then the whole type is considered abstract. <br />5. If any part is declared sealed, then the whole type is considered sealed. <br />6. If any part declares a base type, then the whole type inherits that class. All the parts that specify a base class must agree, but parts that omit a base class still inherit the base type. <br />7. Parts can specify different base interfaces, and the final type implements all the interfaces listed by all the partial declarations. <br />8. Any class, struct, or interface members declared in a partial definition are available to all the other parts. The final type is the combination of all the parts at compile time.<br />9. The partial modifier is not available on delegate or enumeration declarations.<br /><br /><strong>Nested Types with partial:</strong><br /><br />Nested types can be partial, even if the type they are nested within is not partial itself.<br /><br />class Container<br />{<br /> partial class Nested<br /> {<br /> void Test() { }<br /> }<br /> partial class Nested<br /> {<br /> void Test2() { }<br /> }<br />}<br /><br /><br /><strong>Attributes with partial:</strong><br /><br />At compile time, attributes of partial-type definitions are merged. For example, consider the following declarations:<br /><br />[SerializableAttribute]<br />partial class Moon { }<br /><br />[ObsoleteAttribute]<br />partial class Moon { }<br /><br />They are equivalent to the following declarations:<br /><br />[SerializableAttribute]<br />[ObsoleteAttribute]<br />class Moon { }<br /><br /><br /><strong>Restrictions:</strong><br /><br />1. All partial-type definitions meant to be parts of the same type must be modified with partial.<br />2. All partial-type definitions meant to be parts of the same type must be defined in the same assembly and the same module (.exe or .dll file). Partial definitions cannot span multiple modules.<br />3. The class name and generic-type parameters must match on all partial-type definitions. Generic types can be partial. Each partial declaration must use the same parameter names in the same order.<br />4. The following keywords on a partial-type definition are optional, but if present on one partial-type definition, cannot conflict with the keywords specified on another partial definition for the same type: public, private, protected, internal, abstract, sealed, base class, new modifier (nested parts), generic constraints.<br /><br /><strong>Advantages</strong><br /><br />They allow programmers on your team to work on different parts of a class without needing to share the same physical file. While this is useful for projects that involve big class files, be wary: If you find your class file getting too large, it may well signal a design fault and refactoring may be required. <br /><br />The most compelling reason for using partial class is to separate your application business logic from the designer-generated code. For example, the code generated by Visual Studio 2005 for a Windows Form is kept separate from your business logic (we will discuss this in a later section). This will prevent developers from messing with the code that is used for the UI. At the same time, it will prevent you from losing your changes to the designer-generated code when you change the UI.<br /><br /><strong>Partial Methods </strong><br /><br />Partial methods are methods living in partial classes which are marked as partial. <br /><br /><strong>Features:</strong><br /><br />1. A partial class or struct may contain a partial method. One part of the class contains the signature of the method. An optional implementation may be defined in the same part or another part. If the implementation is not supplied, then the method and all calls to the method are removed at compile time. <br />2. Partial method declarations must begin with the contextual keyword partial and the method must return void.<br />3. Partial methods can have ref but not out parameters.<br />4. Partial methods are implicitly private, and therefore they cannot be virtual.<br />5. Partial methods cannot be extern, because the presence of the body determines whether they are defining or implementing. <br />6. Partial methods can have static and unsafe modifiers.<br />7. Partial methods can be generic.<br />8. Constraints are put on the defining partial method declaration, and may optionally be repeated on the implementing one. Parameter and type parameter names do not have to be the same in the implementing declaration as in the defining one.<br />9. You can make a delegate to a partial method that has been defined and implemented, but not to a partial method that has only been defined.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-17649136318263388062009-06-25T16:00:00.002+05:302009-06-25T16:00:03.865+05:30C# Generics<strong>Introduction</strong><br /><br />Generics are the most powerful feature of C# 2.0 which allow you to define type-safe data structures, without committing to actual data types. We can use generics in classes and in structs.<br /><br />To do that, use the < and > brackets, enclosing a generic type parameter.<br /><br />E.g.,<br /><br />public class MyStack<T><br />{<br /> T[] myItems; <br /> public void Push(T item)<br /> {...}<br /> public T Pop()<br /> {...}<br />}<br /><br />MyStack<int> stack = new MyStack<int>();<br />stack.Push(1);<br />stack.Push(2);<br />int number = stack.Pop();<br /><br />When using a generic stack, you have to instruct the compiler which type to use instead of the generic type parameter T, both when declaring the variable and when instantiating it: <br /><br />MyStack<int> stack = new MyStack<int>();<br /><br />The advantage of this programming model is that the internal algorithms and data manipulation remain the same while the actual data type can change based on the way the client uses your server code. <br /><br /><strong>Problem with object based solution</strong><br /><br />Performance isuue due to boxing/unboxing<br />No compile-time type safety<br /><br /><strong>Advantages</strong><br /><br />Significant performance boost<br />Higher quality code<br />Reuseable code and the effort <br />Type-safe at compile-time.<br />Gives no boxing, no casting advantage.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-17147200589722993862009-06-25T16:00:00.001+05:302009-06-25T16:00:04.169+05:30New to ASP.Net 2.01. Master Pages: It is meant for applying a consistent look and feel for a whole web site.It is a template for other pages, with shared layout and functionality. The master page defines placeholders for content pages. The result page is a combination (merge) of the master page and the content page. <br /><br />2. Themes: It allow developers to create a customized look for web applications.<br /><br />3. Web Parts: WebParts are all about personalization. It allows user customization of style and content based on User's preferences.<br /><br />4. Navigation: Added controls like Site Maps, Dynamic HTML menus, Tree Views.<br /><br />5. Security: Added controls like Login, LoginStatus, LoginName, LoginView, CreateUserWizard, PasswordRecovery.<br /><br />6. Roles and Personalization: For storing user details.<br /><br />7. Globalization: Improved support for multiple languages.<br /><br />8. Data Access: Added new data controls, removing much of the need for programming and in-depth knowledge of data connections. E.g., SqlDataSource, AccessDataSource, XMLDataSource, ObjectDataSource, SiteMapDataSource.<br /><br />9. Mobility Support: The Microsoft Mobile Internet Toolkit (MMIT) provided this support. MMIT is no longer needed because mobile support is built into all controls.<br /><br />10. Images: Added new controls for handling images: The ImageMap control (image map support) and the DynamicImage control (image support for different browsers).<br /><br />11. Automatic Compilation: All files within a directory will be compiled on the first run, including support for WSDL, and XSD files.<br /><br />12. Compiled Deployment (Installation) and Source Protection: It provides pre-compilation. An entire web site can be pre-compiled. This provides an easy way to deploy (upload to a server) compiled applications, and because only compiled files are deployed, the source code is protected.<br /><br />13. Site Management: It has three new features for web site configuration and management - Local management console, programmable management functions (API) and web-based management tool .<br /><br />14. Development Tools: Visual Studio 2005<br /><br />ASP.Net 2.0 has added numbers of new controls. You can find the complete list here along with their brief overview.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-6246785690351212582009-06-25T16:00:00.000+05:302009-06-25T16:00:05.043+05:30New ASP.Net 2.0 Controls1. ImageMap: This control extends the Image control with a collection of clickable hot spots. You can create (and configure the dimensions of) as many rectangle, circle, and polygon hotspots as you need. The HotSpotMode property can be used to specify whether the user’s click should cause a postback or navigate the user directly to a URL. <br /><br />2. BulletedList: When you need to display a bulleted list on your page, this control is a perfect fit. In addition to the databinding capabilities , there are also such useful properties as BulletStyle, which can be set to circles, squares, numbers, roman numerals, custom images, etc. With the DisplayMode property you can specify that the list items be represented by standard text, HyperLinks, or LinkButtons. <br /><br />3. MultiView: The MultiView control manages multiple View controls to ensure only one is visible at a time. Using the ActiveViewIndex property of the MultiView control we can specify which View should be visible at any particular time. Each View control acts as a content container, and behaves very much like a Panel control at design time.<br /> <br />4. View: Each View control can contain any combination of controls you desire.<br /> <br />5. GridView: A feature-rich replacement for the DataGrid. The DataGrid control was good for its time, but its time is over. It still exists for backward compatibility purposes, but it’s no longer listed in the Visual Studio 2005 toolbox by default. The replacement is the new GridView control, which is better in every way. The paging and sorting functionality is now far more automated, and yet still extensible in case you want to get your hands dirty. The GridView control renders more efficiently than the DataGrid control did, and it supports a wider variety of column types: BoundField, ButtonField, CheckboxField, CommandField, HyperLinkField, ImageField, and TemplateField. <br /> <br />6. DetailsView: The DetailsView control displays the details of a database record on a page. The automated display and editing capabilities provide the potential to eliminate lots of boilerplate code. Like the GridView, it automatically displays appropriate controls when in edit mode and allows for detailed customizations via templates. The DetailsView control can be used by itself, but when combined with the GridView control it provides an elegant solution to many common Master/Detail scenarios.<br /><br />7. FormView: The FormView control contains seven templates, which can be modified and displayed in varying combinations to support a variety of functionality. The view must be configured via templates at run time or else nothing will appear on the form at run time. <br /><br />8. LoginView: Displays different sets of controls based on the user’s login status.<br /> <br />9. TreeView: One of the most feature-rich controls of ASP.NET 2.0, but not truly a View control in the same sense as these other View controls.<br /> <br />10. Wizard: This new control takes the MultiView concept to the next level. This rich control lets you create a fully functional wizard to lead users through a sequential set of steps. You can create and configure as many steps as you need in the wizard at design time via the new SmartTag technology of the Visual Studio 2005 designer. The designs you can create are highly customizable because of a flexible object model that permits the use of Templates to represent one or more of the steps. The wizard manages the Back and Next buttons appropriately and persists all control values between each step so you don’t have to worry about such mundane details. <br /><br />11. Substitution: This new control works in cooperation with the OutputCache directive that’s been around since ASP.NET 1.x. Specifically, it acts as an exception to the OutputCache directive. Set the MethodName property to a valid function name in the page. Every time the page is requested, this function will be called and the return value will be automatically displayed in the Substitution control. This way you can be sure the contents displayed in the control will always be fresh, even though the rest of the page may be pulled from the cache. <br /><br />12. SqlDataSource: Used for data binding to a Microsoft SQL Server (or SQL Server Express) database.<br /> <br />13. AccessDataSource: Used for data binding to a Microsoft Access database.<br /> <br />14. XMLDataSource: Used for data binding to XML files and streams.<br /> <br />15. ObjectDataSource: Used for data binding to custom middle-tier business objects.<br /> <br />16. SiteMapDataSource: Used for binding to a Site Map, which is stored in XML by default.<br /> <br />17. SiteMapPath: The new SiteMapPath control displays the user’s current location in the navigational hierarchy of the Web site. Each level is represented with a hyperlink so the user can quickly jump to their desired destinations.<br /><br />18. Menu: This high-quality hierarchical menu control can appear vertically or horizontally. This exceptionally configurable navigation control can be bound to a SiteMapDataSource control or edited independently. <br /><br />19. Treeview: The ImageSet property lets you automatically display a variety of useful and attractive images in front of each node. While the default behavior is to post back between each node click and raise a SelectedNodeChanged event, the Target property lets you specify another frame in which to display the address in the NavigateURL property, so no postback is required. You can also use the SelectAction property to specify other behaviors, such as expanding the node without a postback, doing nothing, or expanding the node and raising a postback event. Each node can optionally have a checkbox. The TreeView nodes can be configured at design time, bound to a SiteMapDataSource control, or, for larger tree structures, sub nodes can be loaded on demand to conserve server resources. This requires a postback after many of the user’s mouse clicks — except for uplevel browsers, which can take advantage of the automatically generated client-side AJAX code to call back to the server and fill in the nodes without requiring a full-page postback. <br /><br />20. Login: The new Login control provides a user name and password screen that you may have created dozens of times before. However, you’ll never need to create one ever again, now that it’s been done in such a thoroughly reusable and extensible way. <br /><br />21. LoginStatus: The new LoginStatus control displays in two different states. If the user is not logged in, it provides a hyperlink to the login page. If the user is logged in, it provides a hyperlink that logs them out. In either case, you can configure the hyperlink text that is displayed. <br /><br />22.LoginView: The LoginView control is similar to the LoginStatus control, except instead of displaying a simple link, it will display whatever set of controls you’d like based on the user’s login status. It can display one set of controls for logged-out users, and another set of controls for logged-in users. It can also display varying sets of controls based on the current user’s role.<br /><br />23. ChangePassword: Any decent authentication system must provide users with a way to change their password. The ChangePassword control provides such functionality by providing the standard three-textbox user interface for old password, new password, and verify new password. By default it accepts only strong passwords, and you can configure it to accept whatever combination of letters, numbers, and symbols your requirements demand. <br /><br />24. PasswordRecovery: Any decent authentication system must also provide a way to deal with forgotten passwords. That’s where the new PasswordRecovery control comes in handy. This flexible control can handle a variety of common techniques for dealing with forgotten passwords, such as secret question/answer pairs, e-mailing a person their password, and/or generating a new password. <br /><br />25. LoginName: The LoginName control displays the person’s user name when they’re logged in (or when it’s available automatically through Windows Authentication); it’s invisible when the user is not logged in. <br /><br />26. CreateUserWizard: The CreateUserWizard control is a functionally rich control that allows a user to enter all the standard information a site generally requires to create a new user, such as their desired username, password, e-mail address, etc. It’s fully extensible, allowing you to add whatever custom fields you require. Because it inherits from the Wizard Web control, you can easily divide the user registration process into as many steps as you desire.<br /><br />27. WebPartManager: The WebPartManager control’s purpose is to manage and orchestrate all the WebPart controls on the page. It is not visible at run time. <br /><br />28. WebPartZone: Each instance of the WebPartZone control can hold one or more WebParts. Each WebPartZone can be minimized, moved, deleted, or added by the developer and (if configured to do so) by the user. Each user can configure the page to their own liking and the customizations will be remembered and persisted between each of their visits. <br /><br />29. CatalogZone: The CatalogZone control contains CatalogPart controls, such as DeclarativeCatalogPart, PageCatalogPart, and ImportCatalogPart. These controls are used to create a catalog of WebParts that users can choose to add to their page. <br /><br />30. EditorPart: EditorPart controls (such as the AppearanceEditorPart, BehaviorEditorPart, LayoutEditorPart, and PropertyGridEditorPart) can only be placed within an EditorZone control. These controls are used to allow users to edit and personalize pages. <br /><br />31. ConnectionZone: The ConnectionZone control contains ConnectionPart controls. These are used to create connections between WebParts on a page. They permit one WebPart to send information to another WebPart. <br /><br />32. ProxyWebPartManager: The ProxyWebPartManager control provides a way to specify static connections inside a content page when the WebPageMaster class has been added to a Master Page. <br /><br />33. Report Viewer: The new Report Viewer control allows you to design reports visually from a DataSet or other data source. It can cache reports, generate reports on demand, retrieve pre-generated reports from SQL Server 2005 Reporting Services, and more. <br /><br />34. CrystalReportPartsViewer and CrystalReportSource: CrystalReportViewer control from ASP.NET 1.x has been joined by two new companion controls: CrystalReportPartsViewer and CrystalReportSource. Both of these controls are invisible at run time. The CrystalReportSource control manages report data sources, parameters, and caching.<br /><br />Apart from these new controls many of the older controls have enhancements. For example:<br /><br />1. Button controls now support posting to other pages and have a declarative client-side OnClientClick event. <br />2. The Panel control now has scrollbar support so you can easily create scrolling areas within your page. <br />3. The Validation controls have been enhanced to support multiple independent validation groups within a single page.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-42986154791867835502009-06-23T19:23:00.005+05:302009-06-23T19:29:58.734+05:30Access Modifiers in c#<strong>Access Modifiers in C#<br /></strong>Access Modifiers (Access Specifiers) describes as the scope of accessibility of an Object and its members. All C# types and type members have an accessibility level . We can control the scope of the member object of a class using access specifiers. We are using access modifiers for providing security of our applications. When we specify the accessibility of a type or member we have to declare it by using any of the access modifiers provided by C# language.<br /><br />C# provide five access specifiers , they are as follows:<br /><br />1. <u>public</u>: Access is not restricted.<br />2. <u>protected</u>: Access is limited to the containing class or types derived from the containing class.<br />3. <u>internal</u>: Access is limited to the current assembly.<br />4. <u>protected internal</u>: Access is limited to the current assembly or types derived from the containing class.<br />5. <u>private</u>: Access is limited to the containing type.<br /><br /><strong>Default and allowed access modifiers for members</strong><br /><br /><u>enum</u><br />Default: public<br />Allowed: None<br /><br /><u>interface</u><br />Default: public<br />Allowed: None<br /><br /><u>class</u><br />Default: private<br />Allowed: public, protected, internal, private, protected internal<br /><br /><u>struct</u><br />Default: private<br />Allowed: public, internal, privateAnihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-523137266217700492009-06-23T18:51:00.001+05:302009-06-23T18:52:42.671+05:30System.String Vs System.Text.StringBuilderThe System.String object is immutable, once set, the content of a String object cannot be modified. Trying to change its value succeeds, but this actually destroys the old String object and creates a new one, which requires a new allocation of space for that new object. In situations where you need to perform repeated modifications to a string, the overhead associated with creating a new String object can be costly. <br /><br />The System.Text.StringBuilder class can be used when you want to modify a string without creating a new object. It will not create a new string object but instead append to the existing string. For example, using the StringBuilder class can boost performance when concatenating many strings together in a loop.<br /><br />The StringBuilder's initial capacity is set to 16 by default. The capacity then increases by an order of 2 whenever the current capacity is passed.<br /><br />The size of a StringBuilder object's storage can be obtained from the class' Capacity property. The length of the string in a StringBuilder object can be obtained from its Length property. The capacity can be increased or decreased with the Capacity property or EnsureCapacity method, but it cannot be less than the value of the Length property.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-11095709366293150862009-06-23T08:34:00.003+05:302009-06-23T09:14:18.946+05:30Web Farm Vs Web Gardening<strong>Web Farm:</strong><br /><br />A web farm is a multi-server scenario. A Web farm allows you to expand a Web Site across multiple servers. E.g., we may have a server in each state of US. If the load on one server is in excess then the other servers step in to bear the brunt. The main reason behind the scene is to distribute the load over the multiple server. Load balancer is used to distribute the load on those server.<br /><br />It can based on various models:<br /><br />1. RoundRobin. (All servers share load equally)<br />2. NLB (economical)<br />3. HLB (expensive but can scale up to 8192 servers)<br />4. Hybrid (of 2 and 3).<br />5. CLB (Component load balancer).<br /><br /><strong>Web Garden:</strong><br /><br />By default Each Application Pool runs with a Single Worker Process (W3Wp.exe). We can Assign multiple Worker Process With a Single Application Pool. An Application Poll with multiple Worker process is called Web Garden. Many worker processes with same Application Pool can sometimes provide better throughput performance and application response time.<br /><br />A Web garden allows you to expand a Web Site across multiple CPUs within a single server. So a web garden is a multi-processor setup. i.e., a single server. In a Web garden, HTTP.sys distributes the requests among the set of worker processes in the application pool.<br /><br />It can based on various models:<br /><br />1. inproc (non web farm but fast when you have very few customers).<br />2. StateServer (for webfarm)<br />3. SqlServer (for webfarm)<br /><br />Creating a Web garden for an application pool can also enhance performance in the following situations:<br /><br />-> Robust processing of requests: When a worker process in an application pool is tied up (for example, when a script engine stops responding), other worker processes can accept and process requests for the application pool.<br /><br />-> Reduced contention for resources: When a Web garden reaches a steady state, each new TCP/IP connection is assigned, according to a round-robin scheme, to a worker process in the Web garden. This helps smooth out workloads and reduce contention for resources that are bound to a worker process.<br /><br />Note: There are some Certain Restriction to use Web Garden with your web application. If we use Session Mode to "in proc", our application will not work correctly because session will be handled by different Worker Process. For Avoid this Type of problem we should have to use Session Mode "out proc" and we can use "Session State Server" or "SQL-Server Session State".<br /><br />More details: InProc is handled by Worker Process. Its keeps data insides its memory object. Now if we have multiple Worker Process, then it would be very difficult to handled the session because, each and every Worker process has it own memory, so if the first request goes to WP1 and its keep the session data and Second Request goes to WP2 and when we try to retrieve session data, it will not able to return . Which will throw error. So we should always avoid Web Garden in InProc Session Mode.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-85668683061752874752009-06-22T15:20:00.008+05:302009-06-22T23:28:27.509+05:30IEnumerable and IEnumeratorIn the .NET Framework, these two interfaces are designed to allow you to iterate easily over collections of objects as you would typically do in a for loop. Many classes in the .NET Framework have implemented these interfaces and do their work behind the scenes so we don’t have to worry about how it is done.<br /><br />Any classes implementing these two interfaces are classified as an enumerable collection. This means that User-defined class behaves like any other collection object written by Microsoft, such as an ArrayList.<br /><br />There are many features that define an enumerable collection, and by implementing these two interfaces, the framework guarantees that this object has these features. For example, an enumerable collection must have a method called MoveNext, which moves the cursor within the collection one step forward. By implementing the IEnumerator interface, the class is promising (and is required) to implement this method.<br /><br />IEnumerator and IEnumerable interfaces are defined in System.Collections namespace.<br /><br /><span style="font-weight: bold;">IEnumerator</span><br /><br />MSDN describes the IEnumerator class as "Supports a simple iteration over a collection.", as well as:<br /><br />"IEnumerator is the base interface for all enumerators. Enumerators only allow reading the data in the collection. Enumerators cannot be used to modify the underlying collection.<br /><br />Initially, the enumerator is positioned before the first element in the collection. Reset also brings the enumerator back to this position. At this position, calling Current throws an exception. Therefore, you must call MoveNext to advance the enumerator to the first element of the collection before reading the value of Current."<br /><br />IEnumerator is an interface that has following members:<br /><br />-> Property: Current<br />-> Method: MoveNext<br />-> Method: Reset<br /><br />Presumably, any element in a collection can be retrieved through its index property. But instead of element index, the IEnumerator provides two abstract methods and a property to pull a particular element in a collection. And they are Reset(), MoveNext() and Current.<br /><br />public interface IEnumerator<br />{<br />bool MoveNext(); //An enumerator is always positioned before the<br />//first element of the collection, first call to MoveNext<br />//moves the enumerator over the first element of the<br />//collection<br />object Current { get ; } //Returns current object from the collection<br />void Reset(); //Resets enumerator to just above the first element of the collection.<br />}<br /><br /><span style="font-weight: bold;">IEnumerable</span><br /><br />IEnumerable is an interface that has 1 method called GetEnumerator. The MSDN documentation describes the GetEnumerator method as "Exposes the enumerator, which supports a simple iteration over a collection."... It then goes on to say "IEnumerable must be implemented to support the ForEach semantics of Microsoft Visual Basic. COM classes that allow enumerators also implement this interface".<br /><br />IEnumerable is an interface that has following member:<br /><br />-> Method: GetEnumerator<br /><br />public interface IEnumerable<br />{<br />//The signature of GetEnumerator() is as follows:<br />public IEnumerator GetEnumerator()<br />{<br /> //return IEnumerator of our Custom Type<br /> return(IEnumerator)this;<br />}<br />}<br /><br />Note: IEnumerator interface is meant to be used as accessors and is not helpful to make any changes in the collection or elements of the collection.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-31245217863389437562009-06-22T15:19:00.001+05:302009-06-22T15:45:27.653+05:30Abstract class vs. InterfaceYou can think of an Interface as an abstract class with all the implementation stripped out and everything that is not public removed.<br /><br />-> An abstract class can have abstract members as well non abstract members. But in an interface all the members are implicitly abstract and all the members of the interface must override to its derived class.<br />-> Abstract classes can add more functionality without destroying the child classes that were using the old version. In an interface, creation of additional functions will have an effect on its child classes, due to the necessary implementation of interface methods to classes.<br />-> The members of the interface are public with no implementation. Abstract classes can have protected parts, static methods, etc.<br />-> A class can inherit one or more interfaces, but only one abstract class.<br />-> Abstract Class defines abstract member signatures which derived classes must implement. Otherwise, the derived class itself will be abstract. In Interface, compiler throws an error.<br />-> In Abstract Classes, we can include data fields. In Interface, we cannot include data fields. However, abstract properties may be declared.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0tag:blogger.com,1999:blog-475985139046443162.post-31547120879113214892009-06-22T14:47:00.009+05:302009-06-22T15:42:00.530+05:30Interface in C#An interface can be a member of a namespace or a class and can contain signatures of the following members: Methods, Properties, Indexers, Events. The actual implementation is done in the class that implements the interface.<br /><br />interface IIntelligence<br />{<br /> /// Method declaration within the interface<br /> bool intelligent_behavior();<br /><br /> /// Indexer declaration within the interface<br /> object this[int index]<br /> {<br /> get;<br /> set;<br /> }<br /> /// Event declaration within an interface<br /> /// testEvent should also be declared as a delegate before<br /> event testEvent IQEvent;<br /><br /> /// Property declaration within an interface<br /> string IQProperty<br /> {<br /> get{}<br /> set{}<br /> }<br />}<br /><br />-> An interface can inherit from one or more base interfaces.<br />-> A class or struct can inherit more than one interface.<br />-> An interface cannot contain fields.<br />-> The interface can't contain constants, data fields, constructors, destructors and static members.<br />-> Interfaces members are automatically public.<br />-> When a base type list contains a base class and interfaces, the base class must come first in the list.<br />-> A class that implements an interface can explicitly implement members of that interface. An explicitly implemented member cannot be accessed through a class instance, but only through an instance of the interface, for example:<br /><br />interface IPoint<br />{<br />// Property signatures:<br />int x<br />{ get; set; }<br /><br />int y<br />{<br />get; set; }<br />}<br /><br />class Point : IPoint<br />{<br />// Fields:<br />private int _x;<br />private int _y;<br /><br />// Constructor:<br />public Point(int x, int y)<br />{<br />_x = x;<br />_y = y;<br />}<br /><br />// Property implementation:<br />public int x<br />{<br />get<br />{ return _x; }<br /><br />set<br />{ _x = value; }<br />}<br /><br />public int y<br />{<br />get<br />{ return _y; }<br />set<br />{ _y = value; }<br />}<br />}<br /><br />class MainClass<br />{<br />static void PrintPoint(IPoint p)<br />{<br />Console.WriteLine("x={0}, y={1}", p.x, p.y);<br />}<br /><br />static void Main()<br />{<br />Point p = new Point(2, 3);<br />Console.Write("My Point: ");<br />PrintPoint(p);<br />}<br />}<br /><br />-> To implement an interface member, the corresponding member on the class must be public, non-static, and have the same name and signature as the interface member.<br />-> Properties and indexers on a class can define extra accessors for a property or indexer defined on an interface. For example, an interface may declare a property with a get accessor, but the class implementing the interface can declare the same property with both a get and set accessor. However, if the property or indexer uses explicit implementation, the accessors must match.<br /><br /><strong>Using "Is" and "As" Operators to Verify the Implementation of an Interface</strong><br /><br />"is" keyword is used to verify whether the method exists in the class implementing the given interface or not.<br /><br />if(human is IIntelligence)<br /><br />{<br /> IIntelligence humanIQ = (IIntelligence)human;<br /> humanIQ.intelligent_behavior();<br />}<br /><br />In the example case above, when you will run it, it will give a warning that "the given expression is always of the provided type" and the validity is also been checked twice: one in using the "is" operator and the other when casting it to the interface type.<br /><br />But we can also use the "as" operator to cast and check the types more efficiently. The "as" operator returns an object type and null if the type mismatched whereas the "is" operator returns a Boolean value. Here, no warning will be generated.<br /><br />IIntelligence humanIQ = human as IIntelligence;<br /><br />if(null != humanIQ)<br /><br /> {<br /> humanIQ.intelligent_behavior();<br /> }<br /><br />Note: Microsoft STRONGLY recommends that ALL interfaces begin with the character 'I'.Anihttp://www.blogger.com/profile/14690432812972071876noreply@blogger.com0