Programming Articles - Page 1172 of 3363

Explain the role of HttpContext class in ASP.NET Core

Akshay Khot
Updated on 22-Jun-2021 13:27:54

7K+ Views

The HttpContext encapsulates all the HTTP-specific information about a single HTTP request.When an HTTP request arrives at the server, the server processes the request and builds an HttpContext object. This object represents the request which your application code can use to create the response.The HttpContext object constructed by the ASP.NET Core web server acts as a container for a single request. It stores the request and response information, such as the properties of request, request-related services, and any data to/from the request or errors, if there are any.ASP.NET Core applications access the HTTPContext through the IHttpContextAccessor interface. The HttpContextAccessor class ... Read More

How does ASP.NET Core provide data access with Entity Framework?

Akshay Khot
Updated on 22-Jun-2021 13:24:03

428 Views

Entity Framework is an ORM (object-relational mapper) framework that makes it easy to create, retrieve, update, or delete data from relational databases. Using Entity Framework, you can work with C# objects that abstract the database related code, so you rarely have to deal with raw SQL.The following figure illustrates where the Entity Framework fits into a layered architecture.Entity Framework Core (EF Core) is the new version of Entity Framework 6. Similar to .NET Core, EF Core is a lightweight, open-source, and cross-platform version of Entity Framework. It is developed to be used with .NET Core applications.To integrate EF Core into ... Read More

How do you get the current figure number in Python's Matplotlib?

Vikram Chiluka
Updated on 22-Sep-2022 13:03:20

3K+ Views

In this article, we are going to the current figure number in Python’s matplotlib. Matplotlib is a Python library that is a numerical-mathematical extension of the NumPy library. Pyplot is a state-based interface to a Matplotlib module that provides MATLAB-like functionality. Line Plot, Contour, Histogram, Scatter, 3D Plot, and other plots are available in Pyplot. Using plt.gcf().number What is plt.gcf() The matplotlib.pyplot.gcf() function is primarily used to obtain the current figure. One is generated using the figure() function if no current figure is available. matplotlib.pyplot.gcf() Algorithm (Steps) Following are the Algorithm/steps to be followed to perform the desired task ... Read More

What is Heap Sort in Python?

pawandeep
Updated on 11-Jun-2021 12:52:39

451 Views

Heap Sort is the sorting technique based on binary heap data structure. In order to proceed with heap sort, you need to be familiar with binary tree and binary heap.What is a Complete binary tree?A complete binary tree is a tree data structure where all the levels except the last one are completely filled. The last level must be filled from the left side.What is a Binary heap?Binary heap is a special case of the binary tree. Binary heaps are of two types −Max Heap − The parent node at each level is greater than its child nodes.Min Heap − ... Read More

Which is the fastest implementation of Python

pawandeep
Updated on 11-Jun-2021 12:51:50

957 Views

Python has many active implementations. We will be addressing its different implementations and know which is the fastest implementation.Different implementations of Python −IronPython − This is the Python implementation which runs on .NET framework. This implementation is written in C#. It uses .net virtual machine for running. IronPython can use the python libraries and .net framework libraries.Jython − Jython is the implementation of Python which runs on the Java Platform. The jython makes use of the java classes and libraries. The jythoncode is compiled into java byte code and it is run on Java Virtual Machine.PyPy − This is the implementation of Python ... Read More

What is Python Unit Testing?

pawandeep
Updated on 11-Jun-2021 12:51:30

756 Views

What is unit testing?Unit testing is a type of software testing where each individual component of the system is tested. Unit testing is important practice for the developers. It ensures that every component of the software is functioning appropriately as expected. Unit testing is mainly performed by the developers during the coding phase of the software development.Unit testing makes it easy to fix the problems as the developers come to know which particular component of the system or software has the issues and the developers can fix that particular unit.Python Unit TestingThe python has an in-built package called unittest which is ... Read More

How to read JSON file in Python

pawandeep
Updated on 23-Aug-2023 03:50:38

79K+ Views

What is a JSON file?JSON stands for JavaScript Object Notation. It is commonly used for transmitting data in web applications (such as sending data from server to client to display on the web pages).Sample JSON FileExample 1: {    "fruit": "Apple",    "size": "Large",    "color": "Red" }Example 2: {    'name': 'Karan',    'languages': ['English', 'French'] }The json file will have .json extensionRead JSON file in PythonPython has an in-built package called json which can be used to work with JSON data and to read JSON files. The json module has many functions among which load() and loads() are ... Read More

What is Insertion sort in Python?

pawandeep
Updated on 11-Jun-2021 12:50:08

6K+ Views

Insertion sort is the simple method of sorting an array. In this technique, the array is virtually split into the sorted and unsorted part. An element from unsorted part is picked and is placed at correct position in the sorted part.The array elements are traversed from 1 to n.If the array element at position i is greater than its predecessor, it does not need to be moved.If the array element at position i is less than its predecessor, it needs to be shifted towards left until we find a predecessor smaller than it or if we reach at the leftmost ... Read More

How to create a DataFrame in Python?

pawandeep
Updated on 25-Aug-2023 01:13:12

35K+ Views

Dataframe is a 2D data structure. Dataframe is used to represent data in tabular format in rows and columns. It is like a spreadsheet or a sql table. Dataframe is a Pandas object.To create a dataframe, we need to import pandas. Dataframe can be created using dataframe() function. The dataframe() takes one or two parameters. The first one is the data which is to be filled in the dataframe table. The data can be in form of list of lists or dictionary of lists. In case of list of lists data, the second parameter is the columns name.Create dataframe from ... Read More

How to connect Database in Python?

pawandeep
Updated on 11-Jun-2021 12:49:17

4K+ Views

Most of the applications need to be integrated or connected with a database for performing certain relevant operations. The majority of projects require database connectivity to store certain data about the users. MySQL Database can be integrated with the Python applications.To connect MySQL database, we need to have it installed on our system. We need MySQL Connector to establish connection with the database. We can install MySql Connector using the following command.python –m pip install mysql-connector-pythonThis will install the MySQL Connector which is used to connect the python project or application to a database.Create a connectionFirst of all, it is ... Read More

Advertisements