code-rag-bench/online-tutorials huggingface dataset:
Console.SetIn() Method in C# - GeeksforGeeks

11 Mar, 2019
The Console.SetIn() method is used to set the In property of the specified StreamReader object i.e. it redirects the standard input from the console to the input file. Since the console is set with this StreamReader object, the ReadLine() method can be called to read the contents of the file, line by line.
Syntax: public static void SetIn (System.IO.StreamReader newIn);
Parameter:newIn: It is a stream which is the new standard input.
Exceptions:
ArgumentNullException: If the newIn is null.
SecurityException: If the caller does not have the required permission.
Example: In this example, the SetIn() method is used to set the StreamReader object to the console, and the file’s content will be read, stored and printed.
Text File Used:
// C# program to demonstrate SetIn() methodusing System;using System.IO;  class GFG {      // Main Method    static void Main()    {          // Create a string to get         // data from the file        string geeks = " ";          // creating the StreamReader object        // and set it to the desired         // text file        using(StreamReader gfg = new StreamReader("D:\\out.txt"))        {              // setting the StreamReader             // object to the Console            Console.SetIn(gfg);              string l;              // Reading the contents of the file into l            while ((l = Console.ReadLine()) != null)             {                geeks = geeks + l;            }              // Printing the file contents            // appended to "Hello "            Console.WriteLine("Hello " + geeks);              // Waiting for user input            // to exit the program            Console.ReadKey();        }    }}
Output:
Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.console.setin?view=netframework-4.7.2#System_Console_SetIn_System_IO_TextReader_
CSharp-Console-Class
CSharp-method
Picked
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Extension Method in C#
HashSet in C# with Examples
C# | Inheritance
Partial Classes in C#
C# | Generics - Introduction
Top 50 C# Interview Questions & Answers
Switch Statement in C#
C# | How to insert an element in an Array?
Convert String to Character Array in C#
Lambda Expressions in C#
C# String.IndexOf( ) Method

The String.IndexOf() method in C# is used to find the zero-based index of the first occurrence of a specified Unicode character or string within this instance.
The syntax is as follows −
public int IndexOf (string val);
Above, val is the string to find.
Let us now see an example −
 Live Demo
using System;
public class Demo {
   public static void Main(String[] args) {
      string str1 = "Jacob";
      string str2 = "John";
      Console.WriteLine("String 1 = "+str1);
      Console.WriteLine("HashCode of String 1 = "+str1.GetHashCode());
      Console.WriteLine("Index of character 'o' is str1 = " + str1.IndexOf("o"));
      Console.WriteLine("\nString 2 = "+str2);
      Console.WriteLine("HashCode of String 2 = "+str2.GetHashCode());
      Console.WriteLine("Index of character 'o' is str2 =" + str2.IndexOf("o"));
      bool res = str1.Contains(str2);
      if (res)
         Console.WriteLine("Found!");
      else
         Console.WriteLine("Not found!");
   }
}
This will produce the following output −
String 1 = Jacob
HashCode of String 1 = -790718923
Index of character 'o' is str1 = 3
String 2 = John
HashCode of String 2 = -1505962600
Index of character 'o' is str2 =1
Not found!
Let us now see another example −
 Live Demo
using System;
public class Demo {
   public static void Main(String[] args) {
      string str1 = "Kevin";
      string str2 = "Evin";
      Console.WriteLine("String 1 = "+str1);
      Console.WriteLine("HashCode of String 1 = "+str1.GetHashCode());
      Console.WriteLine("Index of character 'k' in str1 = " + str1.IndexOf("k"));
      Console.WriteLine("\nString 2 = "+str2);
      Console.WriteLine("HashCode of String 2 = "+str2.GetHashCode());
      Console.WriteLine("Index of character 'k' in str2 =" + str2.IndexOf("k"));
      bool res = str1.Contains(str2);
      if (res)
         Console.WriteLine("Found!");
      else
         Console.WriteLine("Not found!");
   }
}
This will produce the following output −
String 1 = Kevin
HashCode of String 1 = -768104063
Index of character 'k' in str1 = -1
String 2 = Evin
HashCode of String 2 = 1223510568
Index of character 'k' in str2 =-1
Not found!
SQL Tryit Editor v1.6

DELETE FROM Customers;
​
Edit the SQL Statement, and click "Run SQL" to see the result.
This SQL-Statement is not supported in the WebSQL Database.
The example still works, because it uses a modified version of SQL.
Your browser does not support WebSQL.
Your are now using a light-version of the Try-SQL Editor, with a read-only Database.
If you switch to a browser with WebSQL support, you can try any SQL statement, and play with the Database as much as you like. The Database can also be restored at any time.
Our Try-SQL Editor uses WebSQL to demonstrate SQL.
A Database-object is created in your browser, for testing purposes.
You can try any SQL statement, and play with the Database as much as you like. The Database can be restored at any time, simply by clicking the "Restore Database" button.
WebSQL stores a Database locally, on the user's computer. Each user gets their own Database object.
WebSQL is supported in Chrome, Safari, Opera, and Edge(79).
If you use another browser you will still be able to use our Try SQL Editor, but a different version, using a server-based ASP application, with a read-only Access Database, where users are not allowed to make any changes to the data.
BabelJS - Project setup using Babel 7

The latest version of Babel, 7 released with changes to the already existing packages. The installation part remains the same as it was for Babel 6. The only difference in Babel 7 is that all the packages need to be installed with @babel/, for example @babel/core, @babel/preset-env, @babel/cli, @babel/polyfill, etc.
Here is a project setup created using babel 7.
Execute the following command to start the project setup −
npm init

npm install --save-dev @babel/core
npm install --save-dev @babel/cli
npm install --save-dev @babel/preset-env

Here is the package.json created −
Now will create a .babelrc file in the root folder −
Create a folder src/ and add file main.js to it and write your code to transpile to es5.
let add = (a,b) => {
   return a+b;
}
npx babel src/main.js --out-file main_es5.js

"use strict";

var add = function add(a, b) {
   return a + b;
};
The working of Babel 7 remains the same as Babel 6. The only difference is the pacakge installation with @babel.
There are some presets deprecated in babel 7. The list is as follows −
ES20xx presets
babel-preset-env
babel-preset-latest
Stage presets in Babel
Also the year from the packages is removed - @babel/plugin-transform-es2015-classes is now @babel/plugin-transform-classes
We will see one more example of working with typescript and transpile it to Es2015 JavaScript using typescript preset and babel 7.
To work with typescript, we need typescript package to be installed as follows −
npm install --save-dev @babel/preset-typescript

Create test.ts file in the src/ folder and write the code in typescript form −
let getName = (person: string) => {
   return "Hello, " + person;
}

getName("Siya");
npx babel src/test.ts --out-file test.js

"use strict";

var getName = function getName(person) {
   return "Hello, " + person;
};

getName("Siya");
 Print
 Add Notes
 Bookmark this page
How to add an active class to the current element with JavaScript?

To add an active class to the current element with JavaScript, the code is as follows −
 Live Demo
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
   .btn {
      border: none;
      outline: none;
      padding: 10px 16px;
      background-color: #6ea2f0;
      cursor: pointer;
      color:white;
      font-size: 18px;
   }
   .active, .btn:hover {
      background-color: #666;
      color: white;
   }
</style>
</head>
<body>
<h1>Active Button Example</h1>
<div id="sampleDiv">
<button class="btn">Giraffe</button>
<button class="btn active">Cow</button>
<button class="btn">Lion</button>
<button class="btn">Leopard</button>
<button class="btn">Cheetah</button>
</div>
<h2>Press any of the above button to set it class to active</h2>
<script>
   var btns = document.querySelectorAll(".btn");
   Array.from(btns).forEach(item => {
      item.addEventListener("click", () => {
         var selected = document.getElementsByClassName("active");
         selected[0].className = selected[0].className.replace(" active", "");
         item.className += " active";
      });
   });
</script>
</body>
</html>
The above code will produce the following output −
On clicking any other button −
Convert Images to PDFs using Tkinter

Python is a scripting language and thus, it helps in many ways to create file converters such as CSV to PDF, PDF to DOC, and vice-versa. With the help of certain libraries, we can also create an application that converts images into PDF. To create such an application, we use the img2pdf module in Python. It helps to parse the image binary and converts it into PDFs.
We will follow these steps to create an application,
First, make sure the system has img2pdf requirements already in place. Type pip
install img2pdf on your terminal to install the package. Import img2pdf in the notebook.
First, make sure the system has img2pdf requirements already in place. Type pip
install img2pdf on your terminal to install the package. Import img2pdf in the notebook.
Import filedialog to open a dialog box that asks users to select multiple images in the directory.
Import filedialog to open a dialog box that asks users to select multiple images in the directory.
Import tkinter Library by typing from tkinter import *
Import tkinter Library by typing from tkinter import *
Create a basic structure using Tkinter Library such as Button Widget to open the
File Dialog, Label widget to show the message.
Create a basic structure using Tkinter Library such as Button Widget to open the
File Dialog, Label widget to show the message.
Define a function to open the dialog Box which asks users to select multiple
images in the directory.
Define a function to open the dialog Box which asks users to select multiple
images in the directory.
Define a function for opening the file as binary and convert it into PDF using the convert method.
Define a function for opening the file as binary and convert it into PDF using the convert method.
# Import required Libraries
from tkinter import *
from tkinter import filedialog
import img2pdf
from tkinter import ttk
# Create an instance of tkinter frame
win = Tk()
#set the geometry
win.geometry('750x250')
win.title("Image to PDF")
def select_file():
   global images
   images = filedialog.askopenfilenames(initialdir = "",title = "Select Images")
   Label(win, text=images).pack()
#Convert Image to PDF
def image_to_pdf():
   for image in enumerate(images):
      with open(f"{image}.pdf", "wb") as file:
         file.write(img2pdf.convert(images))
         Label(frame,text=file).pack()
# Add Labels and Buttons
Label(win, text = "Image to PDF Convertor",font = "Caveat 25 bold").pack(pady = 30)
ttk.Button(win, text = "Select Images",command = select_file).pack(ipadx = 10)
frame = Frame(win)
frame.pack()
ttk.Button(frame, text = "Convert and Save",command = image_to_pdf).pack(side = LEFT, pady=20,ipadx = 10)
win.mainloop()
Running the above code will display the application window that will convert the images into PDF file.
Now, select an Image file from the local directory and click the "Convert and Save" button to convert and save it as PDF.
How to standardize columns in an R data frame?

This can be done by using scale function.
> data<- data.frame(x = rnorm(10, 50, 1.5), y = runif(10, 2, 5))
> data
      x        y
1  49.57542 2.940931
2  49.51565 2.264866
3  50.70819 2.918803
4  49.09796 2.416676
5  49.90089 2.349696
6  49.03445 3.883145
7  51.29564 4.072614
8  49.11014 3.526852
9  49.41255 3.320530
10 49.42131 3.033730
> standardized_data <- scale(data)
> standardized_data
x y
[1,]  -0.1774447 -0.20927607
[2,]  -0.2579076 -1.28232321
[3,]   1.3476023 -0.24439768
[4,]  -0.8202493 -1.04137095
[5,]   0.2607412 -1.14768085
[6,]  -0.9057468  1.28619932
[7,]   2.1384776  1.58692277
[8,]  -0.8038439  0.72069363
[9,]  -0.3967165  0.39321942
[10,] -0.3849124 -0.06198639
attr(,"scaled:center")
    x       y
49.707220 3.072784
attr(,"scaled:scale")
    x         y
0.7427788 0.6300430
Encapsulation in Java

Encapsulation is one of the four fundamental OOP concepts. The other three are inheritance, polymorphism, and abstraction.
Encapsulation in Java is a mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. In encapsulation, the variables of a class will be hidden from other classes, and can be accessed only through the methods of their current class. Therefore, it is also known as data hiding.
To achieve encapsulation in Java −
Declare the variables of a class as private.
Provide public setter and getter methods to modify and view the variables values.
Following is an example that demonstrates how to achieve Encapsulation in Java −
/* File name : EncapTest.java */
public class EncapTest {
   private String name;
   private String idNum;
   private int age;
   public int getAge() {
      return age;
   }
   public String getName() {
      return name;
   }
   public String getIdNum() {
      return idNum;
   }
   public void setAge( int newAge) {
      age = newAge;
   }
   public void setName(String newName) {
      name = newName;
   }
   public void setIdNum( String newId) {
      idNum = newId;
   }
}
The public setXXX() and getXXX() methods are the access points of the instance variables of the EncapTest class. Normally, these methods are referred as getters and setters. Therefore, any class that wants to access the variables should access them through these getters and setters.
Find by _id on an array of objects in MongoDB database?

To find by _id on an array of objects, use aggregation and avoid using find(). Let us first create a collection with documents −
> db.demo414.insertOne(
...    {
...       "_id": "110",
...       "details":[
...          {
...             "StudentName":"John",
...             "StudentMarks":56
...          },
...          {
...             "StudentName":"Robert",
...             "StudentMarks":98
...          }
...       ]
...    }
... );
{ "acknowledged" : true, "insertedId" : "110" }
Display all documents from a collection with the help of find() method −
> db.demo414.find();
This will produce the following output −
{ "_id" : "110", "details" : [ { "StudentName" : "John", "StudentMarks" : 56 }, { "StudentName" : "Robert", "StudentMarks" : 98 } ] }
Following is the query to find by _id on an array of objects −
> db.demo414.aggregate([{$unwind: "$details"}, {$match:{"details.StudentMarks" :56}}] )
This will produce the following output −
{ "_id" : "110", "details" : { "StudentName" : "John", "StudentMarks" : 56 } }
How to print spaces in Python3? - GeeksforGeeks

01 Aug, 2020
In this article, we will learn about how to print space or multiple spaces in the Python programming language. Spacing in Python language is quite simple than other programming language. In C languages, to print 10 spaces a loop is used while in python no loop is used to print number of spaces.
Following are the example of the print spaces:
Example 1: A simple way to print spaces
Python3
# Python program to print spaces  # No spacesprint("GeeksForGeeks")  # To print the blank linesprint(' ')  # Also print the blanksprint(" ")  # To print the spaces in sentenceprint("Geeks  For    Geeks")
Output:
GeeksForGeeks
 
 
Geeks  For    Geeks



Example 2: Printing spaces between two values while printing in a single print statement.
Python3
# Python program to print spacesx = 1y = 2  # use of "," symbolprint("x:",x)print("y:",y)print(x,"+",y,"=",x+y)
Output:
x: 1
y: 2
1 + 2 = 3



Example 3: Print multiple spaces between two values.
Python3
# Python program to print spaces  # To print the single spaces in sentenceprint("Geeks"+" "+"For"+" "+"Geeks")print("Geeks","For","Geeks")  # to print spaces by given timesprint("Geeks"+" "*3+"For"+" "*3+"Geeks")print("Geeks"+" "*5+"For"+" "*10+"Geeks")
Output:
Geeks For Geeks
Geeks For Geeks
Geeks   For   Geeks
Geeks     For          Geeks



python-basics
python-io
Python
python-io
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python String | replace()
Create a Pandas DataFrame from Lists
Reading and Writing to text files in Python
*args and **kwargs in Python
How To Convert Python Dictionary To JSON?
SQLite - DISTINCT Keyword

SQLite DISTINCT keyword is used in conjunction with SELECT statement to eliminate all the duplicate records and fetching only the unique records.
There may be a situation when you have multiple duplicate records in a table. While fetching such records, it makes more sense to fetch only unique records instead of fetching duplicate records.
Following is the basic syntax of DISTINCT keyword to eliminate duplicate records.
SELECT DISTINCT column1, column2,.....columnN 
FROM table_name
WHERE [condition]

Consider COMPANY table with the following records.
ID          NAME        AGE         ADDRESS     SALARY
----------  ----------  ----------  ----------  ----------
1           Paul        32          California  20000.0
2           Allen       25          Texas       15000.0
3           Teddy       23          Norway      20000.0
4           Mark        25          Rich-Mond   65000.0
5           David       27          Texas       85000.0
6           Kim         22          South-Hall  45000.0
7           James       24          Houston     10000.0
8           Paul        24          Houston     20000.0
9           James       44          Norway      5000.0
10          James       45          Texas       5000.0
First, let us see how the following SELECT query returns duplicate salary records.
sqlite> SELECT name FROM COMPANY;
This will produce the following result.
NAME
----------
Paul
Allen
Teddy
Mark
David
Kim
James
Paul
James
James

Now, let us use DISTINCT keyword with the above SELECT query and see the result.
sqlite> SELECT DISTINCT name FROM COMPANY;
This will produce the following result, where there is no duplicate entry.
NAME
----------
Paul
Allen
Teddy
Mark
David
Kim
James


    25 Lectures 
     4.5 hours 

 Sandip Bhattacharya

    17 Lectures 
     1 hours 

 Laurence Svekis

    5 Lectures 
     51 mins

 Vinay Kumar
 Print
 Add Notes
 Bookmark this page
java.net.PasswordAuthentication Class in Java - GeeksforGeeks

28 Mar, 2021
PasswordAuthentication class is provided by package java.net for implementing networking applications, and it is used in those cases when it is required to hold the data that will be used by the Authenticator. It holds the username and password.
Syntax of its constructors :
PasswordAuthentication(String userName, char[] password)
This will create new PasswordAuthentication object for the given username and password. The given user password is cloned before it is stored in the new PasswordAuthentication object.
Method details: 
getUserName() : This will give the username and is return a string value.getPassword() : This will return user password and return char array.
getUserName() : This will give the username and is return a string value.
getPassword() : This will return user password and return char array.
Methods it inherited from class java.lang.Object : 
equals()toString()hashCode()clone()getClass()finalize()notify()notifyAll()
equals()
toString()
hashCode()
clone()
getClass()
finalize()
notify()
notifyAll()
Java
// Java Program to illustrate the // java.net.PasswordAuthentication// Classimport java.io.*;import java.net.PasswordAuthentication;  class GFG {      public static void main(String args[])    {        GFG acc = new GFG();        acc.proceed();    }      private void proceed()    {        // Initializing the user name        String userName = "Geek";                // Initializing the password - This is a char        // array since the PasswordAuthentication        // supports this argument        char[] password = { 'g', 'e', 'e', 'k', 'g', 'o',                            'r', 'g', 'e', 'e', 'k', 's' };          PasswordAuthentication passwordAuthentication            = new PasswordAuthentication(userName,                                         password);        System.out.println(            "UserName: "            + passwordAuthentication.getUserName());                // The below getPassword actually returns the        // reference to the password as per the Java API        // documentation.        System.out.println(            "Password: "            + passwordAuthentication.getPassword());                // You can get the password in normal string        System.out.println(            "Password: "            + String.copyValueOf(                passwordAuthentication.getPassword()));    }}
UserName: Geek
Password: [C@4e50df2e
Password: geekgorgeeks
Java-net-package
Picked
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
7 Things You Didn’t Know About Java
Different ways of Reading a text file in Java
Generics in Java
Constructors in Java
length vs length() in Java
How to convert an Array to String in Java?
List Interface in Java with Examples
Comparator Interface in Java with Examples
Compare two Strings in Java
Differences between JDK, JRE and JVM
How to Detect if Someone's Stealing Your WiFi? - GeeksforGeeks

10 May, 2020
When it comes to finding out who’s using our Wifi, there are n number of softwares available on the internet. As we know, that all Softwares are not to be trusted so here in this article we will look at an approach that is being used by most professionals and it only uses your “Command prompt” or “Terminal”.
To detect WiFi theft, follow the steps given below:
Step 1: Open terminal or command-prompt of the Operating SystemType “sudo apt install net-tools” (for Linux and Mac users).
sudo apt install net-tools 
Note: Windows has it installed by default.
After installing, type
 ifconfig
Go to “wlp3s0” and find “inet” in the second line(shown in the image above). Copy that IP address.
Step 2: Install nmapType the following command (for Linux and Mac)
sudo apt install nmap 
For Windows, Follow this link to install Nmap Nmap for Windows.
After installing, type
nmap -sP 192.168.0.104/24 
Paste your IP address instead of “192.168.0.104” followed by “/24” and run the above command.Finally, you will get all the connected devices to your Wifi.
If you see that there are any extra users, that means someone if stealing your wifi.
Best precautions:
If you have an open wifi, secure it using a password.
If you find such instances, change your password.
Picked
How To
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install FFmpeg on Windows?
How to Add External JAR File to an IntelliJ IDEA Project?
How to Set Git Username and Password in GitBash?
How to create a nested RecyclerView in Android
How to Install Jupyter Notebook on MacOS?
How to Create and Setup Spring Boot Project in Eclipse IDE?
How to Install a local module using npm?
How To Pass and Parse Linux Bash Script Arguments and Parameters
How to Check the OS Version in Linux?
How to Get Current Location in Android?
Tailwind CSS Order - GeeksforGeeks

23 Mar, 2022
Order is one of the best feature of tailwind CSS by using this class we can order the flex and grid items according to our requirements. There are lots of order class. This class is used to render flex and grid items in a different order than they appear in the DOM.
Order:
order-1
order-2
order-3
order-4
order-5
order-6
order-7
order-8
order-9
order-10
order-11
order-12
order-first
order-last
order-none
Syntax:
<element order- number | string >
Parameter: This class accepts two types of parameters, but one at a time, can only follow the order number or the position you will mention.
number: Integer number to follow the order index.
string: In word order index position, only accept last and first.
Example: In this example, we set the order-last on the first flex item and set the order-first on the 5th flex item, now you can see the order list is different from the normal.
HTML
<!DOCTYPE html> <html>  <head>     <title>Tailwind order Class</title>       <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"           rel="stylesheet"> </head>   <body class="text-center">     <h1 class="text-green-600 text-5xl font-bold">        GeeksforGeeks    </h1>       <b>Tailwind CSS order Class</b>       <div id="main" class="flex flex-row justify-evenly">         <div class="bg-green-900 order-last w-24 h-12">1</div>         <div class="bg-green-800 w-24 h-12">2</div>         <div class="bg-green-700 w-24 h-12">3</div>         <div class="bg-green-600 w-24 h-12">4</div>         <div class="bg-green-500 order-first w-24 h-12">5</div>         <div class="bg-green-400 w-24 h-12">6</div>     </div> </body>   </html>
Output:
akshaysingh98088
Tailwind CSS
Tailwind-Flexbox
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to insert spaces/tabs in text using HTML/CSS?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to update Node.js and NPM to next version ?
How to create footer to stay at the bottom of a Web page?
How to apply style to parent if it has child with CSS?
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?
Replace all the matches of a Pattern from a String in R Programming - gsub() Function - GeeksforGeeks

05 Jun, 2020
gsub() function in R Language is used to replace all the matches of a pattern from a string. If the pattern is not found the string will be returned as it is.
Syntax:gsub(pattern, replacement, string, ignore.case=TRUE/FALSE)
Parameters:pattern: string to be matchedreplacement: string for replacementstring: String or String vectorignore.case: Boolean value for case-sensitive replacement
Example 1:
# R program to illustrate # the use of gsub() function  # Create a stringx <- "Geeksforgeeks"  # Calling gsub() functiongsub("eek", "ood", x)  # Calling gsub() with case-sensitivitygsub("gee", "Boo", x, ignore.case = FALSE)  # Calling gsub() with case-insensitivitygsub("gee", "Boo", x, ignore.case = TRUE)
Output:
[1] "Goodsforgoods"
[1] "GeeksforBooks"
[1] "BooksforBooks"

Example 2:
# R program to illustrate # the use of gsub() function  # Create a stringx <- c("R Example", "Java example", "Go-Lang Example")  # Calling gsub() functiongsub("Example", "Tutorial", x)  # Calling gsub() with case-insensitivitygsub("Example", "Tutorial", x, ignore.case = TRUE)
Output:
[1] "R Tutorial"       "Java example"     "Go-Lang Tutorial"
[1] "R Tutorial"       "Java Tutorial"    "Go-Lang Tutorial"

R String-Functions
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
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)
How to change Row Names of DataFrame in R ?
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?
Printing Output of an R Program
How to Split Column Into Multiple Columns in R DataFrame?
K-Means Clustering in R Programming
ReactJS Blueprint FileInput Component - GeeksforGeeks

08 Apr, 2022
BlueprintJS is a React-based UI toolkit for the web. This library is very optimized and popular for building interfaces that are complex data-dense for desktop applications. FileInput Component provides a way for users to upload files to our application. We can use the following approach in ReactJS to use the ReactJS Blueprint FileInput Component.
FileInput Props:
buttonText: It is used to denote the button text.
disabled: It is used to indicate whether the file input is non-interactive or not.
fill: It is used to indicate whether the file input should take up the full width of its container or not.
hasSelection: It is used to indicate whether the user has made a selection in the input or not.
inputProps: It is used to denote the props to pass to the child input.
large: It is used to indicate whether the file input should appear with large styling or not.
onInputChange: It is a callback function that is triggered on <input> change events.
text: It is used to denote the text to display.
   
Creating React Application And Installing Module:
 
Step 1: Create a React application using the following command:
 
npx create-react-app foldername
Step 2: After creating your project folder i.e. foldername, move to it using the following command:
 
cd foldername
Step 3: After creating the ReactJS application, Install the required module using the following command:
 
npm install @blueprintjs/core
 
Project Structure: It will look like the following.
 
Project Structure
Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
 
import React from 'react'
import '@blueprintjs/core/lib/css/blueprint.css';
import { FileInput } from "@blueprintjs/core";

function App() {
    return (
        <div style={{
            display: 'block', width: 500, padding: 30
        }}>
            <h4>ReactJS Blueprint FileInput Component</h4>
            <FileInput text={'Please upload your file'} buttonText={'Upload'} />
        </div>
    );
}

export default App;
  
Step to Run Application: Run the application using the following command from the root directory of the project:
 
npm start
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
 
Reference: https://blueprintjs.com/docs/#core/components/file-input
 
avtarkumar719
Blueprint-Core
Blueprint-Form Inputs
React-Blueprint
JavaScript
ReactJS
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
Introduction to Object Oriented Programming in JavaScript
JavaScript | Promises
Difference Between PUT and PATCH Request
How to fetch data from an API in ReactJS ?
How to redirect to another page in ReactJS ?
How to pass data from child component to its parent in ReactJS ?
How to pass data from one component to other component in ReactJS ?
ReactJS Functional Components
numpy string operations | title() function - GeeksforGeeks

14 Jan, 2019
numpy.core.defchararray.title(arr): function is used to Return element-wise title cased version of string or unicode.Title case words start with uppercase characters, all remaining cased characters are lowercase.
Parameters:arr : [ array_like ] Input array which may be str or unicode.
Returns : [ndarray] Output array of str or unicode, depending on input type.
Code #1:
# Python Program explaining# numpy.char.title() function   import numpy as geek     in_arr = geek.array(['p4q r', '4q rp', 'q rp4', 'rp4q'])print ("input array : ", in_arr)  out_arr = geek.char.title(in_arr)print ("output titled array :", out_arr)
input array :  ['p4q r' '4q rp' 'q rp4' 'rp4q']
output titled array : ['P4Q R' '4Q Rp' 'Q Rp4' 'Rp4Q']

 Code #2:
# Python Program explaining# numpy.char.title() function   import numpy as geek     in_arr = geek.array(['geeks', 'for', 'geeks'])  print ("input array : ", in_arr)  out_arr = geek.char.title(in_arr)print ("output titled array :", out_arr )
input array :  ['geeks' 'for' 'geeks']
output titled array : ['Geeks' 'For' 'Geeks']


 
Python numpy-String Operation
Python-numpy
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
Defaultdict in Python
Python | Get unique values from a list
Python | os.path.join() method
Create a directory in Python
Python | Pandas dataframe.groupby()
CSS3 - Border Image

CSS Border image property is used to add image boarder to some elements.you don't need to use any HTML code to call boarder image.A sample syntax of boarder image is as follows −
#borderimg {
   border: 10px solid transparent;
   padding: 15px;
}
The most commonly used values are shown below −
border-image-source
Used to set the image path
border-image-slice
Used to slice the boarder image
border-image-width
Used to set the boarder image width
border-image-repeat
Used to set the boarder image as rounded, repeated and stretched
Following is the example which demonstrates to set image as a border for elements.
<html>
   <head>
      <style>
         #borderimg1 { 
            border: 10px solid transparent;
            padding: 15px;
            border-image-source: url(/css/images/border.png);
            border-image-repeat: round;
            border-image-slice: 30;
            border-image-width: 10px;
         }
         #borderimg2 { 
            border: 10px solid transparent;
            padding: 15px;
            border-image-source: url(/css/images/border.png);
            border-image-repeat: round;
            border-image-slice: 30;
            border-image-width: 20px;
         }
         #borderimg3 { 
            border: 10px solid transparent;
            padding: 15px;
            border-image-source: url(/css/images/border.png);
            border-image-repeat: round;
            border-image-slice: 30;
            border-image-width: 30px;
         }
      </style>
   </head>

   <body>
      <p id = "borderimg1">This is image boarder example.</p>
      <p id = "borderimg2">This is image boarder example.</p>
      <p id = "borderimg3">This is image boarder example.</p>
   </body>
</html> 
It will produce the following result −
This is image boarder example.
This is image boarder example.
This is image boarder example.

    33 Lectures 
     2.5 hours 

 Anadi Sharma

    26 Lectures 
     2.5 hours 

 Frahaan Hussain

    44 Lectures 
     4.5 hours 

 DigiFisk (Programming Is Fun)

    21 Lectures 
     2.5 hours 

 DigiFisk (Programming Is Fun)

    51 Lectures 
     7.5 hours 

 DigiFisk (Programming Is Fun)

    52 Lectures 
     4 hours 

 DigiFisk (Programming Is Fun)
 Print
 Add Notes
 Bookmark this page
Python program to sort and reverse a given list

Suppose we have a list of numbers in Python. We have to reverse and sort the lists using list operations but do not change the actual list. To reverse the list we have reverse() function for lists but if we use it, the list will be reversed in place. Similar for the sort() also. To maintain
actual order we will use the reversed() function and sorted() function.
So, if the input is like l = [2,5,8,6,3,4,7,9], then the output will be [9, 7, 4, 3, 6, 8, 5, 2] [2, 3, 4, 5, 6, 7, 8, 9]
To solve this, we will follow these steps −
rev := list from the output iterator from reversed function output
display rev
srt := sort the list l using sorted() function
display srt
Let us see the following implementation to get better understanding
def solve(l):
   rev = list(reversed(l))
   print (rev)

   srt = sorted(l)
   print(srt)

l = [2,5,8,6,3,4,7,9]
solve(l)
[2,5,8,6,3,4,7,9]
[9, 7, 4, 3, 6, 8, 5, 2] [2, 3, 4, 5, 6, 7, 8, 9]
public access modifier in Java

A class, method, constructor, interface, etc. declared public can be accessed from any other class. Therefore, fields, methods, blocks declared inside a public class can be accessed from any class belonging to the Java Universe.
However, if the public class we are trying to access is in a different package, then the public class still needs to be imported. Because of class inheritance, all public methods and variables of a class are inherited by its sub classes.
The following function uses public access control -
public static void main(String[] arguments) {
   // ...
}
The main() method of an application has to be public. Otherwise, it could not be called by a Java interpreter (such as java) to run the class.
Python | Scipy integrate.dblquad() method - GeeksforGeeks

23 Jan, 2020
With the help of scipy.integrate.dblquad() method, we can get the double integration of a given function from limit a to b by using scipy.integrate.dblquad() method.
Syntax : scipy.integrate.dblquad(func, a, b)
Return : Return the double integrated value of a polynomial.
Example #1 :In this example we can see that by using scipy.integrate.dblquad() method, we are able to get the double integration of a polynomial from limit a to b by using this method.
# import scipy.integrate.dblquadfrom scipy import integrate  gfg = lambda y, x: x * y**2  # using scipy.integrate.dblquad() methodgeek = integrate.dblquad(gfg, 0, 3, lambda x: 0, lambda x: 1)  print(geek)
Output :
1.4999999999999998
Example #2 :
# import scipy.integrate.dblquadfrom scipy import integrategfg = lambda y, x: x * y**2 + 2 * x*y + 4  # using scipy.integrate.dblquad() methodgeek = integrate.dblquad(gfg, 1, 4, lambda x: 0, lambda x: 1)  print(geek)
Output :
21.999999999999996
Python-scipy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python Dictionary
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python String | replace()
Create a Pandas DataFrame from Lists
Reading and Writing to text files in Python
*args and **kwargs in Python
PHP | imagejpeg() Function - GeeksforGeeks

30 Jan, 2020
The imagejpeg() function is an inbuilt function in PHP which is used to display image to browser or file. The main use of this function is to view an image in the browser, convert any other image type to JPEG and altering the quality of the image.
Syntax:
bool imagejpeg( resource $image, int $to, int $quality )
Parameters: This function accepts three parameters as mentioned above and described below:
$image: It specifies the image resource to work on.
$to (Optional): It specifies the path to save the file to.
$quality (Optional): It specifies the quality of the image.
Return Value: This function returns TRUE on success or FALSE on error.
Below examples illustrate the imagejpeg() function in PHP:
Example 1: In this example we will be viewing an image in browser.
<?php  // Load an image from jpeg URL$im = imagecreatefromjpeg('https://media.geeksforgeeks.org/wp-content/uploads/20200123100652/geeksforgeeks12.jpg');  // View the loaded image in browser using imagejpeg() functionheader('Content-type: image/jpg');  imagejpeg($im);imagedestroy($im);?>
Output:
Example 2: In this example we will convert PNG into JPEG.
<?php  // Load an image from PNG URL$im = imagecreatefrompng('https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png');  // Convert the image into JPEG using imagejpeg() functionimagejpeg($im, 'converted.jpg');imagedestroy($im);?>
Output:
This will save the JPEG version of image
in the same folder where your PHP script is.

Example 3: In this example we will alter the quality of the image.
<?php  // Load an image from jpeg URL$im = imagecreatefromjpeg('https://media.geeksforgeeks.org/wp-content/uploads/20200123100652/geeksforgeeks12.jpg');  // View the loaded image in browser using imagejpeg() functionheader('Content-type: image/jpg');  // Decrease the quality of image to 2imagejpeg($im, null, 2);imagedestroy($im);?>
Output:
Reference: https://www.php.net/manual/en/function.imagejpeg.php
PHP-function
PHP-Imagick
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
How to Upload Image into Database and Display it using PHP ?
How to check whether an array is empty using PHP?
PHP | Converting string to Date and DateTime
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 ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Introduction to NPM scripts - GeeksforGeeks

01 Jul, 2021
NPM is a Node Package Manager. It is the world’s largest Software Registry. This registry contains over 800,000 code packages. Many Open-source developers use npm to share software. Many organizations also use npm to manage private development.
“npm scripts” are the entries in the scripts field of the package.json file. The scripts field holds an object where you can specify various commands and scripts that you want to expose. These can be executed using the following command-
npm run <script-name>
NPM scripts are used to automate tasks like minifying CSS, uglifying JavaScript, building project. NPM scripts are versatile and simple and by learning fewer tools, we can automate tasks in our web project.
For example, this is our package.json file.
{
  "name": "example",
  "scripts": {
    "test": "echo 'hello world'"
  }
}
and it can be run by using the following command –
npm run test
This is very useful when we have repetitive tasks and we have to automate them.
NPM scripts within another NPM scripts:
{
  "name": "example",
  "scripts": {
    "start": "npm run lite",
    "lite": "lite-server" 
  }
}
So by using npm start, it will run another command npm run lite, lite is lite-server. So the command that run is npm run lite-server, this will cause node server to run.
Web development and deployment requires a lot of repetitive tasks, So there was a need for tools that automate these tasks.
So here are some tasks which can be automated.
CSS Tasks:
Compiling Sass or Less into CSS.
Running Autoprefixer to add vendor prefixess that are needed.
Minification: removing unnecessary characters (white spaces, newlines, comments) from source code without compromising functionality.
Concatenation
Javascripts Tasks:
JSHint: Checking JavaScript code for errors and potential problems (static code analysis).
Concatenation
Uglification: minification + mangling (reduce local variables to single letters).
Rechecking for errors.
Building Project:
Projects can be build that consists of all files and folders requires and several dependencies.
some of the packages which is used are rimraf, copyfiles, usemin, cssmin, htmlmin, uglifyjs.
Image Compression & BrowserSync:
Images are compressed using imagemin.
Automatically browser is rendered when changes are done using onchange, watch.
akshaysingh98088
Node.js-Misc
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Node.js fs.writeFile() Method
How to install the previous version of node.js and npm ?
Difference between promise and async await in Node.js
How to use an ES6 import in Node.js?
Mongoose | findByIdAndUpdate() Function
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
Stringstream in C++

Here we will see the string stream in C++. The string stream associates a string object with a string. Using this we can read from string as if it were a stream like cin.
The Stringstream has different methods. These are like below −
clear(): Used to clear the stream
str(): To get and set the string object whose content is present in stream
operator << : This will add one string into the stringstream
operator >> : This is used to read from stringstream object.
Let us see two examples of string streams. In the first program we will divide the words into separate strings.
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
using namespace std;
int main() {
   string str("Hello from the dark side");
   string tmp; // A string to store the word on each iteration.
   stringstream str_strm(str);
   vector<string> words; // Create vector to hold our words
   while (str_strm >> tmp) {
      // Provide proper checks here for tmp like if empty
      // Also strip down symbols like !, ., ?, etc.
      // Finally push it.
      words.push_back(tmp);
   }
   for(int i = 0; i<words.size(); i++)
      cout << words[i] << endl;
}
Hello
from
the
dark
side
Here we will convert Decimal to Hexadecimal using string stream.
#include<iostream>
#include<sstream>
using namespace std;
main(){
   int decimal = 61;
   stringstream my_ss;
   my_ss << hex << decimal;
   string res = my_ss.str();
   cout << "The hexadecimal value of 61 is: " << res;
}
The hexadecimal value of 61 is: 3d
How to check whether a variable is null in PHP ?

17 Nov, 2021
We have given a variable and the task is to check whether the value of given variable is null or not and returns a Boolean value using PHP. To check a variable is null or not, we use is_null() function. A variable is considered to be NULL if it does not store any value. It returns TRUE if value of variable $var is NULL, otherwise, returns FALSE. 
Syntax
boolean is_null( $var )
Example:
PHP
<?php// PHP Program to check whether// a variable is null or not? $var1 = NULL;$var2 = "\0"; // "\0" means null character$var3 = "NULL"; // $var1 has NULL value, so always give TRUEis_null($var1) ? print_r("True\n") : print_r("False\n"); // $var2 has '\0' value which consider as null in// c and c++ but here taken as string, gives FALSEis_null($var2) ? print_r("True\n") : print_r("False\n"); // $var3 has NULL string value so it will falseis_null($var3) ? print_r("True\n") : print_r("False\n"); ?>
Output:
True
False
False
prachisoda1234
PHP-Misc
PHP
PHP Programs
Web Technologies
Web technologies Questions
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to fetch data from localserver database and display on HTML table using PHP ?
Difference between HTTP GET and POST Methods
Different ways for passing data to view in Laravel
PHP | file_exists( ) Function
PHP | Ternary Operator
How to call PHP function on the click of a Button ?
How to fetch data from localserver database and display on HTML table using PHP ?
PHP | Ternary Operator
How to create admin login page using PHP?
How to send an email using PHPMailer ?
How to Check if a “lateinit” Variable Has Been Initialized or Not in Kotlin?

23 Jun, 2021
In Kotlin, the lateinit keyword is used for those variables which are initialized after the declaration or we can say that the variable which is late initialized is called a lateinit variable. The lateinit keyword is used when we are sure that the variable will be initialized before using it. If we don’t initialize a lateinit variable before using it gives an error of “lateinit property has not been initialized”. You can check if the lateinit variable has been initialized or not before using it with the help of isInitialized() method. This method will return true if the lateinit property has been initialized otherwise it will return false.
You can easily do this by:
::variableName.isInitialized
or:
this::variableName.isInitialized
But if you are inside a listener or inner class, do this:
this@OuterClassName::variableName.isInitialized
For Example:
Kotlin
class Tutorial {      lateinit var tutorialName : String      fun initializeName(){        println(this::tutorialName.isInitialized)                  // initializing name        tutorialName = "GFG Android Course"         println(this::tutorialName.isInitialized)    }}  fun main() {    Tutorial().initializeName();}
Output:
false
true
Kotlin
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Add Views Dynamically and Store Data in Arraylist in Android?
How to Communicate Between Fragments in Android?
Retrofit with Kotlin Coroutine in Android
Suspend Function In Kotlin Coroutines
How to Get Current Location in Android?
Kotlin extension function
Dagger Hilt in Android with Example
Scopes in Kotlin Coroutines
Kotlin Sealed Classes
Singleton Class in Kotlin