Friday 31 October 2014

Regular Expressions Time HH:MM:SS.MMMMMM

Read XML and group using Generic in Asp.Net Using C#

Create new asp.net web application.
Add your xml file.Name it : abc.xml
Create new class file name it MyDTO.cs


Now Add new web form to show xml data in grid.

Open Webform html view.
Use below code:

Now open webform.cs file.

SharePoint get current user information

SharePoint load remote styles

Error : Failed to establish connection with report server. Verify the server URL is correct or review ULS logs for more information. Product area: SQL Server Reporting Services, Category: Configuration Pages

Root Cause: We have to use ip address
Solution:I was trying to connect server with server name. Ex:http://MyServerName:8282/ReportingServer
It was throwing above error. Then i tried with IP address.Ex:http://196.22.31.42:8282/ReportingServer
My problem solved...

Error : The file you are attempting to save or retrieve has been blocked from this Web site by the server administrators.

Solution:
1. Start Central Administration.
2. Click Security, and then click "Define Blocked file types"
3. On the Blocked File Types page, click the Web application that you want to configure in the Web Application box.
4. Remove the file name extension from the list of blocked file types.
5. Click OK.

Thursday 30 October 2014

HCL Asp.Net Interview


           Difference between Client-side and Server-side code.

Client-side code:-

1)     It is a scripting language that can be included in the HTML Page or can contain in the   Source File either .vb or .cs and it is executed in the Browser.
2)     Client side code validates the data before sending it to server.
3)     It is used in validations and faster than server side code.

      Server-side code:-

1)     It is written in the .CS file for C# and .vb file for VB.Net and the Code is executed in the Server side.
2)     Server side code validates the data to check whether sent data is correct or not.
3)     Performance is lower than client side code due to server round trips.
4)     Client cannot see the business logic though it is stored on server.


Difference between String and String Builder:-

  • String is Immutable i.e. not allowed to change the value of an object.(cannot alter)

  • String Builder is Mutable which is allowed to change the value of an object. And it is used when there are complex manipulations have to be done. (Can alter many times).

Difference between Server. Transfer and Response. Redirect:-

  • Server. Transfer is used when redirecting the web page within the same application.
             In this browsers history is not updated. The URL is not changed. Can be used only for .aspx
             pages. No Round trip.
  • Response. Redirect is applicable towards the redirection of the web page between 2 applications. Browsers history is updated. The URL is changed. Can be used for both .aspx and html pages. It provides a Round trip.


Difference between cookies and session:-

  1) Cookies stored in the client side. We can store only strings.

Types of cookies:-

             a) Persistent Cookie:
·         Also called as Permanent Cookie.
·         A cookie that is stored on a user’s hard drive until it expires r delete the cookie.
             b) Session Cookie (in memory):

·         Also called as Temporary Cookie.
·         A Cookie that is available until the browser is active.
                     

   2) Session stores the value in Server side. A session is available as long as browser is opened. We can store the objects also.

       Types of Modes in Session State:-
              
·          InProc mode, which stores session state in memory on the Web server. This is the default.
·          StateServer mode, which stores session state in a separate process called the ASP.NET state service. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.
·         SQLServer mode stores session state in a SQL Server database. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.
·         Custom mode, which enables you to specify a custom storage provider.
·          Off mode

     Difference between Session object and Application Object:-

        Session Object:-

1)     Session object is a memory unique to client.
2)     Session supports any type of object including own custom data types.

Application Object:-

1)     Application object is a memory common to all the clients within a website.
2)     Application memory will be existing till the application is running under worker process.

    Difference between Web user control and Web Custom control

         Web User Control:-
1)     Easier to create.
2)     Limited support for consumers who use a visual design tool.
3)     A separate copy of the control is required in each application.
4)     Cannot be added to the toolbox in visual studio.
5)     Good for static layout.

Used: For different applications.

Web Custom Control:-
      1)Harder to create.
      2)Full visual design tool support for consumers.
      3)Only a singlt copy of the control is required,in the global assembly cache.
      4)Can be added to the toolbox in visual studio.

  Used: For same website

How to Deploy an ASP.net web application? 
  
   After creating and testing your ASP.NET application, the next step is to deploy the application.
   Deployment is the process of distributing the finished application to be installed on other
   Computer.

 You can deploy an ASP.NET Web application using any one of the following
 Three deployment options:      

1.     XCOPY Deployment
2.     Using the Copy Project option in VS .NET
3.     Deployment using VS.NET installer

Difference between Web.config and Machine.config:-

  Web.Config:
     1) This is automatically created when you create an ASP.Net web application project.
     2) This is also called application level configuration file.
     3) This file inherits setting from the machine.config.
     4) Web.config is particular Web Application Specific, it has 
diff web.config files for different applications.
                              
    Machine.Config:

        1) This is automatically installed when you install Visual Studio.Net.
         2) This is also called machine level configuration file.
         3) Only one machine.config file exists on a server.
        4) This file is at the highest level in the configuration hierarchy.

Difference between Array list and Hash table:-

1)     Array list Provides collection similar to an array, but that grows dynamically as the number of elements change. The search for an item in an array list is performed sequentially so it is slow. Type of access is indexed.(sequential access)

2) Hash table is a collection of key-value pairs implemented by hash algorithm. They are big and fast. Type of access is using the hash of a key value. (Random access)

 What are the events fired while loading Grid view?

     1)GridView1_Init
     2)GridView1_RowCreated
     3)GridView1_RowDataBound
     4)GridView1_Load
     5)GridView1_PreRender
     6)GridView1_Unload
   
AutoEventWireup:
          
·         Indicates whether the page's events are automatically enabled
·         If Autoeventwireup=”True”, the ASP.Net runtime does not require events to specify
       Event handlers like Page Load etc.
·         If AutoEventwireup=”false”, manually we have to map the functions to the particular event.

Page. Load+=new Event Handler (this.page_Load)

ADO.NET
Difference between Dataset and Data Reader:-

·         Dataset works on Disconnected Architecture.
·         All type of operations (update, delete etc) can be done through Dataset. Dataset maintains the original data and the modified data separately which requires more space.
·         Low performance. Changes to the Dataset can be propagated back to the data source from where the data originated. Any changes made are applicable on local database and then original database using Data Adapter.

Used:  To maintain relationships between multiple tables and used when there are more no. of operations (insert, update, delete).
Example: Display information in websites from Database.


  • Data Reader works on connected Architecture.
  • Data Reader is Forward-only, Read-only. No local storage is required.
  • Better performance. Data Reader support access to multiple Result sets, but only one at a time. The data is no longer available once the connection to the data source of Data Reader is closed. Can access one table at time. Changes are directly made to the database.

Used: When fewer operations are required.
Example: Display current price in Stock Market, Booking a berth in Railways.

Difference between Copy and Clone:-

  • Clone will copy the structure of the Data. Creates another reference to the same location.

  • Copy will copy the complete structure as well as the Data. Creates two different references to the two different address spaces.

ExecuteNonQuery ():

·         Executes a sqlcommand that executes a SQL statement or stored procedure
·         This doesn’t return a result set.
·         ExecuteNonQuery () is used to upload or insert data into the database.
·         It returns int value.

Execute Reader ():

·         Used to execute sql statements like select which will return result set and result set is accessed by using data readers.
·         Execute Reader() is used for Retrieving data from the database.(Forward only –only retrieval of records)
·         It is used when SELECT command returns more than one value.

Execute Scalar ():
·         Executes the Query and returns the first column of the first row in the result set returned by the query
·         Retrieves a single value from Aggregate functions like sum, count etc.

  1. Create registration page (userid, password, email (unique) and phone number.).
  2. Create login page.
  3. Create forget password page. (here user need to enter email to receive password)
Password should receive to email.
  1. Gridview bind from database.
  2. Gridview edit, delete and update.
  3. Query string, session and cookies.
  4. Search features.
  5. Bind data in to dropdown from database.
  6. Provide the connection details in the web.config

Visual Studio Remove Items from the Recent Projects List

Open Visual Studio
Click File
Select Recent Projects and Solutions
Click Clear Recent Project list
If you want to clear recent files which are opened.
Open Visual Studio
Click File
Select Recent Files
Click Clear Recent File list


If you want to show more recently used list. Follow below settings.
Open Visual Studio
Tools -> Options
Select: Environment node
Select: General Node
You will find: items show in recently used lists
You can increase the number..

Tuesday 28 October 2014

Difference between k2 delegation redirect

k2 delegation: task will assign to another user, but one copy of task will available in original task list also.
k2 redirect: 
task will assign to another user, task will delete from original task list.

HCL cognos Interview questions


Do you have Congnos Certification?
What is query subject
What is Report item
What is Stich Query in Reportnet?
what is Galaxy schema?
how to improve performance in report studio level?
how to create calculate column in report studio?
what is crosstab space?
What is diffence between query calculation and layout calculation?

Display template management using app model

https://github.com/OfficeDev/PnP/blob/master/Samples/Branding.DisplayTemplates/readme.md

SharePoint Samples

https://github.com/OfficeDev/PnP/tree/master/Samples

Monday 27 October 2014

How to access IIS hosted site from another PC with the network

Go to Control Panel
System and Security
Windows Firewall
Advanced settings
Inbound Rules
-Click New rule...
-Provide all the details..
Click on Outbound Rules
-Click New rule...
-Provide all the details..

Now get your local system IP address.
Open Command prompt
Type: ipconfig
Under IPv4 Address, you will see ip number.

Now Open your site using ip address.
Ex: http://127.1.1.1:5656/

Now try above url from another system, he should able to access that..

Friday 24 October 2014

In line if statements in C#



   bool isValid = false;
   int a=200;
   int b=200;
   isValid = a > 1 && b > 1;
if(isValid)
{
//
}else
{
//
}

Thursday 23 October 2014

Install IIS

Open Control Panel
Click on Programs
Click on Turn Windows features on or off
You will get  : Windows Features dialog box.
Expand: Internet Information Searvices to install the default features
Expand: World Wide Web Services
Expand: Application Development features node and click ASP.NET 4.5 to add the features that support ASP.NET. (If you installed .NET 3.5, select ASP.NET 3.5 also.)
Click OK to close the Windows Features dialog box.
To verify that IIS installed successfully, type the following into a web browser:
http://localhost
The default IIS Welcome page is displayed.

Tuesday 21 October 2014

How can i find the xpath

Open Chrome.
Right click on element.
Select Inspect Element.
It will open Developer Tools window at the bottom with the elements HTML code highlighted.
Right click on that line of code and select Copy xpath.

Monday 20 October 2014

XPath Helper



This one is available for chrome.
Open Chrome.
Click Customize and control google chrome.
Click Settings
Click extensions


Or do : chrome://extensions/

Get more extensions
Click : extensions
Search for: XPath Helper
Click +
Click Add.

Open new chrome.
Ctrl+Shift+ X
You will get query window.
Type below query.

I have typed my xpath as below..i got one result..you can try your xpath.
.//div[contains(@data-section-id,'MyID')]//div[contains(@id,'MyNewID')]//a

Friday 17 October 2014

Site Pages missing in SharePoint


Open SharePoint site
Click Site Settings
Click Manage site features under Site Actions
Enable: "Wiki Page Home Page" feature.
Go to Site Settings > Under Look and Feel Click on Welcome Page.
Change it From Home.aspx to default.aspx.

SharePoint Result source based on query sting value


I have a query string (region) in my url, i have to read region value and pass to result source.

Result source will be: 

path:"https://SP2013" SPContentType=MyList owstaxIdMyColumn1MMD:{Term.Id} owstaxIdMyColumn2MMD:Link isActiveOWSBOOL=1 -owstaxIdRegion:{UK} OR owstaxIdRegion:{Request.region}

Basic code to read query string values in result source:
<ManagedPropertyofColumnNameinList>:{Request.<query string name>}

Wednesday 8 October 2014

How to add values to “Person or Group” list column using JavaScript

Sharepoint disable windows authentication prompt

Open IE
Click on Tools icon.
Click on Internet Options.
You will get new window. Click on “Security” tab.
Click on “Local internet” option.
Click on “Custom level…”
You will get new window.
Scroll down, you will find “User Authentication”àLogon
Select “Automatically login with current user name and password”
Click OK
Ok

Close the browser and open new browser, now open SharePoint site, it should not ask username and password.

Monday 6 October 2014

SharePoint Development options

Server Side Object Model
Client Object Model
REST/OData API
SharePoint Web Services

1.Server Side Object Model
-Full trust code using C# or VB.Net
We will use this option most of the times for on-prem SharePoint projects. Since the code will run in the SharePoint server itself. All your code bits will be deployed in SharePoint Server.
-You need add below dlls to develop SharePoint farm solutions
-Microsoft.SharePoint.dll
-Microsoft.SharePoint.Administration.dll
-You need to add below name space while developing SharePoint solutions(Farm solutions)
-Microsoft.SharePoint
-Microsoft.SharePoint.Administration

Some of the class names:
Under: -Microsoft.SharePoint.Administration
-SPFarm
-SPServer
-SPWebApplication
-SPDatabase
-SPContentDatabase
Under: -Microsoft.SharePoint
-SPContext
-SPSite (To access SharePoint sites. Ex:SPSite.RootWeb() will return root site of site collection)
-SPWeb  (To access all List and Libraries.Ex: SPWeb.Lists; will return all list objects)
-SPList (To access list fields, items..)
-SPField
-SPListItem

2.Client Object Model

-.Net client side object model (CSOM). Using C# or VB.Net
-JavaScript Object Model (JSOM). Using javascript, jQuery
-SilverLight Object Model
CSOM -Will be used in on-prem environment or SharePoint App Development(Provider hosted app). We can't use SPO.
JSOM -Will be used in all environments. On-prem or SPO.

Why Client Object Model?
-Using Server Side Object Model, we can develop solutions and we have to deploy that in SharePoint server.
But take a scenario, one Custom Application (Which is not SharePoint Application. Ex: some Windows client app) has to communicate with SharePoint.
For this we can develop client application using SharePoint Web Services, which will access in Windows client app, so no need to deploy this code SharePoint server.
But the limitation is, We don't have enough Web Services where we can access all SharePoint features using web services.
So what we have to do is, every time, we have to develop custom web services on SharePoint and use that service in Windows client app. Because of this everyone is investing their time and money to write custom web services.
So Microsoft is providing new way to access SharePoint objects with out running that code in to SharePoint server, that is called Client Object model.
View below image..


Client Object Model: No need to deploy in SharePoint Server, we can access SharePoint objects from client system.
How we can write Client Object Model? 
A)Using JSOM (Javascript), CSOM(.NetCLR using C# or VB.Net), SilverLight

If your client is using only javascript then you can use JSOM to access SharePoint. You need to add: SP.js and SP.Runtime.js
If your client is using only Asp.Net with C# or Vb.Net then you can use CSOM (C# or VB.Net) to access SharePoint.You need to add:
Microsoft.SharePoint.Client.dll,Microsoft.SharePoint.Client.Runtime.dll
If your client is using only SilverLight then you can use SilverLight to access SharePoint.You need to add:
Microsoft.SharePoint.Client.dll,Microsoft.SharePoint.Client.Runtime.dll

View below image


How Client Object Model Work?
View below image



3.REST/OData API
-URL based api
-REST: Representational state transfer
-URL based protocol
-Technology and platform independent

4.SharePoint Web Services
SharePoint has provided some web services to access SharePoint data, we can use that services in client application.

SharePoint Hierarchy


-SharePoint Farm -Web Application -Site Collection -Top Level Web Site (Root Site) -Sub Site1 -Sub Site2 -Lists -Field -List Item -Library -Field -Document Item

View in diagram

SharePoint 2013 development environment requirements


Friday 3 October 2014

How to find lenovo ThinkPad serial number?


Open Command prompt.
Run as administrator
Enter this command: wmic bios get serialnumber

Thursday 2 October 2014

SharePoint 2013 Term-Driven Pages Friendly URL page not found error

Solution:

Follow below steps..

Open SharePoint site.
Site Settings.
Term store management.

Expand term store.
Select your term.
Select "NAVIGATION" tab

Under Navigation Node Type

Set: Term-Driven Page with Friendy URL
Save

Now Click on "TERM-DRIVEN PAGES" tab
Under: Target Page Settings
Check: Change target page for this term
Click Browse next to "Change target page for this term" Select any page from Page Libraray.

Save.

Note: Select Root Term Set Group.
Select "INTENDED USE".
Enable: Use this Term Set for Site Navigation.
Other wise term store will not come as navigation url.


Wednesday 1 October 2014

sharepoint result sources query on content type using OR

({searchTerms?} (contentclass:sts_listItem_documentlibrary) path:https://MySC) OR ({searchTerms?} (contentclass:sts_listitem) path:https://MySC SPContentType=MyList)