code-rag-bench/online-tutorials huggingface dataset:
GATE | GATE CS 2020 | Question 42

01 Oct, 2021
Consider the following languages.
L1 = { wxyx ∣ w,x,y ∈ (0+1)+ }
L2 = { xy ∣ x,y ∈ (a+b)*, ∣x∣=∣y∣, x≠y } 
Which one of the following is TRUE ?(A) L1 is regular and L2 is context- free(B) L1 context- free but not regular and L2 is context-free(C) Neither L1 nor L2 is context- free(D) L1 context- free but L2 is not context-freeAnswer: (A)Explanation:
L1 = { wxyx ∣ w,x,y ∈ (0+1)+ } 
In L1 putting x as 0 and 1 we get a subset,
L1 = w0y 0 + w1y1 
L1 = (0 + 1)+0(0 + 1)+0 + (0 + 1)+1(0 + 1)+1 
So, L1 is regular language.
L2 = { xy ∣ x,y ∈ (a+b)*, ∣x∣=∣y∣, x≠y } is CFL
We observe that a string is in L2 if and only if it can be written as xy with |x| = |y| such that for some i, the ith character of x is different from the ith character of y. To obtain such a string, we start generating the corresponding ith characters, and fill up the remaining characters.
Based on the above idea, we define the CFG for C is as follows:
S → AB | BA
A → XAX | 0
B → XBX | 1
X → 0 | 1 
Option (A) is correct.
GATE PYQ's on Grammars with Praddyumn Shukla | GeeksforGeeks GATE - YouTubeGeeksforGeeks GATE Computer Science17.4K subscribersGATE PYQ's on Grammars with Praddyumn Shukla | GeeksforGeeks GATEWatch laterShareCopy linkInfoShoppingTap to unmuteIf playback doesn't begin shortly, try restarting your device.You're signed outVideos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer.CancelConfirmMore videosMore videosSwitch cameraShareInclude playlistAn error occurred while retrieving sharing information. Please try again later.Watch on0:000:0026:03 / 1:02:45•Live•<div class="player-unavailable"><h1 class="message">An error occurred.</h1><div class="submessage"><a href="https://www.youtube.com/watch?v=zAzS1PzU0NQ" target="_blank">Try watching this video on www.youtube.com</a>, or enable JavaScript if it is disabled in your browser.</div></div>Quiz of this Question
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | GATE-CS-2014-(Set-2) | Question 65
GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 33
GATE | GATE-CS-2014-(Set-3) | Question 20
GATE | GATE-CS-2015 (Set 3) | Question 65
GATE | GATE-CS-2014-(Set-3) | Question 65
GATE | GATE CS 1996 | Question 63
GATE | Gate IT 2005 | Question 52
GATE | GATE CS 2012 | Question 18
GATE | GATE-CS-2001 | Question 50
GATE | GATE CS 2008 | Question 40
String toString() Method in java with Examples

11 Jul, 2018
String toString() is the built-in method of java.lang which return itself a string. So here no actual conversion is performed. Since toString() method simply returns the current string without any changes, there is no need to call the string explicitly, it is usually called implicitly.Syntax :
public String toString()
Parameter: The method does not accept any parameters .Return Value: This method returns the string itself.
Examples :
Input: String("geeksforgeeks")
Output: geeksforgeeks

Below programs illustrate the Java.lang.String.toString() method:Program 1:
// Java program to illustrate the// Java.lang.String.toString() methodimport java.io.*;public class Geeks {      public static void main(String args[])    {        String Strobj = new String("Welcome to the world of geeks.");        System.out.print("Output String Value :");        System.out.println(Strobj.toString());          String Strobj2 = new String("Let's make it simple for you.");        System.out.print("Output String Value :");        System.out.println(Strobj2.toString());    }}
Output String Value :Welcome to the world of geeks.
Output String Value :Let's make it simple for you.

Program 2:
// Java program to illustrate the// Java.lang.String.toString() methodimport java.io.*;public class Geeks {      public static void main(String args[])    {        String Strobj = new String("THank You");        System.out.print("Output : ");        System.out.println(Strobj.toString());    }}
Output : THank You

Java-Strings
Java
Java-Strings
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
HashMap in Java with Examples
ArrayList in Java
Multidimensional Arrays in Java
Collections in Java
Stream In Java
Set in Java
Singleton Class in Java
Initializing a List in Java
JavaScript | Math.exp() function

24 Jan, 2022
The Math.exp() is an inbuilt function in JavaScript that is used to get the value of ep, where p is any given number. The number e is a mathematical constant having an approximate value equal to 2.718.
It was discovered by the Swiss mathematician Jacob Bernoulli.
This number is also called Euler’s number.
Syntax:  
Math.exp(p)
Parameter: This function accepts a single parameter p as any number.Return Value: It returns the value of ep, where p is any given number as a parameter. 
Example:  
Input  : Math.exp(0)
Output : 1
Explanation: Here the value of parameter p is 0, So after putting the value 0 instead of p in ep then its value becomes 1.  
Input  : Math.exp(2)
Output : 7.38905609893065
Explanation: Here the value of parameter p is 2, So after putting the value 2 instead of p in ep then its value becomes 7.38905609893065.
Let’s see JavaScript program: 
Example 1:
Javascript
<script>  // Here different values is being taken as  // as parameter of Math.exp() function.  document.write(Math.exp(0) + "<br>");  document.write(Math.exp(1) + "<br>");  document.write(Math.exp(2) + "<br>");  document.write(Math.exp(-1) + "<br>");  document.write(Math.exp(-7) + "<br>");  document.write(Math.exp(10) + "<br>");  document.write(Math.exp(1.2));</script>
Output: 
1
2.718281828459045
7.38905609893065
0.36787944117144233
0.0009118819655545162
22026.465794806718
3.3201169227365472
Example 2: Here parameter should be a number otherwise it give an error or NaN i.e, not a number.
Javascript
<script>  // Here alphabet parameter give error.  document.write(Math.exp(a));</script>
Output: 
Error: a is not defined
Javascript
<script>  // Here parameter as a string give NaN.  document.write(Math.exp("gfg"));</script>
Output:
NaN
Supported Browsers: The browsers supported by JavaScript Math.E() function are listed below:  
Google Chrome 1 and above
Internet Explorer 3 and above
Edge 12 and above
Firefox 1 and above
Opera 3 and above
Safari 1 and above
 
Akanksha_Rai
rs1686740
toloc42
ysachin2314
javascript-math
JavaScript
Mathematical
Mathematical
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Mongoose | estimatedDocumentCount() Function - GeeksforGeeks

20 May, 2020
The estimatedDocumentCount() function is quick as it estimates the number of documents in the MongoDB collection. It is used for large collections because this function uses collection metadata rather than scanning the entire collection.
Installation of mongoose module:
You can visit the link to Install mongoose module. You can install this package by using this command.npm install mongooseAfter installing mongoose module, you can check your mongoose version in command prompt using the command.npm version mongooseAfter that, you can just create a folder and add a file, for example index.js. To run this file you need to run the following command.node index.js
You can visit the link to Install mongoose module. You can install this package by using this command.npm install mongoose
npm install mongoose
After installing mongoose module, you can check your mongoose version in command prompt using the command.npm version mongoose
npm version mongoose
After that, you can just create a folder and add a file, for example index.js. To run this file you need to run the following command.node index.js
node index.js
Filename: index.js
const mongoose = require('mongoose');  // Database Connectionmongoose.connect('mongodb://127.0.0.1:27017/geeksforgeeks', {    useNewUrlParser: true,    useCreateIndex: true,    useUnifiedTopology: true});  // User modelconst User = mongoose.model('User', {    name: { type: String },    age: { type: Number }});  User.estimatedDocumentCount(function (err, count) {    if (err){        console.log(err)    }else{        console.log("Estimated Count :", count)    }});
Steps to run the program:
The project structure will look like this:Make sure you have installed mongoose module using following command:npm install mongooseBelow is the sample data in the database before the function is executed, You can use any GUI tool or terminal to see the database, like we have used Robo3T GUI tool as shown below:Run index.js file using below command:node index.js
The project structure will look like this:
Make sure you have installed mongoose module using following command:npm install mongoose
npm install mongoose
Below is the sample data in the database before the function is executed, You can use any GUI tool or terminal to see the database, like we have used Robo3T GUI tool as shown below:
Run index.js file using below command:node index.js
node index.js
So this is how you can use the mongoose estimatedDocumentCount() function which estimates the number of documents in the MongoDB collection.
Mongoose
MongoDB
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to connect MongoDB with ReactJS ?
MongoDB - limit() Method
MongoDB - FindOne() Method
Create user and add role in MongoDB
MongoDB - sort() Method
How to update Node.js and NPM to next version ?
Installation of Node.js on Linux
How to connect Node.js with React.js ?
Node.js fs.renameSync() Method
Node.js fs.readFileSync() Method
C# Program to Reverse the List of Cities using LINQ - GeeksforGeeks

09 Dec, 2021
Given a list of city names, we need to reverse the list of cities and this can be done using the reverse() method in LINQ. The Reverse() method reverses the sequence of the elements in the specified list. it is available in both Queryable and Enumerable classes. It will return an ArgumentNullException if the given source is null.
Syntax:
public static void Reverse ();
Example:
Input  : ["mumbai", "pune", "bangalore", "hyderabad"]
Output : ["hyderabad", "bangalore", "pune", "mumbai"] 

Input  : ["chennai", "vizag", "delhi"]
Output : ["delhi", "vizag", "chennai"]
Approach:
A list of cities is defined using arrayList.
The list of cities is reverse using the Reverse() method.
cities.Reverse();
Finally resultant array is printed using the foreach loop.
foreach (var city in cities)
{
    Console.Write(city + " ");
}
C#
using System;using System.Linq;using System.Collections.Generic;  class geek{    static void Main(string[] args)    {        List<string> cities = new List<string>() {"mumbai","hyderabad","pune","bangalore"};        // reversing the cities arrayList        cities.Reverse();          Console.Write("The Reversed list = ");        Console.Write("[ ");        foreach (var city in cities)        {            Console.Write(city + " ");        }        Console.Write(" ]");    }}
The Reversed list = [ bangalore pune hyderabad mumbai  ]
CSharp LINQ
Picked
C#
C# Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
C# | How to insert an element in an Array?
HashSet in C# with Examples
Convert String to Character Array in C#
Console.ReadLine() Method in C#
Program to Print a New Line in C#
C# Program to Convert a Binary String to an Integer
Hash Function for String data in C#
Convert String to Character Array in C#
C# Program for Dijkstra's shortest path algorithm | Greedy Algo-7
Program to Print a New Line in C#
PyQt5 QComboBox – Change border style when it editable and off state - GeeksforGeeks

17 May, 2020
In this article we will see how we can change the border style of the combo box when it is editable and is in off state, border style can be dotted, dashed etc. When we set border to the combo box it is continuous although we can change it. Styled border will be only visible when combo box is editable and off state.
In order to do this we have to change the style sheet associated with the combo box, below is the stylesheet code
QComboBox::editable:!on
{
border : 4px black;
border-style : dotted;
}

Below is the implementation
# importing librariesfrom PyQt5.QtWidgets import * from PyQt5 import QtCore, QtGuifrom PyQt5.QtGui import * from PyQt5.QtCore import * import sys    class Window(QMainWindow):      def __init__(self):        super().__init__()          # setting title        self.setWindowTitle("Python ")          # setting geometry        self.setGeometry(100, 100, 600, 400)          # calling method        self.UiComponents()          # showing all the widgets        self.show()      # method for widgets    def UiComponents(self):        # creating a check-able combo box object        self.combo_box = QComboBox(self)          # setting geometry of combo box        self.combo_box.setGeometry(200, 150, 100, 40)          # making combo box editable        self.combo_box.setEditable(True)          # geek list        geek_list = ["Sayian", "Super Sayian", "Super Sayian 2", "Super Sayian B"]          # adding list of items to combo box        self.combo_box.addItems(geek_list)          # setting stylesheet of the combo box        # set the border style when it is editable        # and in off state        self.combo_box.setStyleSheet("QComboBox"                                     "{"                                     "border : 4px solid black"                                     "}"                                     "QComboBox::editable:! on"                                     "{"                                     "border : 4px black;"                                     "border-style : dashed;"                                     "}")  # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
Output :
Python PyQt5-ComboBox
Python PyQt5-ComboBox-stylesheet
Python-gui
Python-PyQt
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
How to Install PIP on Windows ?
Read a file line by line in Python
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
Reading and Writing to text files in Python
*args and **kwargs in Python
Convert integer to string in Python
GATE | GATE CS 2021 | Set 2 | Question 13 - GeeksforGeeks

23 May, 2021
Consider the following ANSI C program:
int main () {
    Integer x;
    return 0;
}
Which one of the following phases in a seven-phase C compiler will throw an error?(A) Lexical analyzer(B) Syntax analyzer(C) Semantic analyzer(D) Machine dependent optimizerAnswer: (C)Explanation: Online IDE C compiler returns error: unknown type name ‘Integer’.Check – https://ide.geeksforgeeks.org/OaZAVZN7YvThat is undefined behavior.
Though, it also should be an syntax error as it does not satisfies syntax of ANSI C program for “Integer”.But official key given by GATE authority is “Semantic analyzer”.Quiz of this Question
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | Gate IT 2007 | Question 25
GATE | GATE-CS-2001 | Question 39
GATE | GATE-CS-2000 | Question 41
GATE | GATE-CS-2005 | Question 6
GATE | GATE MOCK 2017 | Question 21
GATE | GATE MOCK 2017 | Question 24
GATE | GATE-CS-2006 | Question 47
GATE | Gate IT 2008 | Question 43
GATE | GATE-CS-2009 | Question 38
GATE | GATE-CS-2003 | Question 90
Input an integer array without spaces in C - GeeksforGeeks

13 Dec, 2018
How to input a large number (a number that cannot be stored even in long long int) without spaces? We need this large number in an integer array such that every array element stores a single digit.
Input : 10000000000000000000000000000000000000000000000
We need to read it in an arr[] = {1, 0, 0...., 0}

In C scanf(), we can specify count of digits to read at a time. Here we need to simply read one digit at a time, so we use %1d.
// C program to read a large number digit by digit#include <stdio.h>int main(){    // array to store digits    int a[100000];    int i, number_of_digits;    scanf("%d", &number_of_digits);    for (i = 0; i < number_of_digits; i++) {          // %1d reads a single digit        scanf("%1d", &a[i]);    }      for (i = 0; i < number_of_digits; i++)         printf("%d ", a[i]);          return 0;}
Input :
27
123456789123456789123456789

Output :
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 

We can also use above style to read any number of fixed digits. For example, below code reads a large number in groups of 3 digits.
// C program to read a large number digit by digit#include <stdio.h>int main(){    // array to store digits    int a[100000];    int i, count;    scanf("%d", &count);    for (i = 0; i < count; i++) {          // %1d reads a single digit        scanf("%3d", &a[i]);    }      for (i = 0; i < count; i++)         printf("%d ", a[i]);          return 0;}
Input :
9
123456789123456789123456789

Output :
123 456 789 123 456 789 123 456 789 

Same concept can be used when we read from a file using fscanf()
C-Input and Output Quiz
c-input-output
cpp-input-output
C Language
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
TCP Server-Client implementation in C
Exception Handling in C++
Multithreading in C
'this' pointer in C++
Arrow operator -> in C/C++ with Examples
Vector in C++ STL
Initialize a vector in C++ (6 different ways)
Inheritance in C++
Map in C++ Standard Template Library (STL)
C++ Classes and Objects
GRE Arithmetic | Exponents and Roots - GeeksforGeeks

05 Apr, 2019
A number can be expressed in terms of base and its powers or exponent or index (Number = Baseexponent). The base of a number can be a positive or negative integer fraction or decimal. Let a number 4, it can be expressed as 2 * 2 or in terms of base and exponent 22. Here base of the number is 2 and exponent is also 2.Example
8 = 23
125 = 53
1296 = 362
1024 = 210
1000 = 103
8 = 23
125 = 53
1296 = 362
1024 = 210
1000 = 103
8 = 23

125 = 53

1296 = 362

1024 = 210

1000 = 103
Possible operations on Exponents:
xa * xb = xa + b
(xa)b = xa*b
xa / xb = xa - b
(xy)a = xayb
(x)-a = (1 / x)a
(x / y)a = xa / yb
xa * xb = xa + b
(xa)b = xa*b
xa / xb = xa - b
(xy)a = xayb
(x)-a = (1 / x)a
(x / y)a = xa / yb
xa * xb = xa + b

(xa)b = xa*b

xa / xb = xa - b

(xy)a = xayb

(x)-a = (1 / x)a

(x / y)a = xa / yb
 Examples on operations:
 22*27 = 29 = 512
 (52)3 = 55 = 3125
 37 / 34 = 34 = 81
 (3 * 5)2 = 32 * 52 225
 5-1 = (1 / 5)1 = 1 / 5 = 0.2
 (3 / 4)5 = 35 / 45 = 243 / 1024 
 22*27 = 29 = 512
 (52)3 = 55 = 3125
 37 / 34 = 34 = 81
 (3 * 5)2 = 32 * 52 225
 5-1 = (1 / 5)1 = 1 / 5 = 0.2
 (3 / 4)5 = 35 / 45 = 243 / 1024
 22*27 = 29 = 512

 (52)3 = 55 = 3125

 37 / 34 = 34 = 81

 (3 * 5)2 = 32 * 52 225

 5-1 = (1 / 5)1 = 1 / 5 = 0.2

 (3 / 4)5 = 35 / 45 = 243 / 1024
When a number are in form of Base1 / exponent then it yields the roots of the number. Root of a number can be square root, cube root andFor example:
 41 / 2 = 2
This can also be expressed as √4 = 2
2 is the square root of 4.
81 / 3 = 2
This can also be expressed as ∛8 = 2
2 is the cube root of 8
 41 / 2 = 2
This can also be expressed as √4 = 2
2 is the square root of 4.

81 / 3 = 2
This can also be expressed as ∛8 = 2
2 is the cube root of 8
Simple operation on roots:
(√x)2 = x
√(x2) = x
√x * √y = √(x*y) 
√x / √y = √(x / y) 
√x + √y = √x + √y ≠ √(x + y) 
√x - √y = √x - √y ≠ √(x - y)  
(√x)2 = x
√(x2) = x
√x * √y = √(x*y) 
√x / √y = √(x / y) 
√x + √y = √x + √y ≠ √(x + y) 
√x - √y = √x - √y ≠ √(x - y)  
(√x)2 = x

√(x2) = x

√x * √y = √(x*y) 

√x / √y = √(x / y) 

√x + √y = √x + √y ≠ √(x + y) 

√x - √y = √x - √y ≠ √(x - y)  
For example:
(√5)2 = 5
√(52) = 5
√5 * √3 = √(5*3) =  √(15) 
√10 / √3 = √(10 / 3) 
√5 + √3 = √5 + √3 ≠ √8 
√5 - √3 = √5 - √3 ≠ √2  
(√5)2 = 5

√(52) = 5

√5 * √3 = √(5*3) =  √(15) 

√10 / √3 = √(10 / 3) 

√5 + √3 = √5 + √3 ≠ √8 

√5 - √3 = √5 - √3 ≠ √2  
Note: Root of a negative number can be expressed in terms of imaginary number.
Aptitude
placement preparation
GRE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GRE Data Analysis | Distribution of Data, Random Variables, and Probability Distributions
GRE Data Analysis | Counting Methods
GRE Data Analysis | Numerical Methods for Describing Data
GRE Algebra | Coordinate Geometry
Vocabulary for CAT and Aptitude Related Exams | Set 2
GRE Algebra | Rules of Exponent
GRE | List of words to enhance your vocabulary with alphabet ‘C’
GRE | List of words to enhance your vocabulary with alphabet 'M'
GRE Data Analysis | Methods for Presenting Data
GRE | List of words to enhance your vocabulary with root alphabet ‘G’
GATE | GATE-CS-2014-(Set-2) | Question 44 - GeeksforGeeks

17 Sep, 2021
For a C program accessing X[i][j][k], the following intermediate code is generated by a compiler. Assume that the size of an integer is 32 bits and the size of a character is 8 bits.
  t0 = i ∗ 1024
  t1 = j ∗ 32
  t2 = k ∗ 4
  t3 = t1 + t0
  t4 = t3 + t2
  t5 = X[t4] 
Which one of the following statements about the source code for the C program is CORRECT?(A) X is declared as “int X[32][32][8]”.(B) X is declared as “int X[4][1024][32]”.(C) X is declared as “char X[4][32][8]”.(D) X is declared as “char X[32][16][2]”.Answer: (A)Explanation: The final expression can be simplified in form ofi, j and k by following the intermediate code steps in reverse order
t5 = X[t4]
   = X[t3 + t2]
   = X[t1 + t0 + t2]
   = X[i*1024 + j*32 + k*4]
   = X + i*1024 + j*32 + k*4 
Since k is multiplied by 4, the array must be an int array.We are left with 2 choices (A and B) among the 4 given choices.
X[i][j][k]’th element in one dimensional array is equivalent toX[i*M*L + j*L + k]’th element in one dimensional array(Note that multi-dimensional arrays are stored in row major order in C).
So we get following equations
j*L*4 = j*32, we get L = 8 (4 is the sizeof(int))
i*1024 = i*M*L*4, we get M = 1024/32 = 32
Therefore option A is the only correct option as M and L are 32 and 8 respectively.
YouTubeGeeksforGeeks GATE Computer Science16.4K subscribersGATE PYQ - Code Generation and Optimization (Continued...) | Joyojyoti Acharya |GeeksforGeeks GATE |Watch laterShareCopy linkInfoShoppingTap to unmuteIf playback doesn't begin shortly, try restarting your device.You're signed outVideos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer.CancelConfirmMore videosMore videosSwitch cameraShareInclude playlistAn error occurred while retrieving sharing information. Please try again later.Watch on0:000:002:57 / 38:16•Live•<div class="player-unavailable"><h1 class="message">An error occurred.</h1><div class="submessage"><a href="https://www.youtube.com/watch?v=mNG-F-8t3a4" target="_blank">Try watching this video on www.youtube.com</a>, or enable JavaScript if it is disabled in your browser.</div></div>Quiz of this Question
GATE-CS-2014-(Set-2)
GATE-GATE-CS-2014-(Set-2)
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | Gate IT 2007 | Question 25
GATE | GATE-CS-2001 | Question 39
GATE | GATE-CS-2000 | Question 41
GATE | GATE-CS-2005 | Question 6
GATE | GATE MOCK 2017 | Question 21
GATE | GATE-CS-2006 | Question 47
GATE | GATE MOCK 2017 | Question 24
GATE | Gate IT 2008 | Question 43
GATE | GATE-CS-2009 | Question 38
GATE | GATE-CS-2003 | Question 90
Setup GitLab Repository On Windows 10

12 Apr, 2018
GitLab is a place where we can manage our git repositories. It can be considered as an alternate of GitHub and Bitbucket. Currently, Gitlab is offering four versions namely Core, Starter, Premium, and Ultimate.
Core: For small and personal projects. Free of cost.Starter: For small and personal projects who need professional support. It is paid.Premium: For teams who need high availability, high performance, and/or 24/7 support.Ultimate: For large enterprises who want to align strategy and execution with security and compliance.
Core: For small and personal projects. Free of cost.
Starter: For small and personal projects who need professional support. It is paid.
Premium: For teams who need high availability, high performance, and/or 24/7 support.
Ultimate: For large enterprises who want to align strategy and execution with security and compliance.
In this article, we will use Core version and learn how to setup GitLab Repository on Windows System in order to manage your codes and projects. So let’s start:
1. Create Account on GitLab.
Username or Email:  abc@gmail.com
Password:  **********
2. Create New Project, named as “Test”.
3. Download Git for Windows and install it.
4. Open Cmd and run following command to check the successful installation of Git.
git --version
5. Set username and email
git config  --global user.name ABC
git config --global user.email “abc@gmail.com”
Note: Username and email should be same as your Gitlab Account.
6. Check for Success:
git config --global --list
7. Go to Directory from where you want to upload project. Right Click there and open “Git Bash Here”.
8. Initialize Git here.
git init
9. Add changes from all tracked and untracked files.
git add -A
10. To add a new remote, use Project URL from GitLab:
git remote add origin https://gitlab.com/abc/Test.git
11. Commit changes with message:
git commit -m "Your_Message"
12. Now push project on GitLab
git push origin master
Pull GitLab Repository
13. Go to the master branch to pull the latest changes from there
git checkout master
14. Download the latest changes in the project
git pull REMOTE NAME-OF-BRANCH -u
(REMOTE: origin) (NAME-OF-BRANCH: could be “master” or an existing branch)
Create New Branch
15. Create a branch. Spaces won’t be recognized, so you will need to use a hyphen or underscore.
git checkout -b NAME-OF-BRANCH
16. Work on a branch that has already been created
git checkout NAME-OF-BRANCH
17. View the changes you’ve made
git status
18. Add changes to commit. You’ll see your changes in red when you type “git status”.
git add CHANGES IN RED
git commit -m "DESCRIBE THE INTENTION OF THE COMMIT"
19. Send changes to gitlab.com
git push REMOTE NAME-OF-BRANCH
GitHub
GBlog
TechTips
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
OpenCV Python program for Vehicle detection in a Video frame

08 Jul, 2022
Face Detection Basics
The objective of the program given is to detect object of interest(Car) in video frames and to keep tracking the same object. This is an example of how to detect vehicles in Python.
Why Vehicle Detection?
The startling losses both in human lives and finance caused by vehicle accidents.
Detecting vehicles in images acquired from a moving platform is a challenging problem.
Steps to download the requirements below:
Download Python 2.7.x version, numpy and OpenCV 2.4.x version.Check if your Windows either 32 bit or 64 bit is compatible and install accordingly.sudo apt-get install python
pip install numpy
sudo apt-get install python
pip install numpy
install OpenCV from here
Make sure that numpy is running in your python then try to install opencv.
Put the cars.xml file in the same folder. Save this as .xml file.
Download this video from here as input
# OpenCV Python program to detect cars in video frame# import libraries of python OpenCV import cv2  # capture frames from a videocap = cv2.VideoCapture('video.avi')  # Trained XML classifiers describes some features of some object we want to detectcar_cascade = cv2.CascadeClassifier('cars.xml')  # loop runs if capturing has been initialized.while True:    # reads frames from a video    ret, frames = cap.read()          # convert to gray scale of each frames    gray = cv2.cvtColor(frames, cv2.COLOR_BGR2GRAY)            # Detects cars of different sizes in the input image    cars = car_cascade.detectMultiScale(gray, 1.1, 1)          # To draw a rectangle in each cars    for (x,y,w,h) in cars:        cv2.rectangle(frames,(x,y),(x+w,y+h),(0,0,255),2)     # Display frames in a window    cv2.imshow('video2', frames)          # Wait for Esc key to stop    if cv2.waitKey(33) == 27:        break  # De-allocate any associated memory usagecv2.destroyAllWindows()
References:
Youtube
OpenCV
Google Groups
This article is contributed by Afzal Ansari. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to review-team@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.
OpenCV
Project
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
10 Best Web Development Projects For Your Resume
Twitter Sentiment Analysis using Python
A Group chat application in Java
Student Information Management System
E-commerce Website using Django
Snake Game in C
Java Swing | Simple User Registration Form
Generating Password and OTP in Java
Banking Transaction System using Java
Create a Music Player using JavaScript
jQuery | event.currentTarget Property

26 Feb, 2019
The event.currentTarget property in jQuery is used to return the current DOM element within the event bubbling phase.The event.currentTarget is typically equal to “this”.
Syntax:
event.currentTarget
Parameter:
event: It is required parameter and this parameter comes from the event binding function.
Example-1:
<!DOCTYPE html><html>  <head>    <title>      jQuery event.currentTarget Property  </title>    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">  </script>      <script>        $(document).ready(function() {          $("h1, h2, p").click(function(event) {             alert(event.currentTarget === this);            });        });    </script></head>  <body>    <center>        <h1 id="geeks1" style="color:green;">          GeeksForGeeks      </h1>        <h2 id="geeks2">          jQuery event.currentTarget Property      </h2>        <p>          <b>Note:</b> Click on each HTML element.      </p>    </center></body>  </html>
Output:
Before Click:
After click on any element:
Example-2:
<!DOCTYPE html><html>  <head>    <title>      jQuery event.currentTarget Property  </title>        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">  </script>     <script>        $(document).ready(function() {         $("h1, p").click(function(event) {             alert(event.currentTarget.innerHTML);            });        });    </script></head>  <body>    <center>        <h1 id="geeks1"             style="color:green;">          GeeksForGeeks      </h1>        <h2 id="geeks2">          jQuery event.currentTarget Property      </h2>        <p>        <b>Note:</b> Click on each HTML element.      </p>    </center></body>  </html>
Output:
Before Click:
After click on Geeksforgeeks:
jQuery-Propertie
Picked
JQuery
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
JQuery | Set the value of an input text field
How to change selected value of a drop-down list using jQuery?
Form validation using jQuery
How to add options to a select element using jQuery?
Scroll to the top of the page using JavaScript/jQuery
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
Python – tensorflow.GradientTape()

10 Jul, 2020
TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. 
GradientTape() is used to record operations for automatic differentiation.
Syntax: tensorflow.GradientTape( persistent, watch_accessed_variables)
Parameters:
persistent(optional): It can either be True or False with default value False. It defines whether persistent gradient tape is created or not.
watch_accessed_variables:  It is a boolean defining whether the tape will automatically watch any (trainable) variables accessed while the tape is active or not.
Example 1:
Python3
# Importing the libraryimport tensorflow as tf  x = tf.constant(4.0)  # Using GradientTapewith tf.GradientTape() as gfg:  gfg.watch(x)  y = x * x * x  # Computing gradientres  = gfg.gradient(y, x)  # Printing resultprint("res: ",res)
Output:
res:  tf.Tensor(48.0, shape=(), dtype=float32)


Example 2:
Python3
# Importing the libraryimport tensorflow as tf  x = tf.constant(4.0)  # Using GradientTapewith tf.GradientTape() as gfg:  gfg.watch(x)    # Using nested GradientTape for calculating higher order derivative  with tf.GradientTape() as gg:    gg.watch(x)    y = x * x * x  # Computing first order gradient  first_order = gg.gradient(y, x)  # Computing Second order gradientsecond_order  = gfg.gradient(first_order, x)   # Printing resultprint("first_order: ",first_order)print("second_order: ",second_order)
Output:
first_order:  tf.Tensor(48.0, shape=(), dtype=float32)
second_order:  tf.Tensor(24.0, shape=(), dtype=float32)



Python Tensorflow-math-functions
Python-Tensorflow
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
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Iterate over a list in Python
Python OOPs Concepts
Python | Move one list element to another list

27 Aug, 2019
Sometimes, while working with Python list, there can be a problem in which we need to perform the inter list shifts of elements. Having solution to this problem is always very useful. Let’s discuss certain way in which this task can be performed.
Method : Using pop() + insert() + index()This particular task can be performed using combination of above functions. In this we just use the property of pop function to return and remove element and insert it to the specific position of other list using index function.
# Python3 code to demonstrate working of# Move one list element to another list# Using pop() + index() + insert()  # initializing liststest_list1 = [4, 5, 6, 7, 3, 8]test_list2 = [7, 6, 3, 8, 10, 12]  # printing original listsprint("The original list 1 is : " +  str(test_list1))print("The original list 2 is : " +  str(test_list2))  # Using pop() + index() + insert()# Move one list element to another listres = test_list1.insert(4, test_list2.pop(test_list2.index(10)))  # Printing resultprint("The list 1 after insert is : " +  str(test_list1))print("The list 2 after remove is : " +  str(test_list2))
The original list 1 is : [4, 5, 6, 7, 3, 8]
The original list 2 is : [7, 6, 3, 8, 10, 12]
The list 1 after insert is : [4, 5, 6, 7, 10, 3, 8]
The list 2 after remove is : [7, 6, 3, 8, 12]

Python list-programs
Python
Python Programs
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 ?
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python | Convert string dictionary to dictionary
JQuery | trim() Method

20 Jan, 2022
This trim() Method in jQuery is used to remove the whitespace from the beginning and end of a string
Syntax:
jQuery.trim( str )
Parameters: This method accept a single parameter which is mentioned above and described below:
str: This parameter is the string to be trimmed.
Return Value: It returns the string after removing the whitespaces.
Below example illustrate the use of trim() method in jQuery:Example 1: In this example, the trim() method removes the tab and spaces at the start and at the end of the string.
html
<!DOCTYPE html><html>  <head>    <meta charset="utf-8">    <title>JQuery | trim() method</title>    <script src="https://code.jquery.com/jquery-3.4.1.js">    </script>    <style>        div {            color: blue;        }    </style></head>  <body style="text-align:center;">      <h1 style="color: green">         GeeksforGeeks     </h1>      <h3>JQuery | trim() method</h3>    <pre id="bb"></pre>      <script>        $("#bb").html(            $.trim("     A computer science portal for geeks     "));    </script>  </body>  </html>                                            
Example 2: In this example, the trim() method removes the white spaces from multiple line.
html
<!DOCTYPE html><html>  <head>    <meta charset="utf-8">    <title>JQuery | trim() method</title>    <script src="https://code.jquery.com/jquery-3.4.1.js">    </script>    <style>        pre {            color: green;        }    </style></head>  <body style="text-align:center;">      <h1 style="color: green">         GeeksforGeeks     </h1>      <h3>JQuery | trim() method</h3>    <pre id="geeks"></pre>    <pre id="geeks1"></pre>    <script>        var varr = "\nIt removes all newlines, \n spaces"+            " and \n tabs from the beginning and end of string.\n"        var varr1 = " \n Whitespace in the middle"+            " of string are preserved\n"        $("#geeks").html("<b>Original : <br></b>"                          + varr + varr1);        $("#geeks1").html("<b>Trimmed : <br></b>"                          + $.trim(varr) + $.trim(varr1));    </script>  </body>  </html>       
varshagumber28
jQuery-Methods
JQuery
Web Technologies
Write From Home
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to get the value in an input text box using jQuery ?
jQuery | ajax() Method
Difference Between JavaScript and jQuery
jQuery | parent() & parents() with Examples
jQuery | Introduction
Installation of Node.js on Linux
How to insert spaces/tabs in text using HTML/CSS?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to create footer to stay at the bottom of a Web page?
How to set the default value for an HTML <select> element ?
How to Install PyQt for Python in Windows?

17 Dec, 2021
In this article, we will be looking at the stepwise procedure to install the PyQt for python in Windows. PyQt is a Python binding of the cross-platform GUI toolkit Qt, implemented as a Python plug-in. PyQt is free software developed by the British firm Riverbank Computing. 
There are more than six hundred classes covering a range of features such as:
Graphical User Interfaces
SQL Databases
Web toolkits
XML processing
Networking
Follow the below steps to install PyQt for python on Windows:
Step 1:Verify if python is installed on your system.
Here, the user can simply run the below command in the command prompt or the power shell of the windows to verify if the python is already installed in the system or not. If python is already installed in the system the output of the command will be the running version of python and if not installed it will produce an error. In case if python is not installed the user can refer to How to Install Python.
Command to check if python is already installed:
python --version
Output:
Step 2:Verify that PyQt is not installed before:
In this, the user has to simply type the below command to verify if the PyQt is not installed before, if installed the user has no need to follow the below steps mentioned.
Command:
pip list
Output:
Step 3:Install the PyQt:
Here, it is the final step to install the PyQt in python just the user needs to type the below-mentioned article, the PyQt5 will be successfully installed in the system, and further by repeating step-2 the user can verify if the PyQt is installed.
Command:
 pip install PyQt5
Output:
At this point, you have successfully installed PyQt for python on Windows.
how-to-install
Picked
How To
Installation Guide
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Set Git Username and Password in GitBash?
How to Install Jupyter Notebook on MacOS?
How to Install and Use NVM on Windows?
How to Install Python Packages for AWS Lambda Layers?
How to Install Git in VS Code?
Installation of Node.js on Linux
Installation of Node.js on Windows
How to Install Jupyter Notebook on MacOS?
How to Install and Use NVM on Windows?
How to Install Python Packages for AWS Lambda Layers?
How to get an age from a D.O.B field in MySQL?

To get age from a D.O.B field in MySQL, you can use the following syntax. Here, we subtract the DOB from the current date.
select yourColumnName1,yourColumnName2,........N,year(curdate())-
   year(yourDOBColumnName) as anyVariableName from yourTableName;
To understand the above syntax, let us first create a table. The query to create a table is as follows.
mysql> create table AgeDemo
-> (
-> StudentId int,
-> StudentName varchar(100),
-> StudentDOB date
-> );
Query OK, 0 rows affected (0.61 sec)
Insert some records in the table using insert command. The query is as follows.
mysql> insert into AgeDemo values(1,'John','1998-10-1');
Query OK, 1 row affected (0.20 sec)

mysql> insert into AgeDemo values(2,'Carol','1990-1-2');
Query OK, 1 row affected (0.14 sec)

mysql> insert into AgeDemo values(3,'Sam','2000-12-1');
Query OK, 1 row affected (0.15 sec)

mysql> insert into AgeDemo values(4,'Mike','2010-10-11');
Query OK, 1 row affected (0.18 sec)
Display all records from the table using select statement. The query is as follows.
mysql> select *from AgeDemo;
The following is the output.
+-----------+-------------+------------+
| StudentId | StudentName | StudentDOB |
+-----------+-------------+------------+
| 1         | John        | 1998-10-01 |
| 2         | Carol       | 1990-01-02 |
| 3         | Sam         | 2000-12-01 |
| 4         | Mike        | 2010-10-11 |
+-----------+-------------+------------+
4 rows in set (0.00 sec)
Here is the query to calculate the age from D.O.B. The query is as follows.
mysql> select StudentName,StudentDOB,year(curdate())-year(StudentDOB) as StudentAge from AgeDemo;
The following is the output displaying age.
+-------------+------------+------------+
| StudentName | StudentDOB | StudentAge |
+-------------+------------+------------+
| John        | 1998-10-01 | 21         |
| Carol       | 1990-01-02 | 29         |
| Sam         | 2000-12-01 | 19         |
| Mike        | 2010-10-11 | 9          |
+-------------+------------+------------+
4 rows in set (0.03 sec)
MongoDB – Check the existence of the fields in the specified collection

22 Nov, 2021
In MongoDB, we can check the existence of the field in the specified collection using the $exists operator. When the value of $exists operator is set to true, then this operator matches the document that contains the specified field(including the documents where the value of that field is null). When the value of $exists operator is set to false, then this operator returns only those documents that don’t contain the specified field. 
Syntax:
{ field: { $exists: <boolean> } }
Examples: 
In the following example, we are working with:
Database: gfg
Collections: student
Document: Three documents contains name and age of the students
Check the existence of the field in the student collection:
db.student.find({name:{$exists:true}})
Here, we check the field exists or not in the student collection using $exists operator.
Check the existence of the field of the embedded document:
db.student.find({"details.game":{$exists:true}})
Here, we check the field of the embedded document is exists or not using the $exists operator.
anikaseth98
MongoDB-operators
Picked
MongoDB
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to connect MongoDB with ReactJS ?
MongoDB - limit() Method
MongoDB - sort() Method
MongoDB - FindOne() Method
MongoDB updateOne() Method - db.Collection.updateOne()
MongoDB - Regex
MongoDB - Compound Indexes
MongoDB Cursor
MongoDB updateMany() Method - db.Collection.updateMany()
Spring Boot - CRUD Operations using MongoDB
MoviePy – FPS of Video File Clip

01 Aug, 2020
In this article we will see how we can get the fps i.e frame per second(frame rate) of the video file in MoviePy. MoviePy is a Python module for video editing, which can be used for basic operations on videos and GIF’s. Frame rate is the speed at which those images are shown, or how fast you “flip” through the book and it’s usually expressed as “frames per second, ” or FPS. Each image represents a frame, so if a video is captured and played back at 24fps, that means each second of video shows 24 distinct still images.
We can load the video file clip with the help of command given below
clip = VideoFileClip(file_name)
In order to do this we will use fps attribute with the VideoFileClip object
Syntax : clip.fps
Argument : It takes no argument
Return : It returns float
Below is the implementation
# Import everything needed to edit video clipsfrom moviepy.editor import *  # loading video dsa gfg intro video clip = VideoFileClip("dsa_geek.webm").subclip(0, 10)    # getting frame rate of the cliprate = clip.fps  # printing the fpsprint("FPS : " + str(rate))    print("---------------------------------------")    # showing final clipclip.ipython_display()
Output :
FPS : 29.97002997002997
---------------------------------------
Moviepy - Building video __temp__.mp4.
Moviepy - Writing video __temp__.mp4

                                                                                                                       
Moviepy - Done !
Moviepy - video ready __temp__.mp4
Another example
# Import everything needed to edit video clipsfrom moviepy.editor import *  # loading video gfgclip = VideoFileClip("geeks.mp4")    # getting subclip from itclip1 = clip.subclip(0, 7)  # getting frame rate of the cliprate = clip1.fps  # printing the fpsprint("FPS : " + str(rate))    print("---------------------------------------")    # showing final clipclip1.ipython_display()
Output :
FPS : 60.0
---------------------------------------
Moviepy - Building video __temp__.mp4.
MoviePy - Writing audio in __temp__TEMP_MPY_wvf_snd.mp3
                                                                                                                       
MoviePy - Done.
Moviepy - Writing video __temp__.mp4

                                                                                                                       
Moviepy - Done !
Moviepy - video ready __temp__.mp4
Python-MoviePy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to move a file, group of files, and directories in Linux?

The mv (move) command is used to move one or more files or directories from one directory to another directory using terminal in the Linux/Unix operating system. After using the mv command file is copied from source to destination and source file is removed. The mv command is also used to rename the file.
The general syntax of the mv command is as follows
$ mv [OPTION]...[-T] SOURCE DESTINATION...
$ mv [OPTION]...SOURCE... DIRECTORY...
$ mv [OPTION]...-t DIRECTORY SOURCE...
Brief description of options available in the mv command.
To move a file from a directory and paste it into another directory use the mv command as shown in below.
$ mv file.txt ../snow
Here snow is a directory in which a file will be moved from the current directory after executing the above command.
To move an entire directory to another directory using the mv command without any option the syntax is as follows.
$ mv <SOURCE DIRECTORY> <DESTINATION DIRECTORY>
Suppose snow is a directory which has to move to a shadow directory.
$ mv snow shadow
And the directory will be moved.
Here, we will move a file as well as create a backup file of an existing file in the destination directory that will be used to recover the previous file.
First of all, using the cat command we create a file file.txt and write some contents
$ cat >snow/file.txt

And move into another directory but another file with the same name available in the snow directory then a backup file is created in the snow directory.
$ mv --backup file.txt snow
We can see it using ls -a because just using the ls command hidden files will not prompt.
$ ls -a
Tryit Editor v3.7

Tryit: Canvas with a gradient rectangle