code-rag-bench/online-tutorials huggingface dataset:
Ruby | String concat Method

07 Jan, 2020
concat is a String class method in Ruby which is used to Concatenates two objects of String. If the given object is an Integer, then it is considered a codepoint and converted to a character before concatenation.
Syntax:String_Object.concat(String_Object)
Parameters: This method can take the string object and normal string as the parameters. If it will take integer then this method will convert them into the character.
Returns: This method returns the concatenated string as a result.
Example 1:
# Ruby program for concat method   # taking a string objectstr = "Geeks"   # using the methodstr.concat("ForGeeks")   # displaying the resultputs str
Output:
GeeksForGeeks

Example 2:
# Ruby program for concat method   # taking a string objectstr = "Geeks"   # using the method# but taking integer also inside the method# it will convert it to characterstr.concat("ForGeeks", 33)   # displaying the resultputs str
Output:
GeeksForGeeks!

Ruby String-class
Ruby-Methods
Ruby
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Make a Custom Array of Hashes in Ruby?
Global Variable in Ruby
Ruby | Enumerator each_with_index function
Ruby | Case Statement
Ruby | Array select() function
Ruby | Data Types
Ruby | unless Statement and unless Modifier
Ruby | Hash delete() function
Ruby For Beginners
Ruby | Array class find_index() operation
Python | math.fabs() function

11 Mar, 2019
In Python, math module contains a number of mathematical operations, which can be performed with ease using the module. math.fabs() function returns the absolute value of the number.
Syntax: math.fabs(x)

Parameter:
x: This is a numeric expression.

Returns: the absolute value of the number.
Code #1:
# Python code to demonstrate the working of fabs()    # importing "math" for mathematical operations import math     x = -33.7    # returning the fabs of 33.7print ("The fabs of 33.7 is : ", end ="") print (math.fabs(x))
The fabs of 33.7 is : 33.7

 Code #2:
# Python code to demonstrate the working of fabs()    # importing "math" for mathematical operations import math     # prints the fabs using fabs() method print ("math.fabs(-13.1) : ", math.fabs(-13.1))print ("math.fabs(101.96) : ", math.fabs(101.96))
math.fabs(-13.1) :  13.1
math.fabs(101.96) :  101.96

Python math-library-functions
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python - Tkinter Bitmaps

This attribute to displays a bitmap.  There are following type of bitmaps available −
"error"
"gray75"
"gray50"
"gray25"
"gray12"
"hourglass"
"info"
"questhead"
"question"
"warning"
from Tkinter import *
import Tkinter

top = Tkinter.Tk()

B1 = Tkinter.Button(top, text ="error", relief=RAISED,\
                         bitmap="error")
B2 = Tkinter.Button(top, text ="hourglass", relief=RAISED,\
                         bitmap="hourglass")
B3 = Tkinter.Button(top, text ="info", relief=RAISED,\
                         bitmap="info")
B4 = Tkinter.Button(top, text ="question", relief=RAISED,\
                         bitmap="question")
B5 = Tkinter.Button(top, text ="warning", relief=RAISED,\
                         bitmap="warning")
B1.pack()
B2.pack()
B3.pack()
B4.pack()
B5.pack()
top.mainloop()
When the above code is  executed, it produces the following result −
DataFrame.read_pickle() method in Pandas

16 Jul, 2020
Prerequisite : pd.to_pickle method()
The read_pickle() method is used to pickle (serialize) the given object into the file. This method uses the syntax as given below :
Syntax:
pd.read_pickle(path, compression='infer')

Parameters:
Below is the implementation of the above method with some examples :
Python3
# importing packages import pandas as pd   # dictionary of data dct = {'ID': {0: 23, 1: 43, 2: 12,             3: 13, 4: 67, 5: 89,             6: 90, 7: 56, 8: 34},     'Name': {0: 'Ram', 1: 'Deep',                 2: 'Yash', 3: 'Aman',                 4: 'Arjun', 5: 'Aditya',                 6: 'Divya', 7: 'Chalsea',                 8: 'Akash' },     'Marks': {0: 89, 1: 97, 2: 45, 3: 78,                 4: 56, 5: 76, 6: 100, 7: 87,                 8: 81},     'Grade': {0: 'B', 1: 'A', 2: 'F', 3: 'C',                 4: 'E', 5: 'C', 6: 'A', 7: 'B',                 8: 'B'}     }   # forming dataframe data = pd.DataFrame(dct)   # using to_pickle function to form file # with name 'pickle_file' pd.to_pickle(data,'./pickle_file.pkl')  # unpickled the data by using the# pd.read_pickle methodunpickled_data = pd.read_pickle("./pickle_file.pkl")print(unpickled_data)
Output :
Example 2:
Python3
# importing packages import pandas as pd   # dictionary of data dct = {"f1": range(6), "b1": range(6, 12)}   # forming dataframe data = pd.DataFrame(dct)   # using to_pickle function to form file # with name 'pickle_data' pd.to_pickle(data,'./pickle_data.pkl')  # unpickled the data by using the# pd.read_pickle methodunpickled_data = pd.read_pickle("./pickle_data.pkl")print(unpickled_data)
Output :
Python pandas-pickling
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Convert integer to string in Python
Introduction To PYTHON
Load Balancing on Servers (Randomized Algorithm)

15 Nov, 2015
Consider a high traffic website that receives millions of requests (of different types) per five minutes, the site has k (for example n = 1000) servers to process the requests. How should the load be balanced among servers?
The solutions that we generally think of area) Round Robinb) Assign new request to a server that has minimum load.
Both of the above approaches look good, but they require additional state information to be maintained for load balancing. Following is a simple approach that works better than above approaches.
Do following whenever a new request comes in, 
        Pick a random server and assign the request to a random server

The above approach is simpler, lightweight and surprisingly effective. This approach doesn’t calculate existing load on server and doesn’t need time management.
Analysis of above Random ApproachLet us analyze the average load on a server when above approach of randomly picking server is used.
Let there be k request (or jobs) J1, J2, ... Jk
Let there be n servers be S1, S2, ... Sk.
Let time taken by i’th job be Ti
Let Rij be load on server Si from Job Jj.
Rij is Tj if j’th job (or Jj) is assigned to Si, otherwise 0. Therefore, value of Rij is Tj with probability 1/n and value is 0 with probability (1-1/n)
Let Ri be load on i’th server
Average Load on i'th server 'Ex(Ri)' 
                            [Applying Linearity of Expectation]
                          =  
                          = 
                          = (Total Load)/n  
So average load on a server is total load divided by n which is a perfect result.
What is the possibility of deviation from average (A particular server gets too much load)?The average load from above random assignment approach looks good, but there may be possibility that a particular server becomes too loaded (even if the average is ok).It turns out that the probability of deviation from average is also very low (can be proved using Chernoff bound). Readers can refer below reference links for proves of deviations. For example, in MIT video lecture, it is shown that if there are 2500 requests per unit time and there are 10 servers, then the probability that any particular server gets 10% more load is at most 1/16000. Similar results are shown at the end of second reference also.
So above simple load balancing scheme works perfect. In-fact this scheme is used in load balancers.
References:http://www.cs.princeton.edu/courses/archive/fall09/cos521/Handouts/probabilityandcomputing.pdf
MIT Video Lecture
This article is contributed by Shivam. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Randomized
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Flutter – Ripple Effect

16 Oct, 2020
In Flutter, the InkWell widget is used to perform ripple animation when tapped.  This effect is common for all the app components that follow the material design guideline. A ripple animation in its simplest term can be understood as a black (default) bar at the bottom of an app that displays some data when a tap is done on the respective component of the application.
Let’s better understand these ripple effects using a simple application. To build such an app follow the below steps:
Create a simple widget that can be tapped.
Use the InkWell widget to add callback on the tap action.
Let’s discuss them in detail.
Let’s create a simple widget that has a button that can be tapped using the below code:
Dart
Scaffold.of(context).showSnackBar(SnackBar(      content: Text('Hello Geeks!'),    ));  },  child: Container(    padding: EdgeInsets.all(12.0),    child: Text(' Button'),  ),
Now wrap the widget that we just created above with the InkWell widget as shown below:
Dart
InkWell(  onTap: () {    Scaffold.of(context).showSnackBar(SnackBar(      content: Text('Hello Geeks!'),    ));  },  child: Container(    padding: EdgeInsets.all(12.0),    child: Text('Button'),  ),);
Now let’s build the complete app from the below-given source code.
Complete Source Code:
Dart
import 'package:flutter/material.dart';  void main() => runApp(MyApp());  class MyApp extends StatelessWidget {  @override  Widget build(BuildContext context) {    final title = 'GeeksForGeeks';      return MaterialApp(      title: title,      home: MyHomePage(title: title),    );  }}  class MyHomePage extends StatelessWidget {  final String title;    MyHomePage({Key key, this.title}) : super(key: key);    @override  Widget build(BuildContext context) {    return Scaffold(      appBar: AppBar(        title: Text(title),        backgroundColor: Colors.green,      ),      body: Center(child: MyButton()),    );  }}  class MyButton extends StatelessWidget {  @override  Widget build(BuildContext context) {    return InkWell(      onTap: () {        Scaffold.of(context).showSnackBar(SnackBar(          content: Text('Hello Geeks!'),        ));      },      child: Container(        padding: EdgeInsets.all(12.0),        color: Colors.green,        child: Text(' Button'),      ),    );  }}
Output:
android
Flutter
Flutter-widgets
Dart
Flutter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
PHP & MySQL - Connect Database Example

PHP provides mysqli contruct or mysqli_connect() function to open a database connection. This function takes six parameters and returns a MySQL link identifier on success or FALSE on failure.
$mysqli = new mysqli($host, $username, $passwd, $dbName, $port, $socket);

$host
Optional − The host name running the database server. If not specified, then the default value will be localhost:3306.
$username
Optional − The username accessing the database. If not specified, then the default will be the name of the user that owns the server process.
$passwd
Optional − The password of the user accessing the database. If not specified, then the default will be an empty password.
$dbName
Optional − database name on which query is to be performed.
$port
Optional − the port number to attempt to connect to the MySQL server..
$socket
Optional − socket or named pipe that should be used.
You can disconnect from the MySQL database anytime using another PHP function close().
$mysqli->close();

Try the following example to connect to a MySQL server −
Copy and paste the following example as mysql_example.php −
<html>
   <head>
      <title>Connecting MySQL Server</title>
   </head>
   <body>
      <?php
         $dbhost = 'localhost';
         $dbuser = 'root';
         $dbpass = 'root@123';
         $mysqli = new mysqli($dbhost, $dbuser, $dbpass);
         
         if($mysqli->connect_errno ) {
            printf("Connect failed: %s<br />", $mysqli->connect_error);
            exit();
         }
         printf('Connected successfully.<br />');
         $mysqli->close();
      ?>
   </body>
</html>
Access the mysql_example.php deployed on apache web server and verify the output.
Iterating over Arrays in Java

11 Dec, 2018
Iterating over an array means accessing each element of array one by one. There may be many ways of iterating over an array in Java, below are some simple ways.
Method 1: Using for loop:This is the simplest of all where we just have to use a for loop where a counter variable accesses each element one by one.
// Java program to iterate over an array// using for loopimport java.io.*;class GFG {      public static void main(String args[]) throws IOException    {        int ar[] = { 1, 2, 3, 4, 5, 6, 7, 8 };        int i, x;          // iterating over an array        for (i = 0; i < ar.length; i++) {              // accessing each element of array            x = ar[i];            System.out.print(x + " ");        }    }}
Output :
1 2 3 4 5 6 7 8 

Method 2: Using for each loop :For each loop optimizes the code, save typing and time.
// JAVA program to iterate over an array// using for loopimport java.io.*;class GFG {      public static void main(String args[]) throws IOException    {        int ar[] = { 1, 2, 3, 4, 5, 6, 7, 8 };        int x;          // iterating over an array        for (int i : ar) {              // accessing each element of array            x = i;            System.out.print(x + " ");        }    }}
Output :
1 2 3 4 5 6 7 8 

This article is contributed by Nikita Tiwari. 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.
Java-Array-Programs
Java-Arrays
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Interfaces in Java
Collections in Java
Stream In Java
Singleton Class in Java
Set in Java
Initializing a List in Java
Introduction to Java
Multithreading in Java
Constructors in Java
Exceptions in Java
Python program to remove K length words in String

24 Dec, 2021
Given a String, write a Python program to remove all the words with K length. 
Examples:
Input : test_str = ‘Gfg is best for all geeks’, K = 3 Output : is best geeks Explanation : Gfg, for and all are of length 3, hence removed.
Input : test_str = ‘Gfg is best for all geeks’, K = 2 Output : Gfg best for all geeks Explanation : is of length 2, hence removed. 
Method #1 : Using split() + join() + list comprehension + len()
In this each word is split using split(), and then lengths are checked using len(), and then are omitted matching K. At last words are joined.
Python3
# Python3 code to demonstrate working of# Remove K length words in String# Using split() + join() + list comprehension + len() # initializing stringtest_str = 'Gfg is best for all geeks' # printing original stringprint("The original string is : " + (test_str)) # initializing KK = 3 # getting splitstemp = test_str.split() # omitting K lengthsres = [ele for ele in temp if len(ele) != K] # joining resultres = ' '.join(res) # printing resultprint("Modified String : " + (res))
Output:
The original string is : Gfg is best for all geeks
Modified String : is best geeks
Method #2 : Using filter() + lambda + split() + len() + join()
In this, we perform task of filtering using filter() + lambda, rest all the functionalities are similar to above method.
Python3
# Python3 code to demonstrate working of# Remove K length words in String# Using filter() + lambda + split() + len() + join() # initializing stringtest_str = 'Gfg is best for all geeks' # printing original stringprint("The original string is : " + (test_str)) # initializing KK = 3 # getting splitstemp = test_str.split() # omitting K lengths# filtering using filter() and lambdares = list(filter(lambda ele: len(ele) != K, temp)) # joining resultres = ' '.join(res) # printing resultprint("Modified String : " + (res))
Output:
The original string is : Gfg is best for all geeks
Modified String : is best geeks
nnr223442
Python string-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Iterate over a list in Python
How to iterate through Excel rows in Python?
Enumerate() in Python
Rotate axis tick labels in Seaborn and Matplotlib
Python Dictionary
Python program to convert a list to string
Python program to add two numbers
Python | Get dictionary keys as a list
Python Program for Fibonacci numbers
Python Program for factorial of a number
How to declare variables in C#?

Each variable in C# has a specific type, which determines the size and layout of the variable's memory the range of values that can be stored within that memory and the set of operations that can be applied to the variable.
To declare variables −
<data_type> <variable_list>;
Let us see an example to declare two integer variables −
int a, b;
Above the variable is of int type. Let us declare a variable for other types −
Variable of float type.
float f;
Variable of double type.
double d;
Let us display a variable −
 Live Demo
using System;
using System.Collections;

class Demo {
   static void Main() {
      int x = 50;
      Console.WriteLine("Integer variable:"+x);
   }
}
Integer variable:50
How to delete registry Key using PowerShell?

To delete the registry key using PowerShell, we can use the Remove-Item command. Remove-Item command removes the registry key from the path specified. For example, we have the registry key name NodeSoftware stored at the path HKLM, under the Software key.
To delete the key we will use the below command.
Remove-Item -Path HKLM:\SOFTWARE\NodeSoftware -Force -Verbose
We can also use the Get-Item command to retrieve the Key name and then use the Remove-Item after pipeline.
Get-Item HKLM:\SOFTWARE\NodeSoftware | Remove-Item -Force -Verbose
AngularJS | ng-show Directive - GeeksforGeeks

28 Mar, 2019
The ng-show Directive in AngluarJS is used to show or hide the specified HTML element. If given expression in ng-show attribute is true then the HTML element will display otherwise it hide the HTML element. It is supported by all HTML elements.
Syntax:
<element ng-show="expression"> Contents... </element> 
Example 1: This example uses ng-show Directive to display the HTML element after checked the checkbox.
<!DOCTYPE html><html>  <head>    <title>ng-show Directive</title>          <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js">    </script></head>  <body>    <div ng-app="app" ng-controller="geek">                  <h1 style="color:green">GeeksforGeeks</h1>        <h2>ng-show Directive</h2>                  <input id="chshow" type="checkbox" ng-model="show" />                  <label for="chshow">            Show Paragraph        </label>                  <p ng-show="show" style="background: green; color: white;                 font-size: 14px; width:35%; padding: 10px;">            Show this paragraph using ng-show        </p>    </div>          <script>        var myapp = angular.module("app", []);        myapp.controller("geek", function ($scope) {            $scope.show = false;        });    </script></body>  </html>                    
Output:Before checked the checkbox:After checked the checkbox:
Example 2: This example uses ng-show Directive to display entered number is multiple of 5 or not.
<!DOCTYPE html><html>      <head>    <title>ng-show Directive</title>          <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js">    </script></head>  <body ng-app="app" style="text-align:center">    <div ng-controller="geek" ng-init="val=0">        <h1 style="color:green">GeeksforGeeks</h1>        <h2>ng-show Directive</h2>                  Enter a number:        <input type="text" ng-model="val" ng-keyup="check(val)">          <div ng-hide="show">            <h3>                The number is multiple of 5            </h3>        </div>                  <div ng-show="show">            <h3>                The number is not a multiple of 5            </h3>        </div>    </div>          <script>        var app = angular.module("app", []);        app.controller('geek', ['$scope', function ($scope) {            $scope.check = function (val) {                $scope.show = val % 5 == 0 ? false : true;            };        }]);    </script></body>  </html>                    
Output:
AngularJS-Directives
AngularJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Auth Guards in Angular 9/10/11
How to bundle an Angular app for production?
What is AOT and JIT Compiler in Angular ?
Angular PrimeNG Dropdown Component
How to set focus on input field automatically on page load in AngularJS ?
Top 10 Front End Developer Skills That You Need 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?
D3.js | d3.keys() Function - GeeksforGeeks

28 Jun, 2019
The d3.keys() function in D3.js is used to return an array containing the property names or keys of the specified object or an associative array.
Syntax:
d3.keys(object)
Parameters: This function accepts single parameter object containing key and value in pairs.
Return Value: It returns the keys of the given object.
Below programs illustrate the d3.keys() function in D3.js:
Example 1:
<!DOCTYPE html><html>  <head>    <title>        d3.keys() Function    </title>          <script src = "https://d3js.org/d3.v4.min.js"></script></head>  <body>    <script>              // Initialising an object        var month = {            "January": 1,            "February": 2,            "March": 3,            "April": 4        };                      // Calling the d3.keys() function        A = d3.keys(month);                // Getting the key values of the given object        document.write(A);    </script></body>  </html>                    
Output:
January, February, March, April

Example 2:
<!DOCTYPE html><html>  <head>    <title>        d3.keys() Function    </title>          <script src = "https://d3js.org/d3.v4.min.js"></script></head>  <body>    <script>              // Initialising an object        var month = {            "GeeksforGeeks": 0,            "Geeks": 2,            "Geek": 3,            "gfg": 4        };                      // Calling the d3.keys() function        A = d3.keys(month);                // Getting the key values of the given object        document.write(A);    </script></body>  </html>                    
Output:
GeeksforGeeks, Geeks, Geek, gfg

Reference: https://devdocs.io/d3~5/d3-collection#keys
D3.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
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 Open URL in New Tab using JavaScript ?
Difference Between PUT and PATCH Request
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
What is an identifier and its rules in C language?

Identifier is one of the tokens which are used in C programming language. It is a name which is used to identify the variables, constants, functions, arrays, and also user-defined data.
We cannot use keywords as identifiers because keywords are reserved for special use. Once declared, we can use the identifier in later program statements which refers to the associated value.
The special kind of identifier is known as a statement label and it can be used in goto statements.
The rules for naming identifiers are as follows −
Identifier names are unique.
Identifier names are unique.
Cannot use a keyword as identifiers.
Cannot use a keyword as identifiers.
Identifier has to begin with a letter or underscore (_).
Identifier has to begin with a letter or underscore (_).
It should not contain white space.
It should not contain white space.
Special characters are not allowed.
Special characters are not allowed.
Identifiers can consist of only letters, digits, or underscore.
Identifiers can consist of only letters, digits, or underscore.
Only 31 characters are significant.
Only 31 characters are significant.
They are case sensitive.
They are case sensitive.
Following is the C program to identify which terms are called as identifiers −
 Live Demo
/* C Program to Count Vowels and Consonants in a String */
#include <stdio.h>
int main(){
   char str[100];
   int i, vowels, consonants;
   i = vowels = consonants = 0;
   printf("\nEnter any String : ");
   gets(str);
   while (str[i] != '\0'){
      if(str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u'
      || str[i] == 'A' || str[i] == 'E' || str[i] == 'I' || str[i] == 'O' || str[i] == 'U'){
      vowels++;
   }
   else
      consonants++;
      i++;
   }
   printf("\n no of Vowels in the given String = %d", vowels);
   printf("\n no of Consonants in the given String = %d", consonants);
   return 0;
}
When the above program is executed, it produces the following result −
Enter any String : Tutorials Point
no of Vowels in the given String = 6
no of Consonants in the given String = 9
In the above program the identifiers are −
Str, i, vowels, consonants
cPanel - Cron Jobs

If you want to run a command or a php program on a specified time interval like once a day or once a week, you can setup cron jobs in this interface. Cron jobs allow you to run a specific command or program automatically. This is often required, if you are using a software like CRM or Billing Software. Setting up cron jobs more often may degrade your server’s performance.
To add a new cron job, follow these steps −
Step 1 − Open Cron Jobs by clicking Cron Jobs found in the Advanced section in cPanel.
Step 2 − Scroll down to see Add New Cron Job interface.
Step 3 − You can choose an existing setting from common settings. If you do that all the fields of cron execution time will automatically get filled. Or you can choose your custom runtime settings by specifying in the next text inputs accordingly.
Step 4 − Enter your command to run in cron job. If you are running a php file, enter full name of php file. For example −
php /home/tutorialspoint/public_html/cron.php

Step 5 − Click Add New Cron Job button to add a cron job.
cPanel by default sends an email each time a cron job runs. It also redirects the output of the command or file into the email. Default email for this is your system account, but you can change this email too. To change the email on which you want to receive cron email, firstly find out Cron Email interface in Cron Jobs. Then enter your new email in which you wish to get cron emails. Click Update email to update your email.
If your cron runs more frequently, then you may not want to receive emails, you can disable receiving emails by redirecting your output into null by writing >/dev/null 2>&1 at the end of the command. For example −
php /home/tutorialspoint/public_html/cron.php >/dev/null 2>&1

To edit or delete your existing cron jobs, you can scroll below on the Corn Jobs interface to see current cron jobs. Once you select the job, you can click either the delete link or the edit link to edit or delete a particular cron job.

    10 Lectures 
     47 mins

 Laurence Svekis
 Print
 Add Notes
 Bookmark this page
SQL Query to Delete Duplicate Rows - GeeksforGeeks

23 Sep, 2021
Through this article, we will learn how to delete duplicate rows from a database table. As we know that duplicity in our database tends to be a waste of memory space. It records inaccurate data and is also unable to fetch out the correct data from the database.
One or more rows that have identical or the same data value are considered to be Duplicate rows. 
Now, we have to follow the below steps to complete the task-
Step 1:  First we have to create a table having named “DETAILS”- 
Query:
CREATE TABLE DETAILS
( SN INT IDENTITY(1,1)
 EMPNAME VARCHAR(25),
 DEPT VARCHAR(20),
 CONTACTNO BIGINT NOT NULL,
 CITY VARCHAR(15)
 );
 
Step 2: Now, we have to insert values or data in the table.
INSERT INTO EMPDETAIL
 VALUES ('VISHAL','SALES',9193458625,'GAZIABAD'),
 ('VIPIN','MANAGER',7352158944,'BARIELLY'),
 ('ROHIT','IT',7830246946,'KANPUR'),
('RAHUL','MARKETING',9635688441,'MEERUT'),
('SANJAY','SALES',9149335694,'MORADABAD'),
('VIPIN','MANAGER',7352158944,'BARIELLY'),
('VISHAL','SALES',9193458625,'GAZIABAD'),
('AMAN','IT',78359941265,'RAMPUR');
Output: we have a view of the Table after inserting the values:
Step 3: In this step, we have to find how many rows are duplicated.
Query: 
SELECT EMPNAME,DEPT,CONTACTNO,CITY, COUNT(*) FROM EMPDETAIL
GROUP BY EMPNAME,DEPT,CONTACTNO,CITY
HAVING COUNT(*)>1
Output:
Step 4: You can also find out the unique row by using this row. 
SELECT EMPNAME,DEPT,CONTACTNO,CITY, COUNT(*) FROM DETAILS
GROUP BY EMPNAME,DEPT,CONTACTNO,CITY
Step 5: Finally we have to delete the duplicate row from the Database.
DELETE FROM DETAILS WHERE SN NOT IN (
SELECT MAX(SN) FROM DETAILS GROUP BY EMPNAME,DEPT,CONTACTNO,CITY)
Step 6: After deleting the duplicate row, then we have a view of the table: 
Output:
Picked
SQL-Query
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Update Multiple Columns in Single Update Statement in SQL?
How to Create a Table With Multiple Foreign Keys in SQL?
What is Temporary Table in SQL?
SQL Query to Convert VARCHAR to INT
SQL | Subquery
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL using Python
How to Select Data Between Two Dates and Times in SQL Server?
How to Write a SQL Query For a Specific Date Range and Date Time?
SQL Query to Compare Two Dates
GATE | Gate IT 2008 | Question 79 - GeeksforGeeks

28 Jun, 2021
Consider the code fragment written in C below :
void f (int n){   if (n <=1)  {   printf ("%d", n);  }  else {   f (n/2);   printf ("%d", n%2);  }}
What does f(173) print?
(A) 010110101(B) 010101101(C) 10110101(D) 10101101Answer: (D)Explanation: (173)2 = 10101101Quiz of this Question
Gate IT 2008
GATE-Gate IT 2008
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
GATE | GATE-IT-2004 | Question 83
GATE | GATE-CS-2014-(Set-3) | Question 38
GATE | GATE CS 2018 | Question 37
GATE | GATE-CS-2016 (Set 1) | Question 65
GATE | GATE-CS-2016 (Set 1) | Question 63
GATE | GATE-CS-2016 (Set 2) | Question 48
GATE | GATE-CS-2014-(Set-3) | Question 65
GATE | GATE-CS-2007 | Question 17
GATE | GATE CS 2019 | Question 37
GATE | GATE-CS-2014-(Set-3) | Question 65
Tryit Editor v3.7

Tryit: HTML strong text
How to remove all instances of a specific character from a column in MySQL?

Let us first create a table −
mysql> create table DemoTable
   -> (
   -> FirstName varchar(100)
   -> );
Query OK, 0 rows affected (0.41 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('Adam^^^');
Query OK, 1 row affected (0.14 sec)

mysql> insert into DemoTable values('^^^^^^^^Carol');
Query OK, 1 row affected (0.18 sec)

mysql> insert into DemoTable values('Robert^^^^^^');
Query OK, 1 row affected (0.14 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+---------------+
| FirstName     |
+---------------+
| Adam^^^       |
| ^^^^^^^^Carol |
| Robert^^^^^^  |
+---------------+
3 rows in set (0.00 sec)
Following is the query to remove all instances of a specific character from a column in MySQL. Here, we are removing all the instances of the special character ^ −
mysql> update DemoTable set FirstName=replace(FirstName,'^','');
Query OK, 3 rows affected (0.20 sec)
Rows matched: 3  Changed: 3 Warnings: 0
Let us check table records once again −
mysql> select *from DemoTable;
This will produce the following output −
+-----------+
| FirstName |
+-----------+
| Adam      |
| Carol     |
| Robert    |
+-----------+
3 rows in set (0.00 sec)
Count the Number of matching characters in a pair of Java string

In order to find the count of matching characters in two Java strings the approach is to first create character arrays of both the strings which make comparison simple.After this put each unique character into a Hash map.
Compare each character of other string with created hash map whether it is present or not in case if present than put that character into other hash map this is to prevent duplicates.In last get the size of this new created target hash map which is equal to the count of number of matching characters in two given strings.
 Live Demo
import java.util.HashMap;
public class MatchingCharacters {
   public static void main(String[] args) {
      String str1 = "abcccdef";
         String str2 = "dfgterf";
         char[] arr = str1.toCharArray();
         char[] arr2 = str2.toCharArray();
         HashMap<Character,Integer> hMap = new HashMap<>();
         HashMap<Character,Integer> hMap2 = new HashMap<>();
         for(int i = 0 ; i < arr.length ; i++) {
            if(!hMap.containsKey(arr[i])) {
            hMap.put(arr[i],1);
         }
      }
      for(int i = 0 ;i <arr2.length ;i++) {
         if(hMap.containsKey(arr2[i])) {
            hMap2.put(arr2[i],1);
         }
      }
      System.out.println("Number of matching characters in a pair of Java string is : " + hMap2.size());
   }
}
Number of matching characters in a pair of Java string is : 3
Draw Multiple Rectangles in Image using Python-Opencv

17 Oct, 2021
In this article, we are going to see how to draw multiple rectangles in an image using Python and OpenCV. 
imread(): In the OpenCV, the cv2.imread() function is used to read an image in Python.
Syntax: cv2.imread(path_of_image, flag)
rectangle(): In the OpenCV, the cv2.rectangle function is used to draw a rectangle on the image in Python.
Syntax: cv2.rectangle(image, starting_coordinate, ending_coordinate, color, thickness)
imshow(): In the OpenCV, the cv2.imshow() function is used to display an image in Python.
Syntax: cv2.imshow(window_name, image)
waitKey(): In the OpenCV, the cv2.waitkey() function allows you to wait for a specific time in milliseconds.
destroyAllWindows(): In the OpenCV, the destroyAllWindows() function is used to closes all the windows created using the OpenCV methods.
Python3
# importing OpenCV(cv2) moduleimport cv2  # Read RGB imageimg = cv2.imread("D:\Naveen\gfg.PNG")  # Draw rectangles# Red rectanglecv2.rectangle(img, (100, 560), (700, 480),              (0, 0, 255), 3)  # Blue rectanglecv2.rectangle(img, (650, 450), (420, 240),              (255, 0, 0), 5)  # Green rectanglecv2.rectangle(img, (150, 450), (380, 240),              (0, 255, 0), 4)  # Output img with window name as 'image'cv2.imshow('image', img)  # Maintain output window utill# user presses a keycv2.waitKey(0)  # Destroying present windows on screencv2.destroyAllWindows()
Output:
Picked
Python-OpenCV
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Check if element exists in list in Python
Python | os.path.join() method
How To Convert Python Dictionary To JSON?
Python | Get unique values from a list
Defaultdict in Python
Stream mapToInt() in Java with examples

06 Dec, 2018
Stream mapToInt(ToIntFunction mapper) returns an IntStream consisting of the results of applying the given function to the elements of this stream.
Stream mapToInt(ToIntFunction mapper) is an intermediate operation. These operations are always lazy. Intermediate operations are invoked on a Stream instance and after they finish their processing, they give a Stream instance as output.
Syntax :
IntStream mapToInt(ToIntFunction<? super T> mapper)

Where, IntStream is a sequence of primitive 
int-valued elements and T is the type 
of stream elements. mapper is a stateless function 
which is applied to each element and the function
returns the new stream.

Example 1 : mapToInt() with operation of printing the stream element if divisible by 3.
// Java code for Stream mapToInt// (ToIntFunction mapper) to get a// IntStream by applying the given function// to the elements of this stream.import java.util.*;  class GFG {      // Driver code    public static void main(String[] args)    {          // Creating a list of Strings        List<String> list = Arrays.asList("3", "6", "8",                                             "14", "15");          // Using Stream mapToInt(ToIntFunction mapper)        // and displaying the corresponding IntStream        list.stream().mapToInt(num -> Integer.parseInt(num))                     .filter(num -> num % 3 == 0)                     .forEach(System.out::println);    }}
Output :
3
6
15

Example 2 : mapToInt() to return IntStream after performing operation of mapping string with its length.
// Java code for Stream mapToInt// (ToIntFunction mapper) to get a// IntStream by applying the given function// to the elements of this stream.import java.util.*;  class GFG {      // Driver code    public static void main(String[] args)    {          // Creating a list of Strings        List<String> list = Arrays.asList("Geeks", "for", "gfg",                                          "GeeksforGeeks", "GeeksQuiz");          // Using Stream mapToInt(ToIntFunction mapper)        // and displaying the corresponding IntStream        // which contains length of each element in        // given Stream        list.stream().mapToInt(str -> str.length()).forEach(System.out::println);    }}
Output :
5
3
3
13
9

Java - util package
Java-Functions
java-stream
Java-Stream interface
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Object Oriented Programming (OOPs) Concept in Java
How to iterate any Map in Java
Interfaces in Java
HashMap in Java with Examples
ArrayList in Java
Collections in Java
Multidimensional Arrays in Java
Singleton Class in Java
Set in Java
Stack Class in Java
Python program to determine if the given IP Address is Public or Private using ipaddress module

10 Jul, 2020
Given a Classful IP Address the task is to find whether it is Public or Private.
Private IP address of a system is the IP address which is used to communicate within the same network. Using private IP data or information can be sent or received within the same network.
Public IP address of a system is the IP address which is used to communicate outside the network. Public IP address is basically assigned by the ISP (Internet Service Provider).
Examples:
Input : 17.5.7.8
Output : Public

Input : 172.16.0.10
Output : Private

To implement it, we will use is_private method of ipaddress module of Python 3.3 .
# importing ip_address from # ip address modulefrom ipaddress import ip_address   def IPAddress(IP: str) -> str:    return "Private" if (ip_address(IP).is_private) else "Public"     if __name__ == '__main__' :        # Public IP    print(IPAddress('17.5.7.8'))        # Private IP    print(IPAddress('172.16.0.10'))
Output :
Public
Private
python-utility
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python Program for Fibonacci numbers
Python | Convert string dictionary to dictionary
bzip2 - Unix, Linux Command

bzip2 - To compress or decompress named file(s).
bzip2 [ -cdfkqstvzVL123456789 ] [ filenames ... ]
Compared with gzip, bzip2 creates smaller archives but has a slower decompression time and higher memory use. bzip2 compresses files using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. The command-line options provided are deliberately very similar to those of GNU gzip, but they are not identical. bzip2 expects a list of file names along with the command-line flags. Each file is replaced by a compressed version of itself, with the name original_name.bz2. Each compressed file has the same modification date, permissions, and, when possible, ownership as the corresponding original, so that these properties can be correctly restored at decompression time.
File name handling is naive in the sense that there is no mechanism for preserving original file names, permissions, ownerships or dates in filesystems which lack these concepts, or have serious file name length restrictions, such as MS-DOS. bzip2 and bunzip2 by default will not overwrite existing files. To overwrite, specify the -f flag. 
To compress the file sample.txt and replace it with a compressed version named sample.txt.bz2
$ bzip2 sample.txt
$ ls
sample.txt.bz2

To compress the file sample.txt, keep the uncompressed version and create the new file.
$ bzip2 -k sample.txt
$ ls
sample.txt sample.txt.bz2

To combine a set of mp3 music files into one file with tar and then zip the result with bzip2.
$ tar -cf music.tar 1.mp3 2.mp3 3.mp3
$ bzip2 music.tar
$ ls
1.mp3 2.mp3 3.mp3 music.tar.bz2

To combine a set of mp3 music files into one file with tar and then zip the result with bzip2 in single command.
$ tar -cjf music.tar.bz2 miles.mp3 chet.mp3 charlie.mp3
$ ls
music.tar.bz2 miles.mp3 chet.mp3 charlie.mp3
How to apply CSS style using jQuery ?

20 Sep, 2021
In this article, we will explore how we can apply CSS styles to HTML elements. It is recommended that you have some basic knowledge of HTML, CSS, JavaScript, and jQuery before beginning this article.
It is possible to change the CSS property of an element by using a simple JavaScript API, but we try to complete this challenge using jQuery css() method.  
Syntax:
$().css(propertyname, value);
$().css(properties);
There are many types of CSS methods, which means that each method has the same name but takes different parameters. We will discuss only two methods, one of which is used to change a single CSS property, while the other is used to change multiple CSS properties simultaneously. With the second method, you can pass a JSON string object as a parameter that you want to apply to the HTML element. 
JSON string objects contain CSS properties along with their values, and the first method only takes 2 parameters, namely the property name and the value.
Example: By clicking the button, it adds multiple CSS properties to the selected element, but by double-clicking the button, it adds only one CSS property. The motive of this example is to show the use of two types of CSS methods which are discussed. 
HTML
<!DOCTYPE html><html>  <head>    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js">    </script></head>  <body style="text-align: center;     border: 2px solid green;    min-height: 240px;">    <h1 style="color:green;">        GeeksforGeeks    </h1>      <p id="context">        Hello Geeks!! welcome to geeksforgeeks    </p>      <br>      <button id="change">        clickme    </button>      <script>        let css_property =        {            "color": "green",            "font-size": "20px"        }        $('#change').on('click', function () {              // For multiple css property            $('#context').css(css_property);        });          $('#change').on('dblclick', function () {                          // For single css property            $('#context').css('display', 'none');        })    </script></body>  </html>
Output:
output
Blogathon-2021
jQuery-Methods
jQuery-Questions
Picked
Blogathon
HTML
JQuery
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Import JSON Data into SQL Server?
SQL Query to Convert Datetime to Date
Python program to convert XML to Dictionary
Scrape LinkedIn Using Selenium And Beautiful Soup in Python
How to toggle password visibility in forms using Bootstrap-icons ?
How to update Node.js and NPM to next version ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
REST API (Introduction)
Hide or show elements in HTML using display property
math.modf() function in Lua programming

There are several occurrences when we want to get the integer value of a number and also the fractional value that the number has if any, so that we can use either or both of these values.
Lua provides us with a math.modf() function that we can use to find the integer value along with the fractional value if the number has any.
math.modf(number)
The math.modf() function returns two values when we call the function, the first value is the integer value of the number and the second returned value is the fractional value of the number if it has any.
Let’s consider a simple example where we will make use of the math.modf() function in Lua −
 Live Demo
a, b = math.modf(3.3)
c, d = math.modf(7.1)
print(a, b)
print(c, d)
3    0.3
7    0.1
It should be noted that if we try to find modf of a number which is already the closest integer to itself then we will get the same number as the output.
Consider the example shown below −
 Live Demo
e, f = math.modf(8)
print(e, f)
8     0.0
We can also pass negative numbers in the math.modf() function as an argument.
Consider the example shown below −
 Live Demo
g, h = math.modf(-3.3)
print(g, h)
-3    -0.3
Reason of runtime error in C/C++

08 Feb, 2021
In this article, we will discuss the reason for the run-time error and its solution.
Runtime Error: A runtime error in a program is an error that occurs while the program is running after being successfully compiled. Below are some methods to identify the reason behind Runtime error:
Method 1: When the index of the array is assigned with a negative index it leads to invalid memory access during runtime error. Below is the C++ Program to illustrate the invalid memory access during run-time:
C++
// C++ program to illustrate invalid// memory access during run-time#include <iostream>using namespace std;  // Global declarationint arr[5];  // Driver Codeint main(){    int answer = arr[-10];    cout << answer;      return 0;}
1736487104

Method 2: Sometimes Array or vector runs out of bound of their limits resulting in a runtime error. Below is the C++ program illustrating array runs out of bound:
C++
// C++ program to illustrate// array runs out of bound#include <iostream>using namespace std;  // Driver Codeint main(){    long n;    n = 100000000000;      // 'n' is out of bound for    // the array limit    long a[n];      cout << a[1] << " ";    return 0;}
Output:
Explanation:
This is an error for index out of bound.
It can be resolved by using the size of the array/vector as within the limit.
Method 3: Some silly mistakes encountered while coding in hurry, sometimes leads to runtime error. Below is the C++ program illustrating runtime error by un-assigned variables:
C++
// C++ program to illustrate runtime// error by un-assigned variables#include <iostream>using namespace std;  // Driver Codeint main(){    long long N;      // N is assigned garbage value    long arr[N];      cin >> N;      for (int i = 0; i < N; i++) {        cin >> arr[i];    }      for (int i = 0; i < N; i++) {        cout << arr[i] << " ";    }      return 0;}
Output:
Explanation:
The above program shows “Bad memory access (SIGBUS)” because:
Here, variable N is assigned a garbage value resulting in a runtime error.
Sometimes, since it depends on the compiler how it assigned the garbage value.
This can be resolved by declaring arr[N] after scanning the value for variable n and checking if it is the upper or lower limit of the array/vector index.
CPP-Basics
C++
C++ Programs
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.