Wednesday, 28 January 2015

Scale-up Scale-out in computers

Scale-up: x-->X
Scale-up mean you are going to increase or change the existing environment. Ex: If you 1TB 60GB Server, if you add 1TB 60GB additional then it will be Scale-up. To do scale-up, you have Shutdown the server. It will leads to down time the application.
In scale-up, ip address of the system will not change. So no need to bother about ip address.

Scale-out: x + x + x + x....
Scale-out mean you are going to add additional capacities to exiting system, without disturbing the existing system. No need of down time, you can add or remove without down time.
In scale-out, ip address of the each server will be different, so how can we connect different servers?
Ans is load balancer. Load balancer will provide one public address, so always we have to connect that publiv address, no need to bother about individul server ips.

Monday, 26 January 2015

Syntel SharePoint Interview

asp.net execution with IIS
http handlers and modules
custom web part using user control
what is the best way to use user control in SharePoint
GC external calling
dispose, finalize
feature creation and deployment in SharePoint
SharePoint designer
form installation in SharePoint
ensure child control use?
shall i migrate sub site from SP 2010 to SP 2013
how can i do load and stress testing in SharePoint
performance testing in SharePoint
how to write custom workflow using WWF

Friday, 23 January 2015

How to check in which language the SharePoint was installed?

First and easy set is. Go to sharepoint central admin 15 hive folder (For SharePoint 2013), 14 for 2010, 12 for 2007.

2007

c:\program files\common files\microsoft shared\web server extensions\12\resources

2010

c:\program files\common files\microsoft shared\web server extensions\14\resources

2013

c:\program files\common files\microsoft shared\web server extensions\15\resources

You can see all folder with numbers..
If you see 1033 mean it is English language has installed.It would be en-us, en-uk.. check resource file you will find which english.
1036- French - France (fr-fr)
1031-German - Germany(de-de)
1034-Spanish - Spain(es-es)
1040-Italian - Italy(it-it)
....................
Ref:https://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

Another way is you can check the registry also..

Wednesday, 21 January 2015

Difference between XML and JSON

Note: JSON is a format and not a language
JSON can be used in web applications for data transfer. Prior to JSON, XML was considered to be the chosen data interchange format. XML parsing required an XML DOM implementation on the client side that would ingest the XML response, and then XPath was used to query the response in order to access and retrieve the data. That made life tedious, as querying for data had to be performed at two levels: f irst on the server side where the data was being queried from a database, and the second time was on the client side using XPath. JSON does not need any specific implementations; the JavaScript engine in the browser handles JSON parsing. XML messages often tend to be heavy and verbose, and take up a lot of bandwidth while sending the data over a network connection. Once the XML message is retrieved, it has to be loaded into memory to parse it; let us take a look at a students data feed in XML and JSON.

Arrays in Javascript

Tuesday, 20 January 2015

This configuration section cannot be used at this path

Error: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".
Solution
Open Control Panel
Click on Programs
Click on "Turn windows features on or off"
in the features window, Click Expand: "Internet Information Services"
Click Expand: "World Wide Web Services"
Click Expand: "Application Development Features"
Check (enable) the features. I checked all but CGI.
Still it was not working
I tried below option also...
Browse to “C:\Windows\System32\inetsrv\config” (you will need administrator rights here)
Open applicationHost.config
Find the section that showed up in the “config source” part of the error message page. For me this has typically been “modules” or “handlers”
Change the overrideModeDefault attribute to be “Allow”
So the whole line now looks like:
<section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />
After saving the file, the page loaded up fine in my browser.

The requested page cannot be accessed because the related configuration data for the page is invalid


<handlers accessPolicy="Read, Script" />
Solution:
On the Start menu, choose Control Panel, and then choose Programs.
Under Programs and Features, choose Turn Windows features on or off.
In the Windows features list, expand Internet Information Services, and then expand World Wide Web Services.
Expand Application Development Features, and select the following features:
.NET Extensibility
ASP.NET
ISAPI Extensions
ISAPI Filters
Expand Security, and then select the following features:
Request Filtering
Windows Authentication
Expand Common HTTP Features, and then select the Static Content feature.
To install Internet Information Service (IIS) Manager, under Internet Information Services, expand Web Management Tools, and then select IIS Management Console.
This step is optional. You use Internet Information Service IIS Manager to manage local and remote web servers and sites.
Choose the OK button to complete the installation.
In the Windows features list, expand Microsoft .NET Framework, and then select Windows Communication Foundation HTTP Activation.

HTTP Error 404.17 - Not Found

HTTP Error 404.17 - Not Found
The request matched a wildcard mime map. The request is mapped to the static file handler. If there were different pre-conditions, the request will map to a different handler.
If you want to serve this content as a static file, add an explicit MIME map.
Solution:
Open Control Panel, and then choose Programs.
Under Programs and Features, choose Turn Windows features on or off.
In the Windows features list, expand Internet Information Services, and then expand World Wide Web Services.
Check .Net Framework 4.5 Advanced Serices.
In the Windows features list, expand Internet Information Services, and then expand Application Development features
Check ASP.NET 4.5

Monday, 19 January 2015

HTTP Error 500.19 - Internal Server Error

IIS Manager
Sites
Select your root web site
In the center section pane, Select "Features View"
Right page Under the Actions
Basic Settings
Click on Connect as...
You will see prompt
In the prompt, it should be "Specific user". Click on "Set", you can enter your service account User Id and Password.
Click OK
Now Click "Test Settings.."
It should pass Authentication and Authorization test.
Some times you will see "Authorization" error because of access issue.

If you get Access related issue, try below steps.
1.In Windows Explorer, locate the folder that contains the ApplicationHost.config file that is associated with the Web site, or locate the virtual directories or the application directories that contain the Web.config file that is associated with the Web site.
2.Right-click the folder that contains the ApplicationHost.config file, or right-click the virtual or application directories that may contain the Web.config file.
3.Click Properties.
4.Click the Security tab, and then click Edit.
5.Click Add.
6.In the Enter the object names to select box, type computername\IIS_IUSRS, click Check Names, and then click OK.
Note Computername is a placeholder for the computer name.
7.Click to select the Read check box, and then click OK.
8.In the Properties dialog box for the folder, click OK.
Note Make sure the folder's properties are inherited by the ApplicationHost.config and Web.config files so that IIS_IUSRS has the Read permission for those files.
Or
Add computername\IIS_IUSRS to Administrator group in the system where Application is located.

Friday, 16 January 2015

Alternate Access Mappings in Sharepoint

First get your IP or Public URL or Host Name.
Open IIS (Click Run-->inetmgr-->Expand Sites)
Right click on web site which you want to make to Public
Click "Edit Binding"
Select your web site in the new window. Ex: if it is 80 port just select that..)
Click "Edit" option in the new window.
Provide the Host name: which collected in the Step1.
We have done Host name configuration in IIS
Now we have to do Alternate access map in sharepoint Central Admin
GO to Central Admin-->Application Management
Under Web Application
Select "Config Alternate Access Mappings"
Click on "Edit Public URLs"
In "Alternate Access Mapping Collection:" select web application which you have mapped Host Name in IIS
Provide all the Details and Save

SharePoint Update Manage Metadata Column

How to enable mixed authentication in sql server

Login to SQL Server
Start SQL Server Management Studio
Enter the Server name and select Windows authentication.
Make sure you are logged in with administrator credentials.
Right click on the server name and select properties.
Go to Security and select SQL Server and Windows Authentication Mode.
Right click on the server name and select Restart to restart the SQL services.

How to find the IP Number and MAC Address of a Network Card

Open command prompt window from your system
Type ipconfig /all at the command prompt to check the network card settings
The IP number and MAC address are listed by ipconfig under IP Address and Physical Address.
IP number = IP Address
MAC address= Physical Address

Thursday, 8 January 2015

How .Net web services work when we add web services in any project

Let's assume, i have a project(ABC) where i have added SharePoint web services.

After adding the web services in the project(ABC)....
Microsoft's wsdl.exe utility will generate a spurce code file (C#) based on the web services's WSDl (web service definition language).
Microsoft's csc.exe utility will compiles the code into a proxy (DLL).
Generated proxy(DLL) will register into my project, bin directory.

Now i am good to access any methods inside ABC project, which are there in SharePoint web services...

Sunday, 4 January 2015

What is difference between the “throw” and “throw ex” in .NET?

“Throw” statement preserves original error stack whereas “throw ex” have the stack trace from their throw point. It is always advised to use “throw” because it provides more accurate error information.

Difference between an interface and abstract class?


Interface :
-all the methods having only declaration but no definition.(We have to override all the methods to add definition)
-all the methods are public.(If you have private methods, we can't inherit that method in child class, then we can't override it. In interface all methods should be override in child class)

Abstract 
-we can have some concrete methods. (Mean some methods will have definition, some are no definition).
-An abstract class may have private methods.

What are the differences between System.String and System.Text.StringBuilder classes?


A)System.String is immutable. When we modify the value of a string variable then a new memory is allocated to the new value and the previous memory allocation released. System.StringBuilder was designed to have concept of a mutable string where a variety of operations can be performed without allocation separate memory location for the modified string.

C# struct

The C# struct is a lightweight alternative to a class. It can do almost the same as a class, but it's less "expensive" to use a struct rather than a class. The reason for this is a bit technical, but to sum up, new instances of a class is placed on the heap, where newly instantiated structs are placed on the stack. Furthermore, you are not dealing with references to structs, like with classes, but instead you are working directly with the struct instance. This also means that when you pass a struct to a function, it is by value, instead of as a reference

C# Enumerations

C# abstract class


Abstract classes, marked by the keyword abstract in the class definition, are typically used to define a base class in the hierarchy. What's special about them, is that you can't create an instance of them - if you try, you will get a compile error. Instead, you have to subclass them, as taught in the chapter on inheritance, and create an instance of your subclass. So when do you need an abstract class? It really depends on what you do. 


namespace AbstractClasses { class Program { static void Main(string[] args) { Dog dog = new Dog(); Console.WriteLine(dog.Describe()); Console.ReadKey(); } } abstract class FourLeggedAnimal { public virtual string Describe() { return "Not much is known about this four legged animal!"; } } class Dog : FourLeggedAnimal {
public override string Describe()
    {
        string result = base.Describe();
        result += " In fact, it's a dog!";
        return result;
    }
} }

Abstract methods are only allowed within abstract classes. Their definition will look like a regular method, but they have no code inside them: 

abstract class FourLeggedAnimal
{
    public abstract string Describe();
}
So, why would you want to define an empty method that does nothing? Because an abstract method is an obligation to implent that very method in all subclasses. In fact, it's checked at compile time, to ensure that your subclasses has this method defined. Once again, this is a great way to create a base class for something, while still maintaining a certain amount of control of what the subclasses should be able to do. With this in mind, you can always treat a subclass as its baseclass, whenever you need to use methods defined as abstract methods on the baseclass. For instance, consider the following example: 

namespace AbstractClasses
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Collections.ArrayList animalList = new System.Collections.ArrayList();
            animalList.Add(new Dog());
            animalList.Add(new Cat());
            foreach(FourLeggedAnimal animal in animalList)
                Console.WriteLine(animal.Describe());
            Console.ReadKey();
        }
    }

    abstract class FourLeggedAnimal
    {
        public abstract string Describe();
    }


    class Dog : FourLeggedAnimal
    {

        public override string Describe()
        {
            return "I'm a dog!";
        }
    }

    class Cat : FourLeggedAnimal
    {
        public override string Describe()
        {
            return "I'm a cat!";
        }
    }
}

As you can see, we create an ArrayList to contain our animals. We then instantiate a new dog and a new cat and add them to the list. They are instantiated as a Dog and a Cat respectively, but they are also of the type FourLeggedAnimal, and since the compiler knows that subclasses of that class contains the Describe() method, you are actually allowed to call that method, without knowing the exact type of animal. So by typecasting to the FourLeggedAnimal, which is what we do in the foreach loop, we get access to members of the subclasses. This can be very useful in lots of scenarios.

C# Override

Same method name and same signature.
If you want to override any function, you have to add virtual key word, and while overriding, you have to use override key word.
Ex:

public class Vehicles
{
    public virtual void Greet()
    {
        Console.WriteLine("Hello, I'm some sort of vehicles!");
    }
}

public class Car: Vehicles
{
    public override void Greet()
    {
        Console.WriteLine("Hello, I'm a car!");
    }
}

In the above example, Car class has inherited Vehicles.
Like this we can inherit hierarchy wise. ex:
public class Accord: Car
{
    public override void Greet()
    {
        Console.WriteLine("Hello, I'm a Accord!");
    }
}

Accord class is inheriting Car..like this we can add more..

But we can't do multiple inheritance in C#
Ex: Accord class can't inherit Car and Vehicles.

C# Constructors & Destructors

Constructors 
By default each class will have Constructor with it's class name.
Ex: If i create a class with name Car.
class Car
{
}

one Constructor will create as below..
  public Car()
        {
         
        }

If you want to change anything inside Constructor, you can change it as below..

 public Car()
        {
            Console.WriteLine("Constructor with no parameters called!");
        }


Constructors are special methods, used when instantiating a class. A constructor can never return anything, which is why you don't have to define a return type for it. A normal method is defined like this:

public string Describe()

or

public Car()

Constructor can be overloaded as well, meaning we can have several constructors, with the same name, but different parameters.

overloaded: with the same name, but different parameters

public Car()
{

}

public Car(string color)
{
    this.color = color;
}

A constructor can call another constructor, which can come in handy in several situations. Here is an example:
public Car()
{
    Console.WriteLine("Constructor with no parameters called!");
}

public Car(string color) : this()
{
    this.color = color;
    Console.WriteLine("Constructor with color parameter called!");
}


Destructors

Since C# is garbage collected, meaing that the framework will free the objects that you no longer use, there may be times where you need to do some manual cleanup. A destructor, a method called once an object is disposed, can be used to cleanup resources used by the object. Destructors doesn't look very much like other methods in C#. Here is an example of a destructor for our Car class:

~Car()
{
    Console.WriteLine("Out..");
}
If you run this code, you will see that the constructor with no parameters is called first. This can be used for instantiating various objects for the class in the default constructor, which can be called from other constructors from the class.

SharePoint Create list item using javascript

Saturday, 3 January 2015

How To Read Input From Console in C#

static void Main(string[] args)

The first word is static. The static keyword tells us that this method should be accesible without instantiating the class.

static Class:
If a class is static,  it can have static members, both functions and fields. A static class can't be instantiated, so in other words, it will work more as a grouping of related members than an actual class. You may choose to create a non-static class instead, but let it have certain static members. A non-static class can still be instantiated and used like a regular class, but you can't use a static member on an object of the class. A static class may only contain static members. 
Ex:
public static class Rectangle
{
    public static int CalculateArea(int width, int height)
    {
        return width * height;
    }
}

The next keyword is void, and tells us what this method should return. For instance, int could be an integer or a string of text, but in this case, we don't want our method to return anything, or void, which is the same as no type.
The next word is Main, which is simply the name of our method. This method is the so-called entry-point of our application, that is, the first piece of code to be executed.
string[] args After the name of a method, a set of arguments can be specified within a set of parentheses. In our example, our method takes only one argument, called args. The type of the argument is a string, or to be more precise, an array of strings.

C# Interview Concepts

Introduction to C#
Introduction
Setup
What is .Net
What is the CLR
What is FCl
What is C#
Hello, world
The compiler
Hellp, VIsual Studio
Editing C#
Debugging C#
Types
Classes and objects in C#
Introduction
Class Definitions
Classes and Objects
Constructors
Objects and Variables
Reference types
OOP
Encapsulation
Access Modifiers
Statics
Types and Assemblies
Introduction
Reference types
Value Types
Method parameters
Structs and enums
Immutability
Arrays
Assemblies
Members: Methods, Events, and Properties
Introduction
Methods
Fields and properties
An overview of events
Delegates
Events redux
Flow Control
Introduction
Branching
Switching
Looping
Jumping
Exceptions
Common exceptions
Try and catch
Try, finally, using
Custom exceptions
Object Oriented Programming
Introduction
Pillars of OOP
Inheritance
Polymorphsim
Abstact Classes
Interfaces
Common Interfaces

http://csharp.net-tutorials.com/

ArrayList class is not type-safe, why?


A)ArrayList class is not type-safe because it can store any object.
Ex:
var integers = new ArrayList();
integers.Add(1);
integers.Add(2);
integers.Add("3");

for (int i = 0; i < integers.Count; ++i) {
    int integer = (int)integers[i];
    // do something
}


The above will compile because the value "3", even though it's a string and not an integer, can legally be added to an ArrayList since String derives (like Int32) from Object. However, it will throw an InvalidCastException when you try to set integer to (int)integers[2] because a String cannot be cast to an Int32.

How to know the target platform of an .Net assembly

If you want to know about dll in which platform will run.
I am assuming your assembly has available in GAC
Open GAC folder
How to open GAC folder.
Click start
Click run
Type: assembly
Now it will open GAC folder
Or: C:\Windows\assembly
This is the path of GAC
Now in the GAC folder, you can see all dlls
Select any dll, you will windows propert: Processor Architecture
If it is x86 mean it will run in 32 bit environment
If it is x64 mean it will run in 64 bit system
If it is MSIL, it will run in both 32 and 64 systems (Any CPU).