Thursday, December 27, 2018

How to Creating a Bing Maps Key

Creating a Bing Maps Key

  1. Go to the Bing Maps Dev Center at here.
After success Login you can see below screen :-


Click on "My account" Tab you can see below option select "My keys"

if you want new key than you have to click here to create a new key.
But if you have already key and you want to see you key than you have to select 2nd option.


 In next blog i will explain you how to How to display bing map using this or without key.

Thank you .

Web Services Interview Questions and answers – SOAP, RESTful

Welcome to the Web Services some Interview Questions with detailed answers.

What is a Web Service?

Web Services work on client-server model where client applications can access web services over the network. Web services provide endpoint URLs and expose methods that can be accessed over network through client programs written in C#, shell script or any other different technologies.
Web services are stateless and doesn’t maintain user session like web applications.

What is SOAP?

SOAP stands for Simple Object Access Protocol. SOAP is an XML based industry standard protocol for designing and developing web services. Since it’s XML based, it’s platform and language independent. So our server can be based on JAVA and client can be on .NET, PHP etc. and vice versa.

What is WSDL?
WSDL stands for Web Service Description Language. WSDL is an XML based document that provides technical details about the web service. Some of the useful information in WSDL document are: method name, port types, service end point, binding, method parameters etc.
What are different components of WSDL?
Some of the different tags in WSDL xml are:
    • xsd:import namespace and schemaLocation: provides WSDL URL and unique namespace for web service.
    • message: for method arguments
    • part: for method argument name and type
    • portType: service name, there can be multiple services in a wsdl document.
    • operation: contains method name
    • soap:address for endpoint URL.

What is REST Web Services?

REST is the acronym for REpresentational State Transfer. REST is an architectural style for developing applications that can be accessed over the network. REST architectural style was brought in light by Roy Fielding in his doctoral thesis in 2000.
REST is a stateless client-server architecture where web services are resources and can be identified by their URIs. Client applications can use HTTP GET/POST methods to invoke Restful web services. REST doesn’t specify any specific protocol to use, but in almost all cases it’s used over HTTP/HTTPS. When compared to SOAP web services, these are lightweight and doesn’t follow any standard. We can use XML, JSON, text or any other type of data for request and response.
What are advantages of REST web services?
Some of the advantages of REST web services are:
  • Learning curve is easy since it works on HTTP protocol
  • Supports multiple technologies for data transfer such as text, xml, json, image etc.
  • No contract defined between server and client, so loosely coupled implementation.
  • REST is a lightweight protocol
  • REST methods can be tested easily over browser.

What are disadvantages of REST web services?

Some of the disadvantages of REST are:
  • Since there is no contract defined between service and client, it has to be communicated through other means such as documentation or emails.
  • Since it works on HTTP, there can’t be asynchronous calls.
  • Sessions can’t be maintained.

What is a Resource in Restful web services?

Resource is the fundamental concept of Restful architecture. A resource is an object with a type, relationship with other resources and methods that operate on it. Resources are identified with their URI, HTTP methods they support and request/response data type and format of data.

What are different HTTP Methods supported in Restful Web Services?

Restful web services supported HTTP methods are – GET, POST, PUT, DELETE and HEAD.

Compare SOAP and REST web services?

SOAPREST
SOAP is a standard protocol for creating web services.REST is an architectural style to create web services.
SOAP is acronym for Simple Object Access Protocol.REST is acronym for REpresentational State Transfer.
SOAP uses WSDL to expose supported methods and technical details.REST exposes methods through URIs, there are no technical details.
SOAP web services and client programs are bind with WSDL contractREST doesn’t have any contract defined between server and client
SOAP web services and client are tightly coupled with contract.REST web services are loosely coupled.
SOAP learning curve is hard, requires us to learn about WSDL generation, client stubs creation etc.REST learning curve is simple, POJO classes can be generated easily and works on simple HTTP methods.
SOAP supports XML data format onlyREST supports any data type such as XML, JSON, image etc.
SOAP web services are hard to maintain, any change in WSDL contract requires us to create client stubs again and then make changes to client code.REST web services are easy to maintain when compared to SOAP, a new method can be added without any change at client side for existing resources.
SOAP web services can be tested through programs or software such as Soap UI.REST can be easily tested through CURL command, Browsers and extensions such as Chrome Postman.

What are different types of Web Services?

There are two types of web services:
  1. SOAP Web Services: Runs on SOAP protocol and uses XML technology for sending data.
  2. Restful Web Services: It’s an architectural style and runs on HTTP/HTTPS protocol almost all the time. REST is a stateless client-server architecture where web services are resources and can be identified by their URIs. Client applications can use HTTP GET/POST methods to invoke Restful web services.


Here i am explain you very few question those i am face during my Interview.
I take reference from here for more reading you can follow same link.

Thank you.

Tuesday, December 11, 2018

How to override bootstrap-rating.min.js .

Hi friends ,

Total i will Explain you how to override "bootstrap-rating.min.js".

Special Thank to my friend "vedant.malaikar" he tech me this skill.

So friends is you are new in jquery ajax that is very nice article to you.
 How to create your custom function and  override "bootstrap-rating.min.js".

This is Kartik Visweswaran min.js file if you want to override it.Your are on correct Place.

/*!
 * bootstrap-star-rating v4.0.2
 * http://plugins.krajee.com/star-rating
 *
 * Author: Kartik Visweswaran
 * Copyright: 2013 - 2017, Kartik Visweswaran, Krajee.com
 *
 * Licensed under the BSD 3-Clause
 * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md

In My case i want 10 starts with small size you can change want you want according to your requirement.
So let's start
Step 1:-
Go to unminify.com
Step 2:-
Paset your bootstrap file inside it and click unminify button.

Check your property which property you want to override.

Step 3:-
Go to you View .

 <div class="text-center m-t-md">
                        <input type="button" id="input-3" name="input-3" class="rate" data-min="0" data-max="10" data-step="1" value="0">
                    </div>

An inside the script wrote below code:-

<script type="text/javascript">

    $(document).ready(function () {

$(".rate").rating({
            size: 'xs',
            stars: 10
        });
 });
</script>



!!!!!!!!!!!!!!!!!!!!!!!!!!Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



Monday, November 26, 2018

error in MVC entity framework

Hi all if you are using code first approach in entity framework and you are facing below error.

the solution are as below :-
update-database.


this is solution .

.........................Thank you .................

Wednesday, November 14, 2018

Difference between WriteLine() and Write() method


The main difference between WriteLine() and Write() is that the Write() method only prints the string provided to it, while the WriteLine() method prints the string and moves to the start of next line as well.
Let's take at a look at the example below to understand the difference between these methods.

Example 1: How to use WriteLine() and Write() method?

When we run the program, the output will be


Thank you

Creating DLL and consuming it using C#


Description
DLL  Stand for  (Dynamic Link Library).
How to create a DLL and consuming it  because most of the reusable components are written in the form of a DLL.


Create DLL.

Step 1
First, create a project of type “Class Library” as shown here.


Then we are implementing a Fullname class library that is responsible for show fullname of user.


Step 3
Build this code and you will see that a DLL file has been created rather than an exe in the root directory of the application (path = C:\Users\Admin\Documents\visual studio 2017\Projects\LibraryForDLL\LibraryForTest\bin\Debug\netstandard1.4\ LibraryForTest.dll).

Consume the DLL
Step 1
 
Now create another console based application(Any project) where we will utilize the class library functionality.In my case i am created new project in same Solution Explorer.

 


Step 2
 
Then you need to add the reference of the Fullname Class Library DLL file reference to access the declared class in the library DLL. (Right-click on the Reference then select Add reference then select the path of the DLL file.)

Step 3
 
When you add the class library reference then you will see in the Solution Explorer that a new LibraryForTest is added as in the following,


Step 4
 
Now add the namespace of the class library file in the console application and create the instance of the class declared in the library as follows,


Step 5
Finally, run the application and you must see the result as shown in the image below.


;;;;;;;;;;;;;;;;;;;;;;;;;Thank you ;;;;;;;;;;;;;;;;;

Monday, October 29, 2018

How do I uninstall a Windows service In window using SC Tool?

If you want to Uninstall some services from your service list you have to follow some step


1)You can use the SC tool (Sc.exe) included in the Resource Kit. (included with Windows 7/8/10).

Open a Command Prompt and enter

sc delete <service-name>


Tool help snippet follows:
DESCRIPTION:
        SC is a command line program used for communicating with the
        NT Service Controller and services.

delete----------Deletes a service (from the registry).

Thank you

If it is helpful it is my pleasure .....

Thursday, October 25, 2018

Error CS0012 The type 'DataServiceCollection<>' is defined in an assembly that is not referenced.

Dear all hope you are all good.

Solution of Error "Error CS0012 The type 'DataServiceCollection<>' is defined in an assembly that is not referenced.
You must add a reference to assembly 'Microsoft.OData.Client, Version=6.13.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Svatantra.OmniProcess.Scheduler D:\Arjun\Projects\Svantra\Svatantra.OmniProcessScheduler\Program.cs 141 Active"

As you see above error it is clearly mentioned some .dll version issue
"Svatantra.OmniProcess.Scheduler D:\Arjun\Projects\Svantra\Svatantra.OmniProcessScheduler\Program.cs 141 Active" this is project name .

After some search i found solution of above error it is as below.

1. Follow the instructions in the hotfix ReadMe to install the fix.

2. Download the following dlls from Package Manager Console 
   Microsoft.OData.Client.dll
   Microsoft.OData.Core.dll
   Microsoft.OData.Edm.dll
   Microsoft.Spatial.dll

Install-Package Microsoft.OData.Core -Version 6.15.0
Install-Package Microsoft.OData.Client -Version 6.15.0
Kindly refer the link :- https://gateway.sdl.com/communityknowledge?articleName=000003826


Thank you



Thursday, September 20, 2018

How to read a value from user in Console application?

This article explains how to get an input from the user in  console.It is very basic program.

using System;
class ReadStringData

        {

            public static void Main()

            {

                Console.Write("Enter your name:");
                // String Variable 
                string YourName = Console.ReadLine();

                Console.WriteLine(" Hello Mr. " + YourName);
             
            }

        }
Note :- In this small console application get input from user and display on console screen.

Thank you.............

Command to collapse all sections of code? In Visual Studio

This post is for beginner and advance .net developer.When you know short cut in visual studio you code speed is good.
In Visual Studio (Any) is there a command to collapse/expand all the sections of code in a file?

Kindly follow the below screen :-

Right click in editor -> Outlining to find all options. (After disabling outlining, use same steps to enable outlinging.)


Thank you ....................

Wednesday, September 19, 2018

HOW TO: FIX ERROR - "the 'microsoft.ace.oledb.12.0' provider is not registered on the local machine"

1) 'Microsoft.ACE.OLEDB.12.0' check this engine is available or not if not available download and install it .
2) If above mentioned engin is there in you system  right Click on you used project --- property and follow below screen.
here's some screenshots to show


Sunday, August 26, 2018

This can be changed to 0/1 through using CASE WHEN like this example:

Hi friend in this article i will explain you how to convert 0/1 into true and false.



SELECT
 CASE WHEN Users.IsDeleted = 0  THEN 'false' ELSE 'true' END AS 'IsActive'
 FROM Users


Using the above query you can get result as you expected Users = Table name,IsDeleted =column name and IsActive= My Alien Name(display name)



Thank you,



Thursday, August 9, 2018

Default values table in c# for

The following table shows the default values of value types returned by the default constructors. 


Wednesday, August 1, 2018

List of New Features in C# 6.0

List of New Features in C# 6.0

We can discuss the new features, below is a list of few features in C# 6.0:
  1. Auto Property Initializer
  2. Primary Constructors 
  3. Dictionary Initializer
  4. Declaration Expressions
  5. Static Using
  6. await inside catch block
  7. Exception Filters
  8. Conditional Access Operator to check NULL Values

1. Auto Property Initialzier

Before :-

The only way to initialize an Auto Property is to implement an explicit constructor and set property values inside it.
public class AutoPropertyBeforeCsharp6
{
private string _postTitle = string.Empty;
public AutoPropertyBeforeCsharp6()
{
//assign initial values
PostID = 1;
PostName = "Post 1";
}

public long PostID { get; set; }

public string PostName { get; set; }

public string PostTitle
{
get { return _postTitle; }
protected set
{
_postTitle = value;
}
}
}

After :-

In C# 6, auto implemented property with initial value can be initialized without having to write the constructor. We can simplify the above example to the following:
public class AutoPropertyInCsharp6
{
public long PostID { get; } = 1;

public string PostName { get; } = "Post 1";

public string PostTitle { get; protected set; } = string.Empty;
}

2. Primary Constructors

We mainly use constructor to initialize the values inside it. (Accept parameter values and assign those parameters to instance properties).

Before :-

public class PrimaryConstructorsBeforeCSharp6
{
public PrimaryConstructorsBeforeCSharp6(long postId, string postName, string postTitle)
{
PostID = postId;
PostName = postName;
PostTitle = postTitle; 
}

public long PostID { get; set; }
public string PostName { get; set; }
public string PostTitle { get; set; }
}

After :-

public class PrimaryConstructorsInCSharp6(long postId, string postName, string postTitle)

public long PostID { get; } = postId;
public string PostName { get; } = postName;
public string PostTitle { get; } = postTitle;
}
In C# 6, primary constructor gives us a shortcut syntax for defining constructor with parameters. Only one primary constructor per class is allowed.
If you look closely at the above example, we moved the parameters initialization beside the class name.
You may get the following error “Feature ‘primary constructor’ is only available in ‘experimental’ language version.” To solve this, we need to edit the SolutionName.csproj file to get rid of this error. What you have to do is we need to add additional setting after WarningTag.
<LangVersion>experimental</LangVersion>
Feature ‘primary constructor’ is only available in ‘experimental’ language version

3. Dictionary Initializer

Before :-

The old way of writing a dictionary initializer is as follows:
public class DictionaryInitializerBeforeCSharp6
{
public Dictionary<stringstring> _users = new Dictionary<stringstring>()
{
{"users""Venkat Baggu Blog" },
{"Features""Whats new in C# 6" }
};
}

After :-

We can define dictionary initializer like an array using square brackets.
public class DictionaryInitializerInCSharp6
{
public Dictionary<stringstring> _users { get; } = new Dictionary<stringstring>()
{
["users"] = "Venkat Baggu Blog",
["Features"] = "Whats new in C# 6" 
};
}

4. Declaration Expressions

Before :-

public class DeclarationExpressionsBeforeCShapr6()
{
public static int CheckUserExist(string userId)
{
//Example 1
int id;
if (!int.TryParse(userId, out id))
{
return id;
}
return id;
}

public static string GetUserRole(long userId)
{
////Example 2
var user = _userRepository.Users.FindById(x => x.UserID == userId);
if (user!=null)
{
// work with address ...

return user.City;
}
}
}

After :-

In C# 6, you can declare an local variable in the middle of the expression. With declaration expressions, we can also declare variables inside if statements and various loop statements.
public class DeclarationExpressionsInCShapr6()
{
public static int CheckUserExist(string userId)
{
if (!int.TryParse(userId, out var id))
{
return id;
}
return 0;
}

public static string GetUserRole(long userId)
{
////Example 2
if ((var user = _userRepository.Users.FindById(x => x.UserID == userId) != null)
{
// work with address ...

return user.City;
}
}
}

5. Using Statics

Before :-

To you static members, you don’t need an instance of object to invoke a method. You use syntax as follows:
TypeName.MethodName
public class StaticUsingBeforeCSharp6
{
public void TestMethod()
{
Console.WriteLine("Static Using Before C# 6");
}
}

After :-

In C# 6, you have the ability to use the Static Members without using the type name. You can import the static classes in the namespaces.
If you look at the below example, we moved the Static Console class to the namespace:
using System.Console;
namespace newfeatureincsharp6
{
public class StaticUsingInCSharp6
{
public void TestMethod()
{
WriteLine("Static Using Before C# 6");
}
}
}

6.await Inside catch Block

Before C# 6, await keyword is not available inside the catch and finally blocks. In C# 6, we can finally use the await keyword inside catch and finally blocks.
try 

//Do something
}
catch (Exception)
{
await Logger.Error("exception logging")
}

7.Exception Filters

Exception filters allow you a feature to check an if condition before the catch block executes.
Consider an example that an exception occurred now we want to check if the InnerException null, then it will execute catch block.
//Example 1
try
{
//Some code
}
catch (Exception ex) if (ex.InnerException == null)
{
//Do work

}

//Before C# 6 we write the above code as follows

//Example 1
try
{
//Some code
}
catch (Exception ex) 
{
if(ex.InnerException != null)
{
//Do work;
}
}

8. Conditional Access Operator to Check NULL Values?


Consider an example that we want to retrieve a UserRanking based on the UserID only if UserID is not null.
Before :-
var userRank = "No Rank";
if(UserID != null)
{
userRank = Rank;
}

//or

var userRank = UserID != null ? Rank : "No Rank"

After :-

var userRank = UserID?.Rank ?? "No Rank";

Thank you