code-rag-bench/online-tutorials huggingface dataset:
How to prevent line breaks in the list of items using CSS?

10 May, 2019
The display:inline-block property is used to show an element in the inline-level block container. It converts the block of elements into an inline element. Use height and width property to set an inline element. The display property is used to prevent a line break of a list of items.
Syntax:
element {
    display:inline-block;
} 
Example:
<!DOCTYPE html>                        <html>    <head>        <title>preventline break in list items</title>        <style>            li {                display:inline-block;                text-decoration:underline;            }            h1 {                color:green;            }            h1, h2 {                text-align:center;            }            body {                width:70%;            }        </style>    </head>    <body>        <h1>GeeksforGeeks</h1>        <h2>display:inline-block;</h2>        <b>Subjects Of Computer science:</b>        <ul>            <li>Computer Network</li>            <li>Operating System </li>            <li>Data Structure using C</li>            <li>Object Oriented Programming Concepts</li>            <li>Digital Electronics</li>        </ul>    </body></html>                    
Output:
Supported Browsers: The browser supported by CSS display property are listed below:
Apple Safari 3.1
Google Chrome 4.0
Firefox 3.0
Opera 7.6
Internet Explorer 8.0
Kirti_Mangal
CSS-Misc
Picked
CSS
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Using Selenium in Python to click/select a radio button.

We can select/click the radio button with Selenium. In an html document, each radio button has an attribute type set to a value as radio. In order to select a radio button, we shall first identify it and then apply the click() method to it.
Code Implementation.
from selenium import webdriver
driver = webdriver.Chrome (executable_path="C:\\chromedriver.exe")
# maximize with maximize_window()
driver.maximize_window()
driver.get("https://www.tutorialspoint.com/selenium/selenium_automation_practice.htm")
# identify element and click()
l=driver.find_element_by_xpath("//input[@value='2']")
l.click()
driver.close()
scipy.rfft() in Python

29 Aug, 2020
With the help of scipy.rfft() method, we can compute the fast fourier transformation for real sequence and return the transformed vector by using this method.
Syntax : scipy.fft.rfft(x)
Return : Return the transformed vector.
Example #1 :
In this example we can see that by using scipy.rfft() method, we are able to compute the fast fourier transformation for real sequence and return the transformed vector by using this method.
Python3
# import scipy and numpyimport scipyimport numpy as np  x = np.arange(5)# Using scipy.fftfreq() methodgfg = scipy.fft.rfft(x)  print(gfg)
Output :
[10. +0.j         -2.5+3.4409548j  -2.5+0.81229924j]
Example #2 :
Python3
# import scipy and numpyimport scipyimport numpy as np  x = np.arange(10)# Using scipy.fftfreq() methodgfg = scipy.fft.rfft(x)  print(gfg)
Output :
[45. +0.j         -5.+15.38841769j -5. +6.8819096j  -5. +3.63271264j
-5. +1.62459848j -5. +0.j        ]
Python scipy-stats-functions
Python-scipy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Data Structures | Binary Trees | Question 8

10 Jul, 2018
The number of leaf nodes in a rooted tree of n nodes, with each node having 0 or 3 children is:(A) n/2(B) (n-1)/3(C) (n-1)/2(D) (2n+1)/3Answer: (D)Explanation: Let L be the number of leaf nodes and I be the number of internal nodes, then following relation holds for above given tree (For details, please see question 3 of this post)
  L = (3-1)I + 1 = 2I + 1
Total number of nodes(n) is sum of leaf nodes and internal nodes
  n = L + I
After solving above two, we get L = (2n+1)/3Quiz of this Question
Binary Trees Quiz
Data Structures
Data Structures-Binary Trees
Data Structures
Data Structures
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Bit manipulation | Swap Endianness of a number
Advantages of vector over array in C++
Amazon Interview Experience for SDE-II
Binary Search Tree | Set 3 (Iterative Delete)
Data Structures | Stack | Question 2
Data Structures | Linked List | Question 4
Data Structures | Balanced Binary Search Trees | Question 5
Difference between data type and data structure
Data Structures | Linked List | Question 6
Improving Linear Search Technique
Python Set | symmetric_difference()

06 Feb, 2018
This in-built function of Python Set helps us to get the symmetric difference between two sets, which is equal to the elements present in either of the two sets, but not common to both the sets. Let’s look at the Venn diagram of the symmetric_difference between two sets.
Symmetric Difference is marked in Green
If there are a set_A and set_B, then the symmetric difference between them will be equal to the union of set_A and set_B without the intersection between the two.
// Takes a single parameter that has to be 
// a set and returns a new set which is the 
// symmetric difference between the two sets.
set_A.symmetric_difference(set_B)
Examples:
Input: set_A = {1, 2, 3, 4, 5}
       set_B = {6, 7, 3, 9, 4}
Output :  {1, 2, 5, 6, 7, 9}
Explanation: The common elements {3, 4} 
are discarded from the output.

Input:
set_A = {"ram", "rahim", "ajay", "rishav", "aakash"}
set_B = {"aakash", "ajay", "shyam", "ram", "ravi"}
Output: {"rahim", "rishav", "shyam", "ravi"}

Explanation: The common elements {"ram", "ajay", 
"aakash"} are discarded from the final set
In this program we will try to find the symmetric difference between two sets:
# Python code to find the symmetric_difference# Use of symmetric_difference() method  set_A = {1, 2, 3, 4, 5}set_B = {6, 7, 3, 9, 4}print(set_A.symmetric_difference(set_B))
Output:
{1, 2, 5, 6, 7, 9}
There is also another method to get the symmetric difference between two sets, by the use of an operator “^“.Example:
# Python code to find the Symmetric difference# using ^ operator.  # Driver Codeset_A = {"ram", "rahim", "ajay", "rishav", "aakash"}set_B = {"aakash", "ajay", "shyam", "ram", "ravi"}print(set_A ^ set_B)
Output:
{'shyam', 'ravi', 'rahim', 'rishav'}
# One more example Python code to find # the symmetric_difference use of # symmetric_difference() method  A = {'p', 'a', 'w', 'a', 'n'}B = {'r', 'a', 'o', 'n', 'e'}C = {}  print(A.symmetric_difference(B))print(B.symmetric_difference(A))  print(A.symmetric_difference(C))print(B.symmetric_difference(C))  # this example is contributed by sunny6041
Output:
set(['e', 'o', 'p', 'r', 'w'])
set(['e', 'o', 'p', 'r', 'w'])
set(['a', 'p', 'w', 'n'])
set(['a', 'r', 'e', 'o', 'n'])

python-set
Python
python-set
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Different ways to create Pandas Dataframe
Enumerate() in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
Convert integer to string in Python
How to drop one or multiple columns in Pandas Dataframe
Python input() Function

05 Nov, 2021
Python input() function is used to take user input. By default, it returns the user input in form of a string.
Syntax
input(prompt)
Parameter:
Prompt:  A String, representing a default message (usually screen) before the input. However, it is optional to have a prompt message.
Return: input() returns a string object. Even if the inputted value is an integer it converts it into a string.
By Default, input returns a string. So the name and age will be stored as strings.
Python
# Taking name of the user as input # and storing it name variablename = input("Please Enter Your Name: ")  # taking age of the user as input and # storing in into variable ageage = input("Please Enter Your Age: ")  # printing itprint("The name of the user is {0} and his/her age is {1}".format(name, age))
Output:
In this example, we will be looking at how to take integer input from users. To take integer input we will be using int() along with input()
Python
# Taking number 1 from user as intnum1 = int(input("Please Enter First Number: "))  # Taking number 2 from user as intnum2 = int(input("Please Enter Second Number: "))  # adding num1 and num2 and storing them in# variable additionaddition = num1 + num2  # printingprint("The sum of the two given numbers is {} ".format(addition))
Output:
Similarly, we can use float() to take two float numbers. Let’s see one more example of how to take lists as input
Python
# Taking list1 input from user as listlist1 = list(input("Please Enter Elements of list1: "))  # Taking list2 input from user as listlist2 = list(input("Please Enter Elements of list2: "))    # appending list2 into list1 using .append functionfor i in list2:    list1.append(i)  # printing list1print(list1)
Output:
Picked
Python-Functions
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Update multiple rows in same query in PostgreSQL using Pyscopg2-Python

17 Oct, 2021
In this article, we are going to update multiple rows in the same query in PostgreSQL using Pyscopg2in Python.
We can update multiple values at once by using the update clause from PostgreSQL. First, we import the psycopg2 package and establish a connection to a PostgreSQL database using the pyscopg2.connect() method. 
UPDATE "table"
SET "column_one" = value1, 
"column_two" = value2, 
"column_three" = valueN
WHERE condition;
Python3
import psycopg2  conn = psycopg2.connect(    database="classroom_database",      user='postgres', password='pass',    host='127.0.0.1', port='5432')  conn.autocommit = Truecursor = conn.cursor()    sql = ''' update  student_details  set          cgpa = 9.5 ,          branch = 'AE'        where student_name = 'rahul';'''  cursor.execute(sql)  sql1 = '''select * from student_details;'''cursor.execute(sql1)  for i in cursor.fetchall():    print(i)  conn.commit()conn.close()
Output:
(12124468, 'arjun', 9.7, 'arjun19@gmail.com', 'CSE')
(12124469, 'DIYA', 9.4, 'diya@gmail.com', 'CSE')
(12124466, 'sarah', 9.8, 'sarah1212@gmail.com', 'CSE')
(12124470, 'priya', 8.8, 'priya@gmail.com', 'CSE')
(12124467, 'rahul', 9.5, 'rahul9@gmail.com', 'AE')
Output in PostgreSQL:
Picked
Python PostgreSQL
Python Pyscopg2
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
Python | os.path.join() method
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python | Get unique values from a list
Create a directory in Python
Draw Multiple Time Series in Same Plot in R

26 May, 2022
Time Series in R programming language is used to see how an object behaves over a period of time. In R, it can be easily done by the ts() function with some parameters. Time series takes the data vector and each data is connected with timestamp value as given by the user. 
First, we create a data vector that has data for all the time series that have to be drawn. Then we plot the time series using the first dataset and plot() function. Then add other time series using line() function to the existing plot. Then we may add a legend on top to show which line in the plot represents which time series.
Example:
R
# Create sample dataset.seed(1023)                           sample_data <- round(data.frame(year = 1997:2021,                     time_data1 = 1:25 + rnorm(25),                     time_data2  = 30:6 + runif(25, 0, 10),                     time_data3  = rnorm(25, 5, 5))) # Plot a graph with time_data1plot(sample_data$year,                               sample_data$time_data1,     type = "l",     col = 2,     ylim = c(- 15, 40),     xlab = "Year",     ylab = "Values") # Add line graphs of other two datasetlines(sample_data$year,                                  sample_data$time_data2,      type = "l",      col = 3) lines(sample_data$year,                                  sample_data$time_data3,      type = "l",      col = 4) # Add legend in top right cornerlegend("topright",                                 c("Geeksforgeeks", "technical-scripter", "geek-i-knack"),       lty = 1,       col = 2:4)
Output:
Multiple time series in one plot
In ggplot2 we can directly use geom_line() to draw the plot. 
We first create a sample data vector. The ggplot2 will be used to draw the plot and reshape will melt the data from the wide form to long-form. Convert data from the wide form to long-form.
Syntax:
melt(sample_data, id.vars = variable)
Draw the plot with the help of ggplot2 and geom_line(),
Example:
R
# Create sample dataset.seed(1023)                           sample_data <- round(data.frame(year = 1997:2021,                     time_data1 = 1:25 + rnorm(25),                     time_data2  = 30:6 + runif(25, 0, 10),                     time_data3  = rnorm(25, 5, 5))) # Load packages reshape2 and ggplot2library("reshape2") library("ggplot2")   # Convert sample_data from wide form to long formdata_final <- melt(sample_data, id.vars = "year") # Plot the final dataggplot(data_final,                                  aes(x = year,           y = value,           col = variable)) + geom_line()
Output:
Multiple time series using ggplot2
varshagumber28
Picked
R-Charts
R-Graphs
R-plots
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
numpy.arctan() in Python

29 Nov, 2018
numpy.arctan(x[, out]) = ufunc ‘arctan’) : This mathematical function helps user to calculate inverse tangent for all x(being the array elements).
Parameters :
array : [array_like]elements are in radians.
out   : [array_like]array of same shape as x.

Note :
2pi Radians = 360 degreesThe convention is to return the angle z whose real part lies in [-pi/2, pi/2].
Return :
An array with inverse tangent of x
for all x i.e. array elements. 

The values are in the closed interval [-pi/2, pi/2].

 Code #1 : Working
# Python program explaining# arctan() function  import numpy as np  in_array = [0, 1, 0.3, -1]print ("Input array : \n", in_array)  arctan_Values = np.arctan(in_array)print ("\nInverse Tangent values : \n",                            arctan_Values)
Output :
Input array : 
 [0, 1, 0.3, -1]

Inverse Tangent values : 
 [ 0.          0.78539816  0.29145679 -0.78539816]
 Code #2 : Graphical representation
# Python program showing# Graphical representation  # of arctan() function  import numpy as npimport matplotlib.pyplot as plt  in_array = np.linspace(-np.pi, np.pi, 12)out_array1 = np.tan(in_array)out_array2 = np.arctan(in_array)  print("in_array : ", in_array)print("\nout_array with tan : ", out_array1)print("\nout_arraywith arctan : ", out_array1)  # red for numpy.arccos()plt.plot(in_array, out_array1,            color = 'blue', marker = "*")              plt.plot(in_array, out_array2,            color = 'red', marker = "o")              plt.title("blue : numpy.tan() \nred : numpy.arctan()")plt.xlabel("X")plt.ylabel("Y")plt.show()
Output :
in_array :  [-3.14159265 -2.57039399 -1.99919533 -1.42799666 -0.856798   -0.28559933
  0.28559933  0.856798    1.42799666  1.99919533  2.57039399  3.14159265]

out_array with tan :  [  1.22464680e-16   6.42660977e-01   2.18969456e+00  -6.95515277e+00
  -1.15406152e+00  -2.93626493e-01   2.93626493e-01   1.15406152e+00
   6.95515277e+00  -2.18969456e+00  -6.42660977e-01  -1.22464680e-16]

out_arraywith arctan :  [  1.22464680e-16   6.42660977e-01   2.18969456e+00  -6.95515277e+00
  -1.15406152e+00  -2.93626493e-01   2.93626493e-01   1.15406152e+00
   6.95515277e+00  -2.18969456e+00  -6.42660977e-01  -1.22464680e-16]
References :https://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.arcsin.html#numpy.arccos.
Python numpy-Mathematical Function
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
unordered_multimap equal_range() function in C++ STL

08 Aug, 2018
unordered_multimap::equal_range() is a built-in function in C++ STL which returns the range in which all the element’s key is equal to a key. It returns a pair of iterators where the first is an iterator pointing to the lower bound of the range and second is an iterator pointing to the upper bound of the range. If there is no element equal to a given value in the container, then it returns a pair where both lower and upper bound points to the position past the end of the container or unordered_multimap.end().
Syntax:
unordered_multimap_name.equal_range(k)
Parameters: The function accepts a mandatory parameter k. The range returned will have the elements with key k.
Return Value: It returns a pair of iterators.
Below programs illustrates the above function:
Program 1:
// C++ program to illustrate the// unordered_multimap::equal_range()#include <iostream>#include <unordered_map>using namespace std;  int main(){      // declaration    unordered_multimap<int, int> sample;      // inserts key and element    sample.insert({ 1, 2 });    sample.insert({ 1, 2 });    sample.insert({ 2, 3 });    sample.insert({ 3, 4 });    sample.insert({ 2, 6 });      // iterator of pairs pointing to range    // which includes 1 and print by iterating in range    auto itr = sample.equal_range(1);    cout << "Elements with Key 1: ";    for (auto it = itr.first; it != itr.second; it++) {        cout << it->second << " ";    }      cout << endl;      // iterator of pairs pointing to range    // which includes 2 and print by iterating in range    itr = sample.equal_range(2);    cout << "Elements with Key 2: ";    for (auto it = itr.first; it != itr.second; it++) {        cout << it->second << " ";    }      return 0;}
Elements with Key 1: 2 2 
Elements with Key 2: 6 3

Program 2:
// C++ program to illustrate the// unordered_multimap::equal_range()#include <iostream>#include <unordered_map>using namespace std;  int main(){      // declaration    unordered_multimap<char, char> sample;      // inserts key and element    sample.insert({ 'a', 'b' });    sample.insert({ 'a', 'b' });    sample.insert({ 'a', 'd' });    sample.insert({ 'b', 'e' });    sample.insert({ 'b', 'd' });      // iterator of pairs pointing to range    // which includes b and print by iterating in range    auto itr = sample.equal_range('b');    cout << "Elements with Key b: ";    for (auto it = itr.first; it != itr.second; it++) {        cout << it->second << " ";    }      cout << endl;      // iterator of pairs pointing to range    // which includes a and print by iterating in range    itr = sample.equal_range('a');    cout << "Elements with Key a: ";    for (auto it = itr.first; it != itr.second; it++) {        cout << it->second << " ";    }      return 0;}
Elements with Key b: d e 
Elements with Key a: d b b

CPP-Functions
cpp-unordered_multimap
STL
C++
STL
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Guava - BigIntegerMath Class

BigIntegerMath provides utility methods on BigInteger.
Following is the declaration for com.google.common.math.BigIntegerMath class −
@GwtCompatible(emulated = true)
public final class BigIntegerMath
   extends Object
static BigInteger binomial(int n, int k)
Returns n choose k, also known as the binomial coefficient of n and k, that is, n! / (k! (n - k)!).
static BigInteger divide(BigInteger p, BigInteger q, RoundingMode mode)
Returns the result of dividing p by q, rounding using the specified RoundingMode.
static BigInteger factorial(int n)
Returns n!, that is, the product of the first n positive integers, or 1 if n == 0.
static boolean isPowerOfTwo(BigInteger x)
Returns true if x represents a power of two.
static int log10(BigInteger x, RoundingMode mode)
Returns the base-10 logarithm of x, rounded according to the specified rounding mode.
static int log2(BigInteger x, RoundingMode mode)
Returns the base-2 logarithm of x, rounded according to the specified rounding mode.
static BigInteger sqrt(BigInteger x, RoundingMode mode)
Returns the square root of x, rounded with the specified rounding mode.
This class inherits methods from the following class −
java.lang.Object
Create the following java program using any editor of your choice in say C:/> Guava.
import java.math.BigInteger;
import java.math.RoundingMode;

import com.google.common.math.BigIntegerMath;

public class GuavaTester {

   public static void main(String args[]) {
      GuavaTester tester = new GuavaTester();
      tester.testBigIntegerMath();
   }
   
   private void testBigIntegerMath() {
      System.out.println(BigIntegerMath.divide(BigInteger.TEN, new BigInteger("2"), RoundingMode.UNNECESSARY));
      try {
         
         //exception will be thrown as 100 is not completely divisible by 3 
         // thus rounding is required, and RoundingMode is set as UNNESSARY
         System.out.println(BigIntegerMath.divide(BigInteger.TEN, new BigInteger("3"), RoundingMode.UNNECESSARY));
      } catch(ArithmeticException e) {
         System.out.println("Error: " + e.getMessage());
      }

      System.out.println("Log2(2): " + BigIntegerMath.log2(new BigInteger("2"), RoundingMode.HALF_EVEN));

      System.out.println("Log10(10): " + BigIntegerMath.log10(BigInteger.TEN, RoundingMode.HALF_EVEN));

      System.out.println("sqrt(100): " + BigIntegerMath.sqrt(BigInteger.TEN.multiply(BigInteger.TEN), RoundingMode.HALF_EVEN));

      System.out.println("factorial(5): "+BigIntegerMath.factorial(5));
   }
}
Compile the class using javac compiler as follows −
C:\Guava>javac GuavaTester.java

Now run the GuavaTester to see the result.
C:\Guava>java GuavaTester

See the result.
5
Error: Rounding necessary
Log2(2): 1
Log10(10): 1
sqrt(100): 10
factorial(5): 120

 Print
 Add Notes
 Bookmark this page
How to detect orientation change in layout in Android using Kotlin?

Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
Step 2 − Add the following code to res/layout/activity_main.xml.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   tools:context=".MainActivity">
   <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="50dp"
      android:text="Tutorials Point"
      android:textAlignment="center"
      android:textColor="@android:color/holo_green_dark"
      android:textSize="32sp"
      android:textStyle="bold" />
   <TextView
      android:layout_centerInParent="true"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Hello World!"
      android:textSize="24sp"
      android:textStyle="bold" />
</RelativeLayout>
Step 3 − Add the following code to src/MainActivity.kt
import android.content.res.Configuration
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() {
   override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
      title = "KotlinApp"
   }
   override fun onConfigurationChanged(newConfig: Configuration) {
      super.onConfigurationChanged(newConfig)
      if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
         Toast.makeText(baseContext, "Landscape Mode", Toast.LENGTH_SHORT).show()
      } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
         Toast.makeText(baseContext, "Portrait Mode", Toast.LENGTH_SHORT).show()
      }
   }
}
Step 4 − Add the following code to androidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.com.q11">
   <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">
      <activity android:name=".MainActivity">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>
   </application>
</manifest>
Let's try to run your application. I assume you have connected your actual Android Mobile device with your computer. To run the app from android studio, open one of your project's activity files and click the Run icon from the toolbar. Select your mobile device as an option and then check your mobile device which will display your default screen
FLOOR() and CEILING() Function in SQL Server - GeeksforGeeks

29 Sep, 2020
1. FLOOR() Function :The FLOOR() function returns the largest integer value which is less than or equal to a number.
Syntax :
FLOOR(number)
Parameter : Required. A numeric value.number : It is a numeric value.Returns : It returns the integer value.
Example-1 :When the argument holds a positive number.
SELECT FLOOR(21.53);
Output :
21
Example-2 :When the argument holds a negative number.
SELECT FLOOR(-21.53);
Output :
-22
2. CEILING() Function :The CEILING() function returns the smallest integer value which is greater than or equal to a number.
Syntax :
CEILING(number)
Parameter : Required. A numeric value.number : It is a numeric value.Returns : It returns the integer value.
Example-1 :When the argument holds a positive number.
SELECT CEILING(21.53);
Output :
22
Example-2 :When the argument holds a negative number.
SELECT CEILING(-21.53);
Output :
-21
DBMS-SQL
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
SQL Trigger | Student Database
SQL Interview Questions
CTE in SQL
How to Update Multiple Columns in Single Update Statement in SQL?
SQL | GROUP BY
Difference between DELETE, DROP and TRUNCATE
SQL | Views
MySQL | Group_CONCAT() Function
How to Create a Table With Multiple Foreign Keys in SQL?
Difference between DELETE and TRUNCATE
Deque in C++ Standard Template Library (STL) - GeeksforGeeks

17 Jan, 2022
Double-ended queues are sequence containers with the feature of expansion and contraction on both ends. They are similar to vectors, but are more efficient in case of insertion and deletion of elements. Unlike vectors, contiguous storage allocation may not be guaranteed. 
Double Ended Queues are basically an implementation of the data structure double-ended queue. A queue data structure allows insertion only at the end and deletion from the front. This is like a queue in real life, wherein people are removed from the front and added at the back. Double-ended queues are a special case of queues where insertion and deletion operations are possible at both the ends.
The functions for deque are same as vector, with an addition of push and pop operations for both front and back.  
CPP
// CPP Program to implement Deque in STL#include <deque>#include <iostream> using namespace std; void showdq(deque<int> g){    deque<int>::iterator it;    for (it = g.begin(); it != g.end(); ++it)        cout << '\t' << *it;    cout << '\n';} int main(){    deque<int> gquiz;    gquiz.push_back(10);    gquiz.push_front(20);    gquiz.push_back(30);    gquiz.push_front(15);    cout << "The deque gquiz is : ";    showdq(gquiz);     cout << "\ngquiz.size() : " << gquiz.size();    cout << "\ngquiz.max_size() : " << gquiz.max_size();     cout << "\ngquiz.at(2) : " << gquiz.at(2);    cout << "\ngquiz.front() : " << gquiz.front();    cout << "\ngquiz.back() : " << gquiz.back();     cout << "\ngquiz.pop_front() : ";    gquiz.pop_front();    showdq(gquiz);     cout << "\ngquiz.pop_back() : ";    gquiz.pop_back();    showdq(gquiz);     return 0;}
The deque gquiz is :     15    20    10    30

gquiz.size() : 4
gquiz.max_size() : 4611686018427387903
gquiz.at(2) : 10
gquiz.front() : 15
gquiz.back() : 30
gquiz.pop_front() :     20    10    30

gquiz.pop_back() :     20    10
Method
Definition
Recent Articles on Deque
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. 
dkp1903
akshitsaxenaa09
anshikajain26
cpp-containers-library
cpp-deque
deque
STL
C++
STL
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Vector in C++ STL
Initialize a vector in C++ (6 different ways)
Socket Programming in C/C++
std::sort() in C++ STL
Bitwise Operators in C/C++
Virtual Function in C++
Iterators in C++ STL
Templates in C++ with Examples
rand() and srand() in C/C++
unordered_map in C++ STL
How to edit the CSV file using PowerShell?

To edit the CSV file using PowerShell, you need to use the below commands.
We already have the CSV file output.csv, we will import this file first.
$csvfile = Import-csv C:\temp\Outfile.csv
Below is the output of the CSV file.
EMP_Name    EMP_ID     CITY
--------    ------     ----
Charles     2000       New York
James       2500       Scotland
Charles     3000       Poland
We need to update the above file. We will change the CITY of the EMP_ID ‘3000’ to MUMBAI. If we update the CITY name by the EMP_Name, it will update two rows as there two Charles, therefore we will use the EMP_ID token here.
$csv |foreach{if($_.Emp_ID -eq "3000"){$_.City = "Mumbai"}}
$csv |Export-Csv $outfile
EMP_Name       EMP_ID       CITY
--------       ------       ----
Charles        2000         New York
James          2500         Scotland
Charles        3000         Mumbai
Python | Numpy np.hypergeometric() method - GeeksforGeeks

18 Oct, 2019
With the help of np.hypergeometric() method, we can get the hypergeometric distribution in the form of an array by using np.hypergeometric() method.
Syntax : np.hypergeometric(ngood, nbad, samples, size)Return : Return an array of hypergeometric distribution.
Example #1 :In this example we can see that by using np.hypergeometric() method, we are able to get the hypergeometric distribution in the form of an array.
# import numpyimport numpy as np  # using np.hypergeometric() methodgfg = np.random.hypergeometric(50, 5, 5, 20)  print(gfg)
Output :
array([4, 5, 5, 5, 4, 5, 5, 5, 4, 5, 4, 5, 4, 4, 5, 5, 3, 5, 4, 5])
Example #2 :
# import numpyimport numpy as np  # using np.hypergeometric() methodgfg = np.random.hypergeometric(150, 50, 50, 20)  print(gfg)
Output :
[37 35 40 33 43 37 38 38 36 41 42 32 36 35 36 38 35 35 36 35]
Python numpy-arrayManipulation
Python-numpy
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 ?
Selecting rows in pandas DataFrame based on conditions
How to drop one or multiple columns in Pandas Dataframe
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | Get unique values from a list
Defaultdict in Python
Python OOPs Concepts
Python | os.path.join() method
Python | Pandas dataframe.groupby()
How to change spinner text size and text color in Android App using Kotlin?

This example demonstrates how to change spinner text size and text color in Android App using Kotlin.
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
Step 2 − Add the following code to res/layout/activity_main.xml.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:gravity="center"
   tools:context=".MainActivity">  
   <Spinner
      android:id="@+id/spinner"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />
</RelativeLayout>
Step 3 − Add the following code to src/MainActivity.kt
import android.os.Bundle
import android.widget.ArrayAdapter
import android.widget.Spinner
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() {
   lateinit var spinner: Spinner
      override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
      title = "KotlinApp"
      spinner = findViewById(R.id.spinner)
      val superHero = arrayOf<String?>("Batman", "SuperMan", "Flash", "AquaMan", "Shazam")
      val arrayAdapter: ArrayAdapter<Any?> = ArrayAdapter<Any?>(this, R.layout.spinner_list, superHero)
      arrayAdapter.setDropDownViewResource(R.layout.spinner_list)
      spinner.adapter = arrayAdapter
   }
}
Step 4 − Create a layout resource file and add the following code in spinner_list.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:padding="10dp"
   android:textColor="@android:color/holo_red_light"
   android:textSize="16sp"
   android:textStyle="bold|italic" />
Step 5 − Add the following code to androidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app.com.q11">
   <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">
      <activity android:name=".MainActivity">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>
   </application>
</manifest>
Let's try to run your application. I assume you have connected your actual Android Mobile device with your computer. To run the app from android studio, open one of your project's activity files and click the Run icon from the toolbar. Select your mobile device as an option and then check your mobile device which will display your default screen.
Number of operations required to make all array elements Equal in Python

We have given an array of elements, and we have to make them all equal by incrementing the elements by 1. We are allowed to increment n - 1 element at each step. Our goal is to calculate the total number of operations required to make all the array elements equal.
For example, if you take the list [1, 2, 3], it took three operations to make all the elements equal. One solution to the problem is. Find the most significant number at each step and increment the rest of the elements by 1. Let's write the code.
 Live Demo
def main():
   # intializing the array
   arr = [1, 2, 3]
   # initializing operations count to 0
   no_of_operations = 0
   flag = 0
   # performing the operations on array to make them equal
   while not are_equal(arr):
      flag = 1
      # finding the maximum from the list
      maximum = max(arr)
      # incrementing all the elements except maximum
      for i in range(len(arr)):
         if arr[i] != maximum:
            arr[i] += 1
      # incrementing the operations count by 1
      no_of_operations += 1
   print(no_of_operations) if flag == 0 else print(no_of_operations + 1)
# checking whether all the elements are equal or not
def are_equal(arr):
   global no_of_operations
   for i in range(len(arr) - 1):
      if arr[i] != arr[i + 1]:
         return False
   return True
if __name__ == '__main__':
   main()
If you run the above program, you will get the following results.
3
The above method takes more time to compute for large arrays. We can find the number of operations by finding the sum and the smallest element of the array.
Find the sum of the array.
Find the smallest of all elements in the array.
Print the value get from the expression sum - (length - smallest).
See the code below.
 Live Demo
# initializing an array
arr = [1, 2, 3]
# length
length = len(arr)
# sum of element fo the array
elements_sum = sum(arr)
# smallest among all the elements
smallest = min(arr)
# calculating the number of operations
print(elements_sum - (length * smallest))
If you run the above code, you will get the following results.
3
The second method that we discussed is easier and takes less time compared to the first method. If you have any doubts in the tutorial, mention them in the comment section.
Python - Maxwell Distribution in Statistics - GeeksforGeeks

31 Dec, 2019
scipy.stats.maxwell() is a Maxwell (Pareto of the second kind) continuous random variable. It is inherited from the of generic methods as an instance of the rv_continuous class. It completes the methods with details specific for this particular distribution.
Parameters :
q : lower and upper tail probabilityx : quantilesloc : [optional]location parameter. Default = 0scale : [optional]scale parameter. Default = 1size : [tuple of ints, optional] shape or random variates.moments : [optional] composed of letters [‘mvsk’]; ‘m’ = mean, ‘v’ = variance, ‘s’ = Fisher’s skew and ‘k’ = Fisher’s kurtosis. (default = ‘mv’).
Results : Maxwell continuous random variable
Code #1 : Creating Maxwell continuous random variable
# importing library  from scipy.stats import maxwell      numargs = maxwell.numargs a, b = 4.32, 3.18rv = maxwell(a, b)     print ("RV : \n", rv)  
Output :
RV : 
 scipy.stats._distn_infrastructure.rv_frozen object at 0x000002A9D66DEC88

Code #2 : Maxwell continuous variates and probability distribution
import numpy as np quantile = np.arange (0.01, 1, 0.1)   # Random Variates R = maxwell.rvs(a, b) print ("Random Variates : \n", R)   # PDF R = maxwell.pdf(a, b, quantile) print ("\nProbability Distribution : \n", R) 
Output :
Random Variates : 
 8.999401872992793

Probability Distribution : 
 [0.00000000e+00 3.70579394e-21 4.46576264e-05 4.02803131e-02
 3.15216150e-01 6.42768234e-01 7.96800760e-01 7.98281605e-01
 7.24720266e-01 6.27826999e-01]


Code #3 : Graphical Representation.
import numpy as np import matplotlib.pyplot as plt      distribution = np.linspace(0, np.minimum(rv.dist.b, 3)) print("Distribution : \n", distribution)      plot = plt.plot(distribution, rv.pdf(distribution)) 
Output :
Distribution : 
 [0.         0.06122449 0.12244898 0.18367347 0.24489796 0.30612245
 0.36734694 0.42857143 0.48979592 0.55102041 0.6122449  0.67346939
 0.73469388 0.79591837 0.85714286 0.91836735 0.97959184 1.04081633
 1.10204082 1.16326531 1.2244898  1.28571429 1.34693878 1.40816327
 1.46938776 1.53061224 1.59183673 1.65306122 1.71428571 1.7755102
 1.83673469 1.89795918 1.95918367 2.02040816 2.08163265 2.14285714
 2.20408163 2.26530612 2.32653061 2.3877551  2.44897959 2.51020408
 2.57142857 2.63265306 2.69387755 2.75510204 2.81632653 2.87755102
 2.93877551 3.        ]
 
Code #4 : Varying Positional Arguments
import matplotlib.pyplot as plt import numpy as np      x = np.linspace(0, 5, 100)      # Varying positional arguments y1 = maxwell .pdf(x, 1, 3) y2 = maxwell .pdf(x, 1, 4) plt.plot(x, y1, "*", x, y2, "r--") 
Output :
Python scipy-stats-functions
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Enumerate() in Python
How to Install PIP on Windows ?
Different ways to create Pandas Dataframe
Python String | replace()
Create a Pandas DataFrame from Lists
*args and **kwargs in Python
sum() function in Python
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?
Instruction type MOV M, r in 8085 Microprocessor

In 8085 Instruction set, this instruction MOV M, r will copy 8-bit value from the register r to the memory location as pointed by HL register pair.This instruction uses register addressing for specifying the data.
As “r” can have any one of the seven values −
r = A, B, C, D, E, H, or L

Thus there are seven opcodes for this type of instruction. It occupies only 1-Byte in memory.
MOV M, E is an example instruction of this type. It is a 1-Byte instruction. Let us suppose, E is having the initial value ABH, HL register pair is pointing to the memory location 4050H, 4050H memory location’s content is CDH. Then after execution of the instruction MOV M, E, E register’s content will be CDH. The result of execution of this instruction is shown with this example is shown below −
(E)
(HL)
(4050H)
Here is the timing diagram of the instruction MOV M, E as below.
Summary − So this instruction MOV M, E requires 1-Byte, 2-Machine Cycles (Opcode Fetch, Memory Read) and 7 T-States for execution as shown in the timing diagram.
Program to convert a Vector to List in Java

Let’s say the following is our vector with values −
Vector<String> v = new Vector<String>();
v.add("20");
v.add("40");
v.add("60");
v.add("80");
v.add("100");
Now, convert the above Vector to List −
List<String>myList = new ArrayList<String>(v);
Following is the program to convert a Vector to List in Java −
import java.util.*;
public class Demo {
   public static void main(String[] args) {
      Vector<String> v = new Vector<String>();
      v.add("20");
      v.add("40");
      v.add("60");
      v.add("80");
      v.add("100");
      v.add("120");
      v.add("140");
      v.add("160");
      v.add("200");
      System.out.println("Vector elements = " + v);
      List<String>myList = new ArrayList<String>(v);
      System.out.println("List (Vector to List) = " + myList);
   }
}
Vector elements = [20, 40, 60, 80, 100, 120, 140, 160, 200]
List (Vector to List) = [20, 40, 60, 80, 100, 120, 140, 160, 200]
Let us see another example −
import java.util.*;
public class Demo {
   public static void main(String[] args) {
      Vector<String> v = new Vector<String>();
      v.add("20");
      v.add("40");
      v.add("60");
      v.add("80");
      v.add("100");
      v.add("120");
      v.add("140");
      v.add("160");
      v.add("200");
      System.out.println("Vector elements = " + v);
      List<String>myList = Collections.list(v.elements());
      System.out.println("List (Vector to List) = " + myList);
   }
}
Vector elements = [20, 40, 60, 80, 100, 120, 140, 160, 200]
List (Vector to List) = [20, 40, 60, 80, 100, 120, 140, 160, 200]
How to make MySQL table primary key auto increment?

To make MySQL table primary key auto increment, use the below syntax
CREATE TABLE yourTableName
   (
   yourColumnName INT(6) ZEROFILL NOT NULL AUTO_INCREMENT,
   PRIMARY KEY(yourColumnName)
   );
Let us first create a table and set primary key auto increment −
mysql> CREATE TABLE DemoTable
   (
   UserId INT(6) ZEROFILL NOT NULL AUTO_INCREMENT,
   PRIMARY KEY(UserId)
   );
Query OK, 0 rows affected (0.81 sec)
Insert some records in the table using insert command −
mysql> INSERT INTO DemoTable values();
Query OK, 1 row affected (0.12 sec)

mysql> INSERT INTO DemoTable values();
Query OK, 1 row affected (0.13 sec)

mysql> INSERT INTO DemoTable values();
Query OK, 1 row affected (0.10 sec)

mysql> INSERT INTO DemoTable values();
Query OK, 1 row affected (0.44 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+--------+
| UserId |
+--------+
| 000001 |
| 000002 |
| 000003 |
| 000004 |
+--------+
4 rows in set (0.00 sec)
\rlap - Tex Command

\rlap - Used for right overlap.
{ \rlap #1 }
\rlap command is used for right overlap. It creates a box of width zero; the argument is then placed just to the right of this zero-width box and hence will overlap whatever lies to the right.

a\mathrel{\rlap{\;/}{=}}b

a/=b



a\mathrel{\rlap{\;/}{=}}b

a/=b


a\mathrel{\rlap{\;/}{=}}b

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
Delete multiple occurrences of key in Linked list using double pointer - GeeksforGeeks

05 Jun, 2018
Given a singly linked list, delete all occurrences of a given key in it. For example, consider the following list.
Input: 2 -> 2 -> 4 -> 3 -> 2
       Key to delete = 2
Output:  4 -> 3 

This is mainly an alternative of this post which deletes multiple occurrences of a given key using separate condition loops for head and remaining nodes. Here we use a double pointer approach to use a single loop irrespective of the position of the element (head, tail or between). The original method to delete a node from a linked list without an extra check for the head was explained by Linus Torvalds in his “25th Anniversary of Linux” TED talk. This article uses that logic to delete multiple recurrences of the key without an extra check for the head.
Explanation:1. Store address of head in a double pointer till we find a non “key” node. This takes care of the 1st while loop to handle the special case of the head.2. If a node is not “key” node then store the address of node->next in pp.3. if we find a “key” node later on then change pp (ultimately node->next) to point to current node->next.
Following is C++ implementation for the same.
// CPP program to delete multiple// occurrences of a key using single// loop.#include <iostream>using namespace std;  // A linked list nodestruct Node {    int data;    struct Node* next;};  struct Node* head = NULL;  void printList(struct Node* node){    while (node != NULL) {        printf(" %d ", node->data);        node = node->next;    }}  void push(int new_data){    struct Node* new_node = new Node;    new_node->data = new_data;    new_node->next = (head);    (head) = new_node;}  void deleteEntry(int key){    // Start from head    struct Node** pp = &head;    while (*pp) {          struct Node* entry = *pp;          // If key found, then put        // next at the address of pp        // delete entry.        if (entry->data == key) {            *pp = entry->next;            delete (entry);        }          // Else move to next        else            pp = &(entry->next);    }}  int main(){    push(2);    push(2);    push(4);    push(3);    push(2);      int key = 2; // key to delete      puts("Created Linked List: ");    printList(head);    printf("\n");    deleteEntry(key);    printf("\nLinked List after Deletion of 2: \n");    printList(head);    return 0;}
Created Linked List: 
 2  3  4  2  2 

Linked List after Deletion of 2: 
 3  4

cpp-double-pointer
cpp-pointer
Linked List
Linked List
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Delete a node in a Doubly Linked List
Given a linked list which is sorted, how will you insert in sorted way
Insert a node at a specific position in a linked list
Circular Linked List | Set 2 (Traversal)
Program to implement Singly Linked List in C++ using class
Swap nodes in a linked list without swapping data
Priority Queue using Linked List
Circular Singly Linked List | Insertion
Real-time application of Data Structures
Insertion Sort for Singly Linked List