code-rag-bench/online-tutorials huggingface dataset:
Create a list group heading in Bootstrap

To create a list group heading, use the .list-group-item-heading class in Bootstrap.
You can try to run the following code to implement .list-group-item-heading class −
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class = "container">
         <h1>Countries</h1>
         <ul class = "list-group">
            <li class = "list-group-item">
               <h3 class = "list-group-item-heading">Asia</h3>
               <p class = "list-group-item-text">India</p>
               <p class = "list-group-item-text">Nepal</p>
            </li>
            <li class = "list-group-item">
               <h3 class = "list-group-item-heading">Europe</h3>
               <p class = "list-group-item-text">Germany</p>
               <p class = "list-group-item-text">Italy</p>
               <p class = "list-group-item-text">Spain</p>
            </li>
         </ul>
      </div>
   </body>
</html>
Create a Random Sequence of Numbers within t-Distribution in R Programming - rt() Function - GeeksforGeeks

19 Jun, 2020
rt() function in R Language is used to create a random sequence of values from Student t-distribution.
Syntax: rt(n, df, ncp)
Parameters:n: Number of observationsdf: Degree of Freedomncp: Numeric vector of non-centrality parameters.
Example 1:
# R Program to create random sequence# from t distribution  # Calling rt() Functionrt(15, 2)rt(15, 1)
Output:
 [1]  2.09851925 -1.76883434 -0.56019367  0.23263458  1.02778818 -0.82274015
 [7] -1.33110401  4.19230931  0.80622707  0.02468189 -4.00469465  0.02974788
[13]  1.28649412 -0.19235704  0.21665196
 [1]   2.21010764 -11.70663704  -1.00452125   2.07828752   1.95781361
 [6]  -0.53603661   0.02068073  -1.32464307 -49.93080321   0.82594818
[11]  -0.46109805  -0.18965787   0.60498953  -0.44659619  -0.08968020

Example 2:
# R Program to create random sequence# from t distribution  # Calling rt() Functionrt(5, 1, 1:5 * 5)rt(5, 2, 1:10)
Output:
[1] 23.88663 20.26813 62.95437 14.59003 20.58296
[1]  0.1745755  4.5298859  1.1175184  7.4660938 45.1399588

R Math-Function
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
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?
How to filter R DataFrame by values in a column?
How to import an Excel File into R ?
How to filter R dataframe by multiple conditions?
Replace Specific Characters in String in R
Time Series Analysis in R
R - if statement
Instance method in Python

02 Jul, 2020
A class is a user-defined blueprint or prototype from which objects are created. Classes provide a means of bundling data and functionality together. Creating a new class creates a new type of object, allowing new instances of that type to be made. Each class instance can have attributes attached to it for maintaining its state. Class instances can also have methods (defined by its class) for modifying its state.
Example:
# Python program to demonstrate# classes      class Person:            # init method or constructor       def __init__(self, name):          self.name = name            # Sample Method       def say_hi(self):          print('Hello, my name is', self.name)        p = Person('Nikhil')  p.say_hi() 
Output:
Hello, my name is Nikhil

Note: For more information, refer to Python Classes and Objects
Instance attributes are those attributes that are not shared by objects. Every object has its own copy of the instance attribute.
For example, consider a class shapes that have many objects like circle, square, triangle, etc. having its own attributes and methods. An instance attribute refers to the properties of that particular object like edge of the triangle being 3, while the edge of the square can be 4.
An instance method can access and even modify the value of attributes of an instance. It has one default parameter:-
self – It is a keyword which points to the current passed instance. But it need not be passed every time while calling an instance method.
Example:
# Python program to demonstrate# instance methods    class shape:          # Calling Constructor    def __init__(self, edge, color):        self.edge = edge        self.color = color              # Instance Method    def finEdges(self):        return self.edge              # Instance Method    def modifyEdges(self, newedge):        self.edge = newedge          # Driver Codecircle = shape(0, 'red')square = shape(4, 'blue')  # Calling Instance Methodprint("No. of edges for circle: "+ str(circle.finEdges()))  # Calling Instance Methodsquare.modifyEdges(6)  print("No. of edges for square: "+ str(square.finEdges()))
Output
No. of edges for circle: 0
No. of edges for square: 6
Akanksha_Rai
Python-OOP
python-oop-concepts
Technical Scripter 2019
Python
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python program to count words in a sentence

03 Jun, 2022
Data preprocessing is an important task in text classification. With the emergence of Python in the field of data science, it is essential to have certain shorthands to have the upper hand among others. This article discusses ways to count words in a sentence, it starts with space-separated words but also includes ways to in presence of special characters as well. Let’s discuss certain ways to perform this.
Quick Ninja Methods: One line Code to find count words in a sentence with Static and Dynamic Inputs.
Python3
# Quick Two Line CodescountOfWords = len("Geeksforgeeks is best Computer Science Portal".split())print("Count of Words in the given Sentence:", countOfWords) # Quick One Line Codesprint(len("Geeksforgeeks is best Computer Science Portal".split())) # Quick One Line Code with User Inputprint(len(input("Enter Input:").split()))
Output:
 
Method #1: Using split() split function is quite useful and usually quite generic method to get words out of the list, but this approach fails once we introduce special characters in the list. 
Python3
# Python3 code to demonstrate# to count words in string# using split() # initializing string test_string = "Geeksforgeeks is best Computer Science Portal" # printing original stringprint ("The original string is : " +  test_string) # using split()# to count words in stringres = len(test_string.split()) # printing resultprint ("The number of words in string are : " +  str(res))
Method #2 : Using regex(findall()) Regular expressions have to be used in case we require to handle the cases of punctuation marks or special characters in the string. This is the most elegant way in which this task can be performed. 
Example
Python3
# Python3 code to demonstrate# to count words in string# using regex (findall())import re # initializing string test_string = "Geeksforgeeks,    is best @# Computer Science Portal.!!!" # printing original stringprint ("The original string is : " +  test_string) # using regex (findall())# to count words in stringres = len(re.findall(r'\w+', test_string)) # printing resultprint ("The number of words in string are : " +  str(res))
Method #3 : Using sum() + strip() + split() This method performs this particular task without using regex. In this method we first check all the words consisting of all the alphabets, if so they are added to sum and then returned.  
Python3
# Python3 code to demonstrate# to count words in string# using sum() + strip() + split()import string # initializing string test_string = "Geeksforgeeks,    is best @# Computer Science Portal.!!!" # printing original stringprint ("The original string is : " +  test_string) # using sum() + strip() + split()# to count words in stringres = sum([i.strip(string.punctuation).isalpha() for i in test_string.split()]) # printing resultprint ("The number of words in string are : " +  str(res))
dey0btpch57lmvgz5mqhpaiqn337p09fd8yq1lw4
Python string-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | GATE-CS-2014-(Set-2) | Question 65

28 Jun, 2021
SQL allows tuples in relations, and correspondingly defines the multiplicity of tuples in the result of joins. Which one of the following queries always gives the same answer as the nested query shown below:
    select * from R where a in (select S.a from S) 
(A) select R.* from R, S where R.a=S.a(D)(B) select distinct R.* from R,S where R.a=S.a(C) select R.* from R,(select distinct a from S) as S1 whereR.a=S1.a(D) select R.* from R,S where R.a=S.a and is unique RAnswer: (C)Explanation: The solution of this question lies in the data set(tuples) of Relations R and S we define. If we miss some case then we may get wrong answer.Let’s say,
Relation R(BCA) with attributes B, C and A contains the following tuples.
B C A
---------
7 2 1
7 2 1
8 9 5
8 9 5
And Relation S(AMN) with attributes A, M, and N contains the following tuples.
A M N
---------
1 6 7
2 8 4
5 9 6
5 5 3
———————————————————————————————————–Now ,the original Query will give result as:
“select * from R where a in (select S.a from S) ” – The query asks to display every tuple of Relation R where R.a is present in the complete set S.a.
B C A
---------
7 2 1
7 2 1
8 9 5
8 9 5
———————————————————————————————————–
Option A query will result in :
“select R.* from R, S where R.a=S.a”
B C A
---------
7 2 1
7 2 1
8 9 5
8 9 5
8 9 5
8 9 5
———————————————————————————————————–
Option B query will result in :
” select distinct R.* from R,S where R.a=S.a”
B C A
---------
7 2 1
8 9 5
———————————————————————————————————–
Option C query will result in :
“select R.* from R,(select distinct a from S) as S1 whereR.a=S1.a”B C A———7 2 17 2 18 9 58 9 5
———————————————————————————————————–
Option D query will result in : NULL set
“select R.* from R,S where R.a=S.a and is unique R”
———————————————————————————————————-Hence option C query matches the original result set.
Note : As mentioned earlier, we should take those data sets which can show us the difference in different queries. Suppose in R if you don’t put identical tuples then you will get wrong answers. (Try this yourself, this is left as an exercise for you ).Quiz of this Question
GATE-CS-2014-(Set-2)
GATE-GATE-CS-2014-(Set-2)
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Sending an Intent to browser to open specific URL using Kotlin.

This example demonstrates how to Send an Intent to browser to open specific URL using Kotlin
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:layout_height="match_parent"
   android:padding="8dp"
   tools:context=".MainActivity">
   <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="50dp"
      android:text="Tutorials Point"
      android:textAlignment="center"
      android:textColor="@android:color/holo_green_dark"
      android:textSize="32sp"
      android:textStyle="bold" />
   <Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerInParent="true"
      android:onClick="getUrlFromIntent"
      android:text="Get URL from Intent" />
</RelativeLayout>
Step 3 − Add the following code to src/MainActivity.kt
import android.content.Intent
import android.net.Uri
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
class MainActivity : AppCompatActivity() {
   override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
      title = "KotlinApp"
   }
   fun getUrlFromIntent(view: View) {
      val url = "http://www.google.com"
      val intent = Intent(Intent.ACTION_VIEW)
      intent.data = Uri.parse(url)
      startActivity(intent)
   }
}
Step 4 − Add the following code to androidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app.com.q11">
   <uses-permission android:name="android.permission.INTERNET" />
   <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">
      <activity android:name=".MainActivity">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>
   </application>
</manifest>
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 the Run icon from the toolbar. Select your mobile device as an option and then check your mobile device which will display your default screen
Java Comments

Comments can be used to explain Java code, and to make it more readable. It can also be used to 
prevent execution when testing alternative code.
Single-line comments start with two forward slashes (//).
Any text between // and the end of the line 
is ignored by Java (will not be executed).
This example uses a single-line comment before a line of code:
// This is a comment
System.out.println("Hello World");


Try it Yourself »

This example uses a single-line comment at the end of a line of code:
System.out.println("Hello World"); // This is a comment


Try it Yourself »

Multi-line comments start with /* and ends with */.
Any text between /* and */ will be ignored by Java.
This example uses a multi-line comment (a comment block) to explain the code:
/* The code below will print the words Hello World
to the screen, and it is amazing */
System.out.println("Hello World");


Try it Yourself »

It is up to you which you want to use. Normally, we use // for short comments, and /* */ for longer.
Insert the missing part to create two types of comments.
 This is a single-line comment
 This is a multi-line comment 

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.
Check if string contains another string in Swift

To check if a string contains another string in swift, we’ll need two different strings. One string that we have to check if it consists another string.
Let us say the string we want to check is “point” and the whole string is “TutorialsPoint” and another string is “one two three”. Let’s check with both these string in the playground.
We can do this in two ways as shown below. Let’s start by creating three different strings.
var CompleteStr1 = "Tutorials point"
var completeStr2 = "one two three"
var stringToCheck = "point"
In this method we’ll use the .contains method of Strings to check if there is a string within another string, it returns true if it exists, otherwise, it returns false.
if CompleteStr1.contains(stringToCheck) {
   print("contains")
} else {
   print("does not contain")
}
In this method we’ll check the range of a string if the range is nil, it means that the string we are checking for, does not exist. Otherwise, it means that string exists.
if completeStr2.range(of: stringToCheck) != nil {
   print("contains")
} else {
   print("does not contain")
}
When we run the above code, we get the output as shown below.
Similarly, let’s try these methods with one more example.
var Str1 = "12312$$33@"
var Str2 = "%%"
var Str3 = "$$"
if Str1.contains(Str2) {
   print("contains")
} else {
   print("does not contain")
}
if Str1.range(of: Str3) != nil {
   print("contains")
} else {
   print("does not contain")
}
This produces the result as shown below.
Find frequency of each word in a string in Java

In order to get frequency of each in a string in Java we will take help of hash map collection of Java.First convert string to a character array so that it become easy to access each character of string.
Now compare for each character that whether it is present in hash map or not in case it is not present than simply add it to hash map as key and assign one as its value.And if character is present than find its value which is count of occurrence of this character in the string (initial we put as 1 when it is not present in map) and add one to it.Again put the this character into the map with the updated value of its count.
In last print the hash map which will give the each character as key and its occurrence as value.
 Live Demo
import java.util.HashMap;
public class FrequencyOfEachWord {
   public static void main(String[] args) {
      String str = "aaddrfshdsklhio";
      char[] arr = str.toCharArray();
      HashMap<Character,Integer> hMap = new HashMap<>();
      for(int i= 0 ; i< arr.length ; i++) {
         if(hMap.containsKey(arr[i])) {
            int count = hMap.get(arr[i]);
            hMap.put(arr[i],count+1);
         } else {
            hMap.put(arr[i],1);
         }
      }
      System.out.println(hMap);
   }
}
{a=2, r=1, s=2, d=3, f=1, h=2, i=1, k=1, l=1, o=1}
Angular 6 - Modules

Module in Angular refers to a place where you can group the components, directives, pipes, and services, which are related to the application.
In case you are developing a website, the header, footer, left, center and the right section become part of a module.
To define module, we can use the NgModule. When you create a new project using the Angular -cli command, the ngmodule is created in the app.module.ts file by default and it looks as follows −
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
   declarations: [
      AppComponent
   ],
   imports: [
      BrowserModule
   ],
   providers: [],
   bootstrap: [AppComponent]
})
export class AppModule { }
The NgModule needs to be imported as follows −
import { NgModule } from '@angular/core';

The structure for the ngmodule is as shown below −
@NgModule({
   declarations: [
      AppComponent
   ],
   imports: [
      BrowserModule
   ],
   providers: [],
   bootstrap: [AppComponent]
})
It starts with @NgModule and contains an object which has declarations, import s, providers and bootstrap.
It is an array of components created. If any new component gets created, it will be imported first and the reference will be included in declarations as shown below −
declarations: [
   AppComponent,
   NewCmpComponent
]

It is an array of modules required to be used in the application. It can also be used by the components in the Declaration array. For example, right now in the @NgModule we see the Browser Module imported. In case your application needs forms, you can include the module as follows −
import { FormsModule } from '@angular/forms';

The import in the @NgModule will be like the following −
imports: [
   BrowserModule,
   FormsModule
]

This will include the services created.
This includes the main app component for starting the execution.

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    28 Lectures 
     2.5 hours 

 Anadi Sharma

    11 Lectures 
     7.5 hours 

 SHIVPRASAD KOIRALA

    16 Lectures 
     2.5 hours 

 Frahaan Hussain

    69 Lectures 
     5 hours 

 Senol Atac

    53 Lectures 
     3.5 hours 

 Senol Atac
 Print
 Add Notes
 Bookmark this page
Check whether property exists in object or class with PHP

The property_exists() or the isset() function can be used to check if the property exists in the class or object.
Below is the syntax of property_exists() function−
property_exists( mixed $class , string $property )
Example
if (property_exists($object, 'a_property'))
Below is the syntax of isset() function−
isset( mixed $var [, mixed $... ] )
Example
if (isset($object->a_property))
The isset() will return false if the ‘a_property’ is null.
Let us see an example −
 Live Demo
<?php
   class Demo {
      public $one;
      private $two;
      static protected $VAL;
      static function VAL() {
         var_dump(property_exists('myClass', 'two'));
      }
   }
   var_dump(property_exists('Demo', 'one'));
   var_dump(property_exists(new Demo, 'one'));
?>
This will produce the following output−
bool(true)
bool(true)
DAX Text - LEFT function

Returns the specified number of characters from the start of a text string.
LEFT (<text>, <num_chars>) 

text
The text string containing the characters you want to extract, or a reference to a column that contains text.
num_chars
Optional.
The number of characters you want LEFT to extract.
If omitted, default is 1.
A text string.
DAX works with Unicode and stores all characters as the same length. Therefore, a single function LEFT is enough to extract the characters.
If the num_chars argument is a number that is larger than the number of characters in the text string, DAX LEFT function returns the maximum characters available and does not raise any error.
= CONCATENATE (LEFT([Product], 5), [No. of Units]) 
returns a calculated column with the first 5 characters of the Product value concatenated with the value in the No. of Units column in the same row.

    53 Lectures 
     5.5 hours 

 Abhay Gadiya

    24 Lectures 
     2 hours 

 Randy Minder

    26 Lectures 
     4.5 hours 

 Randy Minder
 Print
 Add Notes
 Bookmark this page
GATE | GATE-CS-2015 (Set 2) | Question 54 - GeeksforGeeks

19 Nov, 2018
Consider the sequence of machine instructions given below:
  MUL R5, R0, R1
  DIV R6, R2, R3
  ADD R7, R5, R6
  SUB R8, R7, R4 
In the above sequence, R0 to R8 are general purpose registers. In the instructions shown, the first register stores the result of the operation performed on the second and the third registers. This sequence of instructions is to be executed in a pipelined instruction processor with the following 4 stages: (1) Instruction Fetch and Decode (IF), (2) Operand Fetch (OF), (3) Perform Operation (PO) and (4) Write back the Result (WB). The IF, OF and WB stages take 1 clock cycle each for any instruction. The PO stage takes 1 clock cycle for ADD or SUB instruction, 3 clock cycles for MUL instruction and 5 clock cycles for DIV instruction. The pipelined processor uses operand forwarding from the PO stage to the OF stage. The number of clock cycles taken for the execution of the above sequence of instructions is ___________(A) 11(B) 12(C) 13(D) 14Answer: (C)Explanation:
  1   2   3   4   5   6   7   8   9   10   11   12   13
  IF  OF  PO  PO  PO  WB
      IF  OF          PO  PO  PO  PO  PO   WB
          IF          OF                   PO   WB
              IF          OF                    PO   WB
Quiz of this Question
GATE-CS-2015 (Set 2)
GATE-GATE-CS-2015 (Set 2)
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
GATE | GATE-CS-2016 (Set 2) | Question 48
GATE | GATE-CS-2014-(Set-1) | Question 30
GATE | GATE-CS-2001 | Question 23
GATE | GATE-CS-2015 (Set 1) | Question 65
GATE | GATE CS 2010 | Question 45
GATE | GATE-CS-2014-(Set-1) | Question 65
GATE | GATE-CS-2004 | Question 3
GATE | GATE-CS-2015 (Set 3) | Question 65
C++ Program to count Vowels in a string using Pointer
GATE | GATE CS 2012 | Question 40
Python | Combining tuples in list of tuples - GeeksforGeeks

13 May, 2019
Sometimes, we might have to perform certain problems related to tuples in which we need to segregate the tuple elements to combine with the each element of complex tuple element( such as list ). This can have application in situations we need to combine values to form a whole. Let’s discuss certain ways in which this can be performed.
Method #1 : Using list comprehensionWe can solve this particular problem using the list comprehension technique in which we can iterate for each tuple list and join it with other tuple attribute to join.
# Python3 code to demonstrate# Combining tuples in list of tuples# Using list comprehension  # initializing listtest_list = [([1, 2, 3], 'gfg'), ([5, 4, 3], 'cs')]  # printing original listprint("The original list : " + str(test_list))  # Using list comprehension# Combining tuples in list of tuplesres = [ (tup1, tup2) for i, tup2 in test_list for tup1 in i ]  # print resultprint("The list tuple combination : " + str(res))
The original list : [([1, 2, 3], ‘gfg’), ([5, 4, 3], ‘cs’)]The list tuple combination : [(1, ‘gfg’), (2, ‘gfg’), (3, ‘gfg’), (5, ‘cs’), (4, ‘cs’), (3, ‘cs’)]
 
Method #2 : Using product() + list comprehensionApart from using the tuple for generation of tuples, the product function can be used to get Cartesian product of list elements with tuple element, using the iterator internally.
# Python3 code to demonstrate# Combining tuples in list of tuples# Using product() + list comprehensionfrom itertools import product  # initializing listtest_list = [([1, 2, 3], 'gfg'), ([5, 4, 3], 'cs')]  # printing original listprint("The original list : " + str(test_list))  # Using product() + list comprehension# Combining tuples in list of tuplesres = [ele for i, j in test_list for ele in product(i, [j])]  # print resultprint("The list tuple combination : " + str(res))
The original list : [([1, 2, 3], ‘gfg’), ([5, 4, 3], ‘cs’)]The list tuple combination : [(1, ‘gfg’), (2, ‘gfg’), (3, ‘gfg’), (5, ‘cs’), (4, ‘cs’), (3, ‘cs’)]
Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Box Plot in Python using Matplotlib
Bar Plot in Matplotlib
Python | Get dictionary keys as a list
Python | Convert set into a list
Ways to filter Pandas DataFrame by column values
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python | Split string into list of characters
Python Program for Binary Search (Recursive and Iterative)
Using “WHERE binary” in SQL?

The binary keyword can be used after WHERE clause to compare a value with exact case sensitive match.
The following is an example −
Case 1 − Case insensitive match
The query is as follows −
mysql> select 'joHN'='JOHN' as Result;
The following is the output −
+--------+
| Result |
+--------+
|      1 |
+--------+
1 row in set (0.00 sec)
In the above sample output, the result is true while we know joHN and JOHN are two different words. This is not a case sensitive match.
Case 2 − If you want case sensitive match, use the binary keyword.
The query is as follows −
mysql> select binary 'joHN'='JOHN' as Result;
The following is the output −
+--------+
| Result |
+--------+
|      0 |
+--------+
1 row in set (0.00 sec)
Let us now see another query −
mysql> select binary 'JOHN'='JOHN' as Result;
The following is the output −
+--------+
| Result |
+--------+
|      1 |
+--------+
1 row in set (0.00 sec)
NOTE − You can use binary keyword to make your column case sensitive with the help of binary keyword whenever you create a table.
To understand the above concept, let us create a table. The query to create a table is as follows −
mysql> create table binaryKeywordDemo
   -> (
   -> Id int NOT NULL AUTO_INCREMENT,
   -> Name varchar(10) binary,
   -> PRIMARY KEY(Id)
   -> );
Query OK, 0 rows affected (0.88 sec)
Insert some records in the table using INSERT command. The query is as follows −
mysql> insert into binaryKeywordDemo(Name) values('bOB');
Query OK, 1 row affected (0.15 sec)
mysql> insert into binaryKeywordDemo(Name) values('bob');
Query OK, 1 row affected (0.13 sec)
mysql> insert into binaryKeywordDemo(Name) values('BOB');
Query OK, 1 row affected (0.18 sec)
mysql> insert into binaryKeywordDemo(Name) values('Bob');
Query OK, 1 row affected (0.18 sec)
mysql> insert into binaryKeywordDemo(Name) values('bOb');
Query OK, 1 row affected (0.15 sec)
mysql> insert into binaryKeywordDemo(Name) values('boB');
Query OK, 1 row affected (0.21 sec)
Display all records from the table using select statement. The query is as follows −
mysql> select *from binaryKeywordDemo;
The following is the output −
+----+------+
| Id | Name |
+----+------+
|  1 | bOB  |
|  2 | bob  |
|  3 | BOB  |
|  4 | Bob  |
|  5 | bOb  |
|  6 | boB  |
+----+------+
6 rows in set (0.00 sec)
The following is the query to exact match like case sensitive −
mysql> select *from binaryKeywordDemo where Name='Bob';
Here is the output −
+----+------+
| Id | Name |
+----+------+
|  4 | Bob  |
+----+------+
1 row in set (0.00 sec)
How to read password protected excel file in R ? - GeeksforGeeks

18 Jul, 2021
In this article, we are going to see how to read password-protected Excel files in R programming language.
File in use:  file
Here we will use excel.link package to read the file with a password.
Installation:
install.packages(“excel.link”)
xl.read.file() function is used to read Excel files in R programming.
Syntax: 
xl.read.file( “file_name”, password = “pass”)
Example 1: 
R
# import liblibrary("excel.link")  # read file with passdf <- xl.read.file("data.xlsx", password = "gfg@123")  # display dfhead(df)
Output:
The same module can be used to first unlock the file and then copy its contents onto another so that it can be accessed again without any password. Here we save the file with a password NULL value and save it to another file.
Syntax: 
xl.save.file( file.object, “New_file”, password = NULL , write.res.password = NULL)
Program:
R
# import liblibrary("excel.link")  # read file with passdf <- xl.read.file("data.xlsx", password = "gfg@123")  # save the df into new filexl.save.file(df, "Output.xlsx", password = NULL,             write.res.password = NULL)  # read file without any passworddf1 <- xl.read.file("Output.xlsx")  head(df)
Output:
Here we will use XLConnect package to read the password-protected file. This package provides comprehensive functionality to read, write and format Excel data.
loadWorkbook() function loads Microsoft Excel workbooks.
Syntax: 
loadWorkbook(filename , password )
readWorksheet() function reads data from worksheets.
Syntax: readWorksheet( object, sheet).
Parameters: 
Object: The ‘>workbook to use
Sheet: The name or index of the worksheet to read from
Program:
R
# import liblibrary(XLConnect)  # load the fileworkbook <- loadWorkbook("data.xlsx", password = "gfg@123")  # read the objectdf <- readWorksheet(workbook, "sheet1")  # display dfhead(df)
Output:
Picked
R-Excel
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to import an Excel File into R ?
How to filter R DataFrame by values in a column?
Time Series Analysis in R
R - if statement
Logistic Regression in R Programming
How to validate URL in ReactJS? - GeeksforGeeks

15 Mar, 2022
URL (Uniform Resource Locator) is a reference/address to a resource on the Internet. For example, www.geeksforgeeks.com is a URL. The following example shows how to validate the user entered data and check whether it is valid or not using the npm module in the ReactJS application. 
Creating React Application And Installing Module:
Step 1: Create a React application using the following command:
npx create-react-app foldername
Step 2: After creating your project folder i.e. foldername, move to it using the following command:
cd foldername
Step 3: After creating the ReactJS application, Install the validator module using the following command:
npm install validator
Project Structure: It will look like the following.
Project Structure
App.js: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
Javascript
import React, { useState } from "react";import validator from 'validator'  const App = () => {    const [errorMessage, setErrorMessage] = useState('')      const validate = (value) => {        if (validator.isURL(value)) {      setErrorMessage('Is Valid URL')    } else {      setErrorMessage('Is Not Valid URL')    }  }    return (    <div style={{      marginLeft: '200px',    }}>      <pre>        <h2>Validating URL in ReactJS</h2>        <span>Enter URL: </span><input type="text"         onChange={(e) => validate(e.target.value)}></input> <br />        <span style={{          fontWeight: 'bold',          color: 'red',        }}>{errorMessage}</span>      </pre>    </div>  );}  export default App
Step to Run Application: Run the application using the following command from the root directory of the project:
npm start
Output:
The following will be the output if the user enters an invalid URL as shown below:
The following will be the output if the user enters a valid URL as shown below:
react-js
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
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Python - Bernoulli Distribution in Statistics - GeeksforGeeks

31 Dec, 2019
scipy.stats.bernoulli() is a Bernoulli discrete random variable. It is inherited from the of generic methods as an instance of the rv_discrete class. It completes the methods with details specific for this particular distribution.
Parameters :
x : quantilesloc : [optional]location parameter. Default = 0scale : [optional]scale parameter. Default = 1moments : [optional] composed of letters [‘mvsk’]; ‘m’ = mean, ‘v’ = variance, ‘s’ = Fisher’s skew and ‘k’ = Fisher’s kurtosis. (default = ‘mv’).
Results : Bernoulli discrete random variable
Code #1 : Creating Bernoulli discrete random variable
# importing library  from scipy.stats import bernoulli     numargs = bernoulli .numargs a, b = 0.2, 0.8rv = bernoulli (a, b)     print ("RV : \n", rv)  
Output :
RV : 
 scipy.stats._distn_infrastructure.rv_frozen object at 0x0000016A4C0FC108

Code #2 : Bernoulli discrete variates and probability distribution
import numpy as np quantile = np.arange (0.01, 1, 0.1)   # Random Variates R = bernoulli .rvs(a, b, size = 10) print ("Random Variates : \n", R)   # PDF x = np.linspace(bernoulli.ppf(0.01, a, b),                bernoulli.ppf(0.99, a, b), 10)R = bernoulli.ppf(x, 1, 3)print ("\nProbability Distribution : \n", R) 
Output :
Random Variates : 
 [0 0 0 0 0 0 0 0 0 1]

Probability Distribution : 
 [ 4.  4. nan nan nan nan nan nan nan nan]


Code #3 : Graphical Representation.
import numpy as np import matplotlib.pyplot as plt      distribution = np.linspace(0, np.minimum(rv.dist.b, 2)) print("Distribution : \n", distribution)      plot = plt.plot(distribution, rv.ppf(distribution)) 
Output :
Distribution : 
 [0.         0.02040816 0.04081633 0.06122449 0.08163265 0.10204082
 0.12244898 0.14285714 0.16326531 0.18367347 0.20408163 0.2244898
 0.24489796 0.26530612 0.28571429 0.30612245 0.32653061 0.34693878
 0.36734694 0.3877551  0.40816327 0.42857143 0.44897959 0.46938776
 0.48979592 0.51020408 0.53061224 0.55102041 0.57142857 0.59183673
 0.6122449  0.63265306 0.65306122 0.67346939 0.69387755 0.71428571
 0.73469388 0.75510204 0.7755102  0.79591837 0.81632653 0.83673469
 0.85714286 0.87755102 0.89795918 0.91836735 0.93877551 0.95918367
 0.97959184 1.        ]
  
Code #4 : Varying Positional Arguments
import matplotlib.pyplot as plt import numpy as np   x = np.linspace(0, 5, 100)      # Varying positional arguments y1 = bernoulli.ppf(x, a, b) y2 = bernoulli.pmf(x, a, b) plt.plot(x, y1, "*", x, y2, "r--") 
Output :
Python scipy-stats-functions
Python-scipy
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
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
Application for Internet speed test using pyspeedtest in Python - GeeksforGeeks

05 Sep, 2020
While troubleshooting with Internet speed. We need to first check internet bandwidth speed. So, pyspeedtest module test network bandwidth using Speedtest.net servers. So, before starting we need to install pyspeedtest into your system. Run these code to your command line
pip install pyspeedtest
Approach:
Import pyspeedtest
Create object for SpeedTest()
Check ping with ping()
Check Download speed with download()
Check Upload speed with upload()
Below is the implementation.
Python3
import pyspeedtest    test = pyspeedtest.SpeedTest("www.youtube.com")  test.ping()test.download()test.upload()
Output:
253.4427046775818
16461.88637373227
19425388.307319913

Speed Test Application with Tkinter: This Script implements the above Implementation into a GUI.
Python3
import pyspeedtestfrom tkinter import *    def Speed_test():    t = pyspeedtest.SpeedTest(e1.get())    myping.set(t.ping())    down.set(t.download())    master = Tk()myping = StringVar()down = StringVar()  Label(master, text="Website URL").grid(row=0, sticky=W)Label(master, text="Ping Result:").grid(row=3, sticky=W)Label(master, text="Download Result:").grid(row=4, sticky=W)  result = Label(master, text="", textvariable=myping,               ).grid(row=3, column=1, sticky=W)  result2 = Label(master, text="", textvariable=down,                ).grid(row=4, column=1, sticky=W)    e1 = Entry(master)e1.grid(row=0, column=1)b = Button(master, text="Cheak", command=Speed_test)b.grid(row=0, column=2, columnspan=2, rowspan=2, padx=5, pady=5)  mainloop()
Output:
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
*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
Why is a[i] == i[a] in C/C++ arrays? - GeeksforGeeks

01 Jul, 2017
The definition of [] subscript operator operator in C, according to (C99, 6.5.2.1p2), is that
 E1[E2] is identical to (*((E1)+(E2)))
Compilers use pointer arithmetic internally to access array elements. And because of the conversion rules that apply to the binary + operator, if E1 is an array object (equivalently, a pointer to the initial element of an array object) and E2 is an integer, E1[E2] designates the E2-th element of E1 (counting from zero).
Therefore, a[b] is defined as :
a[b] == *(a + b)

So will evaluate to
a[8] == *(a + 8)

Here, a is a pointer to the first element of the array and a[8] is the value of an elements which is 8 elements further from a, which is the same as *(a + 8) and 8[a] will evaluate to following which means both are same.
8[a] == *(8 + a)

So by addition commutative property, a[8] == 8[a]
Sample program showing above results :
// C program to illustrate// a[i] == i[a] in arrays #include <stdio.h>int main(){    int a[] = {1, 2, 3, 4, 5, 6, 7};    printf("a[5] is %d\n", a[5]);    printf("5[a] is %d\n", 5[a]);    return 0;}
Output:
a[5] is 6
5[a] is 6

This article is contributed by Mandeep Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
C Language
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
TCP Server-Client implementation in C
Exception Handling in C++
Multithreading in C
'this' pointer in C++
Arrow operator -> in C/C++ with Examples
Vector in C++ STL
Initialize a vector in C++ (6 different ways)
Inheritance in C++
Map in C++ Standard Template Library (STL)
C++ Classes and Objects
How to download File Using JavaScript/jQuery ? - GeeksforGeeks

03 Aug, 2021
Suppose you want to download a file when you click on a link. For downloading the file, we mentioned here to implementation as well as folder structure where you can see the file location.
Approach:
Create an anchor tag link on the normal HTML page. We want to download a file when we click on an anchor tag link(Download this file).
html
<!DOCTYPE html><html>  <head>    <title>        Download File Using         JavaScript/jQuery    </title></head>  <body>    <h1>        Download File Using         JavaScript/jQuery    </h1>      <a id="link" href="#">        Download this file    </a></body>  </html>
Provide with the below JavaScript Code:
$(document).ready(function () {
      $("#link").click(function (e) {
          e.preventDefault();
          window.location.href = "File/randomfile.docx";
      });
});

// Note: url= your file path

Note: Replace the above URL with your file path. Implementation and Folder structure is as shown below.
Example:
html
<!DOCTYPE html><html>  <head>    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">    </script></head>  <body>    <h1>        Download File Using         JavaScript/jQuery    </h1>          <h3>        For Downloading, Click         on the below link.    </h3>          <a id="link" href="no-script.html">        Download this file    </a>          <script>        $(document).ready(function () {            $("#link").click(function (e) {                e.preventDefault();                                  window.location.href                     = "File/randomfile.docx";            });        });    </script></body>  </html>
Output:
jQuery is an open source JavaScript library that simplifies the interactions between an HTML/CSS document, It is widely famous with it’s philosophy of “Write less, do more”.You can learn jQuery from the ground up by following this jQuery Tutorial and jQuery Examples.
JavaScript-Misc
jQuery-Misc
Picked
JavaScript
JQuery
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?
JQuery | Set the value of an input text field
Form validation using jQuery
How to change selected value of a drop-down list using jQuery?
How to fetch data from JSON file and display in HTML table using jQuery ?
How to Dynamically Add/Remove Table Rows using jQuery ?
rdiff-backup Command in Linux with Examples - GeeksforGeeks

05 Aug, 2021
rdiff-backup is a command in Linux that is used to backup files over server or local machine and even has a feature of incremental backup which means it only contains those files that have been modified or changed. Its source code is written in python and hence it needs a python interpreter to function. It comes packed with many features like incremental and mirror backup and even it allows you to backup files over a network through SSH 
To install it use the following commands as per your Linux distribution. 
In case of Debian/Ubuntu  
$sudo apt-get install librsync-dev rdiff-backup
In case of CentOS/RedHat  
$wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
$rpm -ivh epel-release-7-9.noarch.rpm
$yum install librsync rdiff-backup
In case of Fedora OS  
$yum install librsync rdiff-backup
1. To backup a folder.  
$rdiff-backup ./backup_folder ./backup_folder.backup 
This will create a backup file of the folder. 
2. To exclude a file from the backup folder.  
$rdiff-backup --exclude-filelist backup_folder/hii ./backup_folder/ backup_file.backup
This will exclude the specified file from the backup file. 
3. To exclude files of a type.  
$rdiff-backup --exclude '**ii' backup_folder/ backup_file.backup/
Here it will exclude all files with the suffix “ii”. 
4. To list the modifications or increments.  
$rdiff-backup -l backup_file.backup
This will list all the changes done so far in the backup file. 
5. To restore a file from its previous versions. 
$rdiff-backup backup_file.backup/rdiff-backup-data/increments/hii.2020-05-17T13\:52\:57+05\:30.diff.gz restore/hii  
This will restore the file when it was previously backed up 
6.To include specific type of files and exclude everything else.  
$rdiff-backup --include "**ii" --exclude '**' backup_folder/ backup_file.backup/ 
This will include only those files that have the suffix “ii”. 
surinderdawra388
linux-command
Linux-file-commands
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
scp command in Linux with Examples
Docker - COPY Instruction
mv command in Linux with examples
SED command in Linux | Set 2
chown command in Linux with Examples
nohup Command in Linux with Examples
Named Pipe or FIFO with example C program
Thread functions in C/C++
uniq Command in LINUX with examples
Start/Stop/Restart Services Using Systemctl in Linux