code-rag-bench/online-tutorials huggingface dataset:
Bootstrap .modal("hide") method

The .modal(“hide”) method in Bootstrap hides the modal.
Hide the Bootstrap modal on the click of a button −
$("#button1").click(function(){
  $("#newModal").modal("hide");
});
The modal is shown using the modal(“show”) method −
$("#newModal").modal("show");
Let us see an example of the modal(‘hide”) method −
Live Demo
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Bootstrap Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <style>
    #button1 {
      width: 140px;
      padding: 20px;
      bottom: 150px;
      z-index: 9999;
      font-size:15px;
      position: absolute;
      margin: 0 auto;
    }
    </style>
  </head>

<body>

<div class="container">
  <h2>Sample</h2>
  <p>This is demo text.</p>
  <p>This is demo text.</p>
  <p>This is demo text.</p>
  <p>This is demo text.</p>
  <p>This is demo text.</p>
  <p>This is demo text.</p>
  <p>This is demo text.</p>
  <p>This is demo text.</p>
  <p>This is demo text.</p>
  <p>This is demo text.</p>
  <p>This is demo text.</p>

  <button type="button" class="btn btn-default btn-lg" id="button1">Click to hide</button>

  <div class="modal fade" id="newModal" role="dialog">
   <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">×</button>
        <h4 class="modal-title">Sample Modal</h4>
      </div>
      <div class="modal-body">
        <p>This is demo text.</p>
      </div>
    </div>
  </div>
 </div>
</div>

<script>
$(document).ready(function(){
  $("#newModal").modal("show");

  $("#button1").click(function(){
    $("#newModal").modal("hide");
  });
});
</script>

</body>
</html>
Fortran - Exit Statement

Exit statement	terminates the loop or select case statement, and transfers execution to the statement immediately following the loop or select.
program nestedLoop 
implicit none

integer:: i, j, k
   iloop: do i = 1, 3      
      jloop: do j = 1, 3         
         kloop: do k = 1, 3    
        
         print*, "(i, j, k): ", i, j, k               
         
         if (k==2) then
            exit jloop 
         end if
         
         end do kloop       
      end do jloop  
   end do iloop 
   
end program nestedLoop  
When the above code is compiled and executed, it produces the following result −
(i, j, k): 1  1  1
(i, j, k): 1  1  2
(i, j, k): 2  1  1
(i, j, k): 2  1  2
(i, j, k): 3  1  1
(i, j, k): 3  1  2

 Print
 Add Notes
 Bookmark this page
How to search for a string in an ArrayList in java?

The contains a () method of the String class accepts Sting value as a parameter, verifies whether the current String object contains the specified string and returns true if it does (else false).
Therefore, to for a string in an ArrayList −
Get the array list.
Get the array list.
Using the for-each loop get each element of the ArrayList object.
Using the for-each loop get each element of the ArrayList object.
Verify whether each element in the array list contains the required string.
Verify whether each element in the array list contains the required string.
If so print the elements.
If so print the elements.
 Live Demo
import java.util.ArrayList;
import java.util.Iterator;
public class FindingString{
   public static void main(String[] args){
      ArrayList <String> list = new ArrayList<String>();
      //Instantiating an ArrayList object
      list.add("JavaFX");
      list.add("Java");
      list.add("WebGL");
      list.add("OpenCV");
      list.add("OpenNLP");
      list.add("JOGL");
      list.add("Hadoop");
      list.add("HBase");
      list.add("Java Script");
      list.add("Flume");
      list.add("Mahout");
      list.add("Impala");
      System.out.println("Contents of the array list: ");
      for (String element : list){
         if (element.contains("Java")){
               System.out.println(element);
         }
      }
   }
}
Contents of the array list:
JavaFX
Java
Java Script
DAX Logical - NOT function

Converts FALSE to TRUE and TRUE to FALSE.
NOT (<logical>) 

logical
A value or expression that can be evaluated to TRUE or FALSE.
Either TRUE or FALSE.
= NOT (AND ([Medal Count]<500, [Count of Sport]>100)) returns True. 
= NOT (AND (Results[Medal Count]>150,Results[Count of Sport]>150)) returns False. 

    53 Lectures 
     5.5 hours 

 Abhay Gadiya

    24 Lectures 
     2 hours 

 Randy Minder

    26 Lectures 
     4.5 hours 

 Randy Minder
 Print
 Add Notes
 Bookmark this page
First-Class Citizens in Python

First-class citizens are entities that enable support for all the operations facilitating other fellow entities.
These entities are often used : while passing an argument , returning a value from function , conditional modifications & value assignment.
In this article, we will look at the implementation & usage of first-class citizens in Python 3.x or earlier. Also, we will be learning what all entities get the tag of being First Class citizens.
These citizens include Variables along with functions.
Integers
Floating type
Complex Numbers
Strings
All four types mentioned above are given the tag of being first-class citizens in Python 3.x. Or earlier.
#Declaration of an integer
print("hello world")
int_inp=int(input())
print("This is a First class Citizen of "+str(type(int_inp)))
#Declaration of floating type
float_inp=float(input())
print("This is a First class Citizen of "+str(type(float_inp)))
#Declaration of complex numbers
complex_inp=complex(input())
print("This is a First class Citizen of "+str(type(complex_inp)))
#Declaration of Strings
str_inp=input()
print("This is a First class Citizen of "+str(type(str_inp)))
2
23.4
4+7j
tutorialspoint
This is a First class Citizen of <class 'int'>
This is a First class Citizen of <class 'float'>
This is a First class Citizen of <class 'complex'>
This is a First class Citizen of <class 'str'>
Now Let’s take a look at some functions which are referred to as first class citizens
First class objects are uniformly handled in Python language. Being objectoriented every entity refers to a default object which can be referenced and dereferenced at any point of time. Storage may be done using data structures or control structures.
Now we will look whether python supports first-class functions or not. So any language is said to support first-class functions when it treats functions as firstclass objects.
# Python program
# functions being be treated as objects
def comp_name(text):
   return text.isupper()
print(comp_name("TUTORIALSPOINT"))
new_name = comp_name #referencing a function with the object
print(new_name("TutorialsPoint"))
True
False
# Python program
# functions being passed as arguments to other functions
def new_inp(text):
   return text.upper()
def old_inp(text):
   return text.lower()
def display(func):
   # storing the function in a normal variable
   code = func("Love Coding, Learn everything on Tutorials Point")
   print (code)
display(new_inp) #directly referenced by passing functions as arguments.
display(old_inp)
LOVE CODING, LEARN EVERYTHING ON TUTORIALS POINT
love coding, learn everything on tutorials point
Here it is clearly seen that Python functions can be referenced using an object and can also be passed as an argument to another function which clearly shows that in Python functions are First Class Citizens and can be referenced and dereferenced using an object entity.
In this article, we learnt the implementation of max and min function included in the Standard Python Library.
\neg - Tex Command

\neg - Used to create neg symbol.
{ \neg}
\neg command draws neg symbol.

\neg

¬



\neg

¬


\neg

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
How to Create Directory If it Does Not Exist using Python? - GeeksforGeeks

28 Nov, 2021
In this article, We will learn how to create a Directory if it Does Not Exist using Python.
Under this method, we will use exists() method takes path of demo_folder as an argument and returns true if the directory exists and returns false if the directory doesn’t exist. makedirs() method is used to create demo_folder directory recursively .i.e. while creating demo_folder  if any intermediate-level directory is missing then it will create all those intermediate missing directories. in the above case if the geeks_dir is not present then it will first create geeks_dir then it will create demo_folder
Directory Used:
Python3
import os  # checking if the directory demo_folder # exist or not.if not os.path.exists("path/to/demo_folder"):          # if the demo_folder directory is not present     # then create it.    os.makedirs("path/to/demo_folder")
Output:
In this method, we will use isdir() method takes path of demo_folder2 as an argument and returns true if the directory exists and return false if the directory doesn’t exist and makedirs() method is used to create demo_folder2 directory recursively .i.e. while creating demo_folder2  if any intermediate-level directory is missing then it will create all those intermediate missing directories. in the above case if the geeks_dir is not present then it will first create geeks_dir then it will create demo_folder2.
Directory Used:
Python3
import os    # checking if the directory demo_folder2 # exist or not.if not os.path.isdir("path/to/demo_folder2"):        # if the demo_folder2 directory is     # not present then create it.    os.makedirs("path/to/demo_folder2")
output:
Picked
Python directory-program
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Python | Pandas dataframe.groupby()
Create a directory in Python
Defaultdict in Python
Python | Get unique values from a list
MySQL query to check if multiple rows exist?

Let us first create a table −
mysql> create table DemoTable1219
(
   Id int,
   Name varchar(40)
);
Query OK, 0 rows affected (0.43 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1219 values(100,'Adam');
Query OK, 1 row affected (0.11 sec)
mysql> insert into DemoTable1219 values(101,'John');
Query OK, 1 row affected (0.23 sec)
mysql> insert into DemoTable1219 values(102,'Chris');
Query OK, 1 row affected (0.12 sec)
mysql> insert into DemoTable1219 values(103,'Bob');
Query OK, 1 row affected (0.18 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable1219;
This will produce the following output −
+------+-------+
| Id   | Name  |
+------+-------+
|  100 | Adam  |
|  101 | John  |
|  102 | Chris |
|  103 | Bob   |
+------+-------+
4 rows in set (0.00 sec)
Following is the query to check if multiple rows exist −
mysql> select count(distinct Id)=3 from DemoTable1219 where Id IN(100,103,102);
This will produce the following output −
+----------------------+
| count(distinct Id)=3 |
+----------------------+
|                   1 |
+----------------------+
1 row in set (0.00 sec)
Note − The returned value is 1 that means multiple rows exists.
Java Connection getTransactionIsolation() method with example

In a database system where more than one transaction is being executed simultaneously and in parallel, the property of isolation states that all the transactions will be carried out and executed as if it is the only transaction in the system. No transaction will affect the existence of any other transaction.
JDBC provides support 5 transaction isolation levels through Connection interface.
TRANSACTION_NONE: It is represented by integer value 0 does not support transactions.
TRANSACTION_READ_COMMITTED: It is represented by integer value 2 supports transactions allowing Non-Repeatable Reads and, Phantom Reads.
TRANSACTION_READ_UNCOMMITTED: It is represented by integer value 1 supports transactions allowing Dirty Reads, Non-Repeatable Reads and, Phantom Reads.
TRANSACTION_REPEATABLE_READ: It is represented by integer value 4 supports transactions allowing only Phantom Reads.
TRANSACTION_SERIALIZABLE: It is represented by integer value 8 supports transactions without allowing Dirty Reads, Non-Repeatable Reads and, Phantom Reads.
The getTransactionIsolation() method of the Connection interface retrieves and returns the current transaction isolation level of the underlying database in integer format.
This method returns an integer value representing one of the 5 transaction isolation levels.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Connection_getTransactionIsolation {
   public static void main(String args[]) throws SQLException {
      //Registering the Driver
      DriverManager.registerDriver(new com.mysql.jdbc.Driver());
      //Getting the connection
      String url = "jdbc:mysql://localhost/mydatabase";
      Connection con = DriverManager.getConnection(url, "root", "password");
      System.out.println("Connection established......");
      //Retrieving the transaction isolation level
      int transactionIsoltionLevel = con.getTransactionIsolation();
      System.out.println("Transaction isolation level of the underlying
         database is: "+transactionIsoltionLevel);
   }
}
Connection established......
Transaction isolation level of the underlying database is: 4
mysqladmin - A MySQL Server Administration Program

The ‘mysqladmin’ is a client that helps perform administrative operations. It can also be used to check the server's configuration and current status, to create and drop databases, and much more.
The mysqladmin can be invoked by using the below command −
shell> mysqladmin [options] command [command-arg] [command [command-arg]] ...
Let us see some of the commands which mysqladmin supports. Some commands take an argument following the command name.
This command creates a new database named db_name.
It deletes the database named db_name and all its tables.
It displays the server status variables and their values.
It flushes all information in the host cache.
It reloads the grant tables. It is same as reload.
It kills the server threads. If multiple thread ID values are provided, then there should be no spaces in the list.
It sets a new password. This changes the password to new_password so that the account used by user is the one with mysqladmin to connect to the server.
This command checks whether the server is available. The return status from mysqladmin is 0 if the server is running, and it is 1 if it is not.
It shows a list of active server threads. This is similar to the output of the SHOW PROCESSLIST statement.
It reloads the grant tables.
It flushes all tables and closes and opens log files.
It stops the server.
It displays the version information from the server.
How to get the following-sibling element for a table type of structure in Selenium?

We can get the following-sibling element for a table type of structure in Selenium webdriver. A following-sibling is used to determine the siblings of the context node.
Also, these siblings should be present at the same hierarchy of the current node and share the same parent. Let us take an instance of a table with table tag having multiple children with tag tr.
Then let us try to identify the elements in the third row highlighted on the below image from the first row which contains the table headers.
//table[@id='table1']/tbody/tr[1]/following-sibling::tr[2]/td
Here, we are locating the third row in the table, but we have provided followingsibling::tr[2] since we are locating the third row from the first row.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
public class FollowingSiblingTable{
   public static void main(String[] args) {
      System.setProperty("webdriver.chrome.driver",
         "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe");
      WebDriver driver = new ChromeDriver();
      //implicit wait
      driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
      //URL launch driver.
      get("https://sqengineer.com/practice-sites/practice-tables-selenium/");
      //identify third row from first row in form of list
      List<WebElement> l = driver.findElements(By.xpath ("//table[@id='table1']/tbody/tr[1]/following-sibling::tr[2]/td"));
      //iterate list to get text of third row elements
      for (int i = 0; i<l.size(); i++) {
         String colVal = driver.findElements(By.xpath ("//table[@id='table1']/tbody/tr[1]/following-sibling::tr[2]/td")) .get(i).getText();
         System.out.println("Values at third row after are : " + colVal);
      }
      driver.close();
   }
}
Can we define a class inside a Java interface?

Yes, you can define a class inside an interface. In general, if the methods of the interface use this class and if we are not using it anywhere else we will declare a class within an interface.
interface Library {
   void issueBook(Book b);
   void retrieveBook(Book b);
   public class Book {
      int bookId;
      String bookName;
      int issueDate;
      int returnDate;
   }
}
public class Sample implements Library {
   public void issueBook(Book b) {
      System.out.println("Book Issued");
   }
   public void retrieveBook(Book b) {
      System.out.println("Book Retrieved");
   }
   public static void main(String args[]) {
      Sample obj = new Sample();
      obj.issueBook(new Library.Book());
      obj.retrieveBook(new Library.Book());
   }
}
Hello welcome to tutorialspoint
If we need to provide a default implementation of the interface, we will define a class inside an interface as:
interface Library {
   void issueBook(Book b);
   void retrieveBook(Book b);
   public class Book implements Library {
      int bookId;
      String bookName;
      int issueDate;
      int returnDate;
      public void issueBook(Book b) {
         System.out.println("book issued");
      }
      public void retrieveBook(Book b) {
         System.out.println("book retrieved");
      }
   }
}
public class Sample {
   public void demo() {
      System.out.println("Hello welcome to tutorialspoint");
   }
   public static void main(String args[]) {
      Sample obj = new Sample();
      obj.demo();
   }
}
How to work with cookies in Selenium with python?

We can work with cookies in Selenium with the help of numerous methods which control the browser or its sessions. We can easily add or delete a cookie. A cookie implementation is essential for ensuring proper authentication of websites.
The methods to work with cookie are listed below −
add_cookie(args)This method adds a cookie to the present session. The arguments consist of the names of the cookies that we want to add.
add_cookie(args)
This method adds a cookie to the present session. The arguments consist of the names of the cookies that we want to add.
Syntax −
driver.add_cookie({'id' : 'val' : 'session'})
get_cookie(args)This method gets a cookie of a specific name. The argument consists of the name of the cookie that we want to retrieve.
get_cookie(args)
This method gets a cookie of a specific name. The argument consists of the name of the cookie that we want to retrieve.
Syntax −
driver.get_cookie("name")
delete_cookie(args)This method deletes a cookie with a specific name. The argument consists of the names of the cookies that we want to delete.
delete_cookie(args)
This method deletes a cookie with a specific name. The argument consists of the names of the cookies that we want to delete.
Syntax −
driver.delete_cookie("session")
delete_all_cookies()This method deletes all cookies in the present session. It has no arguments.
delete_all_cookies()
This method deletes all cookies in the present session. It has no arguments.
Syntax −
driver.delete_all_cookies()

get_cookies()This method returns all the cookies in the present session in the form of dictionaries.
get_cookies()
This method returns all the cookies in the present session in the form of dictionaries.
Syntax −
driver.get_cookies()
Coding Implementation on addition and deletion of cookies.
from selenium import webdriver
#browser exposes an executable file
#Through Selenium test we will invoke the executable file which will then #invoke actual browser
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe")
# to maximize the browser window
driver.maximize_window()
#get method to launch the URL
driver.get("https://www.tutorialspoint.com/selenium/selenium_automation_practice.htm")
#to refresh the browser
driver.refresh()
#to add cookies of particular names
driver.add_cookie({'id' : 'val': 'session'})
#to get a specific cookie
print(driver.get_cookie("id"))
#to get all cookies of the session
print(driver.get_cookies())
#to delete a particular cookie
driver.delete_cookie("val")
#to delete all cookies in present session
driver.delete_all_cookies()
How do I find the length of an array in C/C++?

Some of the methods to find the length of an array are given as follows −
The sizeof() operator can be used to find the length of an array. A program that demonstrates the use of the sizeof operator in C++ is given as follows.
 Live Demo
#include <iostream>
using namespace std;
int main() {
   int arr[5] = {4, 1, 8, 2, 9};
   int len = sizeof(arr)/sizeof(arr[0]);
   cout << "The length of the array is: " << len;
   return 0;
}
The output of the above program is as follows −
The length of the array is: 5
Now, let us understand the above program.
The variable len stores the length of the array. The length is calculated by finding size of array using sizeof and then dividing it by size of one element of the array. Then the value of len is displayed. The code snippet for this is given as follows −
int arr[5] = {4, 1, 8, 2, 9};
int len = sizeof(arr)/sizeof(arr[0]);
cout << "The length of the array is: " << len;
Pointer arithmetic can be used to find the length of an array. A program that demonstrates this is given as follows.
 Live Demo
#include <iostream>
using namespace std;
int main() {
   int arr[5] = {5, 8, 1, 3, 6};
   int len = *(&arr + 1) - arr;
   cout << "The length of the array is: " << len;
   return 0;
}
The output of the above program is as follows −
The length of the array is: 5
Now, let us understand the above program.
The value contained in *(&arr + 1) is the address after 5 elements in the array. The value contained in arr is the address of the starting element in array. So their subtraction results in the length of the array. The code snippet for this is given as follows −
int arr[5] = {5, 8, 1, 3, 6};
int len = *(&arr + 1) - arr;
cout << "The length of the array is: " << len;
PyQt5 - Setting background color to the ComboBox - GeeksforGeeks

22 Apr, 2020
In this article we will see how we can set the background color to the combo box. By default combo box is of grey color although we can change its color. Below is the representation of normal combo box and colorful combo box.
 
In order to do this we have to change the style sheet code of the combo box, below is the style sheet code
QComboBox
{
background-color : lightgreen;
}

Below is the implementation
# importing librariesfrom PyQt5.QtWidgets import * from PyQt5 import QtCore, QtGuifrom PyQt5.QtGui import * from PyQt5.QtCore import * import sys    class Window(QMainWindow):      def __init__(self):        super().__init__()          # setting title        self.setWindowTitle("Python ")          # setting geometry        self.setGeometry(100, 100, 600, 400)          # calling method        self.UiComponents()          # showing all the widgets        self.show()      # method for widgets    def UiComponents(self):          # creating a combo box widget        self.combo_box = QComboBox(self)          # setting geometry of combo box        self.combo_box.setGeometry(200, 150, 150, 30)          # geek list        geek_list = ["Sayian", "Super Sayian", "Super Sayian 2", "Super Sayian B"]          # making it editable        self.combo_box.setEditable(True)          # adding list of items to combo box        self.combo_box.addItems(geek_list)          self.combo_box.setStyleSheet("QComboBox"                                     "{"                                     "background-color: lightgreen;"                                     "}")    # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
Output :
Python PyQt5-ComboBox
Python-gui
Python-PyQt
Python
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
sum() function in Python
*args and **kwargs in Python
GATE | GATE CS 2008 | Question 36 - GeeksforGeeks

19 Nov, 2018
Which of the following are NOT true in a pipelined processor?
I.  Bypassing can handle all RAW hazards.
II. Register renaming can eliminate all register 
    carried WAR hazards.
III. Control hazard penalties can be eliminated by 
     dynamic branch prediction.
(A) I and II only(B) I and III only(C) II and III only(D) I, II and IIIAnswer: (B)Explanation: I – False, Bypassing can’t handle all RAW hazard, consider when any instruction depends on the result of LOAD instruction, now LOAD updates register value at Memory Access Stage (MA), so data will not be available directly on Execute stage.
II – True, register renaming can eliminate all WAR Hazard.
III- False, It cannot completely eliminate, though it can reduce Control Hazard PenaltiesQuiz of this Question
GATE-CS-2008
GATE-GATE CS 2008
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
GATE | GATE-IT-2004 | Question 71
GATE | GATE CS 2011 | Question 7
GATE | GATE-CS-2016 (Set 2) | Question 48
GATE | GATE CS 2010 | Question 24
GATE | GATE-CS-2015 (Set 3) | Question 65
GATE | GATE-CS-2016 (Set 1) | Question 65
GATE | GATE-CS-2014-(Set-3) | Question 38
GATE | GATE CS 2018 | Question 37
GATE | GATE-IT-2004 | Question 83
GATE | GATE-CS-2016 (Set 1) | Question 63
How to get current date and time in Python?

You can get the current date and time using multiple ways. The easiest way is to use the datetime module. It has a function, now, that gives the current date and time. 
import datetime
now = datetime.datetime.now()
print("Current date and time: ")
print(str(now))
This will give the output −
2017-12-29 11:24:48.042720
You can also get the formatted date and time using strftime function. It accepts a format string that you can use to get your desired output. Following are the directives supported by it.
You can use these directives in the strftime function as follows &mminus;
import datetime
now = datetime.datetime.now()
print("Current date and time: ")
print(now.strftime('%Y-%m-%d %H:%M:%S'))
print(now.strftime('%H:%M:%S on %A, %B the %dth, %Y'))
This will give the output −
2017-12-29 12:19:13
12:19:13 on Friday, December the 29th, 2017
Line plot with arrows in Matplotlib

To plot with arrows in matplotlib, we can use arrow() method.
Create x and y data points using numpy.
Plot x and y with color=red and linewidth = 1.
Use arrow method to add an arrow to the axes. The first two values in the arguments are the
coordinates of the arrow base and the next two values are for the length of the arrow along X and
Y direction.
To display the figure, use show() method.
from matplotlib import pyplot as plt
import numpy as np
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
x = np.linspace(-2, 2, 100)
y = np.sin(x)
plt.plot(x, y, c='b', lw=1)
plt.arrow(0, 0, 0.01, np.sin(0.01), shape='full', lw=10,
   length_includes_head=True, head_width=.05, color='r')
plt.show()
Custom Checkbox with CSS appearance Property

We use the appearance property to style an element according to the platform-native style of the user’s operating system.
The syntax of CSS appearance property is as follows −
Selector {
   appearance: /*value*/;
   -webkit-appearance: /*value*/; /*for Safari and Chrome */
   -moz-appearance: /*value*/; /*for Firefox */
}
The following examples illustrate CSS appearance property.
 Live Demo
<!DOCTYPE html>
<html>
   <style>
      input[type=checkbox] {
         appearance: none;
         -webkit-appearance: none;
         -moz-appearance: none;
         padding: 12px;
         background-color: cyan;
         box-shadow: inset 0 3px 3px 5px lightgreen;
         border-radius:50%;
      }
      input[type=checkbox]:checked {
         background-color: coral;
         border: 6px solid cornflowerblue;
         box-shadow: 0 1px 2px lightorange;
      }
      input[type=checkbox]:checked:after {
         content:"Checked";
      }
   </style>
<body>
   <input type="checkbox"> Custom Checkbox Example
</body>
</html>
This gives the following output
 Live Demo
<!DOCTYPE html>
<html>
   <style>
      input[type=checkbox] {
         appearance: none;
         -webkit-appearance: none;
         -moz-appearance: none;
         padding: 10px;
         background-color: cyan;
         border-radius:5%;
      }
      input[type=checkbox]:checked {
         background-color: magenta;
      }
      input[type=checkbox]:checked:before {
         content:"\2713";
         color: white;
         padding: initial;
         font-weight: bold;
      }
   </style>
<body>
   <input type="checkbox"> Another Custom Checkbox Example
</body>
</html>
This gives the following output
How to get the value of environment variable in Postman?

We can get the value of an Environment variable in Postman at runtime with the help of scripts. This is done with the help of the pm.* function. The script to get the Environment variable can be included either in the Tests or Pre-Request Script tab
To get an Environment variable, the script should be −
pm.environment.get('<name of Environment variable>')
Finally, to get the value of the Environment variable in the Postman console, the script should be −
console.log(pm.environment.get('<name of Environment variable>'))
Let us try to get the value of the Environment variable tutorial.
Step1 − Add the below script to get the value of the Environment variable tutorial and print it in console.
console.log(pm.environment.get('tutorial'))
Step2 − Click on Send to execute a request.
Step3 − After the Response is received, open the Postman Console. It displays postman which is the value set for the Environment variable tutorial.
SQL Tryit Editor v1.6

INSERT INTO Customers (CustomerName, City, Country)
SELECT SupplierName, City, Country FROM Suppliers
WHERE Country='Germany';
​
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.
Deploying Flask on Windows. A sad and painful journey of self... | by Kyle Pastor | Towards Data Science

NB: If you can use linux please do! I had to use Windows at my company because the IT will not give us linux boxes. Therefore, after a lot of hair pulling I had to figure out how to deploy a flask API.
For this short article, I will not go into detail about the actual creation of the flask API but more about how to deploy. Here is a super-condensed step by step to get a flask API running.
pip install flask waitress
You will notice we are installing waitress which is a Windows compatible server that we can use to deploy our flask app on multiple threads. This is actually a really nice way to do it! Here is our API code:
from flask import Flaskfrom waitress import serveapp = Flask(__name__)@app.route('/api/v1/')def myendpoint():    return 'We are computering now'serve(app, host='0.0.0.0', port=8080, threads=1) #WAITRESS!
As you can see from the above we have a super complicated API that we can call from the browser when running:
python server.py
We should be able to navigate to http://myIP:8080/api/v1 and get back the expected response.
So this is all good but now what to do? On Windows how do we ensure this will run on boot? The Task Scheduler is how I did it. First, make sure you have admin access then open up the task scheduler.
When creating a task there are a few very important settings:
Make sure you select the highest privileges box
Make sure you select the highest privileges box
2. Trigger the task to run on startup
3. Make sure that you use pythonw to run in the background (or else you will have a command prompt sitting around forever)
4. Use the Start Directory where you python file exists.
BOOM! With that, you should be able to hit run and test your endpoints. With any luck, the next time you reboot the job should trigger and will be running!
I truly hope this helps some poor soul in the future. Godspeed.
A lot of this was just experimentation and the snapshots are my own!
Tryit Editor v3.7

Tryit: HTML pre element
How to schedule tasks in Java to run for repeated fixed-delay execution, beginning after the specified delay

One of the methods in the Timer class is the void schedule(TimerTask task, long delay, long period) method. This method schedules tasks for repeated fixed-delay execution, beginning after the specified delay.
In fixed-delay execution, each execution is scheduled with respect to the original execution time of the preceding execution. If an execution is delayed for a particular reason (case in point, garbage collection), the subsequent executions will be delayed as well.
Declaration −The java.util.Timer.schedule(TimerTask task, long delay, long period) is declared as follows −
public void schedule(TimerTask task, long delay, long period)
Here, task is the task to be scheduled, delay is the delay in milliseconds after which the task is executed and period is the time in milliseconds between successive task executions.
Here, task is the task to be scheduled, firstTime is the first time at which the task is executed and period is the time in milliseconds between successive task executions.
There are few exceptions thrown by the schedule(Timertask task, long delay, long period) method. They are as follows −
Let us see a program illustrating the use of the void schedule(TimerTask task, long delay, long period) method −
 Live Demo
import java.util.*;
class MyTask extends TimerTask {
   public void run() {
      System.out.println("Task is running");
   }
}
public class Example {
   public static void main(String[] args) {
      Timer timer = new Timer(); // creating timer
      TimerTask task = new MyTask(); // creating timer task
      // scheduling the task for repeated fixed-delay execution, beginning after the specified delay
      timer.schedule(task, 800, 1000);
   }
}
Task is running
Task is running
Task is running
Task is running
Task is running
Task is running
Task is running
Task is running
Task is running
JSON.simple - Container Factory

ContainerFactory can be used to create Custom container for parsed JSON objects/arrays. First we need to create a ContainerFactory object and then use it in parse Method of JSONParser to get the required object. See the example below − 
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import org.json.simple.parser.ContainerFactory;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

class JsonDemo {
   public static void main(String[] args) {
      JSONParser parser = new JSONParser();
      String text =  "{\"first\": 123, \"second\": [4, 5, 6], \"third\": 789}";
      ContainerFactory containerFactory = new ContainerFactory() {
         @Override
         public Map createObjectContainer() {
            return new LinkedHashMap<>();
         }
         @Override
         public List creatArrayContainer() {
            return new LinkedList<>();
         }
      };
      try {
         Map map = (Map)parser.parse(text, containerFactory);       
         map.forEach((k,v)->System.out.println("Key : " + k + " Value : " + v));
      } catch(ParseException pe) {
         System.out.println("position: " + pe.getPosition());
         System.out.println(pe);
      }
   }
}
Key : first Value : 123
Key : second Value : [4, 5, 6]
Key : third Value : 789


    20 Lectures 
     1 hours 

 Laurence Svekis

    16 Lectures 
     1 hours 

 Laurence Svekis

    10 Lectures 
     1 hours 

 Laurence Svekis

    23 Lectures 
     2.5 hours 

 Laurence Svekis

    9 Lectures 
     48 mins

 Nilay Mehta

    18 Lectures 
     2.5 hours 

 Stone River ELearning
 Print
 Add Notes
 Bookmark this page
ChronoLocalDate toEpochDay() method in Java with Examples - GeeksforGeeks

29 Apr, 2019
The toEpochDay() method of a ChronoLocalDate interface is used to get this date as a EpochDay. The EpochDay is the count of the day from the 0 EpochDay which is the 1970-01-01 (ISO). The output will be in the ISO-8601 format yyyy-MM-dd.
Syntax:
default long toEpochDay()

Parameters: This method does not accepts any parameters.
Return value: This method returns a long value which is the EpochDay count of this date, not null.
Below programs illustrate the toEpochDay() method:
Program 1:
// Java program to demonstrate// ChronoLocalDate.toEpochDay() method  import java.time.*;import java.time.chrono.*;  public class GFG {    public static void main(String[] args)    {          // create a ChronoLocalDate object        ChronoLocalDate localD            = LocalDate.parse("2018-12-06");          // print ChronoLocalDate        System.out.println("ChronoLocalDate as EpochDay: "                           + localD.toEpochDay());    }}
ChronoLocalDate as EpochDay: 17871

Program 2:
// Java program to demonstrate// ChronoLocalDate.toEpochDay() method  import java.time.*;import java.time.chrono.*;  public class GFG {    public static void main(String[] args)    {          // create a ChronoLocalDate object        ChronoLocalDate localD            = LocalDate.parse("2021-06-30");          // print ChronoLocalDate        System.out.println("ChronoLocalDate as EpochDay: "                           + localD.toEpochDay());    }}
ChronoLocalDate as EpochDay: 18808

Reference: https://docs.oracle.com/javase/9/docs/api/java/time/chrono/ChronoLocalDate.html#toEpochDay–
Java-ChronoLocalDate
Java-Functions
Java-time package
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Constructors in Java
Stream In Java
Different ways of Reading a text file in Java
Exceptions in Java
Functional Interfaces in Java
Java Programming Examples
StringBuilder Class in Java with Examples
Comparator Interface in Java with Examples
Checked vs Unchecked Exceptions in Java
Strings in Java
Java case Keyword

❮ Java Keywords

Calculate the weekday name:
int day = 4;
switch (day) {
  case 1:
    System.out.println("Monday");
    break;
  case 2:
    System.out.println("Tuesday");
    break;
  case 3:
    System.out.println("Wednesday");
    break;
  case 4:
    System.out.println("Thursday");
    break;
  case 5:
    System.out.println("Friday");
    break;
  case 6:
    System.out.println("Saturday");
    break;
  case 7:
    System.out.println("Sunday");
    break;
}
// Outputs "Thursday" (day 4)


Try it Yourself »

The case keyword marks a block of code in a switch statement.
Read more about the switch statement in our Java Switch Tutorial.

❮ Java Keywords

We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
C/C++ program to find the size of int, float, double and char - GeeksforGeeks

05 Dec, 2019
Given four types of variables, namely int, char, float and double, the task is to write a program in C or C++ to find the size of these four types of variables.
Examples:
Input: int
Output: Size of int = 4

Input: double
Output: Size of double = 8

Here is a list of all the data types with its size, range and the access specifiers:
To find the size of the four variables:
The four types of variables are defined in integerType, floatType, doubleType and charType.The size of the variables is calculated using the sizeof() operator.
The four types of variables are defined in integerType, floatType, doubleType and charType.
The size of the variables is calculated using the sizeof() operator.
Below is the C and C++ program to find the size of int, char, float and double data types:
C
C++
// C program to find the size of int, char,// float and double data types  #include <stdio.h>  int main(){    int integerType;    char charType;    float floatType;    double doubleType;      // Calculate and Print    // the size of integer type    printf("Size of int is: %ld\n",           sizeof(integerType));      // Calculate and Print    // the size of charType    printf("Size of char is: %ld\n",           sizeof(charType));      // Calculate and Print    // the size of floatType    printf("Size of float is: %ld\n",           sizeof(floatType));      // Calculate and Print    // the size of doubleType    printf("Size of double is: %ld\n",           sizeof(doubleType));      return 0;}
// C++ program to find the size of int, char,// float and double data types#include <iostream>using namespace std;  int main() {     int integerType;     char charType;     float floatType;     double doubleType;       // Calculate and Print     // the size of integer type     cout << "Size of int is: " <<     sizeof(integerType) <<"\n";       // Calculate and Print     // the size of doubleType     cout << "Size of char is: " <<     sizeof(charType) <<"\n";           // Calculate and Print     // the size of charType     cout << "Size of float is: " <<     sizeof(floatType) <<"\n";      // Calculate and Print     // the size of floatType     cout << "Size of double is: " <<     sizeof(doubleType) <<"\n";       return 0; } 
Size of int is: 4
Size of char is: 1
Size of float is: 4
Size of double is: 8

rameshmarisa
Chinmoy Lenka
C-Data Types
C Language
C Programs
School Programming
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
TCP Server-Client implementation in C
Exception Handling in C++
Multithreading in C
'this' pointer in C++
UDP Server-Client implementation in C
Strings in C
UDP Server-Client implementation in C
Arrow operator -> in C/C++ with Examples
C Program to read contents of Whole File
Header files in C/C++ and its uses
How to remove the title bar in a Tkinter window without using overrideredirect() method?

To remove the title bar of a Tkinter window, we can use wm_attributes('type', 'value') method by specifying the type of property. In the following example, we will use 'fullscreen', a Boolean value that removes the title bar of the window.
#Import the tkinter library
from tkinter import *

#Create an instance of tkinter frame
win = Tk()
win.geometry("700x350")

#Create a Label to print the Name
label= Label(win, text="This is a New Line Text", font= ('Helvetica 14 bold'), foreground= "red3")
label.pack()

win.wm_attributes('-fullscreen', 'True')
win.mainloop()
Running the above code will display a fullscreen window without the title bar.
ftell() in C with example - GeeksforGeeks

10 Mar, 2022
ftell() in C is used to find out the position of file pointer in the file with respect to starting of the file. Syntax of ftell() is: 
long ftell(FILE *pointer)
Consider below C program. The file taken in the example contains the following data : “Someone over there is calling you. We are going for work. Take care of yourself.” (without the quotes) When the fscanf statement is executed word “Someone” is stored in string and the pointer is moved beyond “Someone”. Therefore ftell(fp) returns 7 as length of “someone” is 6. 
CPP
// C program to demonstrate use of ftell()                               #include<stdio.h> int main(){    /* Opening file in read mode */    FILE *fp = fopen("test.txt","r");     /* Reading first string */    char string[20];      fscanf(fp,"%s",string);     /* Printing position of file pointer */    printf("%ld", ftell(fp));    return 0;}
Output : Assuming test.txt contains “Someone over there ....”.  
7
This article is contributed by Hardik Gaur. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. 
simmytarika5
cpp-file-handling
CPP-Library
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Left Shift and Right Shift Operators in C/C++
Function Pointer in C
rand() and srand() in C/C++
Substring in C++
std::string class in C++
TCP Server-Client implementation in C
Enumeration (or enum) in C
Command line arguments in C/C++
Different methods to reverse a string in C/C++
Structures in C