code-rag-bench/online-tutorials huggingface dataset:
Advanced Excel Statistical - RSQ Function

The RSQ function returns the square of the Pearson product moment correlation coefficient through data points in known_y's and known_x's.
RSQ (known_y's,known_x's)

The equation for the Pearson product moment correlation coefficient, r, is −
$$r=\frac{\sum \left ( x-\bar{x} \right )\left ( y-\bar{y} \right )}{\sqrt{\sum \left ( x-\bar{x} \right )^2 \sum \left ( y-\bar{y} \right )^2}}$$
Where x and y are the sample means AVERAGE (known_x’s) and AVERAGE (known_y’s)

The equation for the Pearson product moment correlation coefficient, r, is −
$$r=\frac{\sum \left ( x-\bar{x} \right )\left ( y-\bar{y} \right )}{\sqrt{\sum \left ( x-\bar{x} \right )^2 \sum \left ( y-\bar{y} \right )^2}}$$
Where x and y are the sample means AVERAGE (known_x’s) and AVERAGE (known_y’s)
RSQ returns r2, which is the square of this correlation coefficient.
RSQ returns r2, which is the square of this correlation coefficient.
Arguments can either be numbers or names, arrays, or references that contain numbers.
Arguments can either be numbers or names, arrays, or references that contain numbers.
Logical values and text representations of numbers that you type directly into the list of arguments are counted.
Logical values and text representations of numbers that you type directly into the list of arguments are counted.
If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.
If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.
Arguments that are error values or text that cannot be translated into numbers cause errors.
Arguments that are error values or text that cannot be translated into numbers cause errors.
If known_y's and known_x's are empty or have a different number of data points, RSQ returns the #N/A error value.
If known_y's and known_x's are empty or have a different number of data points, RSQ returns the #N/A error value.
If one or both of the supplied arrays contain only 1 data point, RSQ returns the #DIV/0! error value.
If one or both of the supplied arrays contain only 1 data point, RSQ returns the #DIV/0! error value.
If the standard deviation of their values in one or both of the supplied arrays is equal to zero, RSQ returns the #DIV/0! error value.
If the standard deviation of their values in one or both of the supplied arrays is equal to zero, RSQ returns the #DIV/0! error value.
Excel 2007, Excel 2010, Excel 2013, Excel 2016

    296 Lectures 
     146 hours 

 Arun Motoori

    56 Lectures 
     5.5 hours 

 Pavan Lalwani

    120 Lectures 
     6.5 hours 

 Inf Sid

    134 Lectures 
     8.5 hours 

 Yoda Learning

    46 Lectures 
     7.5 hours 

 William Fiset

    25 Lectures 
     1.5 hours 

 Sasha Miller
 Print
 Add Notes
 Bookmark this page
Python Program to get all unique keys from a List of Dictionaries

When it is required to get all the unique keys from a list of dictionary, the dictionary values are iterated over and converted into a set. This is converted to a list and displayed on the console.
Below is a demonstration of the same
my_list = [{'hi' : 11, 'there' : 28}, {'how' : 11, 'are' : 31}, {'you' : 28, 'Will':31}]
print("The list is:")
print(my_list)

my_result = list(set(value for dic in my_list for value in dic.values()))

print("The result is :")
print(my_result)
The list is:
[{'there': 28, 'hi': 11}, {'how': 11, 'are': 31}, {'Will': 31, 'you': 28}]
The result is :
[11, 28, 31]
A list of dictionary values is defined and is displayed on the console.
A list of dictionary values is defined and is displayed on the console.
It is iterated over, and only the ‘values’ of the dictionary are accessed.
It is iterated over, and only the ‘values’ of the dictionary are accessed.
It is converted to a set to retain only the unique values.
It is converted to a set to retain only the unique values.
This is then converted to a list and assigned to a variable.
This is then converted to a list and assigned to a variable.
This is the output that is displayed on the console.
This is the output that is displayed on the console.
Ext.js - Ext.container.Viewport Container

Ext.container.Viewport − Viewport is a container that automatically resizes itself to the size of the whole browser window. You can then add other ExtJS UI components and containers in it.
Following is the simple syntax to create Ext.container.Viewport container.
Ext.create('Ext.container.Viewport', {
   items: [child1, child2]  
   // this way we can add different child elements to the container as container items.
});

Following is a simple example showing Ext.container.Viewport container.
<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/theme-classic/resources/theme-classic-all.css" 
         rel = "stylesheet" />
      <script type = "text/javascript" 
         src = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all.js"></script>
      
      <script type = "text/javascript">
         Ext.onReady(function () {
            var childPanel1 = Ext.create('Ext.panel.Panel', {
               title: 'Child Panel 1',
               html: 'A Panel'
            });
            var childPanel2 = Ext.create('Ext.panel.Panel', {
               title: 'Child Panel 2',
               html: 'Another Panel'
            });
            Ext.create('Ext.container.Viewport', {
               renderTo: Ext.getBody(),
               items: [ childPanel1, childPanel2 ]
            });
         });
      </script>
   </head>
   
   <body>
   </body>
</html>
The above program will produce the following result −
 Print
 Add Notes
 Bookmark this page
How to delete a row from a table using jQuery?

Use event delegation to include buttons for both add a new and delete a table row on a web page using jQuery.
Firstly, set the delete button:
<button type="button" class="deletebtn" title="Remove row">X</button>
To fire event on click of a button, use jQuery on() method:
$(document).on('click', 'button.deletebtn', function () {
   $(this).closest('tr').remove();
   return false;
});
The following is the complete code delete a row from a table using jQuery:
 Live Demo
<!DOCTYPE html>
<html>
<head>
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
   <script>
   $(document).ready(function(){
      var x = 1;
      $("#newbtn").click(function () {
         $("table tr:first").clone().find("input").each(function () {
            $(this).val('').attr({
               'id': function (_, id) {
                     return id + x
               },
               'name': function (_, name) {
                  return name + x
               },
               'value': ''
         });
      }).end().appendTo("table");
      x++;
   });

   $(document).on('click', 'button.deletebtn', function () {
      $(this).closest('tr').remove();
      return false;
   });
});
</script>
</head>
<body>
<table>
<tr>
<td>
<button type="button" class="deletebtn" title="Remove row">X</button>
</td>
<td>
<input type="text" id="txtTitle" name="txtTitle">
</td>
<td>
<input type="text" id="txtLink" name="txtLink">
</td>
</tr>
</table>
<button id="newbtn">Add new Row</button>
</body>
</html>
What does the "wait_window" method do in Tkinter?

Tkinter has many inbuilt functions that power the application logic to make it more functional and maintainable. Tkinter has the wait_window() method which ideally waits for an event to happen and executes the event of the main window. The wait_window() method can be called after the event which needs to happen before the main window event.
The wait_window() method is useful in many applications where a particular event needs to be executed first before the main program.
In this example, we have created a toplevel window, which when gets destroyed, the event in the main window gets executed instantly.
# Import the required libraries
from tkinter import *

# Create an instance of tkinter frame
win= Tk()

# Set the size of the tkinter window
win.geometry("700x350")

# Add a Text widget in a toplevel window
top= Toplevel(win)
top.geometry("450x150")
Label(top,text="This is a TopLevel Window", font= ('Aerial 17')).pack(pady=50)

# Wait for the toplevel window to be closed
win.wait_window(top)
print("Top Level Window has been Closed!")
win.destroy()

win.mainloop()
Running the above code will display a Label text in a top-level window. The Main window waits for the top level window to get destroyed.
Once we close the top level window, the Main window closes too and prints a message on the screen.
Top Level Window has been Closed!
How to set font face, style, size and color for JTextPane text in Java

For background and foreground color of the JTextPane, use the following −
JTextPane textPane = new JTextPane();
textPane.setBackground(Color.blue);
textPane.setBackground(Color.green);
For font face, style and size, use the Font class and set the font −
Font font = new Font("Serif", Font.ITALIC, 18);
textPane.setFont(font);
The following is an example to set font, style and color for text in JTextPane −
package my;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.text.BadLocationException;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
public class SwingDemo {
   public static void main(String args[]) throws BadLocationException {
      JFrame frame = new JFrame("Demo");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      Container container = frame.getContentPane();
      JTextPane textPane = new JTextPane();
      textPane.setBackground(Color.blue);
      textPane.setBackground(Color.green);
      SimpleAttributeSet attributeSet = new SimpleAttributeSet();
      StyleConstants.setItalic(attributeSet, true);
      textPane.setCharacterAttributes(attributeSet, true);
      textPane.setText("World Cup Cricket begins from ");
      Font font = new Font("Serif", Font.ITALIC, 18);
      textPane.setFont(font);
      StyledDocument doc = textPane.getStyledDocument();
      Style style = textPane.addStyle("", null);
      StyleConstants.setForeground(style, Color.red);
      StyleConstants.setBackground(style, Color.white);
      doc.insertString(doc.getLength(), "30th May ", style);
      StyleConstants.setForeground(style, Color.yellow);
      StyleConstants.setBackground(style, Color.gray);
      doc.insertString(doc.getLength(), "2019", style);
      JScrollPane scrollPane = new JScrollPane(textPane);
      container.add(scrollPane, BorderLayout.CENTER);
      frame.setSize(550, 300);
      frame.setVisible(true);
   }
}
EasyGUI – Multiple Enter Box - GeeksforGeeks

22 Sep, 2020
Multiple Enter Box : It is used to get the multiple input from the user at the single time, inputs can be any keyboard input, it takes inputs in form of string. It displays the title, message to be displayed, a group of places to enter a text and a pair of “Ok”, “Cancel” button which is used confirm the input. It is similar to normal enter box but in multiple enter box multiple inputs can be given at same time, below is how the enter box looks like
In order to do this we will use multenterbox method
Syntax : multenterbox(message, title, list_items, lust_default_text)
Argument : It takes 4 arguments, first string i.e message/information to be displayed, second string i.e title of the window, third is list of string i.e item name and forth is list of string which is default text
Return : It returns the list of entered text and None if cancel is pressed
Example :In this we will create a multi enter box with default text, and will show the specific message on the screen according to the entered text, below is the implementation
# importing easygui modulefrom easygui import *  # message to be displayedtext = "Enter the following details"  # window titletitle = "Window Title GfG"  # list of multiple inputsinput_list = ["Name", "Class", "Section", "Address"]  # list of default textdefault_list = ["eg GfG", "XII", "A", "GeeksforGeeks"]  # creating a integer boxoutput = multenterbox(text, title, input_list, default_list)  # title for the message boxtitle = "Message Box"  # creating a messagemessage = "Enterted details are in form of list : " + str(output)  # creating a message boxmsg = msgbox(message, title)
Output :
Another Example :In this we will create a multi enter box without default text, and will show the specific message on the screen according to the entered text, below is the implementation
# importing easygui modulefrom easygui import *  # message to be displayedtext = "Enter the following details"  # window titletitle = "Window Title GfG"  # list of multiple inputsinput_list = ["Geek Name", "Geek ID", "Experiance"]    # creating a integer boxoutput = multenterbox(text, title, input_list)  # title for the message boxtitle = "Message Box"  # creating a messagemessage = "Enterted details are in form of list : " + str(output)  # creating a message boxmsg = msgbox(message, title)
Output :
Python-EasyGUI
Python-gui
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 program to convert a list to string
Reading and Writing to text files in Python
sum() function in Python
Create a Pandas DataFrame from Lists
SIP - Message Body Header Fields

The Content-Encoding header field is used to indicate that the listed encoding scheme has been applied to the message body. It allows the UAS to determine the decoding scheme necessary to interpret the message body.
Only those encoding schemes listed in an Allow-Encoding header field may be used.
Only those encoding schemes listed in an Allow-Encoding header field may be used.
The compact form is e.
The compact form is e.
Examples:
Content-Encoding: text/plain
e: gzip

The Content-Disposition header field is used to describe the function of a message body. Values include session, icon, alert, and render.
The value session indicates that the message body contains information to describe a media session.
The Content-Language header field is used to indicate the language of a message body. It contains a language tag, which identifies the language.
Example:
Content-Language: en

The Content-Length is used to indicate the number of octets in the message body.
A Content-Length: 0 indicates no message body.
The Content-Type header field is used to specify the Internet media type in the message body.
Media types have the familiar form of type/sub-type.
Media types have the familiar form of type/sub-type.
If this header field is not present, application/sdp is assumed.
If this header field is not present, application/sdp is assumed.
If an Accept header field was present in the request, the response Content-Type must contain a listed type, or a 415 Unsupported Media Type response must be returned.
If an Accept header field was present in the request, the response Content-Type must contain a listed type, or a 415 Unsupported Media Type response must be returned.
The compact form is c.
The compact form is c.
Example:
Content-Type: application/sdp

The MIME-Version header field is used to indicate the version of MIME protocol used to construct the message body.
SIP, like HTTP, is not considered MIME compliant because parsing and semantics are defined by the SIP standard, not the MIME specification. Version 1.0 is the default value.
Example:
MIME-Version: 1.0


    27 Lectures 
     2.5 hours 

 Bernie Raffe
 Print
 Add Notes
 Bookmark this page
How to show Slide down to textview in android

This example demonstrate about How to show Slide down to textview in android.
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
Step 2 − Add the following code to res/layout/activity_main.xml.
<?xml version = "1.0" encoding = "utf-8"?>
<RelativeLayout
   xmlns:android = "http://schemas.android.com/apk/res/android"
   xmlns:tools = "http://schemas.android.com/tools"
   android:layout_width = "match_parent"
   android:gravity = "center"
   android:layout_height = "match_parent">
   <TextView
      android:id = "@+id/text"
      android:textSize = "20dp"
      android:textAlignment = "center"
      android:layout_width = "match_parent"
      android:textColor = "#ff4500"
      android:layout_height = "wrap_content"
      android:singleLine = "true" />
</RelativeLayout>
In the above code, text view is going to scroll down to particular position.
Step 3 − Add the following code to src/MainActivity.java
package com.example.andy.myapplication;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      TextView view = findViewById(R.id.text);
      view.setText("How to show Slide down to show textview animation");
      Animation anim = AnimationUtils.loadAnimation(this, R.anim.slide_in_top);
      view.startAnimation(anim);
   }
}
In the above code, we have taken slide_in_top animation so create a slide_in_top.xml in anim folder. Add the following code in slide_in_top.xml -
<?xml version = "1.0" encoding = "utf-8"?>
<set xmlns:android = "http://schemas.android.com/apk/res/android"
   android:fillAfter = "true"
   android:repeatCount = "100" >
   <translate
      android:duration = "@android:integer/config_mediumAnimTime"
      android:fromYDelta = "-100%"
      android:toYDelta = "0%" />
   <alpha
      android:duration = "@android:integer/config_mediumAnimTime"
      android:fromAlpha = "0.0"
      android:toAlpha = "1.0" />
</set>
Let's try to run your application. I assume you have connected your actual Android Mobile device with your computer. To run the app from android studio, open one of your project's activity files and click Run   icon from the toolbar. Select your mobile device as an option and then check your mobile device which will display your default screen −
In the above result, text view is going to slide down.
Click here to download the project code
Fetch data between two dates and with a specific value in MongoDB. Group and get the sum with count?

To match, use $match in MongoDB and to get data between two dates, use $gte and $lte. Let us create a collection with documents −
> db.demo560.insertOne({"value1":40,"value2":40,shippingDate:new ISODate("2020-02-26")});{
   "acknowledged" : true, "insertedId" : ObjectId("5e8f3d5254b4472ed3e8e867")
}
> db.demo560.insertOne({"value1":20,"value2":60,shippingDate:new ISODate("2020-02-26")});{
   "acknowledged" : true, "insertedId" : ObjectId("5e8f3d5254b4472ed3e8e868")
}
> db.demo560.insertOne({"value1":40,"value2":70,shippingDate:new ISODate("2020-03-31")});{
   "acknowledged" : true, "insertedId" : ObjectId("5e8f3d5254b4472ed3e8e869")
}
> db.demo560.insertOne({"value1":40,"value2":130,shippingDate:new ISODate("2020-03-31")});{
   "acknowledged" : true, "insertedId" : ObjectId("5e8f3d5254b4472ed3e8e86a")
}
Display all documents from a collection with the help of find() method −
> db.demo560.find();
This will produce the following output −
{ "_id" : ObjectId("5e8f3d5254b4472ed3e8e867"), "value1" : 40, "value2" : 40, "shippingDate" : ISODate("2020-02-26T00:00:00Z") }
{ "_id" : ObjectId("5e8f3d5254b4472ed3e8e868"), "value1" : 20, "value2" : 60, "shippingDate" : ISODate("2020-02-26T00:00:00Z") }
{ "_id" : ObjectId("5e8f3d5254b4472ed3e8e869"), "value1" : 40, "value2" : 70, "shippingDate" : ISODate("2020-03-31T00:00:00Z") }
{ "_id" : ObjectId("5e8f3d5254b4472ed3e8e86a"), "value1" : 40, "value2" : 130, "shippingDate" : ISODate("2020-03-31T00:00:00Z") }
Following is the query to fetch data between two dates and with a specific value. Here, value1 40 is our specific value −
> db.demo560.aggregate([
... {
...    $match: {
...       "value1": 40,
...       "shippingDate": {
...          "$gte": ISODate("2020-02-26"),
...          "$lte": ISODate("2020-03-31")
...       }
...    }
... },
... {
...    $group: {
...       "_id": "$shippingDate",
...       total: {
...          $sum: '$value2'
...       },
...       count: {
...          $sum: 1
...       }
...    }
... }
... ])
This will produce the following output −
{ "_id" : ISODate("2020-03-31T00:00:00Z"), "total" : 200, "count" : 2 }
{ "_id" : ISODate("2020-02-26T00:00:00Z"), "total" : 40, "count" : 1 }
What is the difference between integer and floating point literals in Java?

Integer literals represent fixed integer values like 900, 12, 400, -222 etc. (with in the integer range).
Whereas, floating point literals represents fractional values i.e. numbers with decimal values like 25.53, 45.66, 58.66 etc. while writing these literals we should use the notation f or F as 25.53.
 Live Demo
public class StringExample {
   public static void main(String args[]){
      int num1 = 100;
      float num2 = 30.0f;
      System.out.println("Value of integer:"+num1);
      System.out.println("Value of integer:"+num2);
   }
}
Value of integer:100
Value of integer:30.0
How to create a plot with dashed regression line in base R?

To create a regression line in base R, we use abline function after creating the scatterplot but if we want to have the line dash format then lty argument must also be used with value equals to 2 after defining the regression model inside abline. For example, if we have two columns x and y stored in a data frame called df then the plot with dashed regression line can be created by using −
plot(y~x,data=df)
abline(lm(df$y~df$x),lty=2)
Consider the below data frame −
 Live Demo
> x<-rnorm(20,5,0.27)
> y<-rnorm(20,5,0.04)
> df<-data.frame(x,y)
> df
      x       y
1 5.243553 4.969598
2 4.681088 5.076128
3 4.681055 5.041027
4 5.258455 4.989137
5 5.131443 4.987677
6 4.758463 5.018593
7 5.112578 5.022733
8 4.920249 4.989048
9 4.859121 5.036731
10 5.706240 5.024192
11 5.245567 4.950013
12 5.437835 5.000518
13 4.870448 5.020207
14 4.815908 5.035733
15 4.732599 5.012715
16 4.994069 4.986095
17 4.908797 5.004708
18 4.918521 5.003732
19 5.002987 5.005675
20 4.941110 4.998503
Creating the scatterplot between x and y −
plot(y~x,data=df)
Adding the dashed regression line to the above plot −
abline(lm(df$y~df$x),lty=2)
Finding all possible subsets of an array in JavaScript

We are required to write a JavaScript function that takes in an array of literals as the first and the only argument.
The function should construct and return an array of all possible subarrays that can be formed from the original array.
For example −
If the input array is −
const arr = [1, 2, 3];
Then the output should be −
const output = [
   [2],
   [1],
   [3],
   [1,2,3],
   [2,3],
   [1,2],
   [1, 3],
   []
];
The order of subarrays is not that important.
Following is the code −
const arr = [1, 2, 3];
const findAllSubsets = (arr = []) => {
   arr.sort();
   const res = [[]];
   let count, subRes, preLength;
   for (let i = 0; i < arr.length; i++) {
      count = 1;
      while (arr[i + 1] && arr[i + 1] == arr[i]) {
         count += 1;
         i++;
      }
      preLength = res.length;
      for (let j = 0; j < preLength; j++) {
         subRes = res[j].slice();
         for (let x = 1; x <= count; x++) {
            if (x > 0) subRes.push(arr[i]);
            res.push(subRes.slice());
         }
      }
   };
   return res;
};
console.log(findAllSubsets(arr));
Following is the console output −
[
   [], [ 1 ],
   [ 2 ], [ 1, 2 ],
   [ 3 ], [ 1, 3 ],
   [ 2, 3 ], [ 1, 2, 3 ]
]
Generate QRCode With Python In 5 lines | by That Data Bloke | Towards Data Science

A Quick Response Code or a QR Code is a two dimensional bar code consisting of grid of tiny black squares on a white background. Due to its ability to store more information and fast readability, it gained popularity over the traditional bar codes composed of black bars and white spaces.
Python offers a QRCode package which makes it really easy to implement this functionality. We will begin by downloading the following python packages.
pip install pillowpip install qrcode
For the purpose of this demo, I am using the page link to one of my articles (Face Detection in 10 Lines). We will create a QRCode that will store a link to this article.
Now, let us take a look at how simple it is to implement it.
import qrcode# Link for websiteinput_data = "https://towardsdatascience.com/face-detection-in-10-lines-for-beginners-1787aa1d9127"#Creating an instance of qrcodeqr = qrcode.QRCode(        version=1,        box_size=10,        border=5)qr.add_data(input_data)qr.make(fit=True)img = qr.make_image(fill='black', back_color='white')img.save('qrcode001.png')
The QRCode function used above accepts the following parameters:
version: This parameter defines the size of the QR Code generated. It accepts integer values in the range of 1 to 40. The higher this value, bigger the dimension of the generated QR Code image.
box_size: This parameter defines the size of each box in pixels.
border: The border defines the thickness of the border. In this example, the value of 5 means that the border is equal to the thickness of 5 tiny black boxes.
The add_data method is used to pass our input text, which is the hyperlink to the article in our case. The make function with (fit=True) ensures that the entire dimension of the QR Code is utilized, even if our input data could fit into less number of boxes.
The last step is to convert this into an image file and store it. For this, the make_image function is used where we can specify the foreground and background color. I have used black and white respectively, but you can change them as per your preference. The save function stores the image as a .png file in the current directory. The code and dependency details are also present here for reference.
Here’s the QR Code we generated for the link!
In conclusion, we looked at how we can convert a text value into its equivalent QR Code. Perhaps you can create a QR Code for your own website URL or LinkedIn profile and include it in your business card or your CV. Cheers!
towardsdatascience.com
medium.com
References & Further Reading:
[1] https://pypi.org/project/qrcode/[2] https://en.wikipedia.org/wiki/QR_code
How to create an ordered list with list items numbered with uppercase roman numbers in HTML?

To create ordered list in HTML, use the <ol> tag. Ordered list starts with the <ol> tag. The list item starts with the <li> tag and will be marked as numbers, lowercase letters uppercase letters, roman letters, etc. The default numbers for list items.
For creating an ordered list with uppercase roman numbers, use the <ol> tag attribute type. This attribute will assign an uppercase roman number i.e. <ol type = “I”> to create ordered list numbered with uppercase roman numbers.
You can try to run the following code to create an ordered list of list items numbered with uppercase roman numbers in HTML −
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>World Cup Teams</title>
   </head>
   <body>
      <h1>List of teams for World Cup</h1>
      <ol type = "I">
         <li>India</li>
         <li>Australia</li>
         <li>South Africa</li>
         <li>New Zealand</li>
         <li>Pakistan</li>
         <li>Srilanka</li>
         <li>West Indies</li>
         <li>Bangladesh</li>
      </ol>
   </body>
</html>
How to subtract column values from column means in R data frame?

To subtract column values from column means in R data frame, we can follow the below steps −
First of all, create a data frame.
Then, find the column means using colMeans function.
After that, subtract column values from column means.
Let's create a data frame as shown below −
 Live Demo
> x1<-sample(1:100,20)
> x2<-sample(1:100,20)
> x3<-sample(1:100,20)
> df<-data.frame(x1,x2,x3)
> df
On executing, the above script generates the below output(this output will vary on your system due to randomization) −
   x1  x2  x3
1  54  73  57
2  79  52  92
3  87  51  47
4  13  12   1
5  70  90  19
6  15  99   9
7  56  81  22
8  75  68  82
9  63  11  67
10 40  50  71
11 45  42  94
12 32  80  50
13 80  83  33
14  6  27   5
15 91 100  36
16 52  60  46
17 76   9   6
18 19   2  64
19 18  97  27
20 67   8  83
Using colMeans function to find the column means −
 Live Demo
> x1<-sample(1:100,20)
> x2<-sample(1:100,20)
> x3<-sample(1:100,20)
> df<-data.frame(x1,x2,x3)
> colMeans(df)
   x1    x2    x3
51.90 54.75 45.55
Using data frame and column means of the data frame to subtract the column values from column means −
 Live Demo
> x1<-sample(1:100,20)
> x2<-sample(1:100,20)
> x3<-sample(1:100,20)
> df<-data.frame(x1,x2,x3)
> df[]-colMeans(df[])[col(df[])]
     x1      x2     x3
1    2.1  18.25  11.45
2   27.1  -2.75  46.45
3   35.1  -3.75   1.45
4  -38.9 -42.75 -44.55
5   18.1  35.25 -26.55
6  -36.9  44.25 -36.55
7    4.1  26.25 -23.55
8   23.1  13.25  36.45
9   11.1 -43.75  21.45
10 -11.9  -4.75  25.45
11  -6.9 -12.75  48.45
12 -19.9  25.25   4.45
13  28.1  28.25 -12.55
14 -45.9 -27.75 -40.55
15  39.1  45.25  -9.55
16   0.1   5.25   0.45
17  24.1 -45.75 -39.55
18 -32.9 -52.75  18.45
19 -33.9  42.25 -18.55
20  15.1 -46.75  37.45
cron - Unix, Linux Command

cron - daemon process to execute scheduled commands.
cron
Cron searches /var/spool/cron for crontab files which are named after accounts in /etc/passwd; crontabs found are loaded into memory. Cron also searches for /etc/crontab and the files in the /etc/cron.d/ directory, which are in a different format. Cron then wakes up every minute, examining all stored crontabs, checking each command to see if it should be run in the current minute.
To edit a users crontab entry, log into your system for that particular user and type crontab -e. It will open up using its default editor vi. cron checks each minute to see if its spool directory's modtime (or the modtime on /etc/crontab) has changed, and if it has, cron will then examine the modtime on all crontabs and reload those which have changed. Thus cron need not be restarted whenever a crontab file is modfied. Note that the crontab command updates the modtime of the spool directory whenever it changes a crontab.
Cron will email to the user all output of the commands it runs, to silence this, redirect the output to a log file or to /dev/null. You can also redirect email to the user named in the MAILTO environment variable in the crontab, if any exists.

Go to /etc/rc and run cron
$ cd /etc/rc
$ cron


    129 Lectures 
     23 hours 

 Eduonix Learning Solutions

    5 Lectures 
     4.5 hours 

 Frahaan Hussain

    35 Lectures 
     2 hours 

 Pradeep D

    41 Lectures 
     2.5 hours 

 Musab Zayadneh

    46 Lectures 
     4 hours 

 GUHARAJANM

    6 Lectures 
     4 hours 

 Uplatz
 Print
 Add Notes
 Bookmark this page
Calendar isSet() Method in Java with Examples - GeeksforGeeks

18 Dec, 2021
The isSet(int calndr_field) method in Calendar class is used to check whether the given calendar field has a value set or not. All the Cases for which the values have been set by the calculations of the internal field are triggered by a get method call.
Syntax: 
public final boolean isSet(int calndr_field)
Parameters: The method takes one parameter calndr_field that refers to the calendar field which is to be operated upon.Return Value: The method either returns True if the value of the calendar field is set else it returns False.
Below programs illustrate the working of isSet() Method of Calendar class:
Example 1: 
Java
// Java code to illustrate// isSet() method   import java.util.*;public class CalendarDemo {    public static void main(String args[])    {           // Creating a calendar object        Calendar calndr = Calendar.getInstance();           // Displaying the calendar object        System.out.println("The Year is: "                           + calndr.get(Calendar.YEAR));           // Querying for the value if set or not        boolean val = calndr.isSet(Calendar.YEAR);        System.out.println("Is the"                           + " Value set? " + val);           // Clearing the instance        calndr.clear(Calendar.YEAR);           // Performing isSet() operation        val = calndr.isSet(Calendar.YEAR);        System.out.println("Is the"                           + " Value set? " + val);    }}
The Year is: 2019
Is the Value set? true
Is the Value set? false
 
Example 2: 
Java
// Java code to illustrate// isSet() method   import java.util.*;public class CalendarDemo {    public static void main(String args[])    {           // Creating a calendar object        Calendar calndr = Calendar.getInstance();           // Displaying the calendar object        System.out.println("Todays Day is: "                           + calndr.get(                                 Calendar.DAY_OF_MONTH));           // Querying for the value if set or not        boolean val            = calndr.isSet(Calendar.DAY_OF_MONTH);        System.out.println("Is the"                           + " Value set? " + val);           // Clearing the instance        calndr.clear(Calendar.DAY_OF_MONTH);           // Performing isSet() operation        val = calndr.isSet(Calendar.DAY_OF_MONTH);        System.out.println("Is the"                           + " Value set? " + val);    }}
Todays Day is: 21
Is the Value set? true
Is the Value set? false
 
Reference: https://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html#isSet-int- 
as5853535
Java - util package
Java-Calendar
Java-Functions
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Stream In Java
Constructors in Java
Exceptions in Java
Functional Interfaces in Java
Different ways of Reading a text file in Java
Generics in Java
Introduction to Java
Comparator Interface in Java with Examples
Internal Working of HashMap in Java
Strings in Java
How to Slice a 3D Tensor in Pytorch? - GeeksforGeeks

18 Jul, 2021
In this article, we will discuss how to Slice a 3D Tensor in Pytorch.
Let’s create a 3D Tensor for demonstration. We can create a vector by using torch.tensor() function
Syntax: torch.tensor([value1,value2,.value n])
Code:
Python3
# import torch moduleimport torch  # create an 3 D tensor with 8 elements eacha = torch.tensor([[[1, 2, 3, 4, 5, 6, 7, 8],                   [10, 11, 12, 13, 14, 15, 16, 17]],                                      [[71, 72, 73, 74, 75, 76, 77, 78],                   [81, 82, 83, 84, 85, 86, 87, 88]]])  # display actual  tensorprint(a)
Output:
tensor([[[ 1,  2,  3,  4,  5,  6,  7,  8],
        [10, 11, 12, 13, 14, 15, 16, 17]],
       [[71, 72, 73, 74, 75, 76, 77, 78],
        [81, 82, 83, 84, 85, 86, 87, 88]]])
Slicing: Slicing means selecting the elements present in the tensor by using “:” slice operator. We can slice the elements by using the index of that particular element.
Note: Indexing starts with 0
Syntax: tensor[tensor_position_start:tensor_position_end, tensor_dimension_start:tensor_dimension_end , tensor_value_start:tensor_value_end]
Parameters:
tensor_position_start: Specifies the Tensor to start iterating
tensor_position_end: Specifies the Tensor to stop iterating
tensor_dimension_start: Specifies the Tensor to start the iteration of tensor in given positions
tensor_dimension_stop: Specifies the Tensor to stop the iteration of tensor in given positions
tensor_value_start: Specifies the start position of the  tensor to iterate the elements given in dimensions
tensor_value_stop: Specifies the end position of the tensor to iterate the elements given in dimensions
Example 1: Python code to access all the tensors of 1 dimension and get only 7 values in that dimension
Python3
# access  all the tensors of 1 # dimension and get only 7 values # in that dimensionprint(a[0:1, 0:1, :7])
Output:
tensor([[[1, 2, 3, 4, 5, 6, 7]]])
Example 2: Python code to access all the tensors of all dimensions and get only 3 values in each dimension
Python3
# access  all the tensors of all# dimensions and get only 3 values # in each dimensionprint(a[0:1, 0:2, :3])
Output:
tensor([[[ 1,  2,  3],
        [10, 11, 12]]])
Example 3: Access 8 elements in 1 dimension on all tensors
Python3
# access 8 elements in 1 dimension# on all tensorsprint(a[0:2, 1, 0:8])
Output:
tensor([[10, 11, 12, 13, 14, 15, 16, 17],
       [81, 82, 83, 84, 85, 86, 87, 88]])
Picked
Python-PyTorch
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
Convert integer to string in Python
CURTIME() function in MySQL - GeeksforGeeks

27 Nov, 2020
CURTIME() function in MySQL is used to check the current time. It returns the current time as a value in ‘hh:mm:ss’ or ‘hhmmss’ format, depending on whether the function is used in a string or numeric context.
Syntax :
CURTIME(fsp)
Parameters :
This method accepts only one parameter.
fsp –It specifies the returned fractional seconds precision. If the user omits the precision argument, the result will exclude precision.
Returns : 
It returns the current time.
Example-1:
Getting the current time using CURTIME Function.
SELECT CURTIME() as Curr_time ;
Output :
Example 2:
Getting the current time using CURTIME Function with precision is set to 3.
SELECT CURTIME(3) as Curr_time ;
Output :
Example-3:
Getting the current time using CURTIME Function in numeric format.
SELECT CURTIME() + 0  as Curr_time ;
Output :
Example-4:
The CURTIME function can be used to set the value of columns. To demonstrate create a table named DeliveryDetails.
CREATE TABLE DeliveryDetails (
DeliveryId INT AUTO_INCREMENT,
ProductId INT NOT NULL,
ProductName VARCHAR(20) NOT NULL,
Delivered_At TIME NOT NULL,
Delivered_On DATE NOT NULL,
PRIMARY KEY(DeliveryId)
);
Here, we will use CURDATE and CURTIME function when a delivery will be completed. The value in the Delivered_At column will be the value given by CURTIME and the value in the Delivered_On column will be the value given by the CURDATE Function.
INSERT INTO  
DeliveryDetails(ProductId, ProductName, Delivered_At, Delivered_On)
VALUES
(12345, 'Dell Latitude', CURTIME(), CURDATE() );
Now, checking the DeliveryDetails table :
SELECT * FROM DeliveryDetails;
Output :
DBMS-SQL
mysql
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Update Multiple Columns in Single Update Statement in SQL?
SQL | Subquery
How to Create a Table With Multiple Foreign Keys in SQL?
What is Temporary Table in SQL?
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL using Python
SQL Query to Convert VARCHAR to INT
How to Write a SQL Query For a Specific Date Range and Date Time?
How to Select Data Between Two Dates and Times in SQL Server?
SQL Query to Compare Two Dates
Python | Extension function operating on Arrays - GeeksforGeeks

20 Mar, 2019
Let’s write a C extension function that can operate on contiguous arrays of data, as might be created by the array module or libraries like NumPy and this function should be general purpose and not specific to any one array library.
The code should use Buffer Protocol to receive and process arrays in a portable manner. The code below is a C extension function that receives array data and calls the avg(double *buf, int len) function from this article – Using C codes in Python.
Code #1 :
/* Call double avg(double *, int) */static PyObject *py_avg(PyObject *self, PyObject *args){    PyObject *bufobj;    Py_buffer view;    double result;    /* Get the passed Python object */    if (!PyArg_ParseTuple(args, "O", &bufobj))    {        return NULL;    }      /* Attempt to extract buffer information from it */      if (PyObject_GetBuffer(bufobj, &view,                           PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) == -1)    {        return NULL;    }      if (view.ndim != 1)    {        PyErr_SetString(PyExc_TypeError, "Expected a 1-dimensional array");        PyBuffer_Release(&view);        return NULL;    }      /* Check the type of items in the array */    if (strcmp(view.format, "d") != 0)    {        PyErr_SetString(PyExc_TypeError, "Expected an array of doubles");        PyBuffer_Release(&view);        return NULL;    }      /* Pass the raw buffer and size to the C function */    result = avg(view.buf, view.shape[0]);      /* Indicate we're done working with the buffer */    PyBuffer_Release(&view);    return Py_BuildValue("d", result);}
Code #2 : How this extension function works
import array  print("Average : ", avg(array.array('d', [1, 2, 3])))  import numpyprint("Average numpy array : ", avg(numpy.array([1.0, 2.0, 3.0])))print ("Average list : \n", avg([1, 2, 3]))
Output :
Average : 2.0

Average numpy array : 2.0
Average list : 
Traceback (most recent call last):
File "", line 1, in 
TypeError: 'list' does not support the buffer interface

PyBuffer_GetBuffer() function is the key to the code in the article.
It tries to obtain the information about the memory representation in the given arbitrary Python object.
It simply raises an exception and returns -1, if it is not possible to obtain information (as is the case with normal Python objects).
The special flags passed to PyBuffer_GetBuffer() give additional hints about the kind of memory buffer that is requested.
As, PyBUF_ANY_CONTIGUOUS specifies that a contiguous region of memory is required.
Python-ctype
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Python | Get unique values from a list
Defaultdict in Python
Python | os.path.join() method
Create a directory in Python
Python | Pandas dataframe.groupby()
C | File Handling | Question 1 - GeeksforGeeks

28 Jun, 2021
Which of the following true about FILE *fp(A) FILE is a keyword in C for representing files and fp is a variable of FILE type.(B) FILE is a structure and fp is a pointer to the structure of FILE type(C) FILE is a stream(D) FILE is a buffered streamAnswer: (B)Explanation: fp is a pointer of FILE type and FILE is a structure that store following information about opened file.
typedef struct {  int level; /* fill/empty level of buffer */  unsigned flags; /* File status flags */  char fd; /* File descriptor */  unsigned char hold; /* Ungetc char if no buffer */  int bsize; /* Buffer size */  unsigned char *buffer; /* Data transfer buffer */  unsigned char *curp; /* Current active pointer */  unsigned istemp; /* Temporary file indicator */  short token; /* Used for validity checking */}FILE;
Quiz of this Question
C-File Handling
File Handling
C Language
C Quiz
File Handling
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Multidimensional Arrays in C / C++
Left Shift and Right Shift Operators in C/C++
Function Pointer in C
Substring in C++
Core Dump (Segmentation fault) in C/C++
Compiling a C program:- Behind the Scenes
Operator Precedence and Associativity in C
C | Misc | Question 7
C | Arrays | Question 7
Output of C programs | Set 64 (Pointers)
How to refresh a page using selenium JavaScript ? - GeeksforGeeks

23 Nov, 2021
Selenium is a tool with the help of it, we can perform automation testing in web browsers. According to the official documentation of Selenium – Selenium can automate anything present on the web. Automation scripts in Selenium can be written in multiple programming languages like C#, JavaScript, Java, Python, and a few others. In the process of automation of a web, there can come many situations in which you will be required to refresh the page, so this article revolves around how a page can be refreshed automatically using selenium JavaScript.
Syntax:
driver.navigate().refresh();
Example:
driver.get("https://www.geeksforgeeks.org/");
driver.navigate().refresh();
In order to see how exactly we can make use of refresh driver method to refresh a web page in selenium javascript let’s see the following automation scenario.
Approach: Our task is to write an automation script that will open geeksforgeeks web page and refresh it. In order to perform the same we have to follow the following steps:
Create a webdriver (here chromedriver for chrome browser).
Build a new window of chrome using the chromedriver.
Navigate to geeksforgeeks website using the get method.
Refresh the page using refresh method.
Below is the implementation of the above approach:
index.js
// Require selenium webdriverlet webdriver = require("selenium-webdriver");  // Require webdriver for chrome// browser called chromedriverrequire("chromedriver");  // Build a new window of chromelet driver = new webdriver.Builder().forBrowser("chrome").build();  // Open geeksforgeeks using get methoddriver.get("https://www.geeksforgeeks.org/");  //refresh using the refresh driver methoddriver.navigate().refresh();
Step to run the above code: Open the terminal and type the following command.
node index.js
Output:
JavaScript-Questions
selenium
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
JavaScript | Promises
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript