code-rag-bench/online-tutorials huggingface dataset:
How to create line chart in react using material UI and DevExpress ? - GeeksforGeeks

14 Jul, 2021
DevExpress: DevExpress is a package for controlling and building the user interface of the Window, Mobile, and other applications.
Line Charts: Line charts are used to represent the relation between two data relationships X and relationships Y on a different axis. One of the axes of the plot represents the specific categories being compared, while the other axis represents the measured values corresponding to those categories.
Steps for creating React Application And Installing Module:
Step 1: Create a React application using the following command.npx create-react-app foldername
npx create-react-app foldername
Step 2: After creating your project folder i.e. folder name, move to it using the following command.cd foldername
cd foldername
Step 3: After creating the ReactJS application, install the required modules using the following command.npm i --save @devexpress/dx-react-core @devexpress/dx-react-chart
npm install @material-ui/core
npm i --save @devexpress/dx-react-chart-material-ui
npm i --save @devexpress/dx-react-core @devexpress/dx-react-chart
npm install @material-ui/core
npm i --save @devexpress/dx-react-chart-material-ui
Project Structure: It will look like the following :
Project Structure
 
Example: Now write down the following code in the App.js file. Here, the App is our default component where we have written our code.
App.js
import React from "react";import Paper from '@material-ui/core/Paper';import {  ArgumentAxis,  ValueAxis,  Chart,  LineSeries,} from '@devexpress/dx-react-chart-material-ui';    const App = () => {  // Sample dataconst data = [  { x: 1, y: 30 },  { x: 2, y: 40 },  { x: 3, y: 5 },  { x: 4, y: 2 },  { x: 5, y: 21 },];return (    <Paper>    <Chart      data={data}    >      <ArgumentAxis />      <ValueAxis />        <LineSeries valueField="y" argumentField="x" />    </Chart>  </Paper>);}  export default App;
Step to Run Application: Run the application using the following command from the root directory of the project:
npm start
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
Output
Material-UI
React-Questions
JavaScript
ReactJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Remove elements from a JavaScript Array
Difference Between PUT and PATCH Request
How to get character array from string in JavaScript?
How to filter object array based on attributes?
How to fetch data from an API in ReactJS ?
How to redirect to another page in ReactJS ?
How to pass data from child component to its parent in ReactJS ?
How to pass data from one component to other component in ReactJS ?
ReactJS Functional Components
How to insert an image in to MySQL database using Java program?

To hold an image in MySQL database generally blob type is used. Therefore, make sure that you have a table created with a blob datatype with the following description:
+-------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| Name | varchar(255) | YES | | NULL | |
| image | blob | YES | | NULL | |
+-------+--------------+------+-----+---------+-------+
To insert an image in to
MySQL database, follow the steps given below:
You can connect to a database using the getConnection() method of the DriverManager class.
Connect to the MySQL database by passing the MySQL URL which is jdbc:mysql://localhost/sampleDB (where sampleDB is the database name), username and password as parameters to the getConnection() method.
String mysqlUrl = "jdbc:mysql://localhost/sampleDB";
Connection con = DriverManager.getConnection(mysqlUrl, "root", "password");
Create a PreparedStatement object using the prepareStatement() method of the Connection interface. To this method pass the insert query (with place holders) as a parameter.
PreparedStatement pstmt = con.prepareStatement("INSERT INTO MyTable VALUES(?, ?)");
Set the values to the place holders using the setter methods of the PreparedStatement interface. Chose the methods according to the datatype of the column. For Example if the column is of VARCHAR type use setString() method and if it is of INT type you can use setInt() method.
And if it is of Blob type you can set value to it using the setBinaryStream() or setBlob() methods. To these methods pass an integer variable representing the parameter index and an object of InputStream class as parameters.
pstmt.setString(1, "sample image");
//Inserting Blob type
InputStream in = new FileInputStream("E:\\images\\cat.jpg");
pstmt.setBlob(2, in);
Execute the above created PreparedStatement object using the execute() method of the PreparedStatement interface.
import java.io.FileInputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class InsertImageToMySqlDB {
   public static void main(String args[]) throws Exception{
      //Registering the Driver
      DriverManager.registerDriver(new com.mysql.jdbc.Driver());
      //Getting the connection
      String mysqlUrl = "jdbc:mysql://localhost/sampleDB";
      Connection con = DriverManager.getConnection(mysqlUrl, "root", "password");
      System.out.println("Connection established......");
      PreparedStatement pstmt = con.prepareStatement("INSERT INTO MyTable VALUES(?,?)");
      pstmt.setString(1, "sample image");
      //Inserting Blob type
      InputStream in = new FileInputStream("E:\\images\\cat.jpg");
      pstmt.setBlob(2, in);
      //Executing the statement
      pstmt.execute();
      System.out.println("Record inserted......");
   }
}
Connection established......
Record inserted......
Python | Scipy integrate.tplquad() method

23 Jan, 2020
With the help of scipy.integrate.tplquad() method, we can get the triple integration of a given function from limit a to b by using scipy.integrate.tplquad() method.
Syntax : scipy.integrate.tplquad(func, a, b)
Return : Return the triple integrated value of a polynomial.
Example #1 :In this example we can see that by using scipy.integrate.tplquad() method, we are able to get the triple integrated value of a polynomial from limit a to b by using this method.
# import scipy.integrate.tplquadfrom scipy import integrate  gfg = lambda z, y, x: x * y*z + x**2 + y**2 + z**2  # using scipy.integrate.tplquad() methodgeek = integrate.tplquad(gfg, 1, 3, lambda x: 2, lambda x: 3,                              lambda x, y: 0, lambda x, y: 1)  print(geek)
Output :
27.000000000000004
Example #2 :
# import scipy.integrate.tplquadfrom scipy import integrategfg = lambda z, y, x: x**2 + y**2 + z**2 + 1  # using scipy.integrate.tplquad() methodgeek = integrate.tplquad(gfg, 1, 3, lambda x: 2, lambda x: 3,                              lambda x, y: 0, lambda x, y: 1)  print(geek)
Output :
24.0
Python-scipy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Check if element exists in list in Python
Python | os.path.join() method
How To Convert Python Dictionary To JSON?
Python | Get unique values from a list
Defaultdict in Python
Slice of Slices in Golang

15 Dec, 2021
In the Go language, a Slice is a key data type that is powerful and flexible as compared to an array. Slice is an abstraction over an array and overcomes limitations of arrays like getting a size dynamically or creating a sub-array of its own and hence much more convenient to use than traditional arrays. It is just like an array, having an index value and length, but the size of the slice is resized they are not in fixed-size just like an array. Slices only store elements of the same type, different types of elements cannot be stored in the same slice.
A slice is formed by specifying two indices, a low and high bound, separated by a colon as illustrated below:
arr[low_bound : high_bound]  
This includes the low_bound, but excludes the high_bound, where the smallest value of low_bound can be 0 and largest value of high_bound can be the length of arr array.
To make a slice of slices, we can compose them into multi-dimensional data structures similar to that of 2D arrays. This is done by using a function called make() which creates an empty slice with a non-zero length. This is shown in the following example:
Go
package main import (    "fmt") // main functionfunc main() {         // declaring a slice of slices of    // type integer with a length of 3    slice_of_slices := make([][]int , 3)         for i := 0; i < 3; i++ {        // looping through the slice to declare        // slice of slice of length 3        slice_of_slices[i] = make([]int, 3)                 // assigning values to each        // slice of a slice        for j := 0; j < 3; j++{            slice_of_slices[i][j] = i * j        }    }         // printing the slice of slices matrix    for i := 0; i < 3; i++ {        fmt.Println(slice_of_slices[i])    }         fmt.Println("Slice of slices: ", slice_of_slices)}
Output:
[0 0 0]
[0 1 2]
[0 2 4]
Slice of slices:  [[0 0 0] [0 1 2] [0 2 4]]
It is possible to have a variable slice of slices due to their dynamic nature. This is shown in the example below:
Go
package main import (    "fmt") // main functionfunc main() {         // declaring a slice of slices of    // type integer with a length of 3    slice_of_slices := make([][]int , 3)         for i := 0; i < 3; i++ {                 new_length := i * 2 + 1        // looping through the slice to declare        // slice of slice of a variable length        slice_of_slices[i] = make([]int, new_length)                 // assigning values to each        // slice of a slice        for j := 0; j < new_length; j++{            slice_of_slices[i][j] = i * j + 1        }    }         // printing the slice of slices matrix    for i := 0; i < 3; i++ {        fmt.Println(slice_of_slices[i])    }         fmt.Println("Slice of slices: ", slice_of_slices)}
Output:
[1]
[1 2 3]
[1 3 5 7 9]
Slice of slices:  [[1] [1 2 3] [1 3 5 7 9]]
 
dpgraham4401
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Hacktronian – All in one hacking tool for Linux and Android

23 Sep, 2021
Hacktronian is a free and open-source tool available on GitHub which is used as an information-gathering tool. Hacktronian is one of the easiest and useful tools for performing reconnaissance on websites and web applications. Hacktronian have different Modules such as information gathering, password attacks. Hacktronian is a complete package of different hacking tools/modules such as  Setoolkit,  Nmap, Host To IP Conversion, WAScan module, CMS Scanner module, XSStrike module for cross-site scripting. The interactive console provides a number of helpful features, such as command completion and contextual help. Hacktronian provides a command-line interface that you can run on Kali Linux. This tool can be used to get information about our target(domain). 
Step 1: Open your kali Linux operating system and move to the desktop using the following command. Use the second command to install the tool in your kali Linux operating system.
cd Desktop
git clone https://github.com/thehackingsage/hacktronian.git
Step 2: Now use the following command to move into the directory of the tool. Use the second command to give the permission of execution to the tool.
cd hacktronian
chmod +x install.sh
Step 3: Now use the following command to install the tool.
Step 4: The tool has been installed successfully. Use the following command to run the tool.
python2 hacktronian.py
The tool is running successfully. Now we will see examples to use the tool.
Example 1: Use the hacktronian tool to find the host  IP of a domain.
choose option 1:
1
choose option 4
4
Provide domain.
The tool has given the IP address of the domain.
Example 2: Use the hacktronian tool to perform port scanning.
choose option 3
3
Give the target IP-address
The tool started scanning the target ip-address using Nmap. Similarly, you can use the tool on your target also.
Kali-Linux
Linux-Tools
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Docker - COPY Instruction
scp command in Linux with Examples
chown command in Linux with Examples
SED command in Linux | Set 2
nohup Command in Linux with Examples
mv command in Linux with examples
chmod command in Linux with examples
Array Basics in Shell Scripting | Set 1
Introduction to Linux Operating System
Basic Operators in Shell Scripting
Shcheck – Tool to Check Security Headers in Kali Linux

30 Jun, 2021
We know that modern browsers such as chrome and others support many HTTP headers that can improve web application security to protect against clickjacking, cross-site scripting, and other common attacks.  Shcheck is a free and open-source tool available on GitHub.  Shcheck is used to check whether a security feature in a web application is implemented or not. It is based upon the technique of sending the request to the server via the GET method and in response, it receives all the sensitive information traveling in the header. HTTP security headers are a subset of HTTP headers and are exchanged between a web client (usually a browser) and a server to specify the security-related details of HTTP communication. Some HTTP headers that are indirectly related to privacy and security can also be considered HTTP security headers. By enabling suitable headers in web applications and web server settings, you can improve the resilience of your web application against many common attacks, including cross-site scripting (XSS) and clickjacking.
Step 1: Open your Kali Linux operating system and install dependencies using the following command. Install the tool using the second command.
apt install python3 python3-pip
pip3 install shcheck
Step 2: The tool has been downloaded. Use the following command to run the tool.
shcheck.py -h
The tool is running successfully. Now, let’s see an example of using the tool.
Example 1: Use the shcheck tool to scan the header of a domain.
shcheck.py <domain-name>
Similarly, you can test your own domain using this command.
Example 2: Use the shcheck tool to scan the header of a domain with get method.
shcheck.py <domain-name>-g
Example 3: Use the shcheck tool to get information about headers using the “-i” parameter.
shcheck.py <domain-name> -i
Kali-Linux
Linux-Tools
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Docker - COPY Instruction
scp command in Linux with Examples
chown command in Linux with Examples
SED command in Linux | Set 2
Introduction to Linux Operating System
nohup Command in Linux with Examples
Array Basics in Shell Scripting | Set 1
mv command in Linux with examples
chmod command in Linux with examples
screen command in Linux with Examples
Difference between Having clause and Group by clause

22 Nov, 2021
1. Having Clause : Having Clause is basically like the aggregate function with the GROUP BY clause. The HAVING clause is used instead of WHERE with aggregate functions. While the GROUP BY Clause groups rows that have the same values into summary rows. The having clause is used with the where clause in order to find rows with certain conditions. The having clause is always used after the group By clause.  
SELECT COUNT (SALARIES) AS COUNT_SALARIES, EMPLOYEES
FROM EMPLOYEES
GROUP BY SALARIES
HAVING COUNT(SALARIES) > 1; 
2. Group By Clause : The GROUP BY clause is often used with aggregate functions (MAX, SUM, AVG) to group the results by one or more columns or In simple words we can say that The GROUP BY clause is used in collaboration with the SELECT statement to arrange required data into groups. The GROUP BY statement groups rows that have the same values. This Statement is used after the where clause. This statement is often used with some aggregate function like SUM, AVG, COUNT atc. to group the results by one or more columns.  
SELECT COUNT (SALARIES) AS COUNT_SALARIES, EMPLOYEES
FROM EMPLOYEES
GROUP BY SALARIES; 
Difference between Having clause and Group by clause : 
siddwivedi97
DBMS-SQL
Picked
DBMS
Difference Between
SQL
DBMS
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Types of Functional dependencies in DBMS
MySQL | Regular expressions (Regexp)
Difference between OLAP and OLTP in DBMS
What is Temporary Table in SQL?
Difference between Where and Having Clause in SQL
Class method vs Static method in Python
Difference between BFS and DFS
Difference between var, let and const keywords in JavaScript
Difference Between Method Overloading and Method Overriding in Java
Differences between JDK, JRE and JVM
How to Display Multiple Images in One Figure Correctly in Matplotlib?

02 Feb, 2021
The easiest way to display multiple images in one figure is use figure(), add_subplot(), and imshow() methods of Matplotlib. The approach which is used to follow is first initiating fig object by calling fig=plt.figure() and then add an axes object to the fig by calling add_subplot() method. Then will display the image using imshow() method.
Syntax: add_subplot(rows, columns, i)
 Here rows and columns are the total number of rows and columns in the figure and i is the position at which new subplot must be placed.
Steps:
Import required libraries
Create a figure
Set values of rows and column variables
Read images
Add subplot and display image one by one
Consider below Images used as input: 
Image1
Image2
Image3
Image4
Below is the implementation :
Python3
# code for displaying multiple images in one figure  #import librariesimport cv2from matplotlib import pyplot as plt  # create figurefig = plt.figure(figsize=(10, 7))  # setting values to rows and column variablesrows = 2columns = 2  # reading imagesImage1 = cv2.imread('Image1.jpg')Image2 = cv2.imread('Image2.jpg')Image3 = cv2.imread('Image3.jpg')Image4 = cv2.imread('Image4.jpg')  # Adds a subplot at the 1st positionfig.add_subplot(rows, columns, 1)  # showing imageplt.imshow(Image1)plt.axis('off')plt.title("First")  # Adds a subplot at the 2nd positionfig.add_subplot(rows, columns, 2)  # showing imageplt.imshow(Image2)plt.axis('off')plt.title("Second")  # Adds a subplot at the 3rd positionfig.add_subplot(rows, columns, 3)  # showing imageplt.imshow(Image3)plt.axis('off')plt.title("Third")  # Adds a subplot at the 4th positionfig.add_subplot(rows, columns, 4)  # showing imageplt.imshow(Image4)plt.axis('off')plt.title("Fourth")
Output:
Picked
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Iterate over a list in Python
Python OOPs Concepts
Laravel - Installation

For managing dependencies, Laravel uses composer. Make sure you have a Composer installed on your system before you install Laravel. In this chapter, you will see the installation process of Laravel.
You will have to follow the steps given below for installing Laravel onto your system −
Step 1 − Visit the following URL and download composer to install it on your system.
https://getcomposer.org/download/
Step 2 − After the Composer is installed, check the installation by typing the Composer command in the command prompt as shown in the following screenshot.
Step 3 − Create a new directory anywhere in your system for your new Laravel project. After that, move to path where you have created the new directory and type the following command there to install Laravel.
composer create-project laravel/laravel –-prefer-dist

Now, we will focus on installation of version 5.7. In Laravel version 5.7, you can install the
complete framework by typing the following command −
composer create-project laravel/laravel test dev-develop

The output of the command is as shown below −
The Laravel framework can be directly installed with develop branch which includes the latest framework.
Step 4 − The above command will install Laravel in the current directory. Start the Laravel service by executing the following command.
php artisan serve

Step 5 − After executing the above command, you will see a screen as shown below −
Step 6 − Copy the URL underlined in gray in the above screenshot and open that URL in the browser. If you see the following screen, it implies Laravel has been installed successfully.

    13 Lectures 
     3 hours 

 Sebastian Sulinski

    35 Lectures 
     3.5 hours 

 Antonio Papa

    7 Lectures 
     1.5 hours 

 Sebastian Sulinski

    42 Lectures 
     1 hours 

 Skillbakerystudios

    165 Lectures 
     13 hours 

 Paul Carlo Tordecilla

    116 Lectures 
     13 hours 

 Hafizullah Masoudi
 Print
 Add Notes
 Bookmark this page
Python VLC MediaPlayer – Setting Full Screen Status

18 Aug, 2020
In this article we will see how we can set full screen status of the MediaPlayer object in the python vlc module. VLC media player is a free and open-source portable cross-platform media player software and streaming media server developed by the VideoLAN project. MediPlyer object is the basic object in vlc module for playing the video. We can create a MediaPlayer object with the help of MediaPlayer method. Enabling full screen status make it full screen it is similar to toggling full screen but with this status we can undo the full screen.
In order to do this we will use set_fullscreen method with the MediaPlayer object
Syntax : media_player.set_fullscreen(True)
Argument : It takes bool as argument
Return : It returns None
Below is the implementation
# importing vlc moduleimport vlc  # importing time moduleimport time    # creating vlc media player objectmedia_player = vlc.MediaPlayer()  # setting full screen statusmedia_player.media_player.set_fullscreen(True)    # media objectmedia = vlc.Media("death_note.mkv")  # setting media to the media playermedia_player.set_media(media)  # start playing videomedia_player.play()  # wait so the video can be played for 5 seconds# irrespective for length of videotime.sleep(5)
Output :
Another exampleBelow is the implementation
# importing vlc moduleimport vlc  # importing time moduleimport time  # creating vlc media player objectmedia_player = vlc.MediaPlayer()  # media objectmedia = vlc.Media("1mp4.mkv")  # setting media to the media playermedia_player.set_media(media)  # setting full screen statusmedia_player.media_player.set_fullscreen(True)    # start playing videomedia_player.play()  # wait so the video can be played for 5 seconds# irrespective for length of videotime.sleep(5)
Python vlc-library
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Find openSUSE Linux Version?

22 Mar, 2021
openSUSE is well known for its GNU/Linux-based operating systems, mainly Tumbleweed, a tested rolling release, and Leap, a distribution with Long-Term-Support(LTS). MicroOS and Kubic are new transactional, self-contained distributions for use as desktop or container runtime.
Here we figure out which version of the openSUSE Linux distribution is installed and running on a device in this post. The os-release file includes information about all openSUSE versions. 
Methods 1: using lsb-release.
If the lsb-release package is not available on your device, use the zypper command to install it:
$ sudo zypper install lsb-release
Install lsb-release
After installation run the following command:
$ lsb_release -a
We can show all the details above, but we also have other options.
Show the release number:
lsb_release -r
Show the release number
Find the distributor’s ID:
lsb_release -d
Find the distributor’s ID
View a description of the Linux distro:
lsb_release -d
View a description of the Linux distro
Display the code name of the OpenSUSE:
lsb_release -c
Display the code name of the OpenSUSE
It’s simple to display a help message on the screen. You simply need to type the following command:
lsb_release -h
Help
To query and modify the device hostname and related settings, use the hostnamectl command. It will even show you the version of your operating system. Run the hostnamectl command as follows:
$ hostnamectl
Methods 2: using cat utility.
Alternatively, open the terminal and use the cat command to display the contents of /etc/os-release and /usr/lib/os-release:
$ cat /etc/os-release  
OR
$ cat /usr/lib/os-release file 
Cat command
That’s it! We’ve covered both graphical and command-line methods for determining which version of openSUSE you’re running in this short article.
Picked
How To
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Set Git Username and Password in GitBash?
How to Install Jupyter Notebook on MacOS?
How to Install and Use NVM on Windows?
How to Install Python Packages for AWS Lambda Layers?
How to Install Git in VS Code?
Sed Command in Linux/Unix with examples
AWK command in Unix/Linux with examples
grep command in Unix/Linux
cut command in Linux with examples
cp command in Linux with examples
PriorityQueue add() Method in Java

09 Aug, 2019
The Java.util.PriorityQueue.add() method in Java is used to add a specific element into a PriorityQueue. This method internally just calls the Java.util.PriorityQueue.offer() method with the value passed to it. So, it exactly works like offer() method.
Syntax:
Priority_Queue.add(Object element)
Parameters: The parameter element is of the type PriorityQueue and refers to the element to be added to the Queue.
Return Value: The function returns True if the element is successfully added to the PriorityQueue .
Below programs illustrate the Java.util.PriorityQueue.add() method:
Program 1: Adding String elements into the Queue.
// Java code to illustrate add()import java.util.PriorityQueue;  public class PriorityQueueDemo {    public static void main(String args[])    {        // Creating an empty PriorityQueue        PriorityQueue<String> queue = new PriorityQueue<String>();          // Use add() method to add elements into the Queue        queue.add("Welcome");        queue.add("To");        queue.add("Geeks");        queue.add("4");        queue.add("Geeks");          // Displaying the PriorityQueue        System.out.println("PriorityQueue: " + queue);    }}
PriorityQueue: [4, Geeks, To, Welcome, Geeks]

Program 2: Adding Integer elements into the Queue.
// Java code to illustrate add()import java.util.*;  public class PriorityQueueDemo {    public static void main(String args[])    {        // Creating an empty PriorityQueue        PriorityQueue<Integer> queue = new PriorityQueue<Integer>();          // Use add() method to add elements into the Queue        queue.add(10);        queue.add(15);        queue.add(30);        queue.add(20);        queue.add(5);          // Displaying the PriorityQueue        System.out.println("PriorityQueue: " + queue);    }}
PriorityQueue: [5, 10, 30, 20, 15]

PraveenKumar54
Java - util package
Java-Collections
Java-Functions
java-priority-queue
Java
Java
Java-Collections
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
8085 program to find the sum of series of even numbers - GeeksforGeeks

25 Nov, 2019
Problem – Calculate the sum of series of even numbers from the given list of numbers. The length of the list is in memory location 2200H and the series begins from memory location 2201H. Result will store at memory location 2210H.
Examples –
Input : 
2200H= 4H
2201H= 20H
2202H= l5H
2203H= l3H
2204H= 22H

Output : 
Result 2210H = 42H

Program –
Explanation –A microprocessor is a computer processor that incorporates the functions of a central processing unit on a single integrated circuit.
A is an 8-bit accumulator which is used to load and store the data directly.LDA is used to load accumulator direct using 16-bit address (3 Byte instruction).Instructions like MOV, MVI, LDA are the data transfer instructions.ADD is used to add data.HLT is used to halt the program.
A is an 8-bit accumulator which is used to load and store the data directly.
LDA is used to load accumulator direct using 16-bit address (3 Byte instruction).
Instructions like MOV, MVI, LDA are the data transfer instructions.
ADD is used to add data.
HLT is used to halt the program.
realabbas
microprocessor
system-programming
Computer Organization & Architecture
microprocessor
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Architecture of 8085 microprocessor
Computer Organization and Architecture | Pipelining | Set 2 (Dependencies and Data Hazard)
Pin diagram of 8086 microprocessor
Direct Access Media (DMA) Controller in Computer Architecture
Memory mapped I/O and Isolated I/O
General purpose registers in 8086 microprocessor
Difference between SRAM and DRAM
Registers of 8085 microprocessor
8085 program to multiply two 8 bit numbers
8085 program to add two 16 bit numbers
MATLAB - if...else...end Statement

An if statement can be followed by an optional else statement, which executes when the expression is false.
The syntax of an if...else statement in MATLAB is −
if <expression>
   % statement(s) will execute if the boolean expression is true 
   <statement(s)>
else
   <statement(s)>
   % statement(s) will execute if the boolean expression is false 
end

If the boolean expression evaluates to true, then the if block of code will be executed, otherwise else block of code will be executed.
Create a script file and type the following code −
a = 100;
% check the boolean condition 
   if a < 20 
      % if condition is true then print the following 
      fprintf('a is less than 20\n' );
   else
      % if condition is false then print the following 
      fprintf('a is not less than 20\n' );
   end
   fprintf('value of a is : %d\n', a);
When the above code is compiled and executed, it produces the following result −
a is not less than 20
value of a is : 100


    30 Lectures 
     4 hours 

 Nouman Azam

    127 Lectures 
     12 hours 

 Nouman Azam

    17 Lectures 
     3 hours 

 Sanjeev

    37 Lectures 
     5 hours 

 TELCOMA Global

    22 Lectures 
     4 hours 

 TELCOMA Global

    18 Lectures 
     3 hours 

 Phinite Academy
 Print
 Add Notes
 Bookmark this page
Isomorphic Strings in C++

Suppose we have two strings s and t; we have to check whether they are isomorphic or not. Two strings are said to be isomorphic if the characters in s can be replaced to get t.
All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character but a character may map to itself.
So, if the input is like s = "egg", t = "add”, then the output will be true, as e can map to a, and g can map to d.
To solve this, we will follow these steps −
Define an array arr of size 256 and fill with -1
Define an array arr of size 256 and fill with -1
Define an array visited of size 256 and fill with 0
Define an array visited of size 256 and fill with 0
Define an array visited1 of size 256 and fill with 0
Define an array visited1 of size 256 and fill with 0
for initialize i := 0, when i < length of s, update (increase i by 1), do −if visited[s[i]] is same as 1 or visited1[t[i]] is same as 1, then −if arr[s[i]] is not equal to t[i] - ASCII of 'a', then −return falseOtherwisevisited[s[i]] := 1visited1[t[i]] := 1arr[s[i]] := t[i] - ASCII of 'a'
for initialize i := 0, when i < length of s, update (increase i by 1), do −
if visited[s[i]] is same as 1 or visited1[t[i]] is same as 1, then −if arr[s[i]] is not equal to t[i] - ASCII of 'a', then −return false
if visited[s[i]] is same as 1 or visited1[t[i]] is same as 1, then −
if arr[s[i]] is not equal to t[i] - ASCII of 'a', then −return false
if arr[s[i]] is not equal to t[i] - ASCII of 'a', then −
return false
return false
Otherwisevisited[s[i]] := 1visited1[t[i]] := 1arr[s[i]] := t[i] - ASCII of 'a'
Otherwise
visited[s[i]] := 1
visited[s[i]] := 1
visited1[t[i]] := 1
visited1[t[i]] := 1
arr[s[i]] := t[i] - ASCII of 'a'
arr[s[i]] := t[i] - ASCII of 'a'
return true
return true
Let us see the following implementation to get better understanding −
 Live Demo
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
   bool isIsomorphic(string s, string t) {
      vector<int> arr(256, -1);
      vector<bool> visited(256, 0);
      vector<bool> visited1(256, 0);
      for (int i = 0; i < s.length(); i++) {
         if (visited[s[i]] == 1 || visited1[t[i]] == 1) {
            if (arr[s[i]] != t[i] - 'a') {
               return false;
            }
         }
         else {
            visited[s[i]] = 1;
            visited1[t[i]] = 1;
            arr[s[i]] = t[i] - 'a';
         }
      }
      return true;
   }
};
main(){
   Solution ob;
   cout << (ob.isIsomorphic("sky","fry"));
}
"sky","fry"
1
Find a pair with maximum product in array of Integers in C++

Consider we have an array A, there are n different elements. We have to find a pair (x, y) from the array A, such that the product of x and y is maximum. The array may contain positive or negative elements. Suppose an array is like: A = [-1, -4, -3, 0, 2, -5], then the pair will be (-4, -5) as product is maximum.
To solve this problem, we have to keep track four numbers, the positive_max, positive_second_max, negative_max, negative_second_max. At the end if the (positive_max * positive_second_max) is greater than (negative_max * negative_second_max), then return positive pairs, otherwise return negative pairs.
#include<iostream>
#include<cmath>
using namespace std;
void maxProdPair(int arr[], int n) {
   if (n < 2) {
      cout << "No pair is present";
      return;
   }
   if (n == 2) {
      cout << "(" << arr[0] << ", " << arr[1] << ")" << endl;
      return;
   }
   int pos_max = INT_MIN, pos_second_max = INT_MIN;
   int neg_max = INT_MIN, neg_second_max = INT_MIN;
   for (int i = 0; i < n; i++) {
      if (arr[i] > pos_max) {
         pos_second_max = pos_max;
         pos_max = arr[i];
      } else if (arr[i] > pos_second_max)
      pos_second_max = arr[i];
      if (arr[i] < 0 && abs(arr[i]) > abs(neg_max)) {
         neg_second_max = neg_max;
         neg_max = arr[i];
      }
      else if(arr[i] < 0 && abs(arr[i]) > abs(neg_second_max))
      neg_second_max = arr[i];
   }
   if (neg_max*neg_second_max > pos_max*pos_second_max)
      cout << "(" << neg_max << ", " << neg_second_max << ")" << endl;
   else
      cout << "(" << pos_max << ", " << pos_second_max << ")" << endl;
}
int main() {
   int arr[] = {-1, -4, -3, 0, 2, -5};
   int n = sizeof(arr)/sizeof(arr[0]);
   maxProdPair(arr, n);
}
(-5, -4)
Logical Operators in C

Following table shows all the logical operators supported by C language. Assume variable A holds 1 and variable B holds 0, then −
Try the following example to understand all the logical operators available in C −
#include <stdio.h>

main() {

   int a = 5;
   int b = 20;
   int c ;

   if ( a && b ) {
      printf("Line 1 - Condition is true\n" );
   }
	
   if ( a || b ) {
      printf("Line 2 - Condition is true\n" );
   }
   
   /* lets change the value of  a and b */
   a = 0;
   b = 10;
	
   if ( a && b ) {
      printf("Line 3 - Condition is true\n" );
   } else {
      printf("Line 3 - Condition is not true\n" );
   }
	
   if ( !(a && b) ) {
      printf("Line 4 - Condition is true\n" );
   }
	
}
When you compile and execute the above program, it produces the following result −
Line 1 - Condition is true
Line 2 - Condition is true
Line 3 - Condition is not true
Line 4 - Condition is true

 Print
 Add Notes
 Bookmark this page
JupyterLab - Installation and Getting Started

You can try online the features of JupyterLab before installing. Visit https://jupyter.org/try and choose ‘try JupyterLab’ option.
The launcher tab shows currently available kernels and consoles. You can start a new notebook based/terminal based on any of them. The left column is also having tabs for file browser, running kernels and tabs and settings view.
JupyterLab is normally installed automatically with Anaconda distribution. However, it can also be installed separately by using following conda command −
conda install -c conda-forge jupyterlab

You can also use the pip command for this purpose −
pip3 install jupyterlab

To start JupyterLab application, most convenient way is from Anaconda Navigator if it is installed.
Alternately start it from command line from Windows/Linux command terminal or Anaconda prompt using this command −
jupyter lab

Either way, the JupyterLab application’s launch screen looks like this −

    22 Lectures 
     49 mins

 Bigdata Engineer
 Print
 Add Notes
 Bookmark this page
How can we implement a JLabel text with different color and font in Java?

A JLabel class can extend JComponent class and an object of JLabel provides text instructions or information on a GUI.
A JLabel can display a single line of read-only text, an image or both text and an image.
A JLabel can also display a single line of text with different colors and fonts using <font size='font-size' color='color of the text'> Some Text </font> tag inside a HTML tag.
A JLabel can explicitly generate a PropertyChangeListener interface.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MultiColorLabelTest extends JFrame {
   public MultiColorLabelTest() {
      setTitle("MultiColorLabel Test");
      setLayout(new FlowLayout());
      // multi colored with different font size label
      JLabel label = new JLabel("<html><font size='5' color=blue> Welcome to</font> <font            size='6'color=green> Tutorials Point</font></html>");
      add(label);
      setSize(375, 250);
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setLocationRelativeTo(null);
      setVisible(true);
   }
   public static void main(String[] args) {
      new MultiColorLabelTest();
   }
}
What value does read() method return when it reaches the end of a file in java?

The read() method of the input stream classes reads the contents of the given file byte by byte and returns the ASCII value of the read byte in integer form. While reading the file if it reaches the end of the file this method returns -1.
Assume we have a text file (sample.txt) in the current directory with a simple text saying “Hello welcome”. Following Java program reads the contents of the file byte by byte using the read() method and prints the integer value returned for each byte.
Since we are not checking for end of the file, the read() method reaches the end and the last integer of the output will be -1.
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class EndOfFileExample {
   public static void main(String[] args) {
      try{
         File file = new File("sample.txt");
         DataInputStream inputStream = new DataInputStream(new FileInputStream(file));
         System.out.println(file.length());
         for(int i=0; i<=file.length();i++) {
            int num = inputStream.read();
            System.out.println(num);
         }
      } catch(IOException ioe) {
         ioe.printStackTrace();
      }
   }
}
13
72
101
108
108
111
32
119
101
108
99
111
109
101
-1
How to hide or disable the mouse pointer in Tkinter?

There are several ways to disable and enable a particular widget in a Tkinter application. However, if we want to control the Tkinter window components such as mouse cursor, control icons, toolbars, then Tkinter provides several built-in functions which can be used to configure the Tkinter window objects.
To hide or disable the mouse pointer for a particular Tkinter application, then we can configure the mouse property using config(mouse= "none") method. It can be invoked for the master or root window.
#Import tkinter library
from tkinter import *
from tkinter import ttk
#Create an instance of Tkinter frame or window
win= Tk()
#Set the geometry of tkinter frame
win.geometry("750x250")
def callback(event):
   win.destroy()
#Create a Label and a Button widget
label=ttk.Label(win, text="Press Enter to Close the Window", font=('Century 17 bold'))
label.pack(ipadx=10)
win.bind('<Return>',callback)
#Disable the Mouse Pointer
win.config(cursor="none")
win.mainloop()
Running the above code will hide or disable the Mouse Pointer for the window.
Now, while residing in the window, press Enter that will force the window to close.
Get current Gold price using Python - GeeksforGeeks

13 Jan, 2022
In this article we will see how we can get the current gold price in India. There is a variation in price of gold with time to time, price of gold is moved by a combination of supply, demand, and investor behavior. That seems simple enough, yet the way those factors work together is sometimes counterintuitive.
Modules required and Installation:
Requests :Requests allows you to send HTTP/1.1 requests extremely easily. There’s no need to manually add query strings to your URLs.
pip install requests
Beautiful Soup:Beautiful Soup is a library that makes it easy to scrape information from web pages. It sits atop an HTML or XML parser, providing Pythonic idioms for iterating, searching, and modifying the parse tree.
pip install beautifulsoup4
Explanation –We have the google search URL of the gold price from that we have scrape the price of the gold in Indian rupees and store it in a variable, which we further print it.
Below is the implementation.
Python3
# importing librariesfrom bs4 import BeautifulSoup as BSimport requests    # method to get the price of golddef get_price(url):          # getting the request from url     data = requests.get(url)      # converting the text     soup = BS(data.text, 'html.parser')      # finding metha info for the current price    ans = soup.find("div", class_ = "BNeawe s3v9rd AP7Wnd").text          # returning the price    return ans   # url of the gold priceurl = "https://www.google.com / search?q = gold + price"  # calling the get_price methodans = get_price(url)  # printing the ansprint(ans)
Output :
10g of 24k gold (99.9%): 42, 460 INR
sagar0719kumar
Python web-scraping-exercises
Python-BS3
Web-scraping
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
How to drop one or multiple columns in Pandas Dataframe
Selecting rows in pandas DataFrame based on conditions
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | os.path.join() method
Python | Get unique values from a list
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
Python Operators Precedence

The following table lists all operators from highest precedence to lowest.
Operator precedence affects how an expression is evaluated.
For example, x = 7 + 3 * 2; here, x is assigned 13, not 20 because operator * has higher precedence than +, so it first multiplies 3*2 and then adds into 7.
Here, operators with the highest precedence appear at the top of the table, those with the lowest appear at the bottom.
 Live Demo
#!/usr/bin/python
a = 20
b = 10
c = 15
d = 5
e = 0
e = (a + b) * c / d #( 30 * 15 ) / 5
print "Value of (a + b) * c / d is ", e
e = ((a + b) * c) / d # (30 * 15 ) / 5
print "Value of ((a + b) * c) / d is ", e
e = (a + b) * (c / d); # (30) * (15/5)
print "Value of (a + b) * (c / d) is ", e
e = a + (b * c) / d; # 20 + (150/5)
print "Value of a + (b * c) / d is ", e
When you execute the above program it produces the following result −
Value of (a + b) * c / d is 90
Value of ((a + b) * c) / d is 90
Value of (a + b) * (c / d) is 90
Value of a + (b * c) / d is 50
Java Guava | Booleans.toArray() method with Examples - GeeksforGeeks

30 Jan, 2019
The toArray() method of Booleans Class in the Guava library is used to convert the boolean values, passed as the parameter to this method, into a Boolean Array. These boolean values are passed as a Collection to this method. This method returns a Boolean array.
Syntax:
public static boolean[] toArray(Collection<Boolean> collection)
Parameters: This method accepts a mandatory parameter collection which is the collection of boolean values to be converted in to a Boolean array.
Return Value: This method returns a boolean array containing the same values as a collection, in the same order.
Exceptions: This method throws NullPointerException if the passed collection or any of its elements is null.
Below programs illustrate the use of toArray() method:
Example 1:
// Java code to show implementation of// Guava's Booleans.toArray() method  import com.google.common.primitives.Booleans;import java.util.Arrays;import java.util.List;  class GFG {      // Driver's code    public static void main(String[] args)    {          // Creating a List of Boolean        List<Boolean> myList            = Arrays.asList(false, true,                            false, false);          // Using Booleans.toArray() method to convert        // a List or Set of Boolean to an array        // of Boolean        boolean[] arr = Booleans.toArray(myList);          // Displaying an array containing each        // value of collection,        // converted to a boolean value        System.out.println(Arrays.toString(arr));    }}
[false, true, false, false]

Example 2:
// Java code to show implementation of// Guava's Booleans.toArray() method  import com.google.common.primitives.Booleans;import java.util.Arrays;import java.util.List;  class GFG {      // Driver's code    public static void main(String[] args)    {        // Creating a List of Boolean        List<Boolean> myList            = Arrays.asList(true, true, false);          // Using Booleans.toArray() method to convert        // a List or Set of Boolean to an array        // of Boolean        boolean[] arr = Booleans.toArray(myList);          // Displaying an array containing each        // value of collection,        // converted to a boolean value        System.out.println(Arrays.toString(arr));    }}
[true, true, false]

Reference: https://google.github.io/guava/releases/20.0/api/docs/com/google/common/primitives/Booleans.html#toArray-java.util.Collection-
Guava-Booleans
Java-Functions
java-guava
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Stream In Java
Different ways of Reading a text file in Java
Constructors in Java
Exceptions in Java
Generics in Java
Functional Interfaces in Java
Comparator Interface in Java with Examples
HashMap get() Method in Java
Strings in Java
StringBuilder Class in Java with Examples
Prime numbers upto n - JavaScript

Let’s say, we are required to write a JavaScript function that takes in a number, say n, and returns an array containing all the prime numbers upto n.
For example − If the number n is 24, then the output should be −
const output = [2, 3, 5, 7, 11, 13, 17, 19, 23];
Following is the code −
const num = 24;
const isPrime = num => {
   let count = 2;
   while(count < (num / 2)+1){
      if(num % count !== 0){
         count++;
         continue;
      };
      return false;
   };
   return true;
};
const primeUpto = num => {
   if(num < 2){
      return [];
   };
   const res = [2];
   for(let i = 3; i <= num; i++){
      if(!isPrime(i)){
         continue;
      };
      res.push(i);
   };
   return res;
};
console.log(primeUpto(num));
This will produce the following output in console −
[
   2,  3,  5,  7, 11,
   13, 17, 19, 23
]
How to remove an item from an ArrayList in C#?

Firstly, set a a new ArrayList and add elements to it.
ArrayList arr = new ArrayList();
arr.Add( "Jones" );
arr.Add( "Tom" );
arr.Add( "Henry" );
Now let’s remove the item “Tom”. For that, use the Remove() method.
arr.Remove("Tom");
The following is the complete example to remove an element from ArrayList −
 Live Demo
using System;
using System.Collections;

class Demo {
   static void Main(){
      ArrayList arr = new ArrayList();
      arr.Add( "Jones" );
      arr.Add( "Tom" );
      arr.Add( "Henry" );

      Console.WriteLine("Initial ArrayList...");
      foreach(string str in arr) {
         Console.WriteLine(str);
      }

      arr.Remove("Three");
      Console.WriteLine("ArrayList after removing an element...");

      foreach(string str in arr) {
         Console.WriteLine(str);
      }

      Console.ReadLine();
   }
}
Initial ArrayList...
Jones
Tom
Henry
ArrayList after removing an element...
Jones
Tom
Henry