code-rag-bench/online-tutorials huggingface dataset:
Does a constructor have a return type in Java?

No, constructor does not have any return type in Java.
Constructor looks like method but it is not. It does not have a return type and its name is same as the class name. Mostly it is used to instantiate the instance variables of a class.
If the programmer doesn’t write a constructor the compiler writes a constructors on his behalf.
If you closely observe the declaration of the constructor in the following example it just have the name of the constructor which is similar to class and, the parameters. It does not have any return type.
public class DemoTest{
   String name;
   int age;
   
   DemoTest(String name, int age){
      this.name = name;
      this.age = age;
      System.out.println("This is the constructor of the demo class");
   }
   public static void main(String args[]){
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter the value of name: ");
      
      String name = sc.nextLine();
      System.out.println("Enter the value of age: ");
      
      int age = sc.nextInt();
      DemoTest obj = new DemoTest(name, age);
      
      System.out.println("Value of the instance variable name: "+name);
      System.out.println("Value of the instance variable age: "+age);
   }
}
Enter the value of name:
Krishna
Enter the value of age:
29
This is the constructor of the demo class
Value of the instance variable name: Krishna
Value of the instance variable age: 29
DirectX - Window Events

This chapter will focus on the events used in DirectX. It includes various user actions which can be detected by Windows. Whenever a particular event occurs, a notification is sent which describes about the event.
The life cycle of processing the events is mentioned below −
Whenever a new event is created, it is kept in queue. The events are listed priority-wise in the mentioned queue. ProcessEvents() is the function which will verify if the event is recognized or not. If yes it will move to CustomFunction() which focuses on further steps.
Handling events focuses on three basic parts −
Instructing the window to dispatch the respective events
Writing the functions to get the desired events
Giving information to Windows about the list of functions
Now let us focus on each one and understand its importance.
Dispatching events is considered to be very simple. It is done with ProcessEvents() function. The code snippet for understanding this function is mentioned below −
virtual void Run() {
   // Obtain a pointer to the window
   CoreWindow^ Window = CoreWindow::GetForCurrentThread();
   
   // Run ProcessEvents() to dispatch events
   Window->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessUntilQuit);
}

Run() refers to the initialization of event. GetForCurrentThread() is used to get a pointer to the window. Once the pointer is defined, it is considered to be the member of CoreWindow class. It automatically helps in processing events which is highlighted in the code snippet mentioned above.
DirectX includes lots of events that can occur; but in this section, we will be interested only in specific events.
There is a special event called PointerPressed. It triggers when the user either clicks the mouse or when the touchscreen is touched with a pen or a finger. The event function need two major parameters as defined below −
void PointerPressed(CoreWindow^ Window , PointerEventArgs^ Args) {
}

The first parameter is CoreWindow which allows us to access information about the window. The second parameter is considered to be secondary and mentions about the pointer-press such as what type of press should be created i.e., mouse, pen and touch.
In this section, we will focus on setting the parameters to give information to Windows about the list of functions.
Consider the code snippet mentioned below −
virtual void SetWindow(CoreWindow^ Window) {
   Window->PointerPressed += ref new TypedEventHandler
   <CoreWindow^, PointerEventArgs^>(this, &App::PointerPressed);
}

The CoreWindow parameter calls for PointerPressed which refers to the TypeEventHandler, thus specifying information to Windows with the list of functions.
 Print
 Add Notes
 Bookmark this page
XML - Elements

XML elements can be defined as building blocks of an XML. Elements can behave as containers to hold text, elements, attributes, media objects or all of these.
Each XML document contains one or more elements, the scope of which are either delimited by start and end tags, or for empty elements, by an empty-element tag.
Following is the syntax to write an XML element −
<element-name attribute1 attribute2>
....content
</element-name>
where,
element-name is the name of the element. The name its case in the start and end tags must match.
element-name is the name of the element. The name its case in the start and end tags must match.
attribute1, attribute2 are attributes of the element separated by white spaces. An attribute defines a property of the element. It associates a name with a value, which is a string of characters. An attribute is written as −
attribute1, attribute2 are attributes of the element separated by white spaces. An attribute defines a property of the element. It associates a name with a value, which is a string of characters. An attribute is written as −
name = "value"

name is followed by an = sign and a string value inside double(" ") or single(' ') quotes.
An empty element (element with no content) has following syntax −
<name attribute1 attribute2.../>
Following is an example of an XML document using various XML element −
<?xml version = "1.0"?>
<contact-info>
   <address category = "residence">
      <name>Tanmay Patil</name>
      <company>TutorialsPoint</company>
      <phone>(011) 123-4567</phone>
   </address>
</contact-info>
Following rules are required to be followed for XML elements −
An element name can contain any alphanumeric characters. The only punctuation mark allowed in names are the hyphen (-), under-score (_) and period (.).
An element name can contain any alphanumeric characters. The only punctuation mark allowed in names are the hyphen (-), under-score (_) and period (.).
Names are case sensitive. For example, Address, address, and ADDRESS are different names.
Names are case sensitive. For example, Address, address, and ADDRESS are different names.
Start and end tags of an element must be identical.
Start and end tags of an element must be identical.
An element, which is a container, can contain text or elements as seen in the above example.
An element, which is a container, can contain text or elements as seen in the above example.

    84 Lectures 
     6 hours 

 Frahaan Hussain

    29 Lectures 
     2 hours 

 YouAccel

    27 Lectures 
     1 hours 

 Jordan Stanchev

    16 Lectures 
     2 hours 

 Simon Sez IT
 Print
 Add Notes
 Bookmark this page
HTML <input> width Attribute

The width attribute of the <input> element is only used with image and allows you to set the width of the image added using −
<input type=”image”>
The width attribute introduced in HTML5 and acts as the submit button. Following is the syntax −
<input width="pixels">
Above, width represents the width in pixels.
Let us now see an example to implement the width attribute of the <input> element wherein the width is set for input type image −
 Live Demo
<!DOCTYPE html>
<html>
<body>
<h2>Register</h2>
<form action="" method="get">
   Id − <input type="text" name="id" placeholder="Enter UserId here..." size = "25"><br>
   Password − <input type="password" name="pwd" placeholder="Enter password here..."><br>
   DOB − <input type="date" name="dob"><br>
   Telephone − <input type="tel" name="tel" placeholder="Enter mobile number here..."><br>
   Email − <input type="email" name="email" placeholder="Enter email here..." size = "35"><br><br>
   <input type="image" src="go.jpg" alt="Submit" width="120" height="60">
</form>
</body>
</html>
In the above example, we have a form with a button for which are adding an image −
<form action="" method="get">
   Id − <input type="text" name="id" placeholder="Enter UserId here..." size = "25"><br>
   Password − <input type="password" name="pwd" placeholder="Enter password here..."><br>
   DOB − <input type="date" name="dob"><br>
   Telephone − <input type="tel" name="tel" placeholder="Enter mobile number here..."><br>
   Email − <input type="email" name="email" placeholder="Enter email here..." size = "35"><br><br>
   <input type="image" src="go.jpg" alt="Submit" width="120" height="60">
</form>
The image for the button is added with a form control input type image −
<input type="image" src="go.jpg" alt="Submit" width="120" height="60">
The <input> width attribute is used to set the width of this image set.
Python program to compare two Pandas series

In this program, we will declare two Pandas series and compare their elements. Before we solve the problem, we need to import the Pandas library into our local IDE. This can be done by installing Pandas on our local machine. The command for installing Pandas is −
pip install pandas
Series1 = [2,4,6,8,10]Series2 = [1,3,5,7,9]
Series1 = [2,4,6,8,10]
Series2 = [1,3,5,7,9]
Step 1: Define two Pandas series using the Series() function of Pandas library.Step 2: Compare the series using greater than, less than, and equal-to operators.
Step 1: Define two Pandas series using the Series() function of Pandas library.
Step 2: Compare the series using greater than, less than, and equal-to operators.
import pandas as pd
series1 = pd.Series([2,4,6,8,10])
series2 = pd.Series([1,3,5,7,9])
print("Greater Than: \n",series1>series2)
print("\nLess Than: \n",series1<series2)
print("\nEquals : \n", series1 == series2)
Greater Than:
0 True
1 True
2 True
3 True
4 True
dtype: bool

Less Than:
0 False
1 False
2 False
3 False
4 False
dtype: bool

Equals :
0 False
1 False
2 False
3 False
4 False
dtype: bool
How to create an array of strings in JavaScript?

To create an array of strings in JavaScript, simply assign values −
var animals = ["Time", "Money", "Work"];
You can also use the new keyword to create an array of strings in JavaScript −
var animals = new Array("Time", "Money", "Work");
The Array parameter is a list of strings or integers. When you specify a single numeric parameter with the Array constructor, you specify the initial length of the array. The maximum length allowed for an array is 4,294,967,295.
Let’s see an example to create arrays in JavaScript −
Live Demo
<html>    
   <head>      
      <title>JavaScript Arrays</title>    
   </head>        
   <body>      
      <script>          
         var arr = new Array("Time","Money","Work");                    
         var sorted = arr.sort();          
         document.write("Returned string is : " + sorted );      
      </script>          
   </body>
</html>
Returned string is : Money,Time,Work
Posix Character Class \p{Alnum} Match

The character class \p{Alnum} matches any alphanumeric character.
The following example shows the usage of Posix character class matching.
package com.tutorialspoint;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class PosixCharacterClassDemo {
   private static final String REGEX = "\\p{Alnum}";
   private static final String INPUT = "Bb12\tc";

   public static void main(String[] args) {
      // create a pattern
      Pattern  pattern = Pattern.compile(REGEX);
      
      // get a matcher object
      Matcher matcher = pattern.matcher(INPUT); 

      while(matcher.find()) {
         //Prints the start index of the match.
         System.out.println("Match String start(): "+matcher.start());
      }
   }
}
Let us compile and run the above program, this will produce the following result −
Match String start(): 0
Match String start(): 1
Match String start(): 2
Match String start(): 3
Match String start(): 5

 Print
 Add Notes
 Bookmark this page
How can I get the href of elements found by partial link text using Selenium?

We can get the href of elements found by partial link text with Selenium webdriver. First of all we need to identify the links with help of the find_elements_by_partial_link_text() method.
Next to get hold of href of the links we have to use the get_attribute() method and
then pass href as a parameter to the method.
Let us identify the href attribute of links identified with partial link text Policy in the
below page.
from selenium import webdriver
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe")
driver.implicitly_wait(0.5)
driver.get("https://www.tutorialspoint.com/about/about_careers.htm")
#identify links with partial link text
l= driver.find_elements_by_partial_link_text("Policy")
#iterate links
for i in l:
#get href from get_attribute()
print("Href value of link: " + i.get_attribute("href"))
driver.close()
Python | os.system() method - GeeksforGeeks

20 Jun, 2019
The OS module in python provides functions for interacting with the operating system. OS, comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality.
os.system() method execute the command (a string) in a subshell. This method is implemented by calling the Standard C function system(), and has the same limitations. If command generates any output, it is sent to the interpreter standard output stream. Whenever this method is used then the respective shell of the Operating system is opened and the command is executed on it.
Syntax: os.system(command)
Parameter:command: It is of string type that tells which command to execute.
Return Value: On Unix, the return value is the exit status of the process and on Windows, the return value is the value returned by the system shell after running command.
Example #1 :Using os.system() method to get current date of computer
# Python program to explain os.system() method       # importing os module import os   # Command to execute# Using Windows OS commandcmd = 'date'  # Using os.system() methodos.system(cmd)
Example #2 :Using os.system() method to run Notepad.
# Python program to explain os.system() method       # importing os module import os   # Command to execute# Using Windows OS commandcmd = 'notepad'  # Using os.system() methodos.system(cmd)
python-os-module
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
Python program to convert a list to string
Selecting rows in pandas DataFrame based on conditions
How to query on top N rows in MongoDB?

To query on top N rows in MongoDB, you can use aggregate framework. Let us create a collection with documents
> db.topNRowsDemo.insertOne({"StudentName":"Larry","Score":78});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5ca26eee6304881c5ce84b91")
}
> db.topNRowsDemo.insertOne({"StudentName":"Chris","Score":45});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5ca26ef66304881c5ce84b92")
}
> db.topNRowsDemo.insertOne({"StudentName":"Mike","Score":65});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5ca26efe6304881c5ce84b93")
}
> db.topNRowsDemo.insertOne({"StudentName":"Adam","Score":55});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5ca26f066304881c5ce84b94")
}
> db.topNRowsDemo.insertOne({"StudentName":"John","Score":86});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5ca26f0f6304881c5ce84b95")
}
Following is the query to display all documents from a collection with the help of find() method
> db.topNRowsDemo.find().pretty();
This will produce the following output
{
   "_id" : ObjectId("5ca26eee6304881c5ce84b91"),
   "StudentName" : "Larry",
   "Score" : 78
}
{
   "_id" : ObjectId("5ca26ef66304881c5ce84b92"),
   "StudentName" : "Chris",
   "Score" : 45
}
{
   "_id" : ObjectId("5ca26efe6304881c5ce84b93"),
   "StudentName" : "Mike",
   "Score" : 65
}
{
   "_id" : ObjectId("5ca26f066304881c5ce84b94"),
   "StudentName" : "Adam",
   "Score" : 55
}
{
   "_id" : ObjectId("5ca26f0f6304881c5ce84b95"),
   "StudentName" : "John",
   "Score" : 86
}
Here is how you can query on top N rows in MongoDB
> db.topNRowsDemo.aggregate([
...    {$sort: {StudentName: 1}},
...    {$limit: 5},
...    {$match: {Score: {$gt: 65}}}
... ]).pretty();
This will produce the following output
{
   "_id" : ObjectId("5ca26f0f6304881c5ce84b95"),
   "StudentName" : "John",
   "Score" : 86
}
{
   "_id" : ObjectId("5ca26eee6304881c5ce84b91"),
   "StudentName" : "Larry",
   "Score" : 78
}
How to subtract date from today's date in JavaScript?

You need to use currentDate with the help of new Date().getDate(). The syntax is as follows −
var anyVariableName= yourCurrentDate - yourSubstractDateOfCurrentMonth;
var currentDate=new Date().getDate();
var substractDate=new Date("2020-07-01").getDate();
const numberOfDaysInCurrentMonthOnly = currentDate-substractDate;
console.log(numberOfDaysInCurrentMonthOnly);
Note
Today’s date is - 28-07-2020
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo129.js
PS C:\Users\Amit\JavaScript-code> node demo129.js
27
Collectors maxBy() method in Java 8

The maxBy() method of the Collectors class in Java 8 returns a Collector that produces the maximal element according to a given Comparator, described as an Optional<T>.
The syntax is as follows
static <T> Collector<T,?,Optional<T>> maxBy(Comparator<? super T> comparator)
Here, the parameters
T - Type of the input elements
comparator - For comparing elements
Options <T> - A container object THAT may or may not contain a non-null value
To work with Collectors class in Java, import the following package
import java.util.stream.Collectors;
The following is an example to implement maxBy() method in Java
 Live Demo
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Demo {
   public static void main(String[] args) {
      Stream<String> stream = Stream.of("4", "7", "25", "87");
      Optional<String> op = stream.collect(Collectors.maxBy(String::compareTo));
      if (op.isPresent()) {
         System.out.println(op.get());
      } else {
         System.out.println("Nothing!");
      }
   }
}
87
How to set table width in HTML?

To set the table width in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <table> tag, with the CSS property width. HTML5 do not support the width attribute of <table>, so the CSS property width is used with the style attribute to set table width.
Just keep in mind, the usage of style attribute overrides any style set globally. It will override any style set in the HTML <style> tag or external style sheet.
You can try to run the following code to set table width in HTML. We’re also using the <style> tag and the style attribute to style the table borders
<!DOCTYPE html>
<html>
   <head>
      <style>
         th, td {
            border: 1px solid black;
         }
      </style>
   </head>

   <body>
      <h1>Programming Languages</h1>
      <table style="width:100px; border: 1px solid black">
         <tr>
            <th>Language</th>
            <th>Release Year</th>
         </tr>
         <tr>
            <td>Java</td>
            <td>1995</td>
         </tr>
         <tr>
            <td>Pascal</td>
            <td>1970</td>
         </tr>
      </table>
   </body>
</html>
How to compare two strings without case sensitive in Java

The equalsIgnoreCase() method compares this string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object.
Live Demo
public class Sample {
public static void main(String args[]) {
String Str1 = new String("This is really not immutable!!");
String Str2 = Str1;
String Str3 = new String("THIS IS REALLY NOT IMMUTABLE!!");
boolean retVal;

retVal = Str1.equalsIgnoreCase(Str2);
System.out.println("Returned Value = " + retVal );

retVal = Str1.equalsIgnoreCase( Str3 );
System.out.println("Returned Value = " + retVal );
}
}
Returned Value = true
Returned Value = true
Java Examples - String buffering

How to buffer strings ?
Following example buffers strings and flushes it by using emit() method.
public class StringBuffer {
   public static void main(String[] args) {
      countTo_N_Improved();
   }
   private final static int MAX_LENGTH = 30;
   private static String buffer = "";
   
   private static void emit(String nextChunk) {
      if(buffer.length() + nextChunk.length() > MAX_LENGTH) {
         System.out.println(buffer);
         buffer = "";  
      }
      buffer += nextChunk;
   }
   private static final int N = 100;
   private static void countTo_N_Improved() {
      for (int count = 2; count <= N; count = count +2) {
         emit(" " + count);
      }
   }
}
The above code sample will produce the following result.
2 4 6 8 10 12 14 16 18 20 22
24 26 28 30 32 34 36 38 40 42
44 46 48 50 52 54 56 58 60 62
64 66 68 70 72 74 76 78 80 82

StringBuffer and StringBuilder classes are used for creating mutable string.
public class HelloWorld {
   public static void main(String []args) {
      StringBuffer sb = new StringBuffer("hello");
      sb.append("world");
      sb.insert(0, " Tutorialspoint");
      System.out.print(sb);
   }
}
The above code sample will produce the following result.
Tutorialspointhelloworld

 Print
 Add Notes
 Bookmark this page
C Program to find size of a File

This is a C Program to find size of a File.
Begin
   function findfileSize()
   Open a file pointer fp in read only mode.
   If fp is equals to null then
      Print “File not found” and return -1.
   Else count the file size.
      Close the file.
   Put the file pointer at the beginning of the file
   Declare a integer variable result and initialize it with the output of the ftell() function.
   Close file pointer fp.
   Return result.
End
#include <stdio.h>
int findfileSize(char f_n[]) {
   FILE* fp = fopen(f_n, "r"); // opening a file in read mode
   if (fp == NULL) // checking whether the file exists or not {
      printf("File Not Found!\n");
      return -1;
   }
   fseek(fp, 0L, SEEK_END);
   int res = ftell(fp); //counting the size of the file
   fclose(fp); //closing the file
   return res;
}
int main() {
   char f_n[] = { "b.txt" }; //file name is “b.txt” whose size is to be determined
   int result = findfileSize(f_n);
   if (result != -1)
   printf("Size of the file is %ld bytes \n", result); //printing the file size
   return 0;
}
Size of the file is 2649 bytes
Python Design Patterns - Strategy

The strategy pattern is a type of behavioral pattern. The main goal of strategy pattern is to enable client to choose from different algorithms or procedures to complete the specified task. Different algorithms can be swapped in and out without any complications for the mentioned task.
This pattern can be used to improve flexibility when external resources are accessed.
The program shown below helps in implementing the strategy pattern.
import types

class StrategyExample:
   def __init__(self, func = None):
      self.name = 'Strategy Example 0'
      if func is not None:
         self.execute = types.MethodType(func, self)

   def execute(self):
      print(self.name)

def execute_replacement1(self): 
   print(self.name + 'from execute 1')

def execute_replacement2(self):
   print(self.name + 'from execute 2')

if __name__ == '__main__':
   strat0 = StrategyExample()
   strat1 = StrategyExample(execute_replacement1)
   strat1.name = 'Strategy Example 1'
   strat2 = StrategyExample(execute_replacement2)
   strat2.name = 'Strategy Example 2'
   strat0.execute()
   strat1.execute()
   strat2.execute()
The above program generates the following output −
It provides a list of strategies from the functions, which execute the output. The major focus of this behavior pattern is behavior.

    187 Lectures 
     17.5 hours 

 Malhar Lathkar

    55 Lectures 
     8 hours 

 Arnab Chakraborty

    136 Lectures 
     11 hours 

 In28Minutes Official

    75 Lectures 
     13 hours 

 Eduonix Learning Solutions

    70 Lectures 
     8.5 hours 

 Lets Kode It

    63 Lectures 
     6 hours 

 Abhilash Nelson
 Print
 Add Notes
 Bookmark this page
MySQL - IN Clause

You can use IN clause to replace many OR conditions
To understand IN clause, consider an employee_tbl table, which is having the following records −
mysql> SELECT * FROM employee_tbl;
+------+------+------------+--------------------+
|  id  | name | work_date  | daily_typing_pages |
+------+------+------------+--------------------+
|   1  | John | 2007-01-24 |        250         |
|   2  | Ram  | 2007-05-27 |        220         |
|   3  | Jack | 2007-05-06 |        170         |
|   3  | Jack | 2007-04-06 |        100         |
|   4  | Jill | 2007-04-06 |        220         |
|   5  | Zara | 2007-06-06 |        300         |
|   5  | Zara | 2007-02-06 |        350         |
+------+------+------------+--------------------+
7 rows in set (0.00 sec)
Now, suppose based on the above table you want to display records with daily_typing_pages equal to 250 and 220 and 170. This can be done using OR conditions as follows
mysql>SELECT * FROM employee_tbl 
   ->WHERE daily_typing_pages= 250 OR  
   ->daily_typing_pages= 220 OR  daily_typing_pages= 170; 
+------+------+------------+--------------------+
|  id  | name | work_date  | daily_typing_pages |
+------+------+------------+--------------------+
|   1  | John | 2007-01-24 |        250         |
|   2  | Ram  | 2007-05-27 |        220         |
|   3  | Jack | 2007-05-06 |        170         |
|   4  | Jill | 2007-04-06 |        220         |
+------+------+------------+--------------------+
4 rows in set (0.02 sec)
Same can be achieved using IN clause as follows −
mysql> SELECT * FROM employee_tbl 
   -> WHERE daily_typing_pages IN ( 250, 220, 170 );
+------+------+------------+--------------------+
|  id  | name | work_date  | daily_typing_pages |
+------+------+------------+--------------------+
|   1  | John | 2007-01-24 |        250         |
|   2  | Ram  | 2007-05-27 |        220         |
|   3  | Jack | 2007-05-06 |        170         |
|   4  | Jill | 2007-04-06 |        220         |
+------+------+------------+--------------------+
4 rows in set (0.02 sec)

    31 Lectures 
     6 hours 

 Eduonix Learning Solutions

    84 Lectures 
     5.5 hours 

 Frahaan Hussain

    6 Lectures 
     3.5 hours 

 DATAhill Solutions Srinivas Reddy

    60 Lectures 
     10 hours 

 Vijay Kumar Parvatha Reddy

    10 Lectures 
     1 hours 

 Harshit Srivastava

    25 Lectures 
     4 hours 

 Trevoir Williams
 Print
 Add Notes
 Bookmark this page
HTML title Tag - GeeksforGeeks

17 Mar, 2022
The <title> tag in HTML is used to define the title of HTML document. It sets the title in the browser toolbar. It provides the title for the web page when it is added to favorites. It displays the title for the page in search engine results.Note: You can NOT have more than one <title> element in an HTML document.
Syntax:  
<title> Title name </title>
Example:  
HTML
<!DOCTYPE html><html>    <head>        <title>title Tag</title>    </head>    <body>        <h1>GeeksforGeeks</h1>        <h2><title> Tag</h2>          <p>Welcome to GeeksforGeeks!</p>      </body></html>                   
Output:  
Supported Browser:  
Google Chrome
Internet Explorer
Firefox
Opera
Safari
 
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
arorakashish0911
shubhamyadav4
ManasChhabra2
HTML-Tags
HTML
HTML
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 set the default value for an HTML <select> element ?
How to update Node.js and NPM to next version ?
Hide or show elements in HTML using display property
HTML Cheat Sheet - A Basic Guide to HTML
How to set input type date in dd-mm-yyyy format using HTML ?
REST API (Introduction)
How to Insert Form Data into Database using PHP ?
CSS to put icon inside an input element in a form
GATE | GATE-CS-2014-(Set-3) | Question 44 - GeeksforGeeks

17 Sep, 2021
Consider the basic block given below.
  a = b + c
  c = a + d
  d = b + c
  e = d - b
  a = e + b 
The minimum number of nodes and edges present in the DAG representation of the above basic block respectively are(A) 6 and 6(B) 8 and 10(C) 9 and 12(D) 4 and 4Answer: (A)Explanation: Simplifying the given equations : d = b + c (given) e = d – b (given)=> d = b + c and e = c e = d – b (given) a = e + b (given)=> a = d
 
 Thus, the given DAG has 6 nodes and 6 edges.
YouTubeGeeksforGeeks GATE Computer Science16.3K subscribersGATE PYQ - Code Generation and Optimization | Joyojyoti Acharya | GeeksforGeeks GATE |Watch laterShareCopy linkInfoShoppingTap to unmuteIf playback doesn't begin shortly, try restarting your device.You're signed outVideos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer.CancelConfirmMore videosMore videosSwitch cameraShareInclude playlistAn error occurred while retrieving sharing information. Please try again later.Watch on0:000:0054:59 / 59:20•Live•<div class="player-unavailable"><h1 class="message">An error occurred.</h1><div class="submessage"><a href="https://www.youtube.com/watch?v=4ab8S2Qs7h8" target="_blank">Try watching this video on www.youtube.com</a>, or enable JavaScript if it is disabled in your browser.</div></div>
 Please comment below if you find anything wrong in the above post.
Quiz of this Question
GATE-CS-2014-(Set-3)
GATE-GATE-CS-2014-(Set-3)
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | Gate IT 2007 | Question 25
GATE | GATE-CS-2000 | Question 41
GATE | GATE-CS-2001 | Question 39
GATE | GATE-CS-2005 | Question 6
GATE | GATE MOCK 2017 | Question 21
GATE | GATE-CS-2006 | Question 47
GATE | GATE MOCK 2017 | Question 24
GATE | Gate IT 2008 | Question 43
GATE | GATE-CS-2009 | Question 38
GATE | GATE-CS-2003 | Question 90
Different ways of Reading a file in C#

Here, we are reading two different files −
Reading text file −
 Live Demo
using System;
using System.IO;

namespace FileApplication {
   class Program {
      static void Main(string[] args) {
         try {
            using (StreamReader sr = new StreamReader("d:/new.txt")) {
               string line;

               // Read and display lines from the file until
               // the end of the file is reached.
               while ((line = sr.ReadLine()) != null) {
                  Console.WriteLine(line);
               }
            }
         } catch (Exception e) {
            // Let the user know what went wrong.
            Console.WriteLine("The file could not be read:");
            Console.WriteLine(e.Message);
         }
         Console.ReadKey();
      }
   }
}
The file could not be read:
Could not find a part of the path "/home/cg/root/4281363/d:/new.txt".
Reading binary file −
using System.IO;

namespace BinaryFileApplication {
   class Program {
      static void Main(string[] args) {
         BinaryWriter bw;
         BinaryReader br;

         int i = 25;
         double d = 3.14157;
         bool b = true;
         string s = "I am happy";

         //create the file
         try {
            bw = new BinaryWriter(new FileStream("mydata", FileMode.Create));
         } catch (IOException e) {
            Console.WriteLine(e.Message + "\n Cannot create file.");
            return;
         }

         //writing into the file
         try {
            bw.Write(i);
            bw.Write(d);
            bw.Write(b);
            bw.Write(s);
         } catch (IOException e) {
            Console.WriteLine(e.Message + "\n Cannot write to file.");
            return;
         }
         bw.Close();

         //reading from the file
         try {
            br = new BinaryReader(new FileStream("mydata", FileMode.Open));
         } catch (IOException e) {
            Console.WriteLine(e.Message + "\n Cannot open file.");
            return;
         }

         try {
            i = br.ReadInt32();
            Console.WriteLine("Integer data: {0}", i);
            d = br.ReadDouble();
            Console.WriteLine("Double data: {0}", d);
            b = br.ReadBoolean();
            Console.WriteLine("Boolean data: {0}", b);
            s = br.ReadString();
            Console.WriteLine("String data: {0}", s);
         } catch (IOException e) {
            Console.WriteLine(e.Message + "\n Cannot read from file.");
            return;
         }

         br.Close();
         Console.ReadKey();
      }
   }
}
How to allow multiple file uploads in HTML forms.

If you want to allow a user to upload the file to your website, you need to use a file upload box, also known as a file select box. This is created using the <input> element and the type attribute is set to file.
To allow multiple file uploads in HTML forms, use the multiple attributes. The multiple attributes work with email and file input types.
You can try to run the following code to upload multiple files −
<!DOCTYPE html>
<html>
   <head>
      <title>Upload multiple files</title>
   </head>

   <body>
      <form>
         <input type="file" name="name" multiple><br><br>
         After uploading multiple files, click Submit.<br>
         <input type="submit" value="Submit">
      </form>
   </body>
</html>
How to remove cellspacing from tables using CSS? - GeeksforGeeks

01 Dec, 2020
This is a Default behavior of the table cells that there is some space between their Borders. To remove this space we can use the CSS border-collapsing Property. This Property is used to set the borders of the cell present inside the table and tells whether these cells will share a common border or not.
Syntax:
border-collapse: collapse; 
Example:  
<!DOCTYPE html> <html>     <head>         <title>          Remove cellspacing from tables using CSS        </title>                   <!-- border-collapse CSS property -->        <style>             table, td, th {                 border: 2px solid black;             }                           #collapseTable {                 border-collapse: collapse;             }         </style>     </head>       <body>         <h2> Before using the border Collapsing Property        </h2>                   <table id = "separateTable">             <tr>                 <th>Author Name</th>                 <th>Contact No</th>             </tr>             <tr>                 <td>Geek</td>                 <td>XXXXXXXXXX</td>             </tr>             <tr>                 <td>GFG</td>                 <td>XXXXXXXXXX</td>             </tr>         </table>               <h2> After using the border collapsing Property        </h2>                   <table id = "collapseTable">             <tr>                 <th>Author Name</th>                 <th>Contact No</th>             </tr>             <tr>                 <td>Geek</td>                 <td>XXXXXXXXXX</td>             </tr>             <tr>                 <td>GFG</td>                 <td>XXXXXXXXXX</td>             </tr>         </table>     </body> </html>
Output  
Supported Browsers are listed below:
Google Chrome
Internet Explorer
Firefox
Opera
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
CSS-Misc
HTML-Misc
CSS
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Design a web page using HTML and CSS
Form validation using jQuery
Search Bar using HTML, CSS and JavaScript
How to set space between the flexbox ?
How to style a checkbox using CSS?
How to set the default value for an HTML <select> element ?
How to set input type date in dd-mm-yyyy format using HTML ?
How to Insert Form Data into Database using PHP ?
Hide or show elements in HTML using display property
REST API (Introduction)
C Program to Sort an array of names or strings

In this problem, we are given an array of string. Our task is to create a c program to sort an array of name or string. This program will sort all the names we have given in the input in ascending alphabetical order.
Let’s take an example to understand the problem,
namesArray = ["Rishabh", "Jyoti", "Palak", "Akash"]
["Akash", "jyoti", "palak", "Rishabh"]
To solve this we will use the qsort() function of the standard template library as we know sorting of integer values the thing that changes here is we are considering string for comparison instead of integer values.
So, the comparator that is used in the qsort() will be changed, and strcmp() will be used to compare the strings in the comparator. Using this we can sort the array of names or strings.
C Program to Sort an array of names or strings
 Live Demo
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static int comparator(const void* str1, const void* str2) {
   if(strcmp(*(const char**)str1, *(const char**)str2) >= 0)
      return 1;
   else return 0;
}
int main() {
   const char* arr[] = {"Rishabh", "Jyoti", "Palak", "Akash"};
   int n = sizeof(arr) / sizeof(arr[0]);
   printf("\nGiven array of names: \t");
   for (int i = 0; i < n; i++) printf("%s \t", arr[i]);
      qsort(arr, n, sizeof(const char*), comparator);
   printf("\nSorted array of names: \t");
   for (int i = 0; i < n; i++)
      printf("%s \t", arr[i]);
   return 0;
}
Given array of names:  Rishabh Jyoti Palak Akash
Sorted array of names: Akash   Jyoti Palak Rishabh
How to change the scale of imshow in matplotlib without stretching the image?

To change the scale of imshow in matplotlib without stretching the image, we can take the following steps.
Set the figure size and adjust the padding between and around the subplots.
Set the figure size and adjust the padding between and around the subplots.
Create random data points with 4×4 dimension.
Create random data points with 4×4 dimension.
Display the data as an image, i.e., on a 2D regular raster.
Display the data as an image, i.e., on a 2D regular raster.
Use the extent parameter of imshow to map the image buffer pixel coordinates to a data space coordinate system.
Use the extent parameter of imshow to map the image buffer pixel coordinates to a data space coordinate system.
Next, set the aspect ratio of the image manually by supplying a value such as "aspect=4" or let it auto-scale by using aspect='auto'. This will prevent stretching of the image. By default, imshow sets the aspect of the plot to 1.
Next, set the aspect ratio of the image manually by supplying a value such as "aspect=4" or let it auto-scale by using aspect='auto'. This will prevent stretching of the image. By default, imshow sets the aspect of the plot to 1.
To display the figure, use Show() method.
To display the figure, use Show() method.
import numpy as np
from matplotlib import pyplot as plt

plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True

data = np.random.rand(4, 4)

plt.imshow(data, origin='lower', extent=[-4, 4, -1, 1], aspect=4)

plt.show()
It will produce the following output −
HTML | <font> color Attribute

28 Jul, 2021
The HTML <font> color Attribute is used to specify the text color inside the <font> element.
Syntax:
<font color="color_name|hex_number|rgb_number">
Attribute Values:
color_name: It sets the text color by using color name. For example: “red”.
hex_number: It sets the text color by using color hex code. For example: “#0000ff”.
rgb_number: It sets the text color by using rgb code. For example: “rgb(0, 153, 0)”.
Note: The <font> color attribute is not supported by HTML5.
Example:
<!DOCTYPE html><html>  <head>    <title>        HTML font face Attribute    </title></head>  <body>    <font size="6"          face="verdana"          color="green">            GeeksforGeeks!        </font>    <br>      <font size="6"          face="arial"           color="#008000">            GeeksforGeeks!        </font>    <br>      <font size="6"          color="rgb(128, 128, 0)">            GeeksforGeeks!        </font></body>  </html>
Output:
Supported Browsers: The browser supported by HTML <font> color attribute are listed below:
Google Chrome
Internet Explorer
Firefox
Safari
Opera
HTML is the foundation of webpages, is used for webpage development by structuring websites and web apps.You can learn HTML from the ground up by following this HTML Tutorial and HTML Examples.
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Creating a C++ template in vim in Linux

25 Jun, 2020
Vim allows users to create specific templates for files ending with certain extensions.
step 1: Create a template in ~/.vim/templates/ directory.A template is a skeleton content that can be fit into all the files ending with a certain specific extension.step 2: Add commands to ~/.vimrc file that directs vim to populate the new file with contents of the specified template.
For example:
  :autocmd BufNewFile  *.c 0r ~/vim/skeleton.c 

Explanation:– autocmd stands for Auto command.– BufNewFile is an event that denotes opening of a new file in the buffer.– *.c denotes all the files with extensions `.c`.– 0r denotes read a file and insert its content on top of the new file with extension `.c`. This is followed by a path to the skeleton file.
Step 1: Open the terminal.Step 2: Change directory to ~/.vim/templates/.
$ cd ~/.vim/templates/

Note: If templates subdirectory is not available then create one in .vim folder.
$ mkdir templates && cd templates

Step 3: Open template file.
$ sudo vim skeleton.cpp

Example:Step 4: Add skeleton/template. Save and close.Example:Step 5: Open ~/.vimrc file.
$ sudo vim  ~/.vimrc

Step 6: Add the following line to it.
:autocmd BufNewFile *.cpp 0r ~/.vim/templates/skeleton.cpp

Example:Step 7: Save and close.
Example:
coderjojo
Articles
C++
Linux-Unix
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Java Program to Convert Fahrenheit into Celsius

24 Nov, 2020
Here we are converting Fahrenheit temperature value to Celsius temperature value. Fahrenheit and Celsius are the measures of temperature having Unit in degrees as oF and oC respectively.
Formula
Celsius = (Fahrenheit - 32) / 1.8
Approach
Initialize the  value of Fahrenheit as 50.0 and Celsius as 0.0Calculate the Celsius using the above given formula.Display Celsius temperature.
Initialize the  value of Fahrenheit as 50.0 and Celsius as 0.0
Calculate the Celsius using the above given formula.
Display Celsius temperature.
Example
Java
// Java Program to Convert Fahrenheit into Celsius  class fahrenheittocelsius {        public static void main(String[] args)    {        // temperature in fahrenheit        double fahrenheit = 50.0, celsius = 0.0;          // calculate celsius temperature        celsius = (fahrenheit - 32) / 1.8;          // print the celsius temperature        System.out.println(            "value of temperature in celsius:" + celsius);    }}
value of temperature in celsius:10.0

Time Complexity: O(1)
Picked
Technical Scripter 2020
Java
Java Programs
Technical Scripter
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Stream In Java
Introduction to Java
Constructors in Java
Exceptions in Java
Generics in Java
Java Programming Examples
Convert Double to Integer in Java
Implementing a Linked List in Java using Class
Factory method design pattern in Java
Java Program to Remove Duplicate Elements From the Array
Node.js GM write() Function

11 Oct, 2021
The write() function is an inbuilt function in the GraphicsMagick library which is used to write an image to a file. If a file already exists, then it will be overwritten. The function returns the true value on success.Syntax: 
write( filename )
Parameters: This function accepts single parameters as mentioned above and described below:  
filename: This parameter is used to specify the name of the file.
Return Value: This function returns the GraphicsMagick object.Example 1:  
javascript
// Include gm libraryvar gm = require('gm');  // Import the imagegm(600, 300, 'white')  // set the color for the stroke.stroke("green", 3)  // Set the font .font("Helvetica.ttf", 60)  // Invoke drawRectangle function with// x0: 10, y0: 100, x1:260, y1:210.drawRectangle(10, 100, 260, 210)  // Invoke drawText in order to// name the box as 1 .drawText(150, 170, "1")  // Invoke drawrectangle function with// x0: 260, y0:100, x1: 350, y1: 210.drawRectangle(260, 100, 350, 210)  // Invoke drawText in order to// name the box as 2.drawText(300, 170, "2")  // Call to drawText Function.drawText(100, 280, "GeeksforGeeks!")  // Process and write the image .write("drawRectangle1.png", function (err) {  if (!err) console.log('done');});
Output: 
Example 2: Overwriting the file.  
javascript
// Include gm libraryvar gm = require('gm');  //Import the imagegm(600, 300, 'white')  // set the color for the stroke.stroke("green", 3)  // Set the font .font("Helvetica.ttf", 60)  // Invoke drawRectangle function with// x0: 10, y0: 100, x1:260, y1:210,// wc: 40, wh: 40.drawRectangle(10, 100, 260, 210, 40, 40)  // Invoke drawText in order to// name the box as 1 .drawText(150, 170, "1")  // Invoke drawrectangle function with// x0: 260, y0:100, x1: 350, y1: 210,// wc: 80, wh: 80.drawRectangle(260, 100, 350, 210, 80, 80)  // Invoke drawText in order to// name the box as 2.drawText(300, 170, "2")  // Call to drawText Function.drawText(100, 280, "GeeksforGeeks!")  // Process and write the image .write("drawRectangle1.png", function (err) {  if (!err) console.log('done');});
Output: 
Reference: https://www.npmjs.com/package/gm
anikaseth98
Image-Processing
Node.js-GM
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.