Posts

ARC - Advanced Rest Client

Image
Today I am going to explain how to check the API response on particular request through ARC (Advanced Rest Client).  What is API? API stand for Application Program Interface. API is used to define how software component should interact. It's an command or set of instruction that asked from one program to another. Now's day API used in Mobile development, web application for e.g for showing the current weather. We will focus on the Mobile Development API. In Mobile development we are always want to check what the API is returning, for that purpose the ARC is useful & time saving. API react on bases of some request and response in two form either JSON or XML. To install the ARC you need following things: Chrome Google Account PS: ARC is compatibility with Windows and MAC How to Install ARC? Open Chrome Go to Apps section present in Bookmark bar Click on Web Store In Search bar present in Left Panel add keyword "Advanced Rest Client"...

LINQ First vs FirstOrDefault vs Single vs SingleOrDefault

Below is a chart explaining the difference between them and examples of each scenario. First() FirstOrDefault ( ) Single ( ) SingleOrDefault ( ) Description Return first element of the sequence elements Return first element of the sequence elements or default value if no element is found Return a single element of a sequence Return a single element of a sequence, or a default value if that element is not found\ Exception Thrown when There are no elements in the result Only if the source is null There are 0 or more than 1 elements in the result There is more than one element in the result When to use When more than 1 element is expected and you want only the first When more than 1 element is expected and you want only the first. Also it is ok for the result to be empty If exactly 1 element is expected not 0 or more than 1 When 0 or 1 element is expected Example First, we create an Employee table for querying. We will test with different ...

ONGC Paper for Programming Domain - June 2014

I am sharing a question paper related to ONGC written exam held in June 2014 relate to programming domain. While preparing for an  exam,  I had searched a lot previous year paper, but I don't get anything. Here is question paper The paper is divided into 4 sections Section 1: Proamming which include DS , C++, OOPS, Database, so on Section 2: GK (History + Current affair) Section 3: Reasoning Section 4: Quantity Aptitude I am sharing only section 1  and remain section is similar to other exams. 1) Which of the following is NOT a characteristic of the OSI model? a) Each layer performs a subset of the required communication functions. b) Each layer does not rely on the next lower layer to perform more primitive functions c) Each layer provides services to the next higher layer. d) Changes are one layer should not require changes in another layer 2) The algorithm used to solve the Eight Queens Problem? 3) What is the use of HELLO prot...

Create Connection String Through Notepad

Image
For communicate with database, the most importing thing required is connection string . Here I will tell you simply way to create your connection string. Following is steps to generate your Connection String: Open your Notepad and create an empty text file, then click File -> click Save -> and  save it with the File name: " TestConnection . udl " to your desktop. ( as shown in following screen) Go to your desktop and double-click on the TestConnection . udl file you just created and the Data Link Properties box will pop up.  Select  Provider tab and Find the provider that you want to connect with and click Next . ( as shown in follwoing scrren ) Now from the Connection tab , select or enter your source/ server name -> then enter information to log on to server -> and select the database on the server. Click Test Connection and click OK to save the file. Note: If errors occur during testing of your connect...

Error when you browse your ASP site from IIS

When you take a copy of your project from TFS, and you run the project it will create virtual directory in IIS (Internet Information Service), after running (or pressing F5) it will encounter an error like Server Error in '/' Application. Or It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error will occur because you virtual directory is not act as Application. For converting your virtual directory in an Application follows following steps: For windows XP: Start -->  control panel --> Administrative tools --> Internet Information Service (IIS) Right click on website folder and select properties. Select the directory tab and click the create button in the Application Settings section. Now you can see the application name field enabled and your website converted into an application. Then click OK. Now browse your application, it will run without any error. For W...

Count down timer in asp.net

We can display the count down by using timer control or by using the java script. Timer control will repeatedly call the post back on every tick, which will decrease the performance of the site. It’s better to use the java script. Following is the code for implementing the Count Down:- Test.aspx: < asp : Label ID ="lblTimer" runat ="server"></ asp : Label > Write this line in body, if it is simple one page site. If you have master page the write above code in the asp : Content. Script:- On the same page write following script:- This script will update the time and on label and calculate the time in Hours, Minutes, and Seconds. < script type ="text/javascript" language ="javascript">       var timeout = "<%= Session.Timeout * 60 * 1000 %>" ;       var lbltimer = document.getElementById( "<%= lblTimer.ClientID %>" );       debugger...

Execution Process of MVC Application

When we execute the MVC application it will process in the following steps: 1) Receive first request for the application:- In the Global.ascx file, the route of application is decided, by adding the route object in route table . 2) Performing Routing:- The URLRoutingModule uses the first matching Route object in the route table collection, which is uses to crate a Request Context object 3)  Create MVC request handler:-  The MVCRouteHandler object create an instance of the MVCHadler class and passes it the RequestContext instance. 4) Create Controller:-   The MVCHandler oject uses the RequestContext instance to identify Controller 5) Execute Controller:- The MVCHandler instance call the controller execute method. 6) Invoke Action:- The ControllerAcctionInvoker object is associated with the controller determine wwhich action method of the controller class to call and then call the method. 7) Execute Result:-  A typical action method mig...