code-rag-bench/online-tutorials huggingface dataset:
Type of 'this' Pointer in C++ - GeeksforGeeks

06 Jan, 2022
this pointer refers to the current object of the class and passes it as a parameter to another method. In C++, this pointer is passed as a hidden argument to all non-static member function calls. 
Type of ‘this’ pointer: The type of this depends upon function declaration. The type of this pointer is either const ExampleClass * or ExampleClass *. It depends on whether it lies inside a const or a non-const method of the class ExampleClass.
1) If the member function of class X is declared const, the type of this is const X* as shown below,
CPP
// CPP Program to demonstrate// if the member function of a// class X is declared const#include <iostream>using namespace std;  class X {    void fun() const    {        // this is passed as hidden argument to fun().        // Type of this is const X* const    }};
2) If the member function is declared volatile, the type of this is volatile X* as shown below,
CPP
// CPP Program to demonstrate// if the member function is// declared volatile#include <iostream>using namespace std;  class X {    void fun() volatile    {        // this is passed as hidden argument to fun().        // Type of this is volatile X* const    }};
3) If the member function is declared const volatile, the type of this is const volatile X* as shown below,
CPP
// CPP program to demonstrate// if the member function is// declared const volatile#include <iostream>using namespace std;  class X {    void fun() const volatile    {        // this is passed as hidden argument to fun().        // Type of this is const volatile X* const    }};
Please note that const, volatile, and const volatile are type qualifiers.
Note: ‘this’ pointer is not an lvalue.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
anshikajain26
C++-this pointer
cpp-pointer
pointer
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Inheritance in C++
C++ Classes and Objects
Socket Programming in C/C++
Operator Overloading in C++
Multidimensional Arrays in C / C++
Virtual Function in C++
Constructors in C++
Object Oriented Programming in C++
Copy Constructor in C++
Templates in C++ with Examples
Equals(String, String) Method in C#

The Equals() method in C# is used to check whether two String objects have the same value or not.
bool string.Equals(string s1, string s2)
Above, s1 and s2 are the strings to be compared.
 Live Demo
using System;
public class Demo {
   public static void Main(string[] args) {
      string s1 = "Kevin";
      string s2 = "Tom";
      string s3 = s2;
      Console.WriteLine("String1 = "+s1);
      Console.WriteLine("String2 = "+s2);
      Console.WriteLine("Are both the strings equal? = "+s1.Equals(s2));
      Console.WriteLine("Are both the strings equal? = "+s2.Equals(s3));
   }
}
String1 = Kevin
String2 = Tom
Are both the strings equal? = False
Are both the strings equal? = True
 Live Demo
using System;
public class Demo {
   public static void Main(string[] args) {
      string s1 = "David";
      string s2 = "David";
      string s3 = s2;
      string s4 = "Tom";
      string s5 = s4;
      Console.WriteLine("String1 = "+s1);
      Console.WriteLine("String2 = "+s2);
      Console.WriteLine("String3 = "+s3);
      Console.WriteLine("String4 = "+s4);
      Console.WriteLine("String5 = "+s5);
      Console.WriteLine("Is s1 and s2 equal? = "+s1.Equals(s2));
      Console.WriteLine("Is s2 and s3 equal? = "+s2.Equals(s3));
      Console.WriteLine("Is s3 and s4 equal? = "+s3.Equals(s4));
      Console.WriteLine("Is s4 and s5 equal? = "+s4.Equals(s5));
   }
}
String1 = David
String2 = David
String3 = David
String4 = Tom
String5 = Tom
Is s1 and s2 equal? = True
Is s2 and s3 equal? = True
Is s3 and s4 equal? = False
Is s4 and s5 equal? = True
Binary Operators Overloading in C++

The binary operators take two arguments and following are the examples of Binary operators. You use binary operators very frequently like addition (+) operator, subtraction (-) operator and division (/) operator.
Following example explains how addition (+) operator can be overloaded. Similar way, you can overload subtraction (-) and division (/) operators.
#include <iostream>
using namespace std;
 
class Box {
   double length;      // Length of a box
   double breadth;     // Breadth of a box
   double height;      // Height of a box
   
   public:
 
   double getVolume(void) {
      return length * breadth * height;
   }
   
   void setLength( double len ) {
      length = len;
   }
 
   void setBreadth( double bre ) {
      breadth = bre;
   }
 
   void setHeight( double hei ) {
      height = hei;
   }
   
   // Overload + operator to add two Box objects.
   Box operator+(const Box& b) {
      Box box;
      box.length = this->length + b.length;
      box.breadth = this->breadth + b.breadth;
      box.height = this->height + b.height;
      return box;
   }
};

// Main function for the program
int main() {
   Box Box1;                // Declare Box1 of type Box
   Box Box2;                // Declare Box2 of type Box
   Box Box3;                // Declare Box3 of type Box
   double volume = 0.0;     // Store the volume of a box here
 
   // box 1 specification
   Box1.setLength(6.0); 
   Box1.setBreadth(7.0); 
   Box1.setHeight(5.0);
 
   // box 2 specification
   Box2.setLength(12.0); 
   Box2.setBreadth(13.0); 
   Box2.setHeight(10.0);
 
   // volume of box 1
   volume = Box1.getVolume();
   cout << "Volume of Box1 : " << volume <<endl;
 
   // volume of box 2
   volume = Box2.getVolume();
   cout << "Volume of Box2 : " << volume <<endl;
 
   // Add two object as follows:
   Box3 = Box1 + Box2;
 
   // volume of box 3
   volume = Box3.getVolume();
   cout << "Volume of Box3 : " << volume <<endl;
 
   return 0;
}
When the above code is compiled and executed, it produces the following result −
Volume of Box1 : 210
Volume of Box2 : 1560
Volume of Box3 : 5400


    154 Lectures 
     11.5 hours 

 Arnab Chakraborty

    14 Lectures 
     57 mins

 Kaushik Roy Chowdhury

    30 Lectures 
     12.5 hours 

 Frahaan Hussain

    54 Lectures 
     3.5 hours 

 Frahaan Hussain

    77 Lectures 
     5.5 hours 

 Frahaan Hussain

    12 Lectures 
     3.5 hours 

 Frahaan Hussain
 Print
 Add Notes
 Bookmark this page
Perl | int() function - GeeksforGeeks

25 Jun, 2019
int() function in Perl returns the integer part of given value. It returns $_ if no value provided. Note that $_ is default input which is 0 in this case. The int() function does not do rounding. For rounding up a value to an integer, sprintf is used.
Syntax: int(VAR)
Parameters:VAR: value which is to be converted into integer
Returns: Returns the integer part of VAR
Example 1:
#!/usr/bin/perl  # Passing positive decimal value$int_val = int(19.8547);print"Integer value is $int_val\n";  # Passing negative decimal value$int_val = int(-18.659);print"Integer value is $int_val\n";
Output:
Integer value is 19
Integer value is -18

Example 2:
#!/usr/bin/perl  # Passing fractional positive value$int_val = int(17 / 4);print"Integer value is $int_val\n";  # Passing fractional negative value$int_val = int(-17 / 4);print"Integer value is $int_val\n";
Output:
Integer value is 4
Integer value is -4
Perl-function
Perl-Math-Functions
Perl
Perl
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Perl | Arrays (push, pop, shift, unshift)
Perl | Arrays
Perl Tutorial - Learn Perl With Examples
Use of print() and say() in Perl
Perl | join() Function
Perl | length() Function
Perl | Basic Syntax of a Perl Program
Perl | Boolean Values
Perl | sleep() Function
Perl | Subroutines or Functions
Why are Python Strings Immutable? - GeeksforGeeks

26 Dec, 2020
An unchanging article alludes to the item which is once made can’t change its worth all its lifetime.  Attempt to execute the accompanying code: 
Python3
name_1 = "Aarun"   name_1[0] = 'T' 
You will get a mistake message when you need to change the substance of the string. 
Traceback (latest call last):  
Record "/home/ca508dc8fa5ad71190ca982b0e3493a8.py", line 2, in <module>  
name_1[0] = 'T'  
TypeError: 'str' object doesn't uphold thing task  
Arrangement  
One potential arrangement is to make another string object with vital alterations: 
Python3
name_1 = "Aarun"  name_2 = "T" + name_1[1:]  print("name_1 = ", name_1, "and name_2 = ", name_2)
Output:
name_1 =  Aarun and name_2 =  Tarun
To watch that they are various strings, check with the id() work: 
Python3
name_1 = "Aarun"name_2 = "T" + name_1[1:]  print("id of name_1 = ", id(name_1))print("id of name_2 = ", id(name_2))
Output:
id of name_1 =  2342565667256
id of name_2 =  2342565669888
To see more about the idea of string permanence, think about the accompanying code: 
Python3
name_1 = "Aarun"name_2 = "Aarun"  print("id of name_1 = ", id(name_1))print("id of name_2 = ", id(name_2))
At the point when the above lines of code are executed, you will find that the id’s of both name_1 and name_2 objects, which allude to the string “Aarun”, are the equivalent.  
To burrow further, execute the accompanying assertions: 
Python3
name_1 = "Aarun"print("id of name_1 = ", id(name_1))  name_1 = "Tarun"print("id of name_1  with new value = ", id(name_1))
Output:
id of name_1 =  2342565667256
id of name_1  with new value =  2342565668656
As can be found in the above model, when a string reference is reinitialized with another worth, it is making another article instead of overwriting the past worth.  
Note: In Python, strings are made changeless so software engineers can’t adjust the substance of the item. This keeps away from superfluous bugs.
Picked
python-string
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | Get unique values from a list
Python | os.path.join() method
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
JavaScript TypeError - Can't define property "X": "Obj" is not extensible - GeeksforGeeks

29 Jul, 2020
This JavaScript exception can’t define property “x”: “obj” is not extensible occurs when Object.preventExtensions() used on an object to make it no longer extensible, So now, New properties can not be added to the object.
Message:
TypeError: Cannot create property for a non-extensible object (Edge)
TypeError: can't define property "x": "obj" is not extensible (Firefox)
TypeError: Cannot define property: "x", object is not extensible. (Chrome)

Error Type:
TypeError

Cause of Error: After the Object.preventExtensions() method applied on an object, New properties are added to the object, Which is not permissible. 
Example 1: In this example, the new property is being added after the Object.preventExtensions() method applied, So the error has occurred.
HTML
<script>    'use strict';      var GFG_Obj = {'name': 'GFG'};    Object.preventExtensions(GFG_Obj);      GFG_Obj.age = 22; // error here</script>
Output(in console):
TypeError: Cannot create property for a non-extensible object

Example 2: In this example, the new property is being added using defineProperty() method after the Object.preventExtensions() method applied, So the error has occurred.
HTML
<script>    'use strict';      var GFG_Obj = {'name': 'GFG'};    Object.preventExtensions(GFG_Obj);      // error here    Object.defineProperty(GFG_Obj,       'person', { dob: "02/11/1997" }    );</script>
Output(in console):
TypeError: Cannot define property 'person': object is not extensible

JavaScript-Errors
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
JavaScript | Promises
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Difference between var, let and const keywords in JavaScript
C++ Map Library - find() Function

The C++ function std::map::find() finds an element associated with key k.
If operation succeeds then methods returns iterator pointing to the element otherwise it returns an iterator pointing the map::end().
Following is the declaration for std::map::find() function form std::map header.
iterator find (const key_type& k);
const_iterator find (const key_type& k) const;

k − Key to be searched.
If object is constant qualified then method returns a constant iterator otherwise non-constant iterator.
This member function doesn't throw any exception.
Logarithmic i.e. O(log n)
The following example shows the usage of std::map::find() function.
#include <iostream>
#include <map>

using namespace std;

int main(void) {
   map<char, int> m = {
            {'a', 1},
            {'b', 2},
            {'c', 3},
            {'d', 4},
            {'e', 5},
            };

   auto it = m.find('c');

   cout << "Iterator points to " << it->first << 
      " = " << it->second << endl;

   return 0;
}
Let us compile and run the above program, this will produce the following result −
Iterator points to c = 3

 Print
 Add Notes
 Bookmark this page
How to check if input is numeric in C++?

Here we will see how to check whether a given input is numeric string or a normal string. The numeric string will hold all characters that are in range 0 – 9. The solution is very simple, we will simply go through each characters one by one, and check whether it is numeric or not. If it is numeric, then point to the next, otherwise return false value.
#include <iostream>
using namespace std;
bool isNumeric(string str) {
   for (int i = 0; i < str.length(); i++)
      if (isdigit(str[i]) == false)
         return false; //when one non numeric value is found, return false
      return true;
}
int main() {
   string str;
   cout << "Enter a string: ";
   cin >> str;
   if (isNumeric(str))
      cout << "This is a Number" << endl;
   else
      cout << "This is not a number";
}
Enter a string: 5687
This is a Number
Enter a string: 584asS
This is not a number
Find letter's position in Alphabet using Bit operation in C++

In this problem, we are given a string str consisting of english alphabets. Our task is to find the letter's position in the Alphabet using the Bit operation. 
Problem Description: Here, we will return the position of each character of the string as it is in english alphabets.
The characters of the string are case-insensitive i.e. “t” and “T” are treated the same.
Let’s take an example to understand the problem, 
Input: str = “Tutorialspoint”
Output: 20 21 20 15 18 9 1 12 19 16 15 9 14 20 
A simple solution to find a character's position is by finding its logical AND operation with 31.
Live Demo
#include <iostream>
using namespace std;

void findLetterPosition(string str, int n) {
   
   for (int i = 0; i < n; i++) {
      cout<<(str[i] & 31) << " ";
   }
}

int main() {
   
   string str = "TutorialsPoint";
   int n = str.length();
   cout<<"The letters position in string "<<str<<" is \n";
   findLetterPosition(str, n);

   return 0;
}
The letters position in string TutorialsPoint is
20 21 20 15 18 9 1 12 19 16 15 9 14 20
How to Scrape Youtube Comments with Python | by François St-Amant | Towards Data Science

The first part of any Natural Language Processing project is to get a database. Indeed, having the whole dataset cleaned and labeled only applies on Kaggle, not in real life.
When it comes to sentiment analysis projects, I feel like Youtube comments represent a great and underused source of data. You easily have access to the opinion of all viewers on a very specific subject, i.e. the video.
Knowing all this, here is how to scrape the comments from a Youtube video, step by step.
Here is the video from which I will be scraping the comments: https://www.youtube.com/watch?v=kuhhT_cBtFU&t=2s
It’s a video posted by CNN showing the arrest and shooting of Rayshard Brooks in Atlanta that took place on June 12th.
So first, don’t forget to install a ChromeDriver from right here. You should also have Google Chrome installed. Now that this is done, let’s import the libraries we will need:
import timefrom selenium.webdriver import Chromefrom selenium.webdriver.common.by import Byfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as EC
Selenium is needed here because Youtube is JavaScript rendered, which BeautifulSoup cannot deal with.
All the other modules are needed because Youtube comments are dynamically loaded, which means that they are only visible when you scroll down the page. So we want a loop that will:
Scroll down
Wait for comments to appear
Scrape the comments
Repeat for whatever range we want.
Here is the loop that does just that.
So here is how it works:
Access the URL you want with the driver.get function.Scroll down and wait until everything is visible with wait.until and EC.visibility_of_element_located.Scrape the comments by finding all the #content-text elements (which is what we want, as you can see below) in the current viewed page.
Access the URL you want with the driver.get function.
Scroll down and wait until everything is visible with wait.until and EC.visibility_of_element_located.
Scrape the comments by finding all the #content-text elements (which is what we want, as you can see below) in the current viewed page.
4. Append the comments to the data list.
To scrape comments from another video, all you need to do is change the URL! It’s that easy.
Here, I repeat the loop 200 times, which scrapes about 1,400 comments. Here is what the data looks like:
import pandas as pd   df = pd.DataFrame(data, columns=['comment'])df.head()
There you have it. Now, you would be able to use that data to start your NLP project.
Thanks for reading, I hope this helped!
To become a member: https://francoisstamant.medium.com/membership
How to convert UTC date time into local date time using JavaScript ?

14 Apr, 2022
Given an UTC date and the task is to convert UTC date time into local date-time using JavaScript toLocaleString() function.
Syntax:
var theDate = new Date(Date.parse('06/14/2020 4:41:48 PM UTC'))
theDate.toLocaleString()
JavaScript code: 
javascript
// Function to convert UTC date-time// to Local date-timefunction myFunction() {    var theDate = new Date(Date.parse(            '06/14/2020 4:41:48 PM UTC'));     document.write("Local date Time: ",            theDate.toLocaleString());}
Example: This example converting UTC date time into local date time using JavaScript. 
html
<!DOCTYPE html><html> <head>    <title>        How to convert UTC date time        into local date time?    </title>     <style>        h1 {            color: green;        }         body {            text-align: center;        }    </style></head> <body>    <h1>GeekforGeeks</h1>     <p>        Click the button to convert        UTC date and time to local        date and time    </p>     <p>        UTC date and time:        06/14/2020 4:41:48 PM    </p>     <button onclick="myGeeks()">        Try it    </button>     <p id="demo"></p>     <script>        function myGeeks() {            var theDate = new Date(Date.parse(                '06/14/2020 4:41:48 PM UTC'));             document.getElementById("demo")                .innerHTML = "Local date Time: "                + theDate.toLocaleString();        }    </script></body> </html>
Output:
Before Clicking the Button: 
After Clicking the Button: 
sweetyty
javascript-date
Picked
CSS
HTML
JavaScript
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
usermod command in Linux with Examples

16 Feb, 2022
usermod command or modify user is a command in Linux that is used to change the properties of a user in Linux through the command line. After creating a user we have to sometimes change their attributes like password or login directory etc. so in order to do that we use the Usermod command. The information of a user is stored in the following files: 
 
/etc/passwd
/etc/group
/etc/shadow
/etc/login.defs
/etc/gshadow
/etc/login.defs
When we execute usermod command in terminal the command make the changes in these files itself. 
Note: usermod command needs to be executed only as a root user. 
 
1. To add a comment for a user 
 
sudo usermod -c "This is test user" test_user
 
This will add a comment about the user or a short description related to the user. 
2. To change the home directory of a user 
 
sudo usermod -d /home/manav test_user
 
This will change the home directory of the user to /home/manav. 
3. To change the expiry date of a user 
 
sudo usermod -e 2020-05-29 test_user
 
This will change the expiration date of account “test_user” 
4. To change the group of a user 
 
sudo usermod -g manav test_user
 
This command will now change the group of test user from test_user to manav 
5. To change user login name 
 
sudo usermod -l test_account test_user
 
This will now change the login name of the user “test_user”. 
6. To lock a user 
 
sudo usermod -L test_user
 
This will lock the “test_user” account and will display a! sign in shadow file before the username 
7. To unlock a user 
 
sudo usermod -U test_user
 
This will unlock the “test_user” which was locked by the previous command 
8. To set an unencrypted password for the user 
 
sudo usermod -p test_password test_user
 
This will set the password “test_password” in the unencrypted form for the user “test_user” 
9. To create a shell for the user 
 
sudo usermod -s /bin/sh test_user
 
This command will now create a shell for the user “test_user” from /bin/sh 
10. To change the user id of a user 
 
sudo usermod -u 1234 test_user
 
This command will change the user id of “test_user” to 1234 
gulshankumarar231
sumitgumber28
linux-command
Linux-system-commands
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
tar command in Linux with examples
'crontab' in Linux with Examples
Conditional Statements | Shell Script
Tail command in Linux with examples
Docker - COPY Instruction
UDP Server-Client implementation in C
scp command in Linux with Examples
echo command in Linux with Examples
Cat command in Linux with examples
touch command in Linux with Examples
D3.js scaleLinear() method

19 Aug, 2020
The d3.scaleLinear() method is used to create a visual scale point. This method is used to transform data values into visual variables.
Syntax:
d3.scaleLinear();
Parameters: This method takes no parameters.
Return Value: This method returns a Linear scale function.
Example 1: Plotting scale points.
<!DOCTYPE html><html><meta charset="utf-8"><head>  <title>Line in D3.js</title></head><script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.2/d3.min.js"></script>  <body>    <h1 style="text-align: center;               color: green;">       GeeksforGeeks    </h1>  <center>    <svg width="700" height="40">    <g class="scal" transform="translate(40, 30)">    </g>  </svg></center>  <script>var points = [ 0, 2, 4, 6, 7.72, 9.11, 9.99 ];  var ScaleGener = d3.scaleLinear()  .domain([0, 10])  .range([0, 600]);    d3.select('svg .scal')    .selectAll('circle')    .data(points)    .enter()    .append('circle')    .attr('r', 3)    .attr('fill', "green")    .attr('cx', function(d) {        return ScaleGener(d);    });</script></body></html>
Output:
Example 2: Setting text for each point.
<!DOCTYPE html><html><meta charset="utf-8"><head>  <title>Line in D3.js</title></head><script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.2/d3.min.js"></script>  <body>    <h1 style="text-align: center;                color: green;">      GeeksforGeeks    </h1>  <center>    <svg width="700" height="40">    <g class="scal" transform="translate(40, 30)">    </g>  </svg></center>  <script>var points = [ 0, 2, 4, 6, 7.72, 9.11, 9.99 ];  var ScaleGener = d3.scaleLinear()  .domain([0, 10])  .range([0, 600]);    d3.select('svg .scal')    .selectAll('circle')    .data(points)    .enter()    .append('circle')    .attr('r', 3)    .attr('fill', "green")    .attr('cx', function(d) {        return ScaleGener(d);    });  d3.select('svg .scal')    .selectAll('text')    .data(points)    .enter()    .append('text')    .attr('x', function(d) {        return ScaleGener(d);    })    .attr('y', -10)    .text(function(d) {        return d;    });  </script></body></html>
Output:
D3.js
HTML
JavaScript
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
Types of CSS (Cascading Style Sheet)
How to position a div at the bottom of its container using CSS?
How to Upload Image into Database and Display it using PHP ?
How to Insert Form Data into Database using PHP ?
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
File uploading in React.js
How to calculate the number of days between two dates in javascript?
Node.js | fs.writeFileSync() Method
How to skip blank and null values in MySQL?

To skip blank and null in MySQL, use the following syntax:
select *from yourTableName where yourColumnName IS NOT NULL AND yourColumnName <> '';
Let us first create a table:
mysql> create table DemoTable (Id int, FirstName varchar(20));
Query OK, 0 rows affected (0.66 sec)
Following is the query to insert records in the table using insert command:
mysql> insert into DemoTable values(100,'Larry');
Query OK, 1 row affected (0.14 sec)
mysql> insert into DemoTable values(101,'');
Query OK, 1 row affected (0.16 sec)
mysql> insert into DemoTable values(102,'Chris');
Query OK, 1 row affected (0.16 sec)
mysql> insert into DemoTable values(103,null);
Query OK, 1 row affected (0.11 sec)
mysql> insert into DemoTable values(104,' ');
Query OK, 1 row affected (0.10 sec)
mysql> insert into DemoTable values(105,'Robert');
Query OK, 1 row affected (0.16 sec)
mysql> insert into DemoTable values(106,null);
Query OK, 1 row affected (0.13 sec)
Following is the query to display records from the table using select command:
mysql> select *from DemoTable;
This will produce the following output with blank values and NULL:
+------+-----------+
| Id   | FirstName |
+------+-----------+
| 100  | Larry     |
| 101  |           |
| 102  | Chris     |
| 103  | NULL      |
| 104  |           |
| 105  | Robert    |
| 106  | NULL      |
+------+-----------+
7 rows in set (0.00 sec)
Following is the query to skip blank values as well as null in MySQL:
mysql> select *from DemoTable where FirstName IS NOT NULL AND FirstName <> '';
This will produce the following output
+------+-----------+
| Id   | FirstName |
+------+-----------+
| 100  | Larry     |
| 102  | Chris     |
| 105  | Robert    |
+------+-----------+
3 rows in set (0.03 sec)
How to make bootstrap button transparent ?

22 Apr, 2020
Buttons can be made transparent in Bootstrap by using the built-in class property:
Syntax:
<button class="btn bg-transparent">
    Transparent button
</button>
Description:
The <button> tag is used to specify the button element in HTML, which gets executed on pressed.
Generally, the properties of bootstrap must be mentioned in class. Example: class=” “
Inside the class=” ”btn – On mentioning the btn property, specifies that its a bootstrap button.bg – Specifies the background color of the button.transparent – Makes the button transparent.
How to use it:Make sure, you have included the bootstrap code (Starter Template) in your code.
Example:
<!doctype html><html lang="en">  <head>    <!-- Required meta tags -->    <meta charset="utf-8">    <meta name="viewport"           content="width=device-width,                    initial-scale=1,                    shrink-to-fit=no">      <!-- Bootstrap CSS -->    <link rel="stylesheet"           href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"          integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"           crossorigin="anonymous">      <title>Hello, world!</title></head>  <body>      <button class="btn bg-transparent">          Transparent button    </button>      <!-- Optional JavaScript -->    <!-- jQuery first, then Popper.js, then Bootstrap JS -->    <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"            integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n"             crossorigin="anonymous"></script>    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"            integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"             crossorigin="anonymous"></script>    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"             integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"             crossorigin="anonymous"></script></body>  </html>
Output:Before Pressing:After pressing:
The documentation of Bootstrap is well-structured and easy to understand.Reference: Official Documentation
Bootstrap-Misc
Picked
Bootstrap
HTML
Web Technologies
Web technologies Questions
Write From Home
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Schedule a Python Script on PythonAnywhere

23 Jan, 2020
Keeping the computer on 24/7 is not practical, so if you want to execute a Python script at a particular time every day, you probably need a computer that is ON all the time. To make this possible, a website PythonAnywhere gives you access to such a 24/7 computer. You can upload a Python script and schedule it to run at a certain time every day. This availability can be useful, for example, when you want to extract some values (e.g., weather data) from a website and generate a text file with the value or other reports every day.
To schedule, a Python script for execution on PythonAnywhere, follow these simple steps:
Sign up on here the account for Beginners is free with some T&C.
Go to your Dashboard, Files, Upload a File and upload the Python file you want to schedule for execution.
Go to Tasks and set the time of the day you want your script to be executed and type in the name of the Python file you uploaded (e.g., myfirstpyscript.py).Note: The time entered should be in UTC.
Click “create” and you are done.
The Python file will now be executed every day at your specified time.
Example: Below is a very simple Python script you can use to schedule for execution.
from datetime import datetime    # Saves a .txt file with file name# as 2020-01-11-10-20-23.txtwith open(datetime.now().strftime("%Y-%m-%d-%H-%M-%S"), "w")as myfile:          # Content of the file    myfile.write("Hello World !")
The above code creates a text file and writes the string “Hello World!” in that text file. The name of the text file will be the current date and time. For example one file name example would be 2020-01-11-10-20-23.txt.
That name is generated by datetime.now() indicating the date and time the script was executed. Every time the script is executed, the script generates a new text file with a different name. You will have a new text file created every day.
Python-Miscellaneous
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Center any element in Bootstrap

Use the .center-block class in Bootstrap to center an element.
You can try to run the following code to implement the .center-block 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>Heading One</h1>
         <div class = "center-block" style = "background-color:green;color: white; width:200px;">Text will be in center.</div>
      </div>
   </body>
</html>
Is it possible to resume java execution after exception occurs?

An exception is an issue (run time error) occurred during the execution of a program. When an exception occurred the program gets terminated abruptly and, the code past the line that generated the exception never gets executed.
There are two types of exceptions in Java.
Unchecked Exception − An unchecked exception is the one which occurs at the time of execution. These are also called as Runtime Exceptions. These include programming bugs, such as logic errors or improper use of an API. Runtime exceptions are ignored at the time of compilation.
Checked Exception − A checked exception is an exception that occurs at the time of compilation, these are also called as compile time exceptions. These exceptions cannot simply be ignored at the time of compilation; the programmer should take care of (handle) these exceptions.
When a checked/compile time exception occurs you can resume the program by handling it using try-catch blocks. Using these you can display your own message or display the exception message after execution of the complete program.
import java.io.File;
import java.io.FileInputStream;
public class Test {
   public static void main(String args[]){
      System.out.println("Hello");
      try{
         File file =new File("my_file");
         FileInputStream fis = new FileInputStream(file);
      }catch(Exception e){
         System.out.println("Given file path is not found");
      }
   }
}
Given file path is not found
When a run time exception occurs You can handle runtime exceptions and avoid abnormal termination but, there is no specific fix for runtime exceptions in Java, depending on the exception, type you need to change the code.
public class ExceptionExample {
   public static void main(String[] args) {
      //Creating an integer array with size 5
      int inpuArray[] = new int[5];
      //Populating the array
      inpuArray[0] = 41;
      inpuArray[1] = 98;
      inpuArray[2] = 43;
      inpuArray[3] = 26;
      inpuArray[4] = 79;
      //Accessing index greater than the size of the array
      System.out.println( inpuArray[3]);
   }
}
26
SQLSERVER Tryit Editor v1.0

SELECT CustomerName, ASCII(CustomerName) AS NumCodeOfFirstChar
FROM Customers;
​
        
Edit the SQL Statement, and click "Run SQL" to see the result.
This SQL-Statement is not supported in the WebSQL Database.
The example still works, because it uses a modified version of SQL.
Your browser does not support WebSQL.
Your are now using a light-version of the Try-SQL Editor, with a read-only Database.
If you switch to a browser with WebSQL support, you can try any SQL statement, and play with the Database as much as you like. The Database can also be restored at any time.
Our Try-SQL Editor uses WebSQL to demonstrate SQL.
A Database-object is created in your browser, for testing purposes.
You can try any SQL statement, and play with the Database as much as you like. The Database can be restored at any time, simply by clicking the "Restore Database" button.
WebSQL stores a Database locally, on the user's computer. Each user gets their own Database object.
WebSQL is supported in Chrome, Safari, and Opera.
If you use another browser you will still be able to use our Try SQL Editor, but a different version, using a server-based ASP application, with a read-only Access Database, where users are not allowed to make any changes to the data.
How do you split a list into evenly sized chunks in Python?

The easiest way to split list into equal sized chunks is to use a slice operator successively and shifting initial and final position by a fixed number.
In following example, a list with 12 elements is present. We split it into 3 lists each of length 4
l=[10,20,30,40,50,60,70,80,90,100,110,120]
x=0
y=12
for i in range(x,y,4):
x=i
print (l[x:x+4])


[10, 20, 30, 40]
[50, 60, 70, 80]
[90, 100, 110, 120]
Auto Grow a Textarea with JavaScript in CSS

Using JavaScript, we can set our Textarea element to automatically grow with its content
The following examples illustrate how we can achieve the above scenario.
 Live Demo
<!DOCTYPE html>
<html>
<head>
<style>
* {
   margin: 3%;
   color: navy;
   font-size: 1.2em;
}
#ta {
   padding: 2%;
   resize: none;
   width: 330px;
   min-height: 80px;
   overflow: hidden;
   box-sizing: border-box;
}
</style>
</head>
<body>
<form>
<label for="ta">Cool TextArea</label>
<textarea id="ta"></textarea>
</form>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$("#ta").on('input', function() {
   var scroll_height = $("#ta").get(0).scrollHeight;
   $("#ta").css('height', scroll_height + 'px');
});
</script>
</body>
</html>
This will produce the following result −
 Live Demo
<!DOCTYPE html>
<html>
<head>
<style>
div {
   margin: 3%;
   overflow-y: scroll;
}
#ta {
   padding: 2%;
   resize: none;
   width: 333px;
   min-height: 90px;
   overflow: hidden;
   box-sizing: border-box;
   font-size: 1.5em;
}
</style>
</head>
<body>
<div>
<textarea id="ta"></textarea>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$("#ta").on('input', function() {
   var scroll_height = $("#ta").get(0).scrollHeight;
   $("#ta").css('height', scroll_height + 'px');
});
</script>
</body>
</html>
This will produce the following result −
Neo4j - Substring Function

It takes a string as an input and two indexes: one is the start of the index and another is the end of the index and returns a substring from Start Index to End Index-1. All CQL Functions should use "( )" brackets.
Following is the syntax of the function SUBSTRING() in Neo4j.
LOWER (<input-string>) 

Following is a sample Cypher query which demonstrates the usage of the function SUBSTRING() in Neo4j. Here, we are trying get the substring of the names of all the players.
MATCH (n:player)  
RETURN SUBSTRING(n.name,0,5), n.YOB, n.POB
To execute the above query, carry out the following steps −
Step 1 − Open the Neo4j desktop App and start the Neo4j Server. Open the built-in browser app of Neo4j using the URL http://localhost:7474/ as shown in the following screenshot.
Step 2 − Copy and paste the desired query in the dollar prompt and press the play button (to execute the query) highlighted in the following screenshot.
On executing, you will get the following result.
 Print
 Add Notes
 Bookmark this page
A static initialization block in Java

Instance variables are initialized using initialization blocks. However, the static initialization blocks can only initialize the static instance variables. These blocks are only executed once when the class is loaded. There can be multiple static initialization blocks in a class that is called in the order they appear in the program.
A program that demonstrates a static initialization block in Java is given as follows:
 Live Demo
public class Demo {
   static int[] numArray = new int[10];
   static {
      System.out.println("Running static initialization block.");
      for (int i = 0; i < numArray.length; i++) {
         numArray[i] = (int) (100.0 * Math.random());
      }
   }
   void printArray() {
      System.out.println("The initialized values are:");
      for (int i = 0; i < numArray.length; i++) {
         System.out.print(numArray[i] + " ");
      }
      System.out.println();
   }
   public static void main(String[] args) {
      Demo obj1 = new Demo();
      System.out.println("For obj1:");
      obj1.printArray();
      Demo obj2 = new Demo();
      System.out.println("\nFor obj2:");
      obj2.printArray();
   }
}
Running static initialization block.
For obj1:
The initialized values are:
40 75 88 51 44 50 34 79 22 21

For obj2:
The initialized values are:
40 75 88 51 44 50 34 79 22 21
PyQt5 – How to add Separator in Status Bar ? - GeeksforGeeks

22 Apr, 2020
In this article we will see how to add separator in status bar. separator are basically just vertical lines which are used to distinguish items.
Below is the difference between the statusbar with separator and without separator.
The main concept is that we will add a widget between two labels which will be a vertical line which will act as a separator.
Code :
from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * import sys  # creating VLine classclass VLine(QFrame):      # a simple Vertical line    def __init__(self):          super(VLine, self).__init__()        self.setFrameShape(self.VLine|self.Sunken)    class Window(QMainWindow):    def __init__(self):        super().__init__()          # set the title        self.setWindowTitle("Python")          # setting  the geometry of window        self.setGeometry(60, 60, 600, 400)          # setting status bar message        self.statusBar().showMessage("This is status bar")          # setting  border and padding with different sizes        self.statusBar().setStyleSheet("border :3px solid black;")          # creating a label widget        self.label_1 = QLabel("Label 1")          # setting up the border        self.label_1.setStyleSheet("border :2px solid blue;")          # creating a label widget        self.label_2 = QLabel("Label 2")          # setting up the border        self.label_2.setStyleSheet("border :2px solid blue;")          # adding label to status bar        self.statusBar().addPermanentWidget(self.label_1)          # adding VLine object        self.statusBar().addPermanentWidget(VLine())          # adding label        self.statusBar().addPermanentWidget(self.label_2)        # show all the widgets        self.show()    # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()    # start the appsys.exit(App.exec())
Output :
Python-gui
Python-PyQt
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python Dictionary
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python String | replace()
Python program to convert a list to string
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
set find() function in C++ STL - GeeksforGeeks

24 Dec, 2021
The set::find is a built-in function in C++ STL which returns an iterator to the element which is searched in the set container. If the element is not found,  then the iterator points to the position just after the last element in the set.
Syntax:   
 
set_name.find(element) 
Parameters: The function accepts one mandatory parameter element which specifies the element to be searched in the set container. Return Value: The function returns an iterator which points to the element which is searched in the set container. If the element is not found, then the iterator points to the position just after the last element in the set.Below program illustrates the above function.  
CPP
// CPP program to demonstrate the// set::find() function#include <bits/stdc++.h>using namespace std;int main(){     // Initialize set    set<int> s;     s.insert(1);    s.insert(4);    s.insert(2);    s.insert(5);    s.insert(3);     // iterator pointing to    // position where 3 is    auto pos = s.find(3);     // prints the set elements    cout << "The set elements after 3 are: ";    for (auto it = pos; it != s.end(); it++)        cout << *it << " ";     return 0;}
The set elements after 3 are: 3 4 5
 
Time Complexity: The time complexity of set_name.find( key ) is O( log N ). As the elements are stored in a sorted manner by default.
vpsh98
adarshlondhe19
sushanthgupta
devhati83
CPP-Functions
cpp-set
STL
C++
STL
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Inheritance in C++
C++ Classes and Objects
Virtual Function in C++
Bitwise Operators in C/C++
Constructors in C++
Operator Overloading in C++
Templates in C++ with Examples
Socket Programming in C/C++
Polymorphism in C++
Object Oriented Programming in C++
CSS | * Selector - GeeksforGeeks

10 Jul, 2021
The * selector in CSS is used to select all the elements in a HTML document. It also selects all elements which are inside under another element. It is also called universal selector.
Syntax: 
* {
    // CSS property
} 
Example 1: 
HTML
<!DOCTYPE html><html>    <head>        <title>* Selector</title>                 <!-- CSS property of * selector -->        <style>            * {                color:green;                text-align:center;            }        </style>    </head>         <body>        <h1>GeeksforGeeks</h1>        <h2>*(Universal) Selector</h2>        <div>             <p>GFG</p>               <p>Geeks</p>          </div>         <p>It is a computer science portal for geeks.</p>     </body></html>                                     
Output: 
Example 2: 
HTML
<!DOCTYPE html><html>    <head>        <title>* selector</title>                 <!-- CSS property for * selector -->        <style>            * {                background: green;                font-weight:bold;                margin-left:70px;                color:white;            }        </style>    </head>         <body>        <h1>GeeksforGeeks</h1>        <h2>*(Universal) Selector</h2>                 <ul>            <li>Data Structure</li>            <li>Computer Network</li>            <li>Operating System</li>        </ul>                 <ol>            <li>Java</li>            <li>Ruby</li>            <li>Pascal</li>        </ol>             </body></html>                                 
Output: 
Supported Browsers: The browser supported by *(universal) selector are listed below: 
Apple Safari 3.1
Google Chrome 4.0
Firefox 3.0
Opera 9.6
Internet Explorer 7.0
 
saurabh1990aror
CSS-Selectors
Picked
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to create footer to stay at the bottom of a Web page?
How to update Node.js and NPM to next version ?
Types of CSS (Cascading Style Sheet)
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Find position of a Matched Pattern in a String in R Programming – grep() Function - GeeksforGeeks

12 Apr, 2021
grep() function in R Language is used to search for matches of a pattern within each element of the given string. 
Syntax: grep(pattern, x, ignore.case=TRUE/FALSE, value=TRUE/FALSE)Parameters: pattern: Specified pattern which is going to be matched with given elements of the string. x: Specified string vector. ignore.case: If its value is TRUE, it ignores case. value: If its value is TRUE, it return the matching elements vector, else return the indices vector.  
Example 1:  
Python3
# R program to illustrate# grep function # Creating string vectorx <- c("GFG", "gfg", "Geeks", "GEEKS") # Calling grep() functiongrep("gfg", x)grep("Geeks", x)grep("gfg", x, ignore.case = FALSE)grep("Geeks", x, ignore.case = TRUE)
Output :  
[1] 2
[1] 3
[1] 2
[1] 3 4
Example 2:  
Python3
# R program to illustrate# grep function # Creating string vectorx <- c("GFG", "gfg", "Geeks", "GEEKS") # Calling grep() functiongrep("gfg", x, ignore.case = TRUE, value = TRUE)grep("G", x, ignore.case = TRUE, value = TRUE)grep("Geeks", x, ignore.case = FALSE, value = FALSE)grep("GEEKS", x, ignore.case = FALSE, value = FALSE)          
Output:  
[1] "GFG" "gfg"
[1] "GFG"   "gfg"   "Geeks" "GEEKS"
[1] 3
[1] 4
 
arorakashish0911
R String-Functions
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 ?