code-rag-bench/online-tutorials huggingface dataset:
What is pica? How to set the font size in CSS using pica?

A pica is equivalent to 12 points; thus, there are 6 picas per inch. You can try to run the following code to set font size using pica (pc):
<html>
   <head>
   </head>
   <body>
      <div style = "position:relative;left:10px;top:3px;background-color:yellow;font-size:3pc;">
         This div has font size set in pica.
      </div>
   </body>
</html>
Java Program to swap the case of a String

To swap the case of a string, use.
toLowerCase() for title case string.
toLowerCase() for uppercase string
toUpperCase() for lowercase string
Loop through what we discussed above for all the characters in the sting.
for (int i = 0; i > len; i++) {
   c = str.charAt(i);
   // title case converted to lower case
   if (Character.isTitleCase(c)) {
      c = Character.toLowerCase(c);
   }
   // upper case converted to lower case
   if (Character.isUpperCase(c)) {
      c = Character.toLowerCase(c);
   }
   // lower case converted to upper case
   if (Character.isLowerCase(c)) {
      c = Character.toUpperCase(c);
   }
}
 Live Demo
public class Demo {
   public static void main(String []args){
      char c = 0;
      String str = "jack";
      System.out.println("String in lowercase: "+str);
      // length of string
      int len = str.length();
      StringBuffer strBuffer = new StringBuffer(len);
      for (int i = 0; i < len; i++) {
         c = str.charAt(i);
         // title case converted to lower case
         if (Character.isTitleCase(c)) {
            c = Character.toLowerCase(c);
         }
         // upper case converted to lower case
         if (Character.isUpperCase(c)) {
            c = Character.toLowerCase(c);
         }
         // lower case converted to upper case
         if (Character.isLowerCase(c)) {
            c = Character.toUpperCase(c);
         }
         strBuffer.append(c);
      }
      System.out.println("Converting case: "+strBuffer.toString());
   }
}
String in lowercase: jack
Converting case: JACK
How to set your python path on Windows?

To set the PYTHONPATH on windows to point Python to look in other directories for module and package imports, go to:
My Computer > Properties > Advanced System Settings > Environment Variables
Then under system variables edit the PythonPath variable. At the end of the current PYTHONPATH, add a semicolon and then the directory you want to add to this path:
C:\Python27;C:\foo
In this case, are adding the foo directory to the PYTHONPATH. Note that we are appending it and not replacing the PYTHONPATH's original value. In most cases, you shouldn't mess with PYTHONPATH. More often than not, you are doing it wrong and it will only bring you trouble.
C++ Vector Library - vector() Function

The C++ initializer list constructor std::vector::vector() constructs a container from initializer list.
Following is the declaration for initializer list constructor std::vector::vector() form std::vector header.
vector (initializer_list<value_type> ilist, const allocator_type&
   alloc = allocator_type());

ilist − Initializer list to assign values to vector.
Constructor never returns value.
This member function never throws exception.
Linear i.e. O(n)
The following example shows the usage of initializer list constructor std::vector::vector().
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
   auto il = {1, 2, 3, 4, 5};
   /* create vector from initializer list */
   vector<int> v(il);

   for (int i = 0; i < v.size(); ++i)
      cout << v[i] << endl;

   return 0;
}
Let us compile and run the above program, this will produce the following result −
1
2
3
4
5

 Print
 Add Notes
 Bookmark this page
Adding axis to a Plot in R programming - axis () Function - GeeksforGeeks

14 Jul, 2020
axis() function in R Language is to add axis to a plot. It takes side of the plot where axis is to be drawn as argument.
Syntax:axis(side, at=NULL, labels=TRUE)
Parameters:side: It defines the side of the plot the axis is to be drawn on possible values such as below, left, above, and right.at: Point to draw tick markslabels: Specifies texts for tick-mark labels.
Example 1:
# R program to draw axis in a plotx <- 1:5; y = x * xplot(x, y, axes = FALSE)  # Calling the axis() functionaxis(side = 1, at = 1:5, labels = LETTERS[1:5])axis(3)
Output:
In the above example, the straight dotted line is added to the plot joining numerical and alphabetical values plot axis is drawn at the top and bottom part of the plot.
Example 2: Another example to add axes by drawing box
# R program to draw axis to a plotx<-1:5; y = x * xplot(x, y, axes = FALSE)axis(side=1, at = 1:5, labels = LETTERS[1:5])axis(3)  #- To make it look like "usual" plotbox() 
Output:
Here, a box is drawn to drawn using box() function around the axis so that it looks like a usual plot.
Example 3:
# R program to draw axis to a plotx<-1:4; y=x*xplot(x, y, pch = 18, col = "darkgreen", type = "b",           frame = FALSE, xaxt = "n")   # Remove x axisaxis(1, 1:4, LETTERS[1:4], col.axis="blue")axis(3, col = "darkgreen", lty = 2, lwd = 4)axis(4, col = "black", col.axis = "blue", lwd = 4)
Output:
Here, the different type of axis are drawn implementing modification in line width(lwd) and line type(lty).
R Plot-Function
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Change Color of Bars in Barchart using ggplot2 in R
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
How to filter R dataframe by multiple conditions?
R - if statement
How to import an Excel File into R ?
How to change the order of bars in bar chart in R ?
Bootstrap Glyphicons

This is a library of monochromatic icons available in raster image formats, vector image formats, and as fonts. It provides over 250 glyphs in font format. You can use these fonts in your web projects. These glyphs are not free, however if you don't have to spend anything in case you are using them in Bootstrap based projects.
To load the Bootstrap Glyphicons library, copy and paste the following line in the <head> section of the webpage.
<head>
   <link rel = "stylesheet" href = "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
</head>
Bootstrap Glyphicons provides a number of icons. Choose one of them and add the name of the icon class to any HTML element within the < body > tag. In the following example, we have used the icon of the tree and its class name is tree-deciduous.
<html>
   <head>
      <link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
   </head>
	
   <body>
      <i class = "glyphicon glyphicon-tree-deciduous">  </i>
   </body>
</html>
It will produce the following output −
You can increase or decrease the size of an icon by defining its size in the CSS and using it along with the class name as shown below. In the following example, we have defined the size as 6 em.
<html>
   <head>
      <link rel="stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"><style>
      i.mysize {font-size: 6em;}
      </style>
   </head>
 
   <body>
      <i class="glyphicon glyphicon-tree-deciduous mysize"></i>
   </body>
</html>
It will produce the following output:
You can define the color of an icon using the CSS. The following example example shows how to change the color of the tree icon.
<html>
   <head>
      <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"><style>
      i.mysize {font-size: 6em; color: blue;}
      </style>
   </head>
 
   <body>
      <i class="glyphicon glyphicon-tree-deciduous mysize"></i>
   </body>
</html>
It will produce the following output −

    26 Lectures 
     2 hours 

 Neha Gupta

    20 Lectures 
     2 hours 

 Asif Hussain

    43 Lectures 
     5 hours 

 Sharad Kumar

    411 Lectures 
     38.5 hours 

 In28Minutes Official

    71 Lectures 
     10 hours 

 Chaand Sheikh

    207 Lectures 
     33 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page
Evaluate an Expression in R Programming - eval() Function - GeeksforGeeks

19 Jun, 2020
eval() function in R Language is used to evaluate an expression passed to it as argument.
Syntax: eval(expr)
Parameters:expr: expression to be evaluated
Example 1:
# R program to evaluate an expression  # Calling eval() Functioneval(sin(pi / 3))eval(5 + 2)eval(cos(2))
Output:
[1] 0.8660254
[1] 7
[1] -0.4161468

Example 2:
# R program to evaluate an expression  # Creating a vectorx <- c(1, 2, 3)  # Creating a matrixmat <- matrix(c(2, 7, 5, 7), 2)  # Calling eval() functioneval(x * 2)eval(det(mat))
Output:
[1] 2 4 6
[1] -21

R Math-Function
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Replace specific values in column in R DataFrame ?
How to change Row Names of DataFrame in R ?
Filter data by multiple conditions in R using Dplyr
Change Color of Bars in Barchart using ggplot2 in R
Loops in R (for, while, repeat)
Printing Output of an R Program
How to Change Axis Scales in R Plots?
How to Split Column Into Multiple Columns in R DataFrame?
Group by function in R using Dplyr
K-Means Clustering in R Programming
Image Classification of Uploaded Files Using Streamlit’s Killer New Feature | by Posey | Towards Data Science

It’s no secret I’m a massive fan of Streamlit. I think it’s the best way to share early versions of Data Science projects. It’s especially great for demoing your project to a less technical audience. Before investing in frontend developers to build you a proper UI, Streamlit allows you to get some features out in the wild for users to test.
A commonly requested feature that has been left out for far too long is the file uploader. You can use the uploader for basically any file. Probably best to only use this feature with users you can trust. Be careful about the files you let users upload if you’re going to use this feature externally.
As someone who spends massive amounts of time on Computer Vision problems, I’m constantly looking for ways to best get users testing and interacting with solutions for Object Detection, Classification, Anomaly Detection, and much more...
Here’s the final product, explained in code below...
I think you’ll find the code strikingly simple.
uploaded_file = st.file_uploader("text here", type="file_type")
The file uploader can be very simply implemented in one line. You can then pass uploaded_file as needed. For an image it might be something like this to display the image:
# Using PILimage = Image.open(uploaded_file)st.image(image, caption='Uploaded Image.')
For a CSV you could use pandas very simply like:
dataframe = pd.read_csv(uploaded_file) 
As, you can see, there’s a wide class of problems you can approach with file_uploader().
This should be pretty self-explanatory, but for the uninitiated:
# Use pre-trained models# Other pre-trained: https://keras.io/applications/model = VGG16() 
We then manipulate our image:
# Load image, resize image, make array and reshapeimage = load_img(image_path, target_size=(224, 224))image = img_to_array(image)image = image.reshape((1, image.shape[0], image.shape[1], image.shape[2]))    image = preprocess_input(image)
We are now ready for inference:
yhat = model.predict(image)
And finally we return the results:
label = decode_predictions(yhat)    # return highest probability     label = label[0][0]    return label
You can find the full code on Github. Here’s the final result:
Hope you found this useful!
Let’s continue the conversation on Twitter!
Here’s the docs if you want to skip straight to your own implementation: https://streamlit.io/docs/api.html#streamlit.file_uploader
To support my writing and get full access to all articles on Medium, visit https://posey.medium.com/membership
Python Program for Sieve of Eratosthenes

In this article, we will learn about the solution to the problem statement given below.
Problem statement − We are given a number n, we need to print all primes smaller than or equal to n. Constraint: n is a small number.
Now let’s observe the solution in the implementation below −
def SieveOfEratosthenes(n):
   # array of type boolean with True values in it
   prime = [True for i in range(n + 1)]
   p = 2
   while (p * p <= n):
      # If it remain unchanged it is prime
      if (prime[p] == True):
         # updating all the multiples
         for i in range(p * 2, n + 1, p):
            prime[i] = False
      p += 1
   prime[0]= False
   prime[1]= False
   # Print
   for p in range(n + 1):
      if prime[p]:
         print (p,end=" ")
# main
if __name__=='__main__':
   n = 33
   print ("The prime numbers smaller than or equal to", n,"is")
   SieveOfEratosthenes(n)
The prime numbers smaller than or equal to 33 is
2 3 5 7 11 13 17 19 23 29 31
All the variables are declared in the local scope and their references are seen in the figure above.
In this article, we have learned about how we can make a Python Program for Sieve of Eratosthenes
Print leftmost and rightmost nodes of a Binary Tree in C Program.

Given a binary tree with left and right children and the task is to print the exact right and left child of the given tree.
Leftmost nodes are the nodes which are associated on the left side from the parent node of the tree and rightmost nodes are which are associated on the right side from the parent node of the root.
Input: 106 20 320 100 21 61 52
Output: 106 20 320 100 52
Start
Step 1 -> create structure of a node
   Declare int data
   Declare struct node *left and *right
Step 2 -> create struct node* newNode(int val)
   Create node* temp=new node
   Set temp->data = val
   Set temp->left = temp->right = NULL
   return (temp)
step 3 -> Declare Function void print(node *root)
   IF root == NULL
      Return
   Use STL queue<node*> que
   Call que.push(root)
   Use STL vector<int> ans
   Loop While !que.empty()
   Set int n = que.size()
   Loop for int i =0 and i<n and i++
      Set node *temp = que.front()
      Set que.pop()
      IF i=0
         Set ans.push_back(temp->data)
      End
      Else IF i=n-1
         Set ans.push_back(temp->data)
      End
      If temp->left
         Set que.push(temp->left)
      End
      IF temp->right
         Set que.push(temp->right)
      End
   End
   Loop For auto i : ans
      Print i
   End
Step 4 -> In main()
   Declare node *root = newNode(106) to create a node
   Call print(root)
stop
#include <bits/stdc++.h>
using namespace std;
//structure of a node {
   int data;
   struct node* left, *right;
};
//structure to create a new node
struct node* newNode(int val){
   node* temp = new node;
   temp->data = val;
   temp->left = temp->right = NULL;
   return (temp);
}
//function to print corner elements of a tree
void print(node *root) {
   if(root == NULL)
   return;
   queue<node*> que;
   que.push(root);
   vector<int> ans;
   while(!que.empty()){
      int n = que.size();
      for(int i =0;i<n;i++){
         node *temp = que.front();
         que.pop();
         if(i==0)
            ans.push_back(temp->data);
         else if(i==n-1)
            ans.push_back(temp->data);
         if(temp->left)
            que.push(temp->left);
         if(temp->right)
            que.push(temp->right);
      }
   }
   for(auto i : ans)
      cout << i << " ";
}
int main (){
   node *root = newNode(106);
   root->left = newNode(20);
   root->right = newNode(320);
   root->left->left = newNode(100);
   root->left->right = newNode(21);
   root->right->left = newNode(61);
   root->right->right = newNode(52);
   print(root);
   return 0;
}
if we run above program then it will generate following output
106 20 320 100 52
What are the differences between a JComboBox and a JList in Java?

A JComboBox is a component that displays a drop-down list and gives users options that we can select one and only one item at a time whereas a JList shows multiple items (rows) to the user and also gives an option to let the user select multiple items.
A JComboBox can be editable or read-only.
An ActionListener, ChangeListener or ItemListener interfaces can be used to handle the user actions on a JComboBox.
A getSelectedItem() method can be used to get the selected or entered item from a combo box.
A setEditable() method can be used to turn on or turn off the text input part of a combo box.
We can create a JComboBox instance from an array or vector. Most of the time, we will use ComboBoxModel to manipulate ComboBox’s elements.
import java.awt.*;
import javax.swing.*;
public class JComboBoxTest extends JFrame {
   JComboBoxTest() {
      setTitle("JComboBox Test");
      String country[] = {"India","Aus","Singapore","England","Newzealand"};
      JComboBox jcb = new JComboBox(country);
      setLayout(new FlowLayout());
      add(jcb);
      setSize(300, 250);
      setLocationRelativeTo(null);
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setVisible(true);
   }
   public static void main(String[] args) {
      new JComboBoxTest();
   }
}
A JList is a component that allows the user to choose either a single selection or multiple selections.
A JList class itself does not support scrollbar. In order to add scrollbar, we have to use JScrollPane class together with the JList class. The JScrollPane then manages a scrollbar automatically.
A getSelectedIndex() method returns the index of the first selected item or –1 if no items are selected and getSelectedIndexes() method returns an array with the index of each selected item. The array is empty if no items are selected.
A getSelectedValue() returns the first selected item or null if no items are selected.
A DefaultListModel class provides a simple implementation of a list model, which can be used to manage items displayed by a JList control.
import java.awt.*;
import javax.swing.*;
public class JListTest extends JFrame {
   JListTest() {
      setTitle("JList Test");
      DefaultListModel dlm = new DefaultListModel();
      dlm.addElement("India");
      dlm.addElement("Aus");
      dlm.addElement("England");
      dlm.addElement("Singapore");
      JList list = new JList();
      list.setModel(dlm);
      setLayout(new FlowLayout());
      add(list);
      setSize(350,275);
      setLocationRelativeTo(null);
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setVisible(true);
   }
   public static void main(String args[]) {
      new JListTest();
   }
}
How to create an Array in Java?

In Java, you can create an array just like an object using the new keyword. The syntax of creating an array in Java using new keyword −
type[] reference = new type[10];
Where,
type is the data type of the elements of the array.
reference is the reference that holds the array.
And, if you want to populate the array by assigning values to all the elements one by one using the index −
reference [0] = value1;
reference [1] = value2;
For example, if you want to create an integer array of 5 elements you can create it using new keyword −
int[] myArray = new int[5];
You can populate the array element by element using the array index:
myArray [0] = 101;
myArray [1] = 102;
You can also create and initialize an array directly using the flower brackets ({}).
int [] myArray = {10, 20, 30, 40, 50}
MySQL | DECODE( ) Function - GeeksforGeeks

13 Nov, 2019
The MySQL DECODE() function is used for decoding an encoded string and return the original string. The MySQL DECODE() function returns empty strings if the encoded string is an empty string.
The DECODE() function accepts two parameters which are the encoded string to be decoded and the password string to decode the encoded string.
Syntax:
DECODE(encoded_string, password_string);
Parameters Used:
encoded_string – It is used to specify the encoded string that is to be decoded.
password_string – It is used to specify the password string to decode the encoded string.
Return Value:The DECODE function in MySQL returns the original string after decoding an encoded string.
Supported Versions of MySQL:
MySQL 5.7
MySQL 5.6
MySQL 5.5
MySQL 5.1
MySQL 5.0
MySQL 4.1
Example-1: Implementing DECODE function on a string.
SELECT  
DECODE(ENCODE('geeksforgeeks', 'passwordstring'), 'passwordstring'); 
Output:
geeksforgeeks 
Example-2: Implementing DECODE function on a string which has a combination of characters and integers.
SELECT  
DECODE(ENCODE('geeksforgeeks123', 'passwordstring'), 'passwordstring'); 
Output:
geeksforgeeks123 
Example-3: Implementing DECODE function on a NULL string and returning the length of the string after compression.
SELECT  
DECODE(ENCODE('NULL', 'passwordstring'), 'passwordstring'); 
Output:
NULL 
mysql
SQLmysql
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
SQL Interview Questions
CTE in SQL
How to Update Multiple Columns in Single Update Statement in SQL?
Difference between SQL and NoSQL
MySQL | Group_CONCAT() Function
Difference between DELETE and TRUNCATE
SQL | Subquery
How to Create a Table With Multiple Foreign Keys in SQL?
What is Temporary Table in SQL?
MySQL | Regular expressions (Regexp)
How to Create Ubuntu Live USB in Windows? - GeeksforGeeks

01 Feb, 2021
In this article, we will look into the process of creating an Ubuntu live USB on a Windows machine. This USB drive can be further used to either install Ubuntu on your Windows machine or use Ubuntu directly from the USB drive. Through this article, you will learn to create a bootable USB of Ubuntu in Windows. Instructions are valid for all versions of Ubuntu and Windows.
To do so follow the below steps:
Step 1: First you need to download the Ubuntu ISO image file, before installing it on USB. You can download the official Ubuntu ISO from here. You can download any version of Ubuntu at no cost.
Step 2: Once you have downloaded the ISO of Ubuntu, go to this page and download the latest version of Universal USB Installer. For the sake of demonstration, we will be using the Rufus USB installer.
Note: Rufus is a utility that helps format and create bootable USB flash drives,
      such as USB keys/pendrives, memory sticks, etc.
Step 3: Now we need to create a bootable USB. To do so, Plugin the USB drive in the computer and run Universal USB Installer. Follow the below steps to work with the installer:
Step 1: Browse to the location of the downloaded Ubuntu ISO
Step 2: Select the USB drive in which you want to flash Ubuntu.
Step 3: Click on the start button to start the process.
Step 4: Click OK
Now Wait for some time for the process to complete.
Once the live USB is created, you can proceed with testing Ubuntu in live mode. You will need to restart your computer. At boot time, press F2 or F10, or F12 (depending upon your system) to access the boot menu. Once there, choose to boot from USB or removable media. That’s it. You can use Ubuntu without installing here. 
Technical Scripter 2020
How To
Linux-Unix
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install FFmpeg on Windows?
How to Add External JAR File to an IntelliJ IDEA Project?
How to Set Git Username and Password in GitBash?
How to create a nested RecyclerView in Android
How to Install Jupyter Notebook on MacOS?
Sed Command in Linux/Unix with examples
AWK command in Unix/Linux with examples
grep command in Unix/Linux
cut command in Linux with examples
cp command in Linux with examples
TypeScript - String substr()

This method returns the characters in a string beginning at the specified location through the specified number of characters.
string.substr(start[, length]);

start − Location at which to start extracting characters (an integer between 0 and one less than the length of the string).
start − Location at which to start extracting characters (an integer between 0 and one less than the length of the string).
length − The number of characters to extract.
length − The number of characters to extract.
Note − If start is negative, substr uses it as a character index from the end of the string.
The substr() method returns the new sub-string based on given parameters.
var str = "Apples are round, and apples are juicy."; 
console.log("(1,2): "    + str.substr(1,2)); 
console.log("(-2,2): "   + str.substr(-2,2)); 
console.log("(1): "      + str.substr(1)); 
console.log("(-20, 2): " + str.substr(-20,2)); 
console.log("(20, 2): "  + str.substr(20,2));

On compiling, it will generate the same code in JavaScript.
Its output is as follows −
(1,2): pp 
(-2,2): y. 
(1): pples are round, and apples are juicy. 
(-20, 2): nd 
(20, 2): d


    45 Lectures 
     4 hours 

 Antonio Papa

    41 Lectures 
     7 hours 

 Haider Malik

    60 Lectures 
     2.5 hours 

 Skillbakerystudios

    77 Lectures 
     8 hours 

 Sean Bradley

    77 Lectures 
     3.5 hours 

 TELCOMA Global

    19 Lectures 
     3 hours 

 Christopher Frewin
 Print
 Add Notes
 Bookmark this page
Explain closure of attributes in DBMS

Closure of an attribute x is the set of all attributes that are functional dependencies on X with respect to F. It is denoted by X+ which means what X can determine.
Let’s see the algorithm to compute X+
Step 1 − X+ =X
Step 2 − repeat until X+ does not changeFor each FD Y->Z in FIf Y ⊆ X+ then X+ = X+ U Z
For each FD Y->Z in FIf Y ⊆ X+ then X+ = X+ U Z
If Y ⊆ X+ then X+ = X+ U Z
Consider a relation R(A,B,C,D,E,F)
F: E->A, E->D, A->C, A->D, AE->F, AG->K.
Find the closure of E or E+
The closure of E or E+ is as follows −
  E+ = E
    =EA       {for E->A add A}
    =EAD      {for E->D add D}
    =EADC     {for A->C add C}
    =EADC     {for A->D D already added}
    =EADCF    {for AE->F add F}
    =EADCF    {for AG->K don’t add k AG ⊄ D+)
Let the relation R(A,B,C,D,E,F)
F: B->C, BC->AD, D->E, CF->B. Find the closure of B.
The closure for B is as follows −
B+ = {B,C,A,D,E}
Closure is used to find the candidate keys of R and compute F+
Candidate key of R: X is a candidate keys of R if X->{R}
For example,
R(A,B,C,D,E,F) WHERE F:A->BC, B->D, C->DE, BC->F. Then, find the candidate keys of R.
A+= {A,B,C,D,E,F}={R}=>A is a candidate key
B+= {B,D} => B is not a candidate key
C+= {C,D,E} => C is not a candidate key
BC+= {B,C,D,E,F} => BC is not a candidate key
Closure of F (F+): F+ is the set of all FDs that can be inferred/ derived from F. Using Armstrong Axioms repeatedly on F, we can compute all the FDs.
R(A,B,C,D,E) AND F: A->B,B->C, C->D, A->E. Find the closure of F
A+= {A,B,C,D,E}
B+= {B,C,D}
C+= {C,D}
F+= {A->A, A->B, A->C, A->D, A->E, B->B, B->C, B->D, C->C, C->D}
How to initialize a dynamic array in C++?

Here is a C++ program to initialize a dynamic array. Here in this program we can use dynamically allocated array to return a local array from the function Array().
 Live Demo
#include <iostream>
using namespace std;
int* Array() {
   int* a = new int[100];
   a[0] = 7;
   a[1] = 6;
   a[2] = 4;
   a[3] = 5;
   return a;
}
int main() {
   int* p = Array();
   cout <<"The elements are:"<< p[0] << " " << p[1]<<" " <<p[2] << " " << p[3];
   return 0;
}
The elements are:7 6 4 5
Convert a String to Uppercase in C

Here is the program to convert a string to uppercase in C language,
#include <stdio.h>
#include <string.h>
int main() {
   char s[100];
   int i;
   printf("\nEnter a string : ");
   gets(s);
   for (i = 0; s[i]!='\0'; i++) {
      if(s[i] >= 'a' && s[i] <= 'z') {
         s[i] = s[i] -32;
      }
   }
   printf("\nString in Upper Case = %s", s);
   return 0;
}
Enter a string : hello world!
String in Upper Case = HELLO WORLD!
In the program, the actual code of conversion of string to upper case is present in main() function. An array of char type s[100] is declared which will store the entered string by user.
Then, for loop is used to convert the string into upper case string and if block is used to check that if characters are in lower case then, convert them in upper case by subtracting 32 from their ASCII value.
for (i = 0; s[i]!='\0'; i++) {
   if(s[i] >= 'a' && s[i] <= 'z') {
      s[i] = s[i] -32;
   }
}
Java For Loop

When you know exactly how many times you want to loop through a block of 
code, use the for loop instead of a while loop:
for (statement 1; statement 2; statement 3) {
  // code block to be executed
}
Statement 1 is executed (one time) before the execution of the code block.
Statement 2 defines the condition for executing the code block.
Statement 3 is executed (every time) after the code block has been executed.
The example below will print the numbers 0 to 4:
for (int i = 0; i < 5; i++) {
  System.out.println(i);
}


Try it Yourself »

Statement 1 sets a variable before the loop starts (int i = 0).
Statement 2 defines the condition for the loop to run (i must be less than 
5). If the condition is true, the loop will start over again, if it is false, 
the loop will end.
Statement 3 increases a value (i++) each time the code block in the loop has 
been executed.
This example will only print even values between 0 and 10:
for (int i = 0; i <= 10; i = i + 2) {
  System.out.println(i);
}


Try it Yourself »

Use a for loop to print "Yes" 5 times.
 (int i = 0; i < 5; ) {
  System.out.println();
}

Start the Exercise
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 Program to merge contents of two files into a third file - GeeksforGeeks

07 Jul, 2017
Let the given two files be file1.txt and file2.txt. The following are steps to merge.1) Open file1.txt and file2.txt in read mode.2) Open file3.txt in write mode.3) Run a loop to one by one copy characters of file1.txt to file3.txt.4) Run a loop to one by one copy characters of file2.txt to file3.txt.5) Close all files.
To successfully run the below program file1.txt and fil2.txt must exits in same folder.
#include <stdio.h>#include <stdlib.h>  int main(){   // Open two files to be merged   FILE *fp1 = fopen("file1.txt", "r");   FILE *fp2 = fopen("file2.txt", "r");     // Open file to store the result   FILE *fp3 = fopen("file3.txt", "w");   char c;     if (fp1 == NULL || fp2 == NULL || fp3 == NULL)   {         puts("Could not open files");         exit(0);   }     // Copy contents of first file to file3.txt   while ((c = fgetc(fp1)) != EOF)      fputc(c, fp3);     // Copy contents of second file to file3.txt   while ((c = fgetc(fp2)) != EOF)      fputc(c, fp3);     printf("Merged file1.txt and file2.txt into file3.txt");     fclose(fp1);   fclose(fp2);   fclose(fp3);   return 0;}
Output:
Merged file1.txt and file2.txt into file3.txt
Related Articles :
Java program to merge two files alternatively into third file
Java program to merge two files into a third file
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
cpp-file-handling
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Multidimensional Arrays in C / C++
rand() and srand() in C/C++
Left Shift and Right Shift Operators in C/C++
Command line arguments in C/C++
Function Pointer in C
Different methods to reverse a string in C/C++
Substring in C++
TCP Server-Client implementation in C
Enumeration (or enum) in C
Structures in C
How to create tensors with gradients in PyTorch?

To create a tensor with gradients, we use an extra parameter "requires_grad = True" while creating a tensor.
requires_grad is a flag that controls whether a tensor requires a gradient or not.
requires_grad is a flag that controls whether a tensor requires a gradient or not.
Only floating point and complex dtype tensors can require gradients.
Only floating point and complex dtype tensors can require gradients.
If requires_grad is false, then the tensor is same as the tensor without the requires_grad parameter.
If requires_grad is false, then the tensor is same as the tensor without the requires_grad parameter.
torch.tensor(value, requires_grad = True)
value – tensor data, user-defined or randomly generated.
value – tensor data, user-defined or randomly generated.
requires_grad – a flag, if True, the tensor is included in the gradient computation.
requires_grad – a flag, if True, the tensor is included in the gradient computation.
It returns a tensor with requires_grad as True.
Import the required library. The required library is torch.
Import the required library. The required library is torch.
Define a tensor with requires_grad = True
Define a tensor with requires_grad = True
Display the created tensor with gradients.
Display the created tensor with gradients.
Let's have a couple of examples for a better understanding of how it works.
In the following example, we created two tensors. One tensor is without requires_grad = True and the other is with requires_grad = True.
# import torch library
import torch

# create a tensor without gradient
tensor1 = torch.tensor([1.,2.,3.])

# create another tensor with gradient
tensor2 = torch.tensor([1.,2.,3.], requires_grad = True)

# print the created tensors
print("Tensor 1:", tensor1)
print("Tensor 2:", tensor2)
Tensor 1: tensor([1., 2., 3.])
Tensor 2: tensor([1., 2., 3.], requires_grad=True)
# import required library
import torch

# create a tensor without gradient
tensor1 = torch.randn(2,2)

# create another tensor with gradient
tensor2 = torch.randn(2,2, requires_grad = True)

# print the created tensors
print("Tensor 1:\n", tensor1)
print("Tensor 2:\n", tensor2)
Tensor 1:
 tensor([[-0.9223, 0.1166],
    [ 1.6904, 0.6709]])
Tensor 2:
 tensor([[ 1.1912, -0.1402],
    [-0.2098, 0.1481]], requires_grad=True)
In the following example, we created a tensor with gradients using numpy array.
# import the required libraries
import torch
import numpy as np

# create a tensor of random numbers with gradients
# generate 2x2 numpy array of random numbers
v = np.random.randn(2,2)

# create a tensor with above random numpy array
tensor1 = torch.tensor(v, requires_grad = True)

# print above created tensor
print(tensor1)
tensor([[ 0.7128, 0.8310],
   [ 1.6389, -0.3444]], dtype=torch.float64,
requires_grad=True)
Flexbox - Flex-Order

The flex-order property is used to define the order of the flexbox item.
The following example demonstrates the order property. Here we are creating six colored boxes with the labels one, two, three, four, five, six, arranged in the same order, and we are reordering them in the order one, two, five, six, three, four, using the flex-order property.
<!doctype html>
<html lang = "en">
   <style>
      .box{
         font-size:35px;
         padding:15px;
      }
      .box1{background:green;}
      .box2{background:blue;}
      .box3{background:red; order:1}
      .box4{background:magenta; order:2}
      .box5{background:yellow;}
      .box6{background:pink;}
      
      .container{
         display:inline-flex;
         border:3px solid black;
         flex-direction:rows;
         flex-wrap:wrap;
      }
   </style>
   
   <body>
      <div class = "container">
         <div class = "box box1">One</div>
         <div class = "box box2">two</div>
         <div class = "box box3">three</div>
         <div class = "box box4">four</div>
         <div class = "box box5">five</div>
         <div class = "box box6">six</div>
      </div>
   </body>
</html>
It will produce the following result −
You can also assign –ve values to the order as shown below.
<!doctype html>
<html lang = "en">
   <style>
      .box{
         font-size:35px;
         padding:15px;
      }
      .box1{background:green;}
      .box2{background:blue;}
      .box3{background:red; order:-1}
      .box4{background:magenta; order:-2}
      .box5{background:yellow;}
      .box6{background:pink;}
      
      .container{
         display:inline-flex;
         border:3px solid black;
         flex-direction:row;
         flex-wrap:wrap;
      }
   </style>
   
   <body>
      <div class = "container">
         <div class = "box box1">One</div>
         <div class = "box box2">two</div>
         <div class = "box box3">three</div>
         <div class = "box box4">four</div>
         <div class = "box box5">five</div>
         <div class = "box box6">six</div>
      </div>
   </body>
</html>
It will produce the following result −

    21 Lectures 
     2.5 hours 

 DigiFisk (Programming Is Fun)

    87 Lectures 
     11 hours 

 Code And Create

    167 Lectures 
     45.5 hours 

 Muslim Helalee
 Print
 Add Notes
 Bookmark this page
How to convert a negative number to a positive one in JavaScript?

To convert a negative number to a positive one in JavaScript, use the abs() method in JavaScript. The method returns the absolute value of a number.
You can try to run the following code to convert a negative number to positive −
<html>
   <head>
      <title>JavaScript Math abs() Method</title>
   </head>
   <body>
      <script>
         var value = Math.abs(-1);
         document.write("First Test Value : " + value );

         var value = Math.abs(null);
         document.write("<br />Second Test Value : " + value );

         var value = Math.abs(20);
         document.write("<br />Third Test Value : " + value );

         var value = Math.abs("string");
         document.write("<br />Fourth Test Value : " + value );
      </script>
   </body>
</html>
edquota Command in Linux with Examples - GeeksforGeeks

13 Aug, 2020
edquota command in Linux is used to edit user/group quotas. We can specify one or more users/groups on the command line. If instead of a number is given in the place of user/group name it is treated as a UID/GID. For each user/group, a short-lived file is made with an ASCII representation of the present disk quotas for that user/group, and an editor is then invoked on the file. The quotas can then be modified or new quotas can be added. Setting a quota to zero indicates that no quota should be imposed. Users are permitted to exceed their soft limits for a grace period which will be specified per file system. Once the grace period has expired, the soft limit is enforced as a tough limit. Only the super-user(sudo) may edit quotas.
edquota [-rm] [-u] [-F formatname] [-p username] [-f filesystem] username ...
edquota [-rm] -g [-F formatname] [-p groupname] [-f filesystem] groupname ...
edquota [-rm] -P [-F formatname] [-p projectname] [-f filesystem] projectname ...
edquota [-u|g|-P] [-F formatname] [-f filesystem] -t
edquota [-u|g|-P] [-F formatname] [-f filesystem] -T username|groupname|projectname ...

1. Edit the user quota. This is the default.
edquota -u username

2. Edit the group quota.
edquota -g groupname

3. Edit the remote quota (via RPC).
edquota [-u|-g] -r username | groupname

4. Copy data from a prototype user/group. If –always-resolve is used, then always try to resolve the name, even if it is composed only of digits.
edquota [-u|-g] -p prototype_name username | groupname 

5. Edit quota for specified format (ie. don’t perform format auto detection). Possible format names are: vfsold, vfsv0, rpc , xfs.
edquota [-u|-g] -F vfsv0 username | groupname

6. Perform specified operations only for the given file system.
edquota [-u|-g] -f filesystem username | groupname

7. Edit the soft time limits for each file system. Time units of ’seconds’, ’minutes’, ’hours’, and ’days’ are understood.
edquota [-u|-g] -t 12 username | groupname

linux-command
Linux-system-commands
Picked
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Thread functions in C/C++
nohup Command in Linux with Examples
mv command in Linux with examples
Docker - COPY Instruction
SED command in Linux | Set 2
chown command in Linux with Examples
Basic Operators in Shell Scripting
Array Basics in Shell Scripting | Set 1
scp command in Linux with Examples
Named Pipe or FIFO with example C program
When logistic regression simply doesn’t work | by Alon Lekhtman | Towards Data Science

Logistic regression is a very commonly used method for predicting a target label from structured tabular data. Although there are some more advanced methods that generally perform better, the simplicity of logistic regression makes it the first choice.
However, it is important to understand the limitations of logistic regression. In this post, I would like to show some of the limitations by presenting a very simple use case in which logistic regression doesn’t work well.
Suppose you want to predict whether the indoor temperature is high or low based on the following two features: outdoor temperature and whether the air conditioner is on.
Let's create a simulated data set for this task:
This is a very simplistic model of “Indoor temperature” — The air conditioner adds 10 degrees to the temperature outside if it is cold outside, and reduces 10 degrees if it is hot outside. Hot is defined as more than 25 degrees. And if the air conditioner is off, the indoor temperature is the same as the temperature outside.
Split the data into train and test:
Train a logistic regression model:
Take the first 10 test cases, and see what the model predicted to them:
As we can see out of 10 cases, 4 were predicted wrong.
Check the accuracy of the model:
0.655
Even though the idea behind the generation of this dataset is pretty simple, there were plenty of data points, and no noise at all, the logistic regression model performed poorly on this dataset.
The reason is that the target label has no linear correlation with the features. In such cases, logistic regression (or linear regression for regression problems) can’t predict targets with good accuracy (even on the training data).
So what can we do in such cases?
We can use another model, a very simple choice might be a decision tree.
Let’s see how it performs on the 10 first cases of the test set:
As we can see the decision tree predicted correctly all of the 10 examples.
And, if we calculate its accuracy:
1.0
That means the decision tree predicted correctly all the cases of the test set.
Perhaps we should take a look at the structure of the decision tree to understand how it performs so well.
We can see that it pretty much figured out the logic — if the temperature outside is more than 35.5 degrees (we have only integer numbers here, so 35 is enough), it will be hot in the room. If the temperature outside is less than 15.5 degrees, it will be cold in the room. Anything in between depends on whether the air conditioner is on.
An interesting thing is that with a little bit more feature engineering we can make the logistic regression work here. If we create new features that combine the temperature outside with the air conditioning in a way that lets the model know whether the air conditioning is heating or cooling, we make this problem be suitable for logistic regression to solve:
0.99
I hope this post gave you a sense of when it is fine to use logistic regression and when it is better to look for other methods, or how to create new features to make your task more suitable for logistic regression.
Compute the Value of Empirical Cumulative Distribution Function in R Programming - ecdf() Function - GeeksforGeeks

25 Jun, 2020
ecdf() function in R Language is used to compute and plot the value of Empirical Cumulative Distribution Function of a numeric vector.
Syntax: ecdf(x)
Parameters:x: Numeric Vector
Example 1:
# R Program to compute the value of# Empirical Cumulative Distribution Function  # Creating a Numeric Vectorx <- seq(1, 50, by = 2)  # Calling ecdf() Functiony <- ecdf(x)y
Output:
Empirical CDF 
Call: ecdf(x)
 x[1:25] =      1,      3,      5,  ...,     47,     49

Example 2:
# R Program to compute the value of# Empirical Cumulative Distribution Function  # Creating a random vectorx <- rnorm(30)  # Calling ecdf() Functiony <- ecdf(x)  # Plot a graphplot(y)
Output:
R Statistics-Function
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Replace specific values in column in R DataFrame ?
Loops in R (for, while, repeat)
Filter data by multiple conditions in R using Dplyr
How to change Row Names of DataFrame in R ?
Change Color of Bars in Barchart using ggplot2 in R
Remove rows with NA in one column of R DataFrame
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
K-Means Clustering in R Programming
C++ String Library - constructor

It is used to construct a string object.and initializing its value depending on the constructor version used.
Following is the declaration for std::string::string.
string();
str − It is an another string object.
str − It is an another string object.
pos − It contains the position of first string character.
pos − It contains the position of first string character.
len − It contains the lenght of sub string.
len − It contains the lenght of sub string.
s − Pointer to an array of characters.
s − Pointer to an array of characters.
n − It contains the information about number of characters to copy.
n − It contains the information about number of characters to copy.
c − Character to fill the string.
c − Character to fill the string.
first, last − It is an nput iterator to find the initial and final positions in a range.
first, last − It is an nput iterator to find the initial and final positions in a range.
il − It is an initializer_list object.
il − It is an initializer_list object.
none
Never throw any exceptiions.
In below example for std::string::string.
#include <iostream>
#include <string>

int main () {
   std::string s0 ("initial string");
   std::string s1;
   std::string s2 (s0);
   std::string s3 (s0, 8, 3);
   std::string s4 ("A character sequence", 6);
   std::string s5 ("Another character sequence");
   std::string s6a (10, 'x');
   std::string s6b (10, 42);
   std::string s7 (s0.begin(), s0.begin()+7);

   std::cout << "s1: " << s1 << "\ns2: " << s2 << "\ns3: " << s3;
   std::cout << "\ns4: " << s4 << "\ns5: " << s5 << "\ns6a: " << s6a;
   std::cout << "\ns6b: " << s6b << "\ns7: " << s7 << '\n';
   return 0;
}
The sample output should be like this −
s1:
s2: initial string
s3: str
s4: A char
s5: Another character sequence
s6a: xxxxxxxxxx
s6b: **********
s7: initial

 Print
 Add Notes
 Bookmark this page
Git Tutorial

Git is a version control system.
Git helps you keep track of code changes.
Git is used to collaborate on code.
In this tutorial, we will show you Git commands like this:
git --version
git version 2.30.2.windows.1
For new users, using the terminal view can seem a bit complicated. Don't worry! We will keep it really simple, and learning this way gives you a good grasp of how Git works.
In the code above, you can see commands (input) and output.
Lines like this are commands we input:
git --version
Lines like this are the output/response to our commands:
git version 2.30.2.windows.1
In general, lines with $ in front of it is input. These are the commands you can copy and run in your terminal.
Git and GitHub are different things.
In this tutorial you will understand what Git is and how to use it on the remote repository platforms, like GitHub.
You can choose, and change, which platform to focus on by clicking in the menu on the right:
Insert the missing part of the command to check which version of Git (if any) 
is installed.
git 


Start the Exercise
Test your Git skills with a quiz.
Start Git Quiz
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.