Translate

Wednesday, August 29, 2012

C# Data Types or Data Types in C#

C# Data Types or what are Data Types in C#


A variable holds data that has a specified type. When we declare a variable to store data in an application, we are required to choose an appropriate data type for that data to hold.
It is known that C# is a type-safe language, which means that the compiler guarantees that values that are stored in variables are always of the appropriate type.

Frequently Used Data Types
The following table shows the frequently used data types in C#, and their characteristics.

Type
Size
Range
Description
Long
8
–2,147,483,648 to 2,147,483,647
Number with big range
Int
4
–9,223,372,036,854,775,808 to
9,223,372,036,854,775,807
Whole Number
Float
4
+/–3.4 × 10^38
Float
Double
8
+/–1.7 × 10^308
Double
precision
(more
accurate)
floatingpoint
numbers
Decimal
16
28 significant figures
Decimal values
String
2 per character
There is no limit
List of characters
DateTime
8
0:00:00 on 01/01/0001 to 23:59:59 on
12/31/9999
Date and time

Variables in C#

Variables in C#


Variables stores values required by application in temporary memory locations, a variable represents a named location in memory for a piece of data. An application can access a piece of data by using the variable it has been assigned to variables store values that an application can change while it is running. Sometimes it is required to store values temporarily when we perform calculations or pass data between the user, an application, or a database.
A variable has the following six facets:
1.Name. Unique identifier that refers to the variable in code.
2. Address. Memory location of the variable.
3. Data type. Type and size of data that the variable can store.
4. Value. Value at the address of the variable.
5. Scope. Defined areas of code that can access and use the variable.

Sunday, August 26, 2012

SharePoint 2010 difference between Sever side object model and Client object model

SharePoint 2010 difference between Sever side object model and Client object model or Comparison between Server side object and client side object model

S.No.
Sever side object model
Client object model
1.
SharePoint installation is required
SharePoint installation is not required
2.
It works with strongly with server objects
Sharepoint 2010 has provided client objects
3.
The object needs to created and access in the site collection
It can be used in .Net applications like console or any application where if it is required to item update/delete/add
4.
using Microsoft.SharePoint
It can be used
Microsoft.SharePoint.Client.Runtime.dll
Microsoft.SharePoint.Client
Silverlight.Runtime.dll

5.
SPContext
SPSite
SPWeb
SPList
SPListItem
SPField
ClientContext
Site
Web
List
ListItem
Field

SharePoint Cloud Computing Book

SharePoint Cloud Computing Book

Sharepoint Cloud Computing Book This is one of the good book
"Microsoft Press - SharePoint 2010 Deploying Cloud-Based Solutions"
http://www.amazon.com/Microsoft-SharePoint-2010-Cloud-Based-Organizations/dp/073566210X

Adding file attachment in custom list programmatically

Adding file attachment in custom list programmatically


Code:

SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    SPSite mySite = new SPSite(“Site Url”); //Mentioned site url
                   SPWeb spweb = mySite.OpenWeb();

                    SPList list = spweb.Lists[“HR Policies”];
                    int ID = Convert.ToInt32(this.Page.Request.QueryString["ItemID"].ToString());
                 SPListItem spNewItem = myList.Items.Add();
                    spWeb.AllowUnsafeUpdates = true;
                    string fileName1 = System.IO.Path.GetFileName(“file Name”);//Mention File name
                    if (fileName1 != "")
                    {
                        Stream fStream = firstinputFile.PostedFile.InputStream;
                        byte[] contents = new byte[fStream.Length];
                        fStream.Read(contents, 0, (int)fStream.Length);
                        fStream.Close();
                        fStream.Dispose();
                        SPAttachmentCollection attachments = myNewItem.Attachments;
                        fileName1 = Path.GetFileName(firstinputFile.PostedFile.FileName);
                        attachments.Add(fileName1, contents);
                        spNewItem.Update();
               }
});


Using RunWithElevatedPrivileges or SPSecurity.RunWithElevatedPrivileges

Using RunWithElevatedPrivileges or SPSecurity.RunWithElevatedPrivileges


"RunWithElevatedPrivileges" method accepts a delegate code which wants to run with administrator’s privileges, actually the code runs under the application pool identity, which is mainly site collection administrator.
The namespace SPSecurity  is required for  RunWithElevatedPrivileges
Sample code shows the item updated code which runs in the SPSecurity.RunWithElevatedPrivileges
Code:
SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                SPSite mySite = new SPSite(“site url”);//mention site url
                 mySite.AllowUnsafeUpdates = true;
                 SPWeb spweb = mySite.OpenWeb();
                 spweb.AllowUnsafeUpdates = true;
                 SPList myList = spweb.Lists[“Demo List”];
                 SPListItem spNewItem = myList.Items.Add();
                 spNewItem["Title"] = “Test Title”;
                 spNewItem.Update();
});

Friday, August 24, 2012

Hardware and Software Requirements for SharePoint 15 or SharePoint 2013

Hardware and Software Requirements for SharePoint 15 or SharePoint 2013


The following requirements is for Web & Application Servers with single server farm
Hardware Requirement

Hardware Requirement
S.No.
Hardware Item
Requirement
1.
Processor
64 bit
2. 
Ram
8 GB
3.
Hard Disk
80 GB


Software Requirements
S.No.
Software Item
Requirement
1.
Windows
Windows Server 2008 R2
2.
SQL Server
Microsoft SQL Server 2008 R2 with Service Pack 1(64 bit)
3.
Web Server
IIS
4.
Sharepoint
Sharepoint 15
5.
.Net Framework
.Net Framework version 4.0
6.
Identity Foundation
Windows Identity foundation WIF 1.0 and 1.1
7.
Updates & other
.NET 4 DGR Update KB 2468871,
Information Protection & Control Client (MSIPC), Open Data Library (ODataLib)


8.
Windows PowerShell
Windows PowerShell 3.0