code-rag-bench/online-tutorials huggingface dataset:
MySQL query to select records with a particular date and time?

You can use BETWEEN clause from MySQL to select records with a particular date and time. The syntax is as follows.
select *from AllRecordsFromadate where AdmissionDate between 'yourDateTimeValue1 ' and ''yourDateTimeValue2';
To understand the above syntax, let us first create a table. The query to create a table is as follows.
mysql> create table AllRecordsFromadate
-> (
-> Id int,
-> Name varchar(100),
-> Age int,
-> AdmissionDate datetime
-> );
Query OK, 0 rows affected (0.53 sec)
Insert some records in the table using insert command. The query to insert records is as follows.
mysql> insert into AllRecordsFromadate values(101,'John',23,'2018-10-13');
Query OK, 1 row affected (0.18 sec)

mysql> insert into AllRecordsFromadate values(102,'Carol',24,'2014-12-5 12:34:50');
Query OK, 1 row affected (0.18 sec)

mysql> insert into AllRecordsFromadate values(103,'Mike',25,'2014-12-5 12:30:40');
Query OK, 1 row affected (0.23 sec)

mysql> insert into AllRecordsFromadate values(104,'Bob',24,'2015-10-7 11:10:20');
Query OK, 1 row affected (0.20 sec)

mysql> insert into AllRecordsFromadate values(105,'Sam',25,'2011-6-26 10:10:20');
Query OK, 1 row affected (0.11 sec)
Display all records from the table using select command. The query is as follows.
mysql> select *from AllRecordsFromadate;
The following is the output.
+------+-------+------+---------------------+
| Id   | Name  | Age  | AdmissionDate       |
+------+-------+------+---------------------+
| 101  | John  | 23   | 2018-10-13 00:00:00 |
| 102  | Carol | 24   | 2014-12-05 12:34:50 |
| 103  | Mike  | 25   | 2014-12-05 12:30:40 |
| 104  | Bob   | 24   | 2015-10-07 11:10:20 |
| 105  | Sam   | 25   | 2011-06-26 10:10:20 |
+------+-------+------+---------------------+
5 rows in set (0.00 sec)
The following is the query can be used for specific date and time.
mysql> select *from AllRecordsFromadate where AdmissionDate between '2014-12-05 10:00:00' and '2014-12-05 12:50:58';
The following is the output.
+------+-------+------+---------------------+
| Id   | Name  | Age  | AdmissionDate       |
+------+-------+------+---------------------+
| 102  | Carol | 24   | 2014-12-05 12:34:50 |
| 103  | Mike  | 25   | 2014-12-05 12:30:40 |
+------+-------+------+---------------------+
2 rows in set (0.00 sec)
How to capture index out of range exception in C#?

IndexOutOfRangeException occurs when you try to access an element with an index that is outsise the bounds of the array.
Let’s say the following is our array. It has 5 elements −
int [] n = new int[5] {66, 33, 56, 23, 81};
Now if you will try to access elements with index more than 5, then the IndexOutOfRange Exception is thrown −
for (j = 0; j < 10; j++ ) {
Console.WriteLine("Element[{0}] = {1}", j, n[j]);
}
In the above example, we are trying to access above index 5, therefore the following error occurs −
System.IndexOutOfRangeException: Index was outside the bounds of the array.
Here is the complete code −
 Live Demo
using System;

namespace Demo {
   class MyArray {
      static void Main(string[] args) {
         try {
            int [] n = new int[5] {66, 33, 56, 23, 81};
            int i,j;
            // error: IndexOutOfRangeException
            for (j = 0; j < 10; j++ ) {
               Console.WriteLine("Element[{0}] = {1}", j, n[j]);
            }
            Console.ReadKey();
         } catch (System.IndexOutOfRangeException e) {
            Console.WriteLine(e);
         }
      }
   }
}
Element[0] = 66
Element[1] = 33
Element[2] = 56
Element[3] = 23
Element[4] = 81
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Demo.MyArray.Main (System.String[] args) [0x00019] in <6ff1dbe1755b407391fe21dec35d62bd>:0
The code will generate an error −
System.IndexOutOfRangeException −Index was outside the bounds of the array.
QTP Working with XML

XML is a markup language designed to store data in a format that can be both readable by human and machine. Using XML, data can also be easily exchanged between computer and database systems.
Sample XML and their key elements are represented below −
Const XMLDataFile = "C:\TestData.xml"
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False
xmlDoc.Load(XMLDataFile)

' Getting the number of Nodes (books)
Set nodes = xmlDoc.SelectNodes("/bookstore/book")
Print "Total books: " & nodes.Length    ' Displays 2

' get all titles
Set nodes = xmlDoc.SelectNodes("/Booklib/book/value/text()")

' get their values
For i = 0 To (nodes.Length - 1)
   Title = nodes(i).NodeValue
   Print "Title is" & (i + 1) & ": " & Title
Next
We can compare two given XMLs −
Dim xmlDoc1
Dim xmlDoc2

' Load the XML Files
Set xmlDoc1 = XMLUtil.CreateXMLFromFile ("C:\File1.xml")
Set xmlDoc2 = XMLUtil.CreateXMLFromFile ("C:\File2.xml")

'Use the compare method of the XML to check if they are equivalent
Comp = xmlDoc1.Compare (xmlDoc1, xmlDoc2)

'Returns 1 if the two files are the same
If Comp = 1 Then
   Msgbox "XML Files are the Same"
Else
   Msgbox "XML Files are Different"
End if

    108 Lectures 
     8 hours 

 Pavan Lalwani
 Print
 Add Notes
 Bookmark this page
Blackeye Phishing Tool in Kali Linux - GeeksforGeeks

28 Nov, 2021
Blackeye is a powerful open-source tool Phishing Tool. Blackeye is becoming very popular nowadays that is used to do phishing attacks on Target. Blackeye is an easy  Social Engineering Toolkit. Blackeye contains some templates generated by another tool called Blackeye. This tool makes it easy to perform phishing attacks. There is a lot of creativity that they can put into making the email look as legitimate as possible. Blackeye offers phishing templates web pages for 33 popular sites such as Facebook, Instagram, Google, Snapchat, GitHub, Yahoo, Protonmail, Spotify, Netflix, Linkedin, WordPress, Origin, Steam, Microsoft, etc. Blackeye also provides an option to use a custom template if someone wants.
Step 1: Open your kali Linux operating system and use the following command to install the tool.
git clone https://github.com/thelinuxchoice/blackeye
Step 2: Now use the following command to move into the directory of the tool.
cd blackeye
ls
Step 3: Now use the following command to run the tool.
bash blackeye.sh
The tool has been installed successfully now if you want to perform a phishing attack on your victims choose any option from the menu list of the blackeye and blackeye will create the phishing link of the respective website which you can send to your victims. For example, if you choose Instagram choose option 1.
The tool has created some target links use these links and send them to the victim. Once the victim filled his/her id password it will reflect in the terminal.
The user has filled in the details.
You can see that the credentials are visible in the terminal.
Example: Use the blackeye tool to get credentials of google account.
Step 1: Choose option 6.
6
Step 2: Send the ngrok link to the victim. Once he/she adds his/her account details it will be reflected on the terminal.
Step 3: You can see the tool has found credentials.
Similarly, you perform experiments using the blackeye tool. The tool is free to use.
Kali-Linux
Linux-Tools
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
nohup Command in Linux with Examples
scp command in Linux with Examples
Thread functions in C/C++
mv command in Linux with examples
chown command in Linux with Examples
SED command in Linux | Set 2
Docker - COPY Instruction
Array Basics in Shell Scripting | Set 1
Basic Operators in Shell Scripting
nslookup command in Linux with Examples
Ways to Create NaN Values in Pandas DataFrame - GeeksforGeeks

08 Dec, 2021
Let’s discuss ways of creating NaN values in the Pandas Dataframe. There are various ways to create NaN values in Pandas dataFrame. Those are:
Using NumPy
Importing csv file having blank values
Applying to_numeric function
Method 1: Using NumPy
Python3
import pandas as pdimport numpy as np  num = {'number': [1,2,np.nan,6,7,np.nan,np.nan]}df = pd.DataFrame(num)  df
Method 2: Importing the CSV file having blank instances
Consider the below csv file named “Book1.csv”:
Code:
Python3
# import pandasimport pandas as pd  # read filedf = pd.read_csv("Book1.csv")  # print valuesdf
You will get Nan values for blank instances.
Method 3: Applying to_numeric function
to_numeric function converts arguments to a numeric type.
Example:
Python3
import pandas as pd  num = {'data': [1,"hjghjd",3,"jxsh"]}df = pd.DataFrame(num)  # this will convert non-numeric # values into NaN valuesdf = pd.to_numeric(df["data"], errors='coerce')  df
Output:
anikaseth98
Python pandas-dataFrame
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Python | Get unique values from a list
Defaultdict in Python
Python | os.path.join() method
Create a directory in Python
Python | Pandas dataframe.groupby()
PHP | die() & sleep() functions - GeeksforGeeks

11 Apr, 2022
die()
The die() is an inbuilt function in PHP. It is used to print message and exit from the current php script. It is equivalent to exit() function in PHP. Syntax :
die($message)
Parameters : This function accepts only one parameter and which is not mandatory to be passed.
$message : This parameter represents the message to printed while exiting from script.
Return Value : It has no return value but prints given message while exiting the script. 
Examples :
Input : die("code ends here")
Output : code ends here

Here, die() function ends the 
script with a message "code
ends here "
Applicable versions : This function is applicable in all PHP4 and later versions. 
Program : 
PHP
<?php// blank url of site// so that die() is executed$site = ""; // open url else die (exit)fopen($site, "r")or die("Unable to connect to given site.");?>
Output :
Unable to connect to given site.
sleep()
The sleep() is an inbuilt function in PHP. It is used to delay the execution of the program for given amount of seconds. 
Syntax :
int sleep(int $seconds)
Parameters : This function accepts only one parameter and which is mandatory to be passed.
$seconds : This parameter represents the delay time in seconds.
Return Value : It returns zero on success, or FALSE on error. This function returns a non-zero value if the call was interrupted by a signal. 
Errors / Exceptions : This function generates E_WARNING when the number of seconds is negative. 
Applicable versions : This function is applicable in PHP 4, PHP 5, PHP 7. 
Program : 
PHP
<?php// initial timingsecho date('h:i:s') . "\n"; // halt for 5 secondssleep(5); // timings after haltecho date('h:i:s');?>
Output :
01:07:16
01:07:21
Note that, Timing after halt (sleep) is 5 seconds more than timings before halt (sleep). 
References: http://php.net/manual/en/function.die.php http://php.net/manual/en/function.sleep.php
Let us see both the functions in a Tabular form -:
mayank007rawa
PHP-function
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to convert array to string in PHP ?
PHP | Converting string to Date and DateTime
How to pass JavaScript variables to PHP ?
Split a comma delimited string into an array in PHP
Download file from URL using PHP
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
How to Set Text of Tkinter Text Widget With a Button? - GeeksforGeeks

23 Dec, 2020
Prerequisite: Python GUI – tkinter
Text Widget is used where a user wants to insert multi-line text fields. In this article, we are going to learn the approaches to set the text inside the text fields of the text widget with the help of a button.
Import the Tkinter module.
Create a GUI window.
Create our text widget
Creating the function to set the text with the help of a button. This function contains one insert method and one delete method. The delete method is called first to delete the remaining text inside the text widget. It will delete anything in the given range of 0 to end.
Then the insert method is called to insert the text we want to push into the text widget. It takes in two parameters, one is the position we want to insert and the second is the desired text we want to set in the form of a string.
The button is created and the function is parsed as a command inside it.
Below is the implementation of the above approach
Python3
# Import the tkinter moduleimport tkinter  # Creating the GUI window.window = tkinter.Tk()window.title("Welcome to geeksforgeeks")window.geometry("800x100")  # Creating our text widget.sample_text = tkinter.Entry(window)sample_text.pack()  # Creating the function to set the text # with the help of buttondef set_text_by_button():      # Delete is going to erase anything    # in the range of 0 and end of file,    # The respective range given here    sample_text.delete(0,"end")          # Insert method inserts the text at    # specified position, Here it is the    # begining    sample_text.insert(0, "Text set by button")  # Setting up the button, set_text_by_button() # is passed as a commandset_up_button = tkinter.Button(window, height=1, width=10, text="Set",                     command=set_text_by_button)  set_up_button.pack()  window.mainloop()
Output:
Picked
Python-tkinter
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Python | Get unique values from a list
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
How to Convert Numbers to Dates in R? - GeeksforGeeks

28 Dec, 2021
In this article, we will discuss how to convert Numbers to Dates in R programming language.
Here we have to consider an integer and then first we have to convert that integer into a character using as.character() function and then convert that character using as.Date() function and finally convert into date using “%Y%m%d” format
Syntax:
 as.Date(as.character(integer),format = “%Y%m%d”)
where, an integer is an input number
Example: Convert Numbers to date
R
# declare an integerdata=2021112 # displayprint( as.Date(as.character(data),format = "%Y%m%d")) # declare an integerdata1=20201209 # displayprint( as.Date(as.character(data1),format = "%Y%m%d"))
 Output: 
[1] "2021-11-02"
[1] "2020-12-09"
strptime() is used to convert into the date from an integer in the “%Y%m%d” format
Syntax:
strptime(integer, format = "%Y%m%d")
Example: Convert Numbers to date
R
# declare an integerdata=2021112 # displayprint( strptime(data, format = "%Y%m%d")) # declare an integerdata1=20201209 # displayprint( strptime(data1, format = "%Y%m%d"))
 Output:
[1] "2021-11-02 UTC"
[1] "2020-12-09 UTC"
Here ymd() is used to convert the integer into year, month, and date which is available in lubridate() package 
Syntax:
ymd(integer)
Example: Convert Numbers to date
R
# load the packagelibrary("lubridate") # declare an integerdata=2021112 # displayprint(ymd(data)) # declare an integerdata1=20201209 # displayprint(ymd(data1))
 Output:
[1] "202-11-12"
[1] "2020-12-09"
surindertarika1234
Picked
R-DateTime
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
How to import an Excel File into R ?
R - if statement
Time Series Analysis in R
Plot mean and standard deviation using ggplot2 in R
How to convert CSV columns to text in Python? - GeeksforGeeks

13 Jan, 2021
In this article, we are going to see how to convert CSV columns to text in Python, and we will also see how to convert all CSV column to text.
Approach:
Read .CSV file using pandas dataframe.
Convert particular column to list using list() constructor
Then sequentially convert each element of the list to a string and join them using a specific character or space.
For our program we are going to use the following CSV file:
Code:
Python3
# importing libraryimport pandas as pd  # Then loading csv filedf = pd.read_csv('datasets/Fruit.csv')  # converting ;FRUIT_NAME' column into lista = list(df['FRUIT_NAME'])  # converting list into string and then joining it with spaceb = ' '.join(str(e) for e in a)  # printing resultprint(b)  # converting 'PRICE' column into listd = list(df['PRICE'])  # another way for joining usede = '\n'.join(map(str, d))  # printing resultprint(e)
Output:
Apple Banana JackFruit Orange Pineapple Guava Grapes Mango

100
70
30
120
90
50
80
200
For this, we don’t need to import any library.
Code:
Python3
# reading csv filetext = open("datasets/Fruit.csv", "r")  # joining with space content of texttext = ' '.join([i for i in text])    # replacing ',' by spacetext = text.replace(",", " ")    #displaying resultprint(text)
Output:
FRUIT_NAME PRICE
Apple 100
Banana 70
JackFruit 30
Orange 120
Pineapple 90
Guava 50
Grapes 80
Mango 200
Picked
python-csv
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Python | Get unique values from a list
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
Drop Collection if already exists in MongoDB using Python - GeeksforGeeks

26 May, 2020
Using drop() method we can drop collection data if data is already exist. If data is not found then it returns False otherwise it returns True if collection is dropped. 
Syntax: 
drop()

Example 1: 
Sample Database:
Python3
import pymongo    client = pymongo.MongoClient("mongodb://localhost:27017/")  # Database namedb = client["mydatabase"]  # Collection namecol = db["gfg"]  # drop collection col1print(col.drop())
Output: 
Example 2: If collection does not exist.  
Python3
import pymongo    client = pymongo.MongoClient("mongodb://localhost:27017/")  # Database namedb = client["mydatabase"]  # Collection namecol = db["gfg"]  # drop collection col1if col.drop():    print('Deleted')else:    print('Not Present')
Output:
Not Present
Python-mongoDB
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
How to Install PIP on Windows ?
Different ways to create Pandas Dataframe
Python String | replace()
*args and **kwargs in Python
Create a Pandas DataFrame from Lists
Convert integer to string in Python
Check if element exists in list in Python
sum() function in Python
How To Convert Python Dictionary To JSON?
Python 3 | Program to print double sided stair-case pattern - GeeksforGeeks

25 Jan, 2018
Below mentioned is the python 3 program to print the double sided stair case pattern.
Examples:
Input : 10
Output :

                 *   * 
                 *   * 
             *   *   *   * 
             *   *   *   * 
         *   *   *   *   *   * 
         *   *   *   *   *   * 
     *   *   *   *   *   *   *   * 
     *   *   *   *   *   *   *   * 
 *   *   *   *   *   *   *   *   *   * 
 *   *   *   *   *   *   *   *   *   * 


Note : This code only works for even values of n.
# Python3 Program to demonstrate # staircase pattern  # function definitiondef pattern(n):      # for loop for rows    for i in range(1,n+1):          # conditional operator        k =i + 1 if(i % 2 != 0) else i          # for loop for printing spaces        for g in range(k,n):            if g>=k:                print(end="  ")          # according to value of k carry        # out further operation        for j in range(0,k):            if j == k - 1:                print(" * ")            else:                print(" * ", end = " ")    # Driver coden = 10pattern(n)
Output:

                 *   * 
                 *   * 
             *   *   *   * 
             *   *   *   * 
         *   *   *   *   *   * 
         *   *   *   *   *   * 
     *   *   *   *   *   *   *   * 
     *   *   *   *   *   *   *   * 
 *   *   *   *   *   *   *   *   *   * 
 *   *   *   *   *   *   *   *   *   * 


pattern-printing
Python Programs
School Programming
pattern-printing
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Convert a list to dictionary
Python | Convert string dictionary to dictionary
Python program to check whether a number is Prime or not
Python Program for Binary Search (Recursive and Iterative)
Python Program for Fibonacci numbers
Python Dictionary
Arrays in C/C++
Inheritance in C++
Reverse a string in Java
C++ Classes and Objects
Array of Strings in C++

Array of strings can be created in C++ using string keyword. Here we are discussing a C++ program by using this approach.
Begin
   Initialize the elements of array by string keyword. And take string as input.
   Print the array.
End.
 Live Demo
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
   string Fruit[3] = {"Grape", "Mango", "Orange"};
   cout <<"The name of fruits are:"<< "\n";
   for (int i = 0; i < 3; i++)
      cout<< Fruit[i]<<",";
   return 0;
}
The name of fruits are:
Grape, Mango, Orange
Mongoose | countDocuments() Function

17 Nov, 2020
The countDocuments() function is used to count the number of documents that match the filter in a database collection.
Installation of mongoose module: 
You can visit the link to Install mongoose module. You can install this package by using this command.
npm install mongoose


After installing mongoose module, you can check your mongoose version in the command prompt using the command.
npm version mongoose


After that, you can just create a folder and add a file, for example, index.js. To run this file you need to run the following command.
node index.js



Filename: index.js 
Javascript
const mongoose = require('mongoose'); // Database Connectionmongoose.connect('mongodb://127.0.0.1:27017/geeksforgeeks', {    useNewUrlParser: true,    useCreateIndex: true,    useUnifiedTopology: true}); // User modelconst User = mongoose.model('User', {    name: { type: String },    age: { type: Number }}); User.countDocuments({age:{$gte:5}}, function (err, count) {    if (err){        console.log(err)    }else{        console.log("Count :", count)    }});
Steps to run the program: 
The project structure will look like this:
Make sure you have installed mongoose module using the following command:
npm install mongoose


Below is the sample data in the database before the function is executed. You can use any GUI tool or terminal to see the database like we have used Robo3T GUI tool as shown below:  
Run index.js file using below command:
node index.js


So this is how you can use the mongoose countDocuments() function which function counts a number of documents matching filter in a database collection. 
sarafvikas5
Mongoose
MongoDB
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Spring Boot JpaRepository with Example
Mongoose Populate() Method
MongoDB - db.collection.Find() Method
Aggregation in MongoDB
Upsert in MongoDB
How to update Node.js and NPM to next version ?
Installation of Node.js on Linux
Node.js fs.readFileSync() Method
Node.js fs.writeFile() Method
How to install the previous version of node.js and npm ?
List out all the Shells Using Linux Commands

22 Jun, 2020
There are various methods to list all the shells which are installed in our Linux system. A Shell is a software program that acts as an interface between the user and the operating system(OS). It can also be thought of as a command interpreter that is used to execute another program.
Method 1: Using cat command
Example:
cat /etc/shells
Using ‘cat’ command
Explanation: The list of all the shells which are currently installed in our Linux system is stored in the ‘shells’ file which is present in /etc folder of the system. It has read-only access by default and is modified automatically whenever we install a new shell in our system. As we can see, the cat command displays the various installed shells along with their installation paths.
Method 2: Use of grep command with Regular Expressions.
Example:
grep '^[^#]' /etc/shells
Using ‘grep’ command
Explanation: Regular Expressions are one of the most powerful tools that come in handy when handling complex expressions. We can use regular expressions with grep command to display all the shells installed in our system as shown above.
Picked
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
Change an HTML5 input placeholder color with CSS

08 Nov, 2021
The placeholder selector in the CSS pseudo-element is used to design the placeholder text by changing the text color and it allows to modify the style of the text. In most of the browsers, the placeholder (inside the input tag) is of grey color. In order to change the color of this placeholder, non-standard ::placeholder selectors can be used, which implements the color attribute in that particular selector. This selector varies from browser to browser. For eg, for Google Chrome, Mozilla Firefox, and Opera Browsers, etc, the selectors can be implemented as:
Syntax: 
::placeholder
For Internet Explorer::-ms-input-placeholder
For Internet Explorer:
:-ms-input-placeholder
For Microsoft Edge:::-ms-input-placeholder
For Microsoft Edge:
::-ms-input-placeholder
Example 1: This code shows the use of ::placeholder selectors in different browsers.
HTML
<!DOCTYPE html><html>  <head>    <title>Change Placeholder Color</title>    <style>    ::placeholder {                /* Firefox, Chrome, Opera */        color: blue;    }          :-ms-input-placeholder {                /* Internet Explorer 10-11 */        color: red;    }          ::-ms-input-placeholder {                /* Microsoft Edge */        color: orange;    }    </style></head>  <body>      <p>Change Placeholder Color</p>      <input type="text" placeholder="Enter your Text"></body>  </html>
Output:
In Google Chrome:
In Google Chrome:
In Microsoft Edge:
In Microsoft Edge:
In Internet Explorer:
In Internet Explorer:
Note: The placeholder selector is no longer supported by Internet Explorer.
Example 2: This code implements a placeholder selector in the email attribute of the input tag. Placeholder selectors can be applied to any attributes (text, tel, password, and etc) of the input tag, to highlight changes in color in any different attributes. 
HTML
<!DOCTYPE html><html>  <head>    <title>Change Placeholder Color</title>    <style>    input[type="email"]::placeholder {                  /* Firefox, Chrome, Opera */        color: blue;    }          input[type="email"]:-ms-input-placeholder {                  /* Internet Explorer 10-11 */        color: red;    }          input[type="email"]::-ms-input-placeholder {                  /* Microsoft Edge */        color: orange;    }    </style></head>  <body>      <p>Change Placeholder Color</p>      <input type="email" placeholder="Enter your Email"></body>  </html>
Output:
ysachin2314
bhaskargeeksforgeeks
CSS-Misc
HTML5
Picked
Technical Scripter 2018
CSS
Technical Scripter
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Convert list of lists to dataframe in R

30 May, 2021
In this article, we will discuss how to convert a list of lists to dataframe in R Programming Language. We will convert a list of lists to a data frame both by row and by column.
Example 1: R program to create three lists inside a list with numeric and character type and convert into dataframe by column.
Syntax as.data.frame(do.call(cbind, list_name))
Parameters: Where cbind is to convert list to dataframe by column and list_name is the input list which is list  of lists
Code:
R
# create list and create 3 lists # inside this listlists = list(list1 = list(1, 2, 3, 4, 5),             list2 = list('a', 'b', 'c', 'd', 'e'),             list3 = list(2, 3, 4, 5, 6))  # convert list of lists into dataframe# by columnprint(as.data.frame(do.call(cbind, lists)))
Output:
  list1 list2 list3
1     1     a     2
2     2     b     3
3     3     c     4
4     4     d     5
5     5     e     6
Example 2: R program to create two lists inside a list with numeric and character type and convert into dataframe by column
R
# create list and create 2 lists # inside this listlists = list(list1 = list(1, 2, 3, 4, 5),             list2 = list('a', 'b', 'c', 'd', 'e'))  # convert list of lists into# dataframe by columnprint(as.data.frame(do.call(cbind, lists)))
Output:
  list1 list2
1     1     a
2     2     b
3     3     c
4     4     d
5     5     e
Example 3: R program to create three lists inside a list with numeric and character type and convert into dataframe by column.
Syntax: as.data.frame(do.call(rbind,list_name))
Parameters: Where rbind is to convert list to dataframe by row and list_name is the input list which is list  of lists
R
# create list and create 3 lists # inside this listlists = list(list1 = list(1, 2, 3, 4, 5),             list2 = list('a', 'b', 'c', 'd', 'e'),             list3 = list(2, 3, 4, 5, 6))  # convert list of lists into dataframe # by rowprint(as.data.frame(do.call(rbind, lists)))
Output:
      V1 V2 V3 V4 V5
list1  1  2  3  4  5
list2  a  b  c  d  e
list3  2  3  4  5  6
Picked
R DataFrame-Programs
R-DataFrame
R Language
R Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
Change Color of Bars in Barchart using ggplot2 in R
How to Change Axis Scales in R Plots?
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
Replace Specific Characters in String in R
Convert Matrix to Dataframe in R
Extract specific column from a DataFrame using column name in R
Python | __import__() function

28 Jan, 2022
While writing a code, there might be a need for some specific modules. So we import those modules by using a single line code in Python.
But what if the name of the module needed is known to us only during runtime? How can we import that module? One can use the Python’s inbuilt __import__() function. It helps to import modules in runtime also.
Syntax: __import__(name, globals, locals, fromlist, level)
Parameters:name : Name of the module to be importedglobals and locals : Interpret namesformlist : Objects or submodules to be imported (as a list)level : Specifies whether to use absolute or relative imports. Default is -1(absolute and relative).
Example #1 :
# importing numpy module# it is equivalent to "import numpy as np"np = __import__('numpy', globals(), locals(), [], 0)  # array from numpya = np.array([1, 2, 3])  # prints the typeprint(type(a))
Output :
<class 'numpy.ndarray'>
 Example #2 :Both the following statements has same meaning and does the same work.
# from numpy import complex as comp, array as arrnp = __import__('numpy', globals(), locals(), ['complex', 'array'], 0)  comp = np.complexarr = np.array
 Application :__import__() is not really necessary in everyday Python programming. Its direct use is rare. But sometimes, when there is a need of importing modules during the runtime, this function comes quite handy.
boscoitehooligan10
Python-Functions
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Read JSON file using Python
Adding new column to existing DataFrame in Pandas
Python map() function
How to get column names in Pandas dataframe
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Taking input in Python
Read a file line by line in Python
Python String | replace()
Merging PDFs using Java - GeeksforGeeks

08 Dec, 2020
Merging multiple PDF documents into a single PDF document is done using the PDFMergerUtility class. This class will take a list of PDF documents and merge them, the result will be saved to the new document. The prerequisite of this topic is that you have already installed apache library 
Follow these steps to merge multiple PDF documents:
First we have to instantiate the PDFMergerUtility class.Second we have to set the destination file using the setDestinationFileName() method.Now we have to set the source files using the addSource() method.Final step we have to merge the documents using the mergeDocuments() method of the PDFMergerUtility class.
First we have to instantiate the PDFMergerUtility class.
Second we have to set the destination file using the setDestinationFileName() method.
Now we have to set the source files using the addSource() method.
Final step we have to merge the documents using the mergeDocuments() method of the PDFMergerUtility class.
Example:
Input : PDF1 = Alice.pdf, PDF2 = Bob.pdf
Output: newMerged.pdf // merged pdf of pdf1 and pdf2 
Implementation:
Java
// Merging multiple pdf documents here  import org.apache.pdfbox.multipdf.PDFMergerUtility;import org.apache.pdfbox.pdmodel.PDDocument;  import java.io.File;import java.io.IOException;  public class GFG {      public static void main(String[] args)        throws IOException    {          // loading all the pdf files we wish to merge          File file1 = new File(            "/Users/piyushkumar/Desktop/Merging Pdfs/file1.pdf");        File file2 = new File(            "/Users/piyushkumar/Desktop/Merging Pdfs/file2.pdf");          // Instantiating PDFMergerUtility class          PDFMergerUtility obj = new PDFMergerUtility();          // Setting the destination file path          obj.setDestinationFileName(            "/Users/piyushkumar/Desktop/Merging Pdfs/newMerged.pdf");          // Add all source files, to be merged          obj.addSource(file1);        obj.addSource(file2);          // Merging documents          obj.mergeDocuments();          System.out.println(            "PDF Documents merged to a single file");    }}
 
Before the execution of the code :
 
After the execution of the code :
If you check the specified path, you will see that a PDF document named newMerged.pdf has been generated which contains the pages of both the original documents.
Picked
Java
Java Programs
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Object Oriented Programming (OOPs) Concept in Java
HashMap in Java with Examples
Stream In Java
Interfaces in Java
How to iterate any Map in Java
Initializing a List in Java
Convert a String to Character Array in Java
Java Programming Examples
Convert Double to Integer in Java
Implementing a Linked List in Java using Class
Tensorflow.js tf.split() Function - GeeksforGeeks

10 May, 2021
Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. It also helps the developers to develop ML models in JavaScript language and can use ML directly in the browser or in Node.js.
The tf.split() function is used to split a tf.tensors into sub tensors.
Syntax:
tf.split (x, numOrSizeSplits, axis?)
Parameters:
x: The input tensor to split.
numOrSizeSplits: It can be a number indicating the number of splits or can be the array in which sizes are provided for each output tensor
axis: It is an axis of the dimension along which to split.
Return Value: It returns tf.Tensor[].
Example 1:
Javascript
// Importing the tensorflow.js libraryimport * as tf from "@tensorflow/tfjs"  const x = tf.tensor2d([10, 20, 50, 60,                       30, 40, 70, 80], [2, 4]);  // Split the tensorconst [gfg, geeks] = tf.split(x, 2, 1);  gfg.print();  geeks.print();
Output:
Tensor
    [[10, 20],
     [30, 40]]
Tensor
    [[50, 60],
     [70, 80]]
Example 2: In this example, making the split with axis as the 2nd parameter as an array.
Javascript
const x = tf.tensor2d([10, 30, 50, 70, 20, 40, 60, 80], [2, 4]);  const [gfg, gfg1, geeks] = tf.split(x, [1, 2, 1], 1);  gfg.print();  gfg1.print();  geeks.print();
Output:
Tensor
    [[10],
     [20]]
Tensor
    [[30, 50],
     [40, 60]]
Tensor
    [[70],
     [80]]
Reference: https://js.tensorflow.org/api/latest/#split
Picked
Tensorflow.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
JavaScript | Promises
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Difference between var, let and const keywords in JavaScript
reflect.DeepEqual() Function in Golang with Examples - GeeksforGeeks

15 Jul, 2021
Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.DeepEqual() Function in Golang is used to check whether x and y are “deeply equal” or not. To access this function, one needs to imports the reflect package in the program.
Syntax: 
func DeepEqual(x, y interface{}) bool
Parameters: This function takes two parameters with value of any type, i.e. x, y.Return Value: This function returns the boolean value.  
Below examples illustrate the use of the above method in Golang:
Example 1: 
Go
// Golang program to illustrate// reflect.DeepEqual() Function package main import (    "fmt"    "reflect")  // Main functionfunc main() {     map_1 := map[int]string{           200: "Anita",        201: "Neha",        203: "Suman",        204: "Robin",        205: "Rohit",    }    map_2 := map[int]string{           200: "Anita",        201: "Neha",        203: "Suman",        204: "Robin",        205: "Rohit",    }         // DeepEqual is used to check    // two interfaces are equal or not    res1 := reflect.DeepEqual(map_1, map_2)    fmt.Println("Is Map 1 is equal to Map 2: ", res1)}
Output: 
Is Map 1 is equal to Map 2:  true
Example 2: 
Go
// Golang program to illustrate// reflect.DeepEqual() Function package main import (    "fmt"    "reflect")  // Main functionfunc main() {     src := reflect.ValueOf([]int{10, 20, 32})    dest := reflect.ValueOf([]int{1, 2, 3})         cnt := reflect.Copy(dest, src)    cnt+=1         // DeepEqual is used to check    // two interfaces are equal or not    res1 := reflect.DeepEqual(src, dest )    fmt.Println("Is dest is equal to src: ", res1)}
Output: 
Is dest is equal to src:  false
 
singghakshay
Golang-reflect
Go Language
Write From Home
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
6 Best Books to Learn Go Programming Language
Arrays in Go
strings.Replace() Function in Golang With Examples
fmt.Sprintf() Function in Golang With Examples
How to Split a String in Golang?
Convert integer to string in Python
Convert string to integer in Python
How to set input type date in dd-mm-yyyy format using HTML ?
Python infinity
Matplotlib.pyplot.title() in Python
Check if a numeric value falls between a range in R Programming - between() function - GeeksforGeeks

26 May, 2020
between() function in R Language is used to check that whether a numeric value falls in a specific range or not.A lower bound and an upper bound is specified and checked if the value falls in it.
Syntax: between(x, left, right)
Parameters:
x: A numeric vectorleft, right: Boundary values
Example 1: Values in Range
# R program to illustrate# between function  # Install dplyr packageinstall.packages("dplyr")     # Load dplyr package    library("dplyr")                 # Define valuex1 <- 7     # Define lower bound                 left1 <- 1    # Define upper bound                  right1 <- 10    # Apply between functionbetween(x1, left1, right1)                          
Output:
TRUE
Here in the above code, we have defined value to 7 to x1 and defined upper and lower bound 1 and 10 respectively.As we have given the value 7 falls in range 1 to 10. So the Output is “TRUE”.
Example 2: Value not in Range
# R program to illustrate# between function  # Install dplyr packageinstall.packages("dplyr")     # Load dplyr package    library("dplyr")   # Define valuex2 <- 11    # Define lower range                      left2 <- 1     # Define upper range                    right2 <- 10                          # Apply between functionbetween(x2, left2, right2) 
Output:
FALSE
Here in the above code, we have assigned a value 11 to x2 and defined upper and lower bound to 1 and 10 respectively.And clearly the value 11 does not fall in a given range from 1 to 10.So the answer is FALSE.
R-Functions
Programming Language
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Top 10 Programming Languages to Learn in 2022
Kotlin Array
C# | Data Types
Difference between Shallow and Deep copy of a class
Advantages and Disadvantages of OOP
Change column name of a given DataFrame in R
How to Replace specific values in column in R DataFrame ?
Filter data by multiple conditions in R using Dplyr
Loops in R (for, while, repeat)
Adding elements in a vector in R programming - append() method
How to convert date and time with different timezones in Python? - GeeksforGeeks

22 Apr, 2021
In this article, we will discuss how to convert date and time with different timezones in Python. To do this we will use one of the modules of python pytz . This module brings the Olson tz database into Python and this library allows accurate and cross-platform timezone calculations using Python. The method pytz.timezone() generates the current timezone of a particular region.
Syntax:
pytz.timezone(“name of the time zone”)
Ex: pytz.timezone(“Asia/Kolkata”)
Example 1:
In the below program the current UTC time is converted according to Asia/Kolkata timezone.
Python3
from datetime import datetimeimport pytz  # get the standard UTC timeUTC = pytz.utc  # it will get the time zone# of the specified locationIST = pytz.timezone('Asia/Kolkata')  # print the date and time in# standard formatprint("UTC in Default Format : ",      datetime.now(UTC))  print("IST in Default Format : ",      datetime.now(IST))  # print the date and time in# specified formatdatetime_utc = datetime.now(UTC)print("Date & Time in UTC : ",      datetime_utc.strftime('%Y:%m:%d %H:%M:%S %Z %z'))  datetime_ist = datetime.now(IST)print("Date & Time in IST : ",      datetime_ist.strftime('%Y:%m:%d %H:%M:%S %Z %z'))
Output:
Example 2:
Here is another program where the current Asia/Kolkata timezone is converted to US/Eastern timezone.
Python3
from datetime import datetimeimport pytz  # get the standard UTC timeoriginal = pytz.timezone('Asia/Kolkata')  # it will get the time zone# of the specified locationconverted = pytz.timezone('US/Eastern')  # print the date and time in# specified formatdateTimeObj = datetime.now(original)print("Original Date & Time: ",      dateTimeObj.strftime('%Y:%m:%d %H:%M:%S %Z %z'))  # converteddateTimeObj = datetime.now(converted )print("Converted Date & Time: ",      dateTimeObj.strftime('%Y:%m:%d %H:%M:%S %Z %z'))
Output:
One can get all timezone values present in the pytz by executing the below code:
for timezone in pytz.all_timezones:
     print(timezone) 
Below is a program to convert a particular timezone to multiple timezones of the Indian region:
Python3
from datetime import datetimeimport pytz  # get the standard UTC timeoriginal = pytz.utc  # create datetime objectdateTimeObj = datetime.now(original)print("Original Date & Time: ",      dateTimeObj.strftime('%Y:%m:%d %H:%M:%S %Z %z'))  # it will get the time zone# of the specified locationfor timeZone in pytz.all_timezones:    if 'Indian/' in timeZone:        dateTimeObj = datetime.now(pytz.timezone(timeZone))        print(timeZone,":",dateTimeObj.strftime('%Y:%m:%d %H:%M:%S %Z %z'))
Output:
Picked
Python datetime-program
Python-datetime
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | Get unique values from a list
Python | os.path.join() method
Defaultdict in Python
Create a directory in Python
Python | Pandas dataframe.groupby()
Python - Extract ith Key's Value of K's Maximum value dictionary - GeeksforGeeks

01 Aug, 2020
Given Dictionary List, extract i’th keys value depending upon Kth key’s maximum value.
Input : test_list = [{“Gfg” : 3, “is” : 9, “best” : 10}, {“Gfg” : 8, “is” : 11, “best” : 19}, {“Gfg” : 9, “is” : 16, “best” : 1}], K = “best”, i = “is”Output : 11Explanation : best is max at 19, its corresponding “is” value is 11.
Input : test_list = [{“Gfg” : 3, “is” : 9, “best” : 10}, {“Gfg” : 8, “is” : 11, “best” : 19}, {“Gfg” : 9, “is” : 16, “best” : 1}], K = “Gfg”, i = “is”Output : 16Explanation : Gfg is max at 9, its corresponding “is” value is 16.
Method #1 : Using max() + lambda
The combination of above functions can be used to solve this problem. In this, we extract max of kth key using max() and lambda. Then ith key is extracted from extracted dictionary.
Python3
# Python3 code to demonstrate working of # Extract ith Key's Value of K's Maximum value dictionary# Using max() + lambda  # initializing liststest_list = [{"Gfg" : 3, "is" : 9, "best" : 10},              {"Gfg" : 8, "is" : 11, "best" : 19},             {"Gfg" : 9, "is" : 16, "best" : 1}]  # printing original listprint("The original list : " + str(test_list))  # initializing K K = "best"  # initializing i i = "Gfg"  # using get() to handle missing key, assigning lowest valueres = max(test_list, key = lambda ele : ele.get(K, 0))[i]      # printing result print("The required value : " + str(res))
The original list : [{'Gfg': 3, 'is': 9, 'best': 10}, {'Gfg': 8, 'is': 11, 'best': 19}, {'Gfg': 9, 'is': 16, 'best': 1}]
The required value : 8

Method #2 : Using max() + external function
This is yet another way to solve this problem. This computes in similar way as above method, just the difference being of usage of custom comparator rather than lambda function.
Python3
# Python3 code to demonstrate working of # Extract ith Key's Value of K's Maximum value dictionary# Using max() + external function  # custom function as comparatordef cust_fnc(ele):    return ele.get(K, 0)   # initializing liststest_list = [{"Gfg" : 3, "is" : 9, "best" : 10},              {"Gfg" : 8, "is" : 11, "best" : 19},             {"Gfg" : 9, "is" : 16, "best" : 1}]  # printing original listprint("The original list : " + str(test_list))  # initializing K K = "best"  # initializing i i = "Gfg"  # using get() to handle missing key, assigning lowest valueres = max(test_list, key = cust_fnc)[i]      # printing result print("The required value : " + str(res))
The original list : [{'Gfg': 3, 'is': 9, 'best': 10}, {'Gfg': 8, 'is': 11, 'best': 19}, {'Gfg': 9, 'is': 16, 'best': 1}]
The required value : 8

Python dictionary-programs
Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Python program to convert a list to string
Defaultdict in Python
Python | Split string into list of characters
Python | Convert a list to dictionary
How to print without newline in Python?