code-rag-bench/online-tutorials huggingface dataset:
Neo4j Create Relationship

23 Aug, 2019
In Neo4j to create relationship between nodes you have to use the CREATE statement like we used to create nodes. lets create relation between two already created nodes.Example:
Already created nodes: 
Query to create relation:$ MATCH (a:GeeksforGeeks), (b:W3School)
WHERE a.Name = "A Computer Science Portal" AND b.Name = "We are the Learner"
CREATE (a)-[r:edutech]->(b)
RETURN r
$ MATCH (a:GeeksforGeeks), (b:W3School)
WHERE a.Name = "A Computer Science Portal" AND b.Name = "We are the Learner"
CREATE (a)-[r:edutech]->(b)
RETURN r
Output of above query:
To create multiple relationship between nodes:You can see how easy it is to continue creating more nodes and relationships between them. So we will create one more node and add two more relationships.
Creating a new node:$ CREATE (c:Company { Name: "Tuitorial" })Output:
$ CREATE (c:Company { Name: "Tuitorial" })
Output:
Creating relationship:MATCH (a:GeeksforGeeks), (b:W3School), (c:Comapny)
WHERE a.Tag = "A Computer Science Portal" AND b.Tag = "We are the Learner" AND 
c.Name = "Tuitorial" CREATE (c)-[pr:PRODUCED]->(b), (c)-[pr1:PROVIDER]->(a)
RETURN a, b, cOutput:My Personal Notes
arrow_drop_upSave
MATCH (a:GeeksforGeeks), (b:W3School), (c:Comapny)
WHERE a.Tag = "A Computer Science Portal" AND b.Tag = "We are the Learner" AND 
c.Name = "Tuitorial" CREATE (c)-[pr:PRODUCED]->(b), (c)-[pr1:PROVIDER]->(a)
RETURN a, b, c
Output:
DBMS
DBMS
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Parse a website with regex and urllib

23 Jan, 2019
Let’s discuss the concept of parsing using python. In python we have lot of modules but for parsing we only need urllib and re i.e regular expression. By using both of these libraries we can fetch the data on web pages.
Note that parsing of websites means that fetch the whole source code and that we want to search using a given url link, it will give you the output as the bulk of HTML content that you can’t understand. Let’s see the demonstration with an explanation to let you understand more about parsing.
Code #1: Libraries needed
# importing librariesimport urllib.requestimport urllib.parseimport re
Code #2:
url = 'https://www.geeksforgeeks.org/'values = {'s':'python programming',          'submit':'search'}
We have defined a url and some related values that we want to search. Remember that we define values as a dictionary and in this key value pair we define python programming to search on the defined url.
Code #3:
data = urllib.parse.urlencode(values)        data = data.encode('utf-8')                  req = urllib.request.Request(url, data)      resp = urllib.request.urlopen(req)             respData = resp.read()                      
In the first line we encode the values that we have defined earlier, then (line 2) we encode the same data that is understand by machine.In 3rd line of code we request for values in the defined url, then use the module urlopen() to open the web document that HTML.In the last line read() will help read the document line by line and assign it to respData named variable.
Code #4:
paragraphs = re.findall(r'<p>(.*?)</p>', str(respData))  for eachP in paragraphs:    print(eachP)
In order to extract the relevant data we apply regular expression. Second argument must be type string and if we want to print the data we apply simple print function. Below are few examples:
Example #1:
import urllib.requestimport urllib.parseimport re   url = 'https://www.geeksforgeeks.org/'values = {'s':'python programming',          'submit':'search'}   data = urllib.parse.urlencode(values)data = data.encode('utf-8')req = urllib.request.Request(url, data)resp = urllib.request.urlopen(req)respData = resp.read()   paragraphs = re.findall(r'<p>(.*?)</p>',str(respData))   for eachP in paragraphs:    print(eachP)
Output: 
Example #2:
import urllib.requestimport urllib.parseimport re   url = 'https://www.geeksforgeeks.org/'values = {'s':'pandas',          'submit':'search'}   data = urllib.parse.urlencode(values)data = data.encode('utf-8')req = urllib.request.Request(url, data)resp = urllib.request.urlopen(req)respData = resp.read()   paragraphs = re.findall(r'<p>(.*?)</p>',str(respData))   for eachP in paragraphs:    print(eachP)
Output: 
python-utility
Python
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Swing Examples - Using Buttons

Following example showcase how to use standard buttons in a Java Swing application.
We are using the following APIs.
JButton − To create a standard button.
JButton − To create a standard button.
JButton.setEnabled(false); − To disable a button.
JButton.setEnabled(false); − To disable a button.
getRootPane().setDefaultButton(submitButton); − To make a button as default button to be clicked when enter key is pressed.
getRootPane().setDefaultButton(submitButton); − To make a button as default button to be clicked when enter key is pressed.
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

public class SwingTester {
   public static void main(String[] args) {
      createWindow();
   }

   private static void createWindow() {    
      JFrame frame = new JFrame("Swing Tester");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      createUI(frame);
      frame.setSize(560, 200);      
      frame.setLocationRelativeTo(null);  
      frame.setVisible(true);
   }

   private static void createUI(final JFrame frame){  
      JPanel panel = new JPanel();
      LayoutManager layout = new FlowLayout();  
      panel.setLayout(layout);       

      JButton okButton = new JButton("Ok");
      JButton cancelButton = new JButton("Cancel");
      cancelButton.setEnabled(false);
      JButton submitButton = new JButton("Submit");

      okButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(frame, "Ok Button clicked.");
         }
      });

      submitButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(frame, "Submit Button clicked.");
         }
      });

      frame.getRootPane().setDefaultButton(submitButton);

      panel.add(okButton);
      panel.add(cancelButton);
      panel.add(submitButton);

      frame.getContentPane().add(panel, BorderLayout.CENTER);    
   }
}
 Print
 Add Notes
 Bookmark this page
How to Concatenate tuples to nested tuples in Python

When it is required to concatenate tuples to nested tuples, the '+' operator can be used. A tuple is an immutable data type. It means, values once defined can't be changed by accessing their index elements. If we try to change the elements, it results in an error. They are important contains since they ensure read-only access.
The '+' operator is used for addition or concatenation operation.
Below is a demonstration of the same −
Live Demo
my_tuple_1 = ( 7, 8, 3, 4, 3, 2),
my_tuple_2 = (9, 6, 8, 2, 1, 4),

print ("The first tuple is : " )
print(my_tuple_1)
print ("The second tuple is : " )
print(my_tuple_2)

my_result = my_tuple_1 + my_tuple_2

print("The tuple after concatenation is : " )
print(my_result)
The first tuple is :
((7, 8, 3, 4, 3, 2),)
The second tuple is :
((9, 6, 8, 2, 1, 4),)
The tuple after concatenation is :
((7, 8, 3, 4, 3, 2), (9, 6, 8, 2, 1, 4))
Two tuples are defined, and are displayed on the console.
The '+' operator is used to concatenate the values.
This result is assigned to a variable.
It is displayed as output on the console.
What are C++ Floating-Point Constants?

Floating-point constants specify values that must have a fractional part.
Floating-point constants have a "mantissa," which specifies the value of the number, an "exponent," which specifies the magnitude of the number, and an optional suffix that specifies the constant's type(double or float).
The mantissa is specified as a sequence of digits followed by a period, followed by an optional sequence of digits representing the fractional part of the number. For example −
24.25
12.00
These values can also contain exponents. For example,
24.25e3 which is equivalent to 24250
In C++ you can use the following code to create a floating point constant −
Live Demo
#include<iostream>
using namespace std;
int main() {
   const float PI = 3.141;  // 3.141 is floating point constant while PI is a constant float.
   cout << PI;
   return 0;
}
This will give the output −
3.141
JavaScript - Array constructor Property

JavaScript array constructor property returns a reference to the array function that created the instance's prototype.
Its syntax is as follows −
array.constructor

Returns the function that created this object's instance.
Try the following example.
<html>
   <head>
      <title>JavaScript Array constructor Property</title>
   </head>
   
   <body>
   
      <script type = "text/javascript">
        var arr = new Array( 10, 20, 30 );
        document.write("arr.constructor is:" + arr.constructor); 
      </script>
      
   </body>
</html>
arr.constructor is: function Array() { [native code] } 


    25 Lectures 
     2.5 hours 

 Anadi Sharma

    74 Lectures 
     10 hours 

 Lets Kode It

    72 Lectures 
     4.5 hours 

 Frahaan Hussain

    70 Lectures 
     4.5 hours 

 Frahaan Hussain

    46 Lectures 
     6 hours 

 Eduonix Learning Solutions

    88 Lectures 
     14 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page
How to convert a data frame to data.table in R?

Since operations with data.table are sometimes faster than the data frames, we might want to convert a data frame to a data.table object. The main difference between data frame and data.table is that data frame is available in the base R but to use data.table we have to install the package data.table. We can do this with the help setDT function in the data.table package.
Consider the below data frame −
> set.seed(1)
> x1<-rnorm(20,0.5)
> x2<-rnorm(20,0.8)
> x3<-rpois(20,2)
> x4<-rpois(20,5)
> x5<-runif(20,5,10)
> df<-data.frame(x1,x2,x3,x4,x5)
> df
x1 x2 x3 x4 x5
1  -0.1264538  1.7189774 2 6 9.959193
2   0.6836433  1.5821363 3 4 7.477968
3  -0.3356286  0.8745650 1 4 7.421748
4   2.0952808 -1.1893517 1 11 5.867212
5   0.8295078  1.4198257 3 6 8.774105
6  -0.3204684  0.7438713 1 3 7.269477
7   0.9874291  0.6442045 3 3 7.555849
8   1.2383247 -0.6707524 0 5 6.037726
9   1.0757814  0.3218499 1 8 6.143291
10  0.1946116  1.2179416 1 5 7.978560
11  2.0117812  2.1586796 1 10 7.874361
12  0.8898432  0.6972123 0 6 5.385322
13 -0.1212406  1.1876716 2 4 5.177703
14 -1.7146999  0.7461950 4 4 8.213977
15  1.6249309 -0.5770596 3 3 9.643076
16  0.4550664  0.3850054 3 1 7.990462
17  0.4838097  0.4057100 2 6 7.804504
18  1.4438362  0.7406866 2 2 7.630139
19  1.3212212  1.9000254 3 5 9.925476
20  1.0939013  1.5631757 2 6 7.538209
Loading data.table package −
> library(data.table)
Converting data frame df to data.table?
> setDT(df)
Checking whether df is a data.table or not −
> is.data.table(df)
[1] TRUE
Let’s have a look at one more example −
> y1<-letters[1:20]
> y2<-rep(c("Group1","Group2","Group3","Group4"),times=5)
> y3<-1:20
> df_new<-data.frame(y1,y2,y3)
> df_new
   y1  y2    y3
1  a Group1  1
2  b Group2  2
3  c Group3  3
4  d Group4  4
5  e Group1  5
6  f Group2  6
7  g Group3  7
8  h Group4  8
9  i Group1  9
10 j Group2 10
11 k Group3 11
12 l Group4 12
13 m Group1 13
14 n Group2 14
15 o Group3 15
16 p Group4 16
17 q Group1 17
18 r Group2 18
19 s Group3 19
20 t Group4 20
> setDT(df_new)
> is.data.table(df_new)
[1] TRUE
AVRO - Deserialization Using Parsers

As mentioned earlier, one can read an Avro schema into a program either by generating a class corresponding to a schema or by using the parsers library. In Avro, data is always stored with its corresponding schema. Therefore, we can always read a serialized item without code generation.
This chapter describes how to read the schema using parsers library and Deserializing the data using Avro.
The serialized data is stored in the file mydata.txt. You can deserialize and read it using Avro.
Follow the procedure given below to deserialize the serialized data from a file.
First of all, read the schema from the file. To do so, use Schema.Parser class. This class provides methods to parse the schema in different formats.
Instantiate the Schema.Parser class by passing the file path where the schema is stored.
Schema schema = new Schema.Parser().parse(new File("/path/to/emp.avsc"));

Create an object of DatumReader interface using SpecificDatumReader class.
DatumReader<emp>empDatumReader = new SpecificDatumReader<emp>(emp.class);

Instantiate DataFileReader class. This class reads serialized data from a file. It requires the DatumReader object, and path of the file where the serialized data exists, as a parameters to the constructor.
DataFileReader<GenericRecord> dataFileReader = new DataFileReader<GenericRecord>(new File("/path/to/mydata.txt"), datumReader);

Print the deserialized data, using the methods of DataFileReader.
The hasNext() method returns a boolean if there are any elements in the Reader
.
The hasNext() method returns a boolean if there are any elements in the Reader
.
The next() method of DataFileReader returns the data in the Reader.
The next() method of DataFileReader returns the data in the Reader.
while(dataFileReader.hasNext()){

   em=dataFileReader.next(em);
   System.out.println(em);
}
The following complete program shows how to deserialize the serialized data using Parsers library −
public class Deserialize {
   public static void main(String args[]) throws Exception{
	
      //Instantiating the Schema.Parser class.
      Schema schema = new Schema.Parser().parse(new File("/home/Hadoop/Avro/schema/emp.avsc"));
      DatumReader<GenericRecord> datumReader = new GenericDatumReader<GenericRecord>(schema);
      DataFileReader<GenericRecord> dataFileReader = new DataFileReader<GenericRecord>(new File("/home/Hadoop/Avro_Work/without_code_gen/mydata.txt"), datumReader);
      GenericRecord emp = null;
		
      while (dataFileReader.hasNext()) {
         emp = dataFileReader.next(emp);
         System.out.println(emp);
      }
      System.out.println("hello");
   }
}
Browse into the directory where the generated code is placed. In this case, it is at home/Hadoop/Avro_work/without_code_gen.
$ cd home/Hadoop/Avro_work/without_code_gen/

Now copy and save the above program in the file named DeSerialize.java. Compile and execute it as shown below −
$ javac Deserialize.java
$ java Deserialize

{"name": "ramu", "id": 1, "salary": 30000, "age": 25, "address": "chennai"}
{"name": "rahman", "id": 2, "salary": 35000, "age": 30, "address": "Delhi"}

 Print
 Add Notes
 Bookmark this page
C# | Creating a read-only wrapper for the List - GeeksforGeeks

27 Jan, 2019
List<T>.AsReadOnly Method is used to get a read-only ReadOnlyCollection<T> wrapper for the current collection.
Syntax:
public System.Collections.ObjectModel.ReadOnlyCollection AsReadOnly ();
Return Value: It returns an object that acts as a read-only wrapper around the current List<T>.
Example:
// C# code to create a read-only// wrapper for the List<T>using System;using System.Collections;using System.Collections.Generic;  class GFG {      // Driver code    public static void Main()    {          // Creating an List<T> of Integers        List<int> firstlist = new List<int>();          // Adding elements to List        firstlist.Add(1);        firstlist.Add(2);        firstlist.Add(3);        firstlist.Add(4);        firstlist.Add(5);        firstlist.Add(6);        firstlist.Add(7);          Console.WriteLine("Before Wrapping: ");          // Displaying the elements in the List        foreach(int i in firstlist)        {            Console.WriteLine(i);        }          // Creating a Read-Only packing        // around the List<T>        IList<int> mylist2 = firstlist.AsReadOnly();          Console.WriteLine("After Wrapping: ");          // Displaying the elements        foreach(int m in mylist2)        {            Console.WriteLine(m);        }          Console.WriteLine("Trying to add new element into mylist2:");          // it will give error        mylist2.Add(8);    }}
Output:
Before Wrapping: 
1
2
3
4
5
6
7
After Wrapping: 
1
2
3
4
5
6
7
Trying to add new element into mylist2:

Runtime Error:
Unhandled Exception:System.NotSupportedException: Collection is read-only.
Note:
A collection that is read-only is simply a collection with a wrapper that prevents modifying the collection. If changes are made to the underlying collection, the read-only collection reflects those changes.
This method is an O(1) operation.
Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.asreadonly?view=netframework-4.7.2
CSharp-Generic-List
CSharp-Generic-Namespace
CSharp-method
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
C# Dictionary with examples
C# | Method Overriding
Destructors in C#
Difference between Ref and Out keywords in C#
C# | String.IndexOf( ) Method | Set - 1
C# | Constructors
Introduction to .NET Framework
C# | Class and Object
C# | Abstract Classes
HashSet in C# with Examples
\mapsto - Tex Command

\mapsto - Used to draw mapsto symbol.
{ \mapsto }
\mapsto command is used to draw mapsto symbol.

\mapsto

↦



\mapsto

↦


\mapsto

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
How to replace values of a Python dictionary?

You can assign a dictionary value to a variable in Python using the access operator []. For example,
my_dict = {
   'foo': 42,
   'bar': 12.5
}
new_var = my_dict['foo']
print(new_var)
This will give the output −
42
This syntax can also be used to reassign the value associated with this key. For example,
my_dict  =  {
   'foo': 42,
   'bar': 12.5
}
my_dict['foo']  =  "Hello"
print(my_dict['foo'])
This will give the output −
Hello
How to disable action bar permanently in Android?

This example demonstrate about How to disable action bar permanently in Android.
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
Step 2 − Add the following code to res/layout/activity_main.java
<? xml version= "1.0" encoding= "utf-8" ?>
<RelativeLayout xmlns: android = "http://schemas.android.com/apk/res/android"
   xmlns: tools = "http://schemas.android.com/tools"
   android :layout_width= "match_parent"
   android :layout_height= "match_parent"
   android :orientation= "vertical"
   tools :context= ".MainActivity" >
   <TextView
      android :layout_width= "match_parent"
      android :layout_height= "wrap_content"
      android :layout_centerInParent= "true"
      android :gravity= "center"
      android :text= "No Action Bar"
      android :textAppearance= "@style/Base.TextAppearance.AppCompat.Large" />
</RelativeLayout>
Step 3 − Add the following code to src/MainActivity.java
package app.tutorialspoint.com.sample ;
import android.os.Bundle ;
import android.support.v7.app.AppCompatActivity ;
public class MainActivity extends AppCompatActivity {
   @Override
   protected void onCreate (Bundle savedInstanceState) {
      super .onCreate(savedInstanceState) ;
      setContentView(R.layout. activity_main ) ;
   }
}
Step 4 − Add the following code to res/values/styles.xml
<resources>
   <!-- Base application theme. -->
   <style name= "AppTheme" parent= "Theme.AppCompat.Light.DarkActionBar" >
      <!-- Customize your theme here. -->
      <item name= "colorPrimary" > @color/colorPrimary </item>
      <item name= "colorPrimaryDark" > @color/colorPrimaryDark </item>
      <item name= "colorAccent" > @color/colorAccent </item>
   </style>
   <style name= "AppTheme.NoActionBar" >
      <item name= "windowActionBar" > false </item>
      <item name= "windowNoTitle" > true </item>
   </style>
</resources>
Step 5 − Add the following code to androidManifest.xml
<? xml version= "1.0" encoding= "utf-8" ?>
<manifest xmlns: android = "http://schemas.android.com/apk/res/android"
   package= "app.tutorialspoint.com.sample" >
   <uses-permission android :name= "android.permission.VIBRATE" />
   <application
      android :allowBackup= "true"
      android :icon= "@mipmap/ic_launcher"
      android:label= "@string/app_name"
      android:roundIcon= "@mipmap/ic_launcher_round"
      android:supportsRtl= "true"
      android:theme= "@style/AppTheme" >
      <activity android:name= ".MainActivity" >
         <intent-filter>
            <action android:name= "android.intent.action.MAIN" />
            <category android:name= "android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>
   </application>
</manifest>
Let's try to run your application. I assume you have connected your actual Android Mobile device with your computer. To run the app from android studio, open one of your project's activity files and click Run  icon from the toolbar. Select your mobile device as an option and then check your mobile device which will display your default screen –
Why does Python automatically exit a script when it’s done? - GeeksforGeeks

26 Nov, 2020
Python is a scripting language. This means that a Python code is executed line by line with the help of a Python interpreter. When a python interpreter encounters an end-of-file character, it is unable to retrieve any data from the script. This EOF(end-of-file) character is the same as the EOF that informs the end of the file while reading data from a file in Python.
There is an EOF character present at the end of each python script that instructs the interpreter to stop the execution of code. While working on a standard input connected to a tty device, we can produce a similar result with CTRL+D on UNIX and CTRL+Z, ENTER on Windows. 
Consider this simple code that takes a number as user input and returns twice of that number.
Python3
a = int(input("Enter number: "))#  waiting for user input...  print("Twice of the number: ", 2 * a)
Try pressing the EOF character(depending on your os) while the program is waiting for user input. The program will terminate as soon as it encounters the EOF character like this:
Exiting Python Script
Notice that the program throws an EOFError Exception when it encounters EOF before the program completion.
We can use the atexit module to detect the script exit. The following code detects script exit using register() function of the atexit module.
Syntax: atexit.register(fun, *args, **kwargs)
Parameters: First the function name is mentioned and then any arguments for that function is passed. The parameters are separated using ‘, ‘.
Return: This function returns the called fun and hence the calling can be traced.
The atexit.register() method takes a function as an argument that is to be executed at script exit.
Python3
import atexit  a = 5print("Twice of a:", a*2)  atexit.register(print, "Exiting Python Script")
Output:
Twice of a: 10
Exiting Python Script

python-basics
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
How to drop one or multiple columns in Pandas Dataframe
Selecting rows in pandas DataFrame based on conditions
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | os.path.join() method
Python | Get unique values from a list
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
Handling errors in SAP GUI Scripting code

You can take reference from GUI Scripting help section and it can explain things in detail.
It provides you default property types as per requirement. If you want to perform next step, stop or abort user step, you can use the following properties.
See the below code that uses above property type to display different messages −
Public Sub get_status_bar_value_exit_if_Error()
   Dim usr_resp AsString
   If(session.findById("wnd[0]/sbar").messagetype = "E"Or
      session.findById("wnd[0]/sbar").messagetype= "W") Then
   usr_resp =MsgBox(session.findById("wnd[0]/sbar").Text & Chr(13) &"Show the Error in SAP ?",
vbYesNo)
    If usr_resp =vbYes Then
 Else
    Callgo_to_Sap_home
 End If
 End
 End If
End Sub
GATE | GATE-CS-2014-(Set-2) | Question 65 - GeeksforGeeks

10 Sep, 2021
Consider the grammar defined by the following production rules, with two operators ∗ and +
    S --> T * P 
    T --> U | T * U
    P --> Q + P | Q
    Q --> Id
    U --> Id

Which one of the following is TRUE?
(A) + is left associative, while ∗ is right associative(B) + is right associative, while ∗ is left associative(C) Both + and ∗ are right associative(D) Both + and ∗ are left associative
Answer: (B)Explanation: From the grammar we can find out associative by looking at grammar.
Let us consider the 2nd production
T -> T * U
T is generating T*U recursively (left recursive) so * is 
left associative.

Similarly
P -> Q + P
Right recursion so + is right associative.
So option B is correct. 
NOTE: Above is the shortcut trick that can be observed after drawingfew parse trees.One can also find out correct answer by drawing the parse tree.
YouTubeGeeksforGeeks GATE Computer Science16.4K subscribersGATE PYQ - Parsing and SDT (Continued) Part 3 with Joyojyoti AcharyaWatch 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:0028:48 / 52:18•Live•<div class="player-unavailable"><h1 class="message">An error occurred.</h1><div class="submessage"><a href="https://www.youtube.com/watch?v=Sn5eIxvrNBc" 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-2000 | Question 41
GATE | GATE-CS-2001 | Question 39
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
DAX Filter - ALL function

Returns all the rows in a table or all the values in a column, ignoring any filters that might have been applied. This function is useful for clearing filters and creating calculations on all the rows in a table.
ALL ({<table> | <column>, [<column>], [<column>] ...}) 

table
The table that you want to clear filters on.
column
The column that you want to clear filters on.
The argument to the ALL function must be either a reference to a base table or one or more references to base columns. You cannot use table expressions or column expressions with the ALL function.
The table or column or columns with filters removed.
ALL function is not used by itself, but serves as an intermediate function that can be used to change the set of results over which some other calculation is performed.
= COUNTA (Results[Medal])/CALCULATE (COUNTA (Results[Medal], ALL (Results)) 
With this DAX formula, all the rows in the Results table are taken into account in the CALCULATE function with the filter containing the ALL function. This way, you have the total count in the denominator.

    53 Lectures 
     5.5 hours 

 Abhay Gadiya

    24 Lectures 
     2 hours 

 Randy Minder

    26 Lectures 
     4.5 hours 

 Randy Minder
 Print
 Add Notes
 Bookmark this page
Find the version of the Pandas and its dependencies in Python

Pandas is the important package for data analysis in Python. There are different versions available for Pandas. Due to some version mismatch, it may create some problems. So we need to find the version numbers of the Pandas. We can see them easily using the following code.
We can use the command like below, to get the version −
pandas.__version__
>>> import pandas as pd
>>> print(pd.__version__)
0.25.2
>>>
We can also get the version of the dependencies using the function like below −
pandas.show_versions()

>>> pd.show_versions()
INSTALLED VERSIONS
------------------
commit : None
python : 3.7.1.final.0
python-bits : 64
OS : Windows
OS-release : 7
machine : AMD64
processor : Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None

pandas : 0.25.2
numpy : 1.15.3
pytz : 2018.7
dateutil : 2.7.4
pip : 19.2.2
setuptools : 39.0.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.2.5
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : 4.6.3
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.2.5
matplotlib : 3.0.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
>>>
RxJS - Creation Operator iif

This operator will decide which Observable will be subscribed.
iif(condition: Function):Observable

condition − The condition is a function if its return true the observable will be subscribed.
An observable will be returned based on the condition.
import { iif, of } from 'rxjs';
import { mergeMap, first, last } from 'rxjs/operators';

let task1 = iif(
   () => (Math.random() + 1) % 2 === 0,
   of("Even Case"),
   of("Odd Case")
);
task1.subscribe(value => console.log(value));
iff() operator acts like a ternary operator and mostly used for if-else condition cases.
Odd Case


    51 Lectures 
     4 hours 

 Daniel Stern
 Print
 Add Notes
 Bookmark this page
How to create a ColorPicker using JavaFX?

A color picker gives you a standard color palette fro which you can select a required color. You can create a color picker by instantiating the javafx.scene.control.ColorPicker class.
The following Example demonstrates the creation of a ColorPicker.
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.ColorPicker;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.FontWeight;
import javafx.stage.Stage;
public class ColorPickerExample extends Application {
   public void start(Stage stage) {
      //Setting the label
      Label label = new Label("Select Desired Color:");
      Font font = Font.font("verdana", FontWeight.BOLD, FontPosture.REGULAR, 12);
      label.setFont(font);
      //Creating a Color picker
      ColorPicker picker = new ColorPicker();
      //Creating a hbox to hold the pagination
      HBox hbox = new HBox();
      hbox.setSpacing(20);
      hbox.setPadding(new Insets(25, 50, 50, 60));
      hbox.getChildren().addAll(label, picker);
      //Setting the stage
      Group root = new Group(hbox);
      Scene scene = new Scene(root, 595, 300, Color.BEIGE);
      stage.setTitle("Color Picker");
      stage.setScene(scene);
      stage.show();
   }
   public static void main(String args[]){
      launch(args);
   }
}
Unix / Linux - Shell Manpage Help

All the Unix commands come with a number of optional and mandatory options. It is very common to forget the complete syntax of these commands.
Because no one can possibly remember every Unix command and all its options, we have online help available to mitigate this right from when Unix was at its development stage.
Unix's version of Help files are called man pages. If there is a command name and you are not sure how to use it, then Man Pages help you out with every step.
Here is the simple command that helps you get the detail of any Unix command while working with the system −
$man command

Suppose there is a command that requires you to get help; assume that you want to know about pwd then you simply need to use the following command −
$man pwd

The above command helps you with the complete information about the pwd command. Try it yourself at your command prompt to get more detail.
You can get complete detail on man command itself using the following command −
$man man

Man pages are generally divided into sections, which generally vary by the man page author's preference. Following table lists some common sections −
NAME
Name of the command
SYNOPSIS
General usage parameters of the command
DESCRIPTION
Describes what the command does
OPTIONS
Describes all the arguments or options to the command
SEE ALSO
Lists other commands that are directly related to the command in the man page or closely resemble its functionality
BUGS
Explains any known issues or bugs that exist with the command or its output
EXAMPLES
Common usage examples that give the reader an idea of how the command can be used
AUTHORS
The author of the man page/command
To sum it up, man pages are a vital resource and the first avenue of research when you need information about commands or files in a Unix system.
The following link gives you a list of the most important and very frequently used Unix Shell commands.
If you do not know how to use any command, then use man page to get complete detail about the command.
Here is the list of Unix Shell - Useful Commands

    129 Lectures 
     23 hours 

 Eduonix Learning Solutions

    5 Lectures 
     4.5 hours 

 Frahaan Hussain

    35 Lectures 
     2 hours 

 Pradeep D

    41 Lectures 
     2.5 hours 

 Musab Zayadneh

    46 Lectures 
     4 hours 

 GUHARAJANM

    6 Lectures 
     4 hours 

 Uplatz
 Print
 Add Notes
 Bookmark this page
Program to add two numbers represented as strings in Python

Suppose we have two strings S, and T, these two are representing an integer, we have to add them and find the result in the same string representation.
So, if the input is like "256478921657", "5871257468", then the output will be "262350179125", as 256478921657 + 5871257468 = 262350179125
To solve this, we will follow these steps −
convert S and T from string to integer
ret = S + T
return ret as string
Let us see the following implementation to get better understanding −
 Live Demo
class Solution:
   def solve(self, a, b):
      return str(int(a) + int(b))
ob = Solution() print(ob.solve("256478921657", "5871257468"))
"256478921657", "5871257468"
262350179125
MariaDB - Alter Command

The ALTER command provides a way to change an existing table's structure, meaning modifications like removing or adding columns, modifying indices, changing data types, or changing names. ALTER also waits to apply changes when a metadata lock is active.
ALTER paired with DROP removes an existing column. However, it fails if the column is the only remaining column.
Review the example given below −
mysql> ALTER TABLE products_tbl DROP version_num;

Use an ALTER...ADD statement to add columns −
mysql> ALTER TABLE products_tbl ADD discontinued CHAR(1);

Use the keywords FIRST and AFTER to specify placement of the column −
ALTER TABLE products_tbl ADD discontinued CHAR(1) FIRST;
ALTER TABLE products_tbl ADD discontinued CHAR(1) AFTER quantity;

Note the FIRST and AFTER keywords only apply to ALTER...ADD statements. Furthermore, you must drop a table and then add it in order to reposition it.
Change a column definition or name by using the MODIFY or CHANGE clause in an ALTER statement. The clauses have similar effects, but utilize substantially different syntax.
Review a CHANGE example given below −
mysql> ALTER TABLE products_tbl CHANGE discontinued status CHAR(4);

In a statement using CHANGE, specify the original column and then the new column that will replace it. Review a MODIFY example below −
mysql> ALTER TABLE products_tbl MODIFY discontinued CHAR(4);

The ALTER command also allows for changing default values. Review an example −
mysql> ALTER TABLE products_tbl ALTER discontinued SET DEFAULT N;

You can also use it to remove default constraints by pairing it with a DROP clause −
mysql> ALTER TABLE products_tbl ALTER discontinued DROP DEFAULT;

Change table type with the TYPE clause −
mysql> ALTER TABLE products_tbl TYPE = INNODB;

Rename a table with the RENAME keyword −
mysql> ALTER TABLE products_tbl RENAME TO products2016_tbl;

 Print
 Add Notes
 Bookmark this page
Unary operator in C++

Unary operator is operators that act upon a single operand to produce a new value. The unary operators are as follows:
These operators have right-to-left associativity. Unary expressions generally involve syntax that precedes a postfix or primary expression.
Let's look at an example of the -(minus) and casting() unary operators.
#include<iostream>
using namespace std;

int main() {
   int x;
   float y = 1.23;
   x = (int) y;
   x = -x;
   cout << x;
   return 0;
}
This gives the output −
-1
How to call a JavaScript function from an onmouseover event?

The onmouseover event triggers when you bring your mouse over any element.
You can try to run the following example to learn how to call a JavaScript function from onmouseover event
Live Demo
<html>
   <head>
      <script>
         <!--
            function over() {
               document.write ("Mouse Over");
            }
            function out() {
               document.write ("Mouse Out");
            }
         //-->
      </script>
   </head>
   <body>
      <p>Bring your mouse inside the division to see the result:</p>
      <div onmouseover="over()" onmouseout="out()">
         <h2> This is inside the division </h2>
      </div>
   </body>
</html>
Random vs Secure Random numbers in Java

Java provides two classes for having random numbers generation - SecureRandom.java and Random.java.The random numbers can be used generally for encryption key or session key or simply password on web server.SecureRandom is under java.security package while Random.java comes under java.util package.The basic and important difference between both is SecureRandom generate more non predictable random numbers as it implements Cryptographically Secure Pseudo-Random Number Generator (CSPRNG) as compare to Random class which uses Linear Congruential Generator (LCG).
A important point to mention here is SecureRandom is subclass of Random class and inherits its all method such as nextBoolean(),nextDouble(),nextFloat(),nextGaussian(),nextInt() and nextLong().
Other differences between Random and SecureRandom includes −
Random class uses system time for its generation algorithm as input while SecureRandom class uses random data from operating system such as timing of I/O events.
Random class uses system time for its generation algorithm as input while SecureRandom class uses random data from operating system such as timing of I/O events.
Due to complex algorithm used in case of SecureRandom which make it more unpredictable,it takes more memory consumption in create secure random numbers than random numbers.
Due to complex algorithm used in case of SecureRandom which make it more unpredictable,it takes more memory consumption in create secure random numbers than random numbers.
Random class has only 48 bits where as SecureRandom can have upto 128 bits which makes the probability of repeating in SecureRandom are smaller.Due to this also the number of attempts to break Random number prediction comes to 2^48 while that of SecureRandom number is 2^128 which again makes it more secure.
Random class has only 48 bits where as SecureRandom can have upto 128 bits which makes the probability of repeating in SecureRandom are smaller.Due to this also the number of attempts to break Random number prediction comes to 2^48 while that of SecureRandom number is 2^128 which again makes it more secure.
 Live Demo
import java.util.Random;
public class RandomClass {
   public static void main(String args[]) {
      Random objRandom = new Random();
      int randomInt1 = objRandom.nextInt(1000);//1000 is range i.e number to be generated would be          between 0 and 1000.
      int randonInt2 = objRandom.nextInt(1000);
      System.out.println("Random Integers: " + randomInt1);
      System.out.println("Random Integers: " + randonInt2);
   }
}
Random Integers: 459
Random Integers: 348
 Live Demo
import java.security.SecureRandom;
public class SecureRandomClass {
   public static void main(String args[]) {
      SecureRandom objSecureRandom = new SecureRandom();
      int randomInt1 = objSecureRandom.nextInt(1000);
      int randonInt2 = objSecureRandom.nextInt(1000);
      System.out.println("Random Integers: " + randomInt1);
      System.out.println("Random Integers: " + randonInt2);
   }
}
Random Integers: 983
Random Integers: 579
Difference between HashMap and HashSet in Java.

HashMap and HashSet both are one of the most important classes of Java Collection framework.
Following are the important differences between HashMap and HashSet.
JavaTester.java
 Live Demo
import java.util.HashSet;
public class JavaTester {
   public static void main(String[] args){
      HashSet<String> hs = new HashSet<String>();
      hs.add("John");
      hs.add("Smith");
      hs.add("Peter");
      System.out.println("Before adding duplicate values \n\n" + hs);
      hs.add("John");
      hs.add("Smith");
      System.out.println("\nAfter adding duplicate values \n\n" + hs);
      hs.add(null);
      hs.add(null);
      System.out.println("\nAfter adding null values \n\n" + hs);
   }
}
Before adding duplicate values
[John, Smith, Peter]
After adding duplicate values
[John, Smith, Peter]
After adding null values
[null, John, Smith, Peter]
JavaTester.java
 Live Demo
import java.util.HashMap;
public class JavaTester {
   public static void main(String[] args){
      HashMap<Integer, String> hm = new HashMap<Integer, String>();
      hm.put(12, "John");
      hm.put(2, "Smith");
      hm.put(7, "Peter");
      System.out.println("\nHashMap object output :\n\n" + hm);
      hm.put(12, "Smith");
      System.out.println("\nAfter inserting duplicate key :\n\n" + hm);
   }
}
HashMap object output :
{2=Smith, 7=Peter, 12=John}
After inserting duplicate key :
{2=Smith, 7=Peter, 12=John}
How to set list in descending order in HTML5 ?

31 Mar, 2021
HTML Lists are used to create informative lists. Any list will have one or more list items. We have three types of lists in HTML.
ul: An unordered list is referred to as an ul. Simple bullets would be used to list the items.
ol: A number that is arranged in a certain order. This will list the items using various numbering schemes.
dl: A definition list. This puts the things in the same order as they will be in a dictionary.
To set reversed ordering of list items in an ordered list, we can use the reversed attribute of the <ol> element in HTML. It was introduced in HTML5 and shows the numbering in descending order.
Syntax:
<ol reversed>
  <li>ListName</li>
 </ol>
Example 1:
HTML
<!DOCTYPE html><html>    <body>  <h2>Rank in Descending order</h2>  <ol reversed>    <li>Kapil</li>    <li>sachin</li>    <li>Will</li>    <li>nikhil</li>    <li>Aakash</li>    <li>Steve</li>    <li>Rahul</li>    <li>Kane</li>    <li>Rohan</li>    <li>John</li>  </ol></body>  </html>
Output:
Example 2: Using the start attribute, you can specify at what number you want the list to begin.
HTML
<!DOCTYPE html><html>    <body>  <h2>Rank in Descending order</h2>  <ol reversed start = 23>    <li>Kapil</li>    <li>sachin</li>    <li>Will</li>    <li>nikhil</li>    <li>Aakash</li>    <li>Steve</li>    <li>Rahul</li>    <li>Kane</li>    <li>Rohan</li>    <li>John</li>  </ol></body>  </html>
Output:
HTML-Attributes
HTML-Questions
HTML-Tags
Picked
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
numpy.roll() in Python

09 Mar, 2022
The numpy.roll() function rolls array elements along the specified axis. Basically what happens is that elements of the input array are being shifted. If an element is being rolled first to the last position, it is rolled back to the first position.  
Syntax : 
numpy.roll(array, shift, axis = None)
Parameters : 
array : [array_like][array_like]Input array, whose elements we want to roll
shift : [int or int_tuple]No. of times we need to shift array elements.
        If a tuple, then axis must be a tuple of the same size, and each of the given 
        axes is shifted
        by the corresponding number. 
        If an int while axis is a tuple of ints, then the same value is used for all given axes.
axis  :  [array_like]Plane, along which we wish to roll array or shift it's elements.
Return : 
Output rolled array, with the same shape as a.
 
Python
# Python Program illustrating# numpy.roll() method  import numpy as geek  array = geek.arange(12).reshape(3, 4)print("Original array : \n", array)  # Rolling array; Shifting one placeprint("\nRolling with 1 shift : \n", geek.roll(array, 1)) # Rolling array; Shifting five placesprint("\nRolling with 5 shift : \n", geek.roll(array, 5)) # Rolling array; Shifting five places with 0th axisprint("\nRolling with 2 shift with 0 axis : \n", geek.roll(array, 2, axis = 0))
Output :  
Original array : 
 [[ 0  1  2  3]
 [ 4  5  6  7]
 [ 8  9 10 11]]

Rolling with 1 shift : 
 [[11  0  1  2]
 [ 3  4  5  6]
 [ 7  8  9 10]]

Rolling with 5 shift : 
 [[ 7  8  9 10]
 [11  0  1  2]
 [ 3  4  5  6]]

Rolling with 2 shift with 0 axis : 
 [[ 4  5  6  7]
 [ 8  9 10 11]
 [ 0  1  2  3]]
References : https://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.roll.htmlNote : These codes won’t run on online IDE’s. So please, run them on your systems to explore the working.This article is contributed by Mohit Gupta_OMG . 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. 
shauryagoyal04
vinayedula
Python numpy-arrayManipulation
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Enumerate() in Python
Different ways to create Pandas Dataframe
Read a file line by line in Python
How to Install PIP on Windows ?
Python String | replace()
*args and **kwargs in Python
Python OOPs Concepts
Python Classes and Objects
Introduction To PYTHON