code-rag-bench/online-tutorials huggingface dataset:
Neo4j - With Clause

You can chain the query arts together using the WITH clause.
Following is the syntax of the WITH clause.
MATCH (n) 
WITH n 
ORDER BY n.property 
RETURN collect(n.property) 

Following is a sample Cypher Query which demonstrates the usage of the WITH clause.
MATCH (n) 
WITH n 
ORDER BY n.name DESC LIMIT 3 
RETURN collect(n.name) 
To execute the above query, carry out the following steps −
Step 1 − Open the Neo4j desktop App and start the Neo4j Server. Open the built-in browser app of Neo4j using the URL http://localhost:7474/ as shown in the following screenshot.
Step 2 − Copy and paste the desired query in the dollar prompt and press the play button (to execute the query) highlighted in the following screenshot.
On executing, you will get the following result.
 Print
 Add Notes
 Bookmark this page
How to create an empty tuple in Python?

You can create empty tuple object by giving no elements in parentheses in assignment statement. Empty tuple object is also created by tuple() built-in function without any arguments
>>> T1 = ()
>>> T1
()
>>> T1 = tuple()
>>> T1
()
C++ Relational Operators

Try the following example to understand all the relational operators available in C++.
Copy and paste the following C++ program in test.cpp file and compile and run this program.
#include <iostream>
using namespace std;

main() {
   int a = 21;
   int b = 10;
   int c ;

   if( a == b ) {
      cout << "Line 1 - a is equal to b" << endl ;
   } else {
      cout << "Line 1 - a is not equal to b" << endl ;
   }
   
   if( a < b ) {
      cout << "Line 2 - a is less than b" << endl ;
   } else {
      cout << "Line 2 - a is not less than b" << endl ;
   }
   
   if( a > b ) {
      cout << "Line 3 - a is greater than b" << endl ;
   } else {
      cout << "Line 3 - a is not greater than b" << endl ;
   }
   
   /* Let's change the values of a and b */
   a = 5;
   b = 20;
   if( a <= b ) {
      cout << "Line 4 - a is either less than \ or equal to  b" << endl ;
   }
   
   if( b >= a ) {
      cout << "Line 5 - b is either greater than \ or equal to b" << endl ;
   }
   
   return 0;
}
When the above code is compiled and executed, it produces the following result −
Line 1 - a is not equal to b
Line 2 - a is not less than b
Line 3 - a is greater than b
Line 4 - a is either less than or euqal to  b
Line 5 - b is either greater than or equal to b


    154 Lectures 
     11.5 hours 

 Arnab Chakraborty

    14 Lectures 
     57 mins

 Kaushik Roy Chowdhury

    30 Lectures 
     12.5 hours 

 Frahaan Hussain

    54 Lectures 
     3.5 hours 

 Frahaan Hussain

    77 Lectures 
     5.5 hours 

 Frahaan Hussain

    12 Lectures 
     3.5 hours 

 Frahaan Hussain
 Print
 Add Notes
 Bookmark this page
Apply style to the parent if it has a child with CSS and HTML

Parent selectors are not present in CSS3. There is a proposed CSS4 selector, $, to do so, which could look like this (Selecting the li element) −
ul $li ul.sub { ... }
As an alternative, with jQuery, a one-liner you could make use of would be this. The: has() selector selects all elements that have one or more elements inside of them, that matches the specified selector. The <li> tag defines a list item. The <ul> tag defines an unordered (bulleted) list.
$('ul li:has(ul.sub)').addClass('has_sub');
You could then style the li.has_sub in your CSS.
Setting the position of TKinter labels

12 Jan, 2021
Tkinter is the standard GUI library for Python. Tkinter in Python comes with a lot of good widgets. Widgets are standard GUI elements, and the Label will also come under these WidgetsNote: For more information, refer to Python GUI – tkinter 
Tkinter Label is a widget that is used to implement display boxes where you can place text or images. The text displayed by this widget can be changed by the developer at any time you want. It is also used to perform tasks such as to underline the part of the text and span the text across multiple lines.
Example:  
 
We can use place() method to set the position of the Tkinter labels. 
Example 1: Placing label at the middle of the window  
Python3
import tkinter as tk  # Creating the root windowroot = tk.Tk() # creating the Label with# the text MiddleLabel_middle = tk.Label(root,                        text ='Middle') # Placing the Label at# the middle of the root window# relx and rely should be properly# set to position the label on# root windowLabel_middle.place(relx = 0.5,                   rely = 0.5,                   anchor = 'center')# Execute Tkinterroot.mainloop()
Output: 
Example 2: Placing label at the lower left side of window  
Python3
# Import Moduleimport tkinter as tk # Create Objectroot = tk.Tk() # Create Label and add some textLower_left = tk.Label(root,text ='Lower_left') # using place method we can set the position of labelLower_left.place(relx = 0.0,                 rely = 1.0,                 anchor ='sw') # Execute Tkinterroot.mainloop()
Output 
Example 3: Placing label at the upper right side of window 
Python3
# Import Moduleimport tkinter as tk # Create Objectroot = tk.Tk() # Create Label and add some textUpper_right = tk.Label(root,text ='Upper_right') # using place method we can set the position of labelUpper_right.place(relx = 1.0,                  rely = 0.0,                  anchor ='ne') # Execute Tkinterroot.mainloop()
Output 
 
abhigoya
Python-tkinter
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Convert integer to string in Python
Python OOPs Concepts
Python | os.path.join() method
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Create a Pandas DataFrame from Lists
How To Convert Python Dictionary To JSON?
Basis Path Testing

Basis path testing, a structured testing or white box testing technique used for designing test cases intended to examine all possible paths of execution at least once. Creating and executing tests for all possible paths results in 100% statement coverage and 100% branch coverage.
Function fn_delete_element (int value, int array_size, int array[])
{
	1 int i;
	location = array_size + 1; 

	2 for i = 1 to array_size
	3 if ( array[i] == value )
	4 location = i;
	 end if;
	 end for;

	5 for i = location to array_size
	6 array[i] = array[i+1];
	end for;
	7 array_size --;
} 
Step 1 : Draw the Flow Graph of the Function/Program under consideration as shown below:
Step 2 : Determine the independent paths.
Path 1:  1 - 2 - 5 - 7 
Path 2:  1 - 2 - 5 - 6 - 7 
Path 3:  1 - 2 - 3 - 2 - 5 - 6 - 7
Path 4:  1 - 2 - 3 - 4 - 2 - 5 - 6 - 7
Sorting a 2D Array according to values in any given column in Java

11 Dec, 2018
We are given a 2D array of order N X M and a column number K ( 1<=K<=m). Our task is to sort the 2D array according to values in the Column K.
Examples:
Input : If our 2D array is given as (Order 4X4) 
        39 27 11 42 
        10 93 91 90 
        54 78 56 89 
        24 64 20 65
        Sorting it by values in column 3 
Output : 39 27 11 42 
         24 64 20 65 
         54 78 56 89 
         10 93 91 90 

The Idea is to use Arrays.sort in Java.
// Java Code to sort 2D Matrix// according to any Columnimport java.util.*;class sort2DMatrixbycolumn {      // Function to sort by column    public static void sortbyColumn(int arr[][], int col)    {        // Using built-in sort function Arrays.sort        Arrays.sort(arr, new Comparator<int[]>() {                      @Override                        // Compare values according to columns          public int compare(final int[] entry1,                              final int[] entry2) {              // To sort in descending order revert             // the '>' Operator            if (entry1[col] > entry2[col])                return 1;            else                return -1;          }        });  // End of function call sort().    }          // Driver Code    public static void main(String args[])    {        int matrix[][] = { { 39, 27, 11, 42 },                           { 10, 93, 91, 90 },                           { 54, 78, 56, 89 },                           { 24, 64, 20, 65 } };        // Sort this matrix by 3rd Column        int col = 3;        sortbyColumn(matrix, col - 1);          // Display the sorted Matrix        for (int i = 0; i < matrix.length; i++) {            for (int j = 0; j < matrix[i].length; j++)                System.out.print(matrix[i][j] + " ");            System.out.println();        }    }}
Output:
 39 27 11 42 
24 64 20 65 
54 78 56 89 
10 93 91 90 

Time complexity : O(n Log n) where n is number of rows. Here assumption is that the sort() function uses a O(n Log n) sorting algorithm.
This article is contributed by DANISH KALEEM. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Java-Array-Programs
Java-Arrays
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Object Oriented Programming (OOPs) Concept in Java
How to iterate any Map in Java
Interfaces in Java
HashMap in Java with Examples
ArrayList in Java
Stream In Java
Collections in Java
Multidimensional Arrays in Java
Singleton Class in Java
Stack Class in Java
Python PIL | ImageDraw.Draw.ellipse()

02 Aug, 2019
PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The ImageDraw module provide simple 2D graphics for Image objects. You can use this module to create new images, annotate or retouch existing images, and to generate graphics on the fly for web use.
ImageDraw.Draw.ellipse() Draws an ellipse inside the given bounding box.
Syntax: PIL.ImageDraw.Draw.ellipse(xy, fill=None, outline=None)
Parameters:xy – Four points to define the bounding box. Sequence of either [(x0, y0), (x1, y1)] or [x0, y0, x1, y1].outline – Color to use for the outline.fill – Color to use for the fill.
Returns: An Image object in ellipse shape.
     # importing image object from PILimport mathfrom PIL import Image, ImageDraw  w, h = 220, 190shape = [(40, 40), (w - 10, h - 10)]  # creating new Image objectimg = Image.new("RGB", (w, h))  # create ellipse imageimg1 = ImageDraw.Draw(img)  img1.ellipse(shape, fill ="# ffff33", outline ="red")img.show()
Output:
Another Example: Here we use different colour for filling.
     # importing image object from PILimport mathfrom PIL import Image, ImageDraw  w, h = 220, 190shape = [(40, 40), (w - 10, h - 10)]  # creating new Image objectimg = Image.new("RGB", (w, h))  # create ellipse imageimg1 = ImageDraw.Draw(img)  img1.ellipse(shape, fill ="# 800080", outline ="green")img.show()
Output:
Python-pil
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Convert integer to string in Python
Python | os.path.join() method
Create a Pandas DataFrame from Lists
Ruby | String gsub Method

12 Dec, 2019
gsub is a String class method in Ruby which is used to return a copy of the given string with all occurrences of pattern substituted for the second argument.
Syntax: str.gsub(pattern, replacement)
Parameters: Here, str is the given string. pattern may be specified regex or character set to be removed. replacement is the set of characters which is to be put.
Returns:A copy of the string with all occurrences of pattern substituted for the second argument.
Example 1:
# Ruby program to demonstrate # the gsub method        # Taking a string and # using the methodputs "Sample".gsub(/[amuyt]/, '*')                 puts "Program".gsub(/([gmra])/, '<\1>')      
Output:
S**ple
Po

Example 2:
# Ruby program to demonstrate # the gsub method        # Taking a string and # using the methodputs "Ruby".gsub(/[tyru]/, '<\1>')                 puts "String".gsub(/([igtr])/, '*')      
Output:
Rb
S***n*

Ruby String-class
Ruby-Methods
Ruby
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Make a Custom Array of Hashes in Ruby?
Ruby | Array count() operation
Ruby | Array slice() function
Ruby | push() function
Include v/s Extend in Ruby
Global Variable in Ruby
Ruby | Array select() function
Ruby | Enumerator each_with_index function
Ruby | Case Statement
Ruby | unless Statement and unless Modifier
Class getName() method in Java with Examples

27 Jan, 2022
The getName() method of java.lang.Class class is used to get the name of this entity. This entity can be a class, an array, an interface, etc. The method returns the name of the entity as a String.Syntax:  
public String getName()
Parameter: This method does not accept any parameter.Return Value: This method returns the name of the entity as a String.Below programs demonstrate the getName() method.Example 1: 
Java
// Java program to demonstrate getName() method public class Test {    public static void main(String[] args)        throws ClassNotFoundException    {         // returns the Class object for this class        Class myClass = Class.forName("Test");         System.out.println("Class represented by myClass: "                           + myClass.toString());         // Get the name of myClass        // using getName() method        System.out.println("Name of myClass: "                           + myClass.getName());    }}
Class represented by myClass: class Test
Name of myClass: Test
 
Example 2: 
Java
// Java program to demonstrate getName() method public class Test {     class Arr {    }     public static void main(String[] args)        throws ClassNotFoundException    {         // returns the Class object for A        Class arrClass = Arr.class;         // Get the name of arrClass        // using getName() method        System.out.println("Name of arrClass: "                           + arrClass.getName());    }}
Name of arrClass: Test$Arr
 
Reference: https://docs.oracle.com/javase/9/docs/api/java/lang/Class.html#getName– 
adnanirshad158
Java-Functions
Java-lang package
Java.lang.Class
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Object Oriented Programming (OOPs) Concept in Java
How to iterate any Map in Java
HashMap in Java with Examples
ArrayList in Java
Stream In Java
Collections in Java
Multidimensional Arrays in Java
Singleton Class in Java
Stack Class in Java
Set in Java
\pmatrix - Tex Command

\pmatrix - Used to create matrix enclosed in parentheses.
{ \pmatrix { <math> & <math> ... \cr <repeat as needed> }}
\pmatrix command is used to create matrix enclosed in parentheses; alignment occurs at the ampersands; a double-backslash can be used in place of the \cr; the final \\ or \cr is optional

A = \pmatrix{
a_{11} & a_{12} & \ldots & a_{1n} \cr
a_{21} & a_{22} & \ldots & a_{2n} \cr
\vdots & \vdots & \ddots & \vdots \cr
a_{m1} & a_{m2} & \ldots & a_{mn} \cr
}


A=(a11a12...a1na21a22...a2n⋮⋮⋱⋮am1am2...amn)



A = \pmatrix{
a_{11} & a_{12} & \ldots & a_{1n} \cr
a_{21} & a_{22} & \ldots & a_{2n} \cr
\vdots & \vdots & \ddots & \vdots \cr
a_{m1} & a_{m2} & \ldots & a_{mn} \cr
}


A=(a11a12...a1na21a22...a2n⋮⋮⋱⋮am1am2...amn)


A = \pmatrix{
a_{11} & a_{12} & \ldots & a_{1n} \cr
a_{21} & a_{22} & \ldots & a_{2n} \cr
\vdots & \vdots & \ddots & \vdots \cr
a_{m1} & a_{m2} & \ldots & a_{mn} \cr
Pascal - Basic Syntax

You have seen a basic structure of pascal program, so it will be easy to understand other basic building blocks of the pascal programming language.
A variable definition is put in a block beginning with a var keyword, followed by definitions of the variables as follows:
var
A_Variable, B_Variable ... : Variable_Type;
Pascal variables are declared outside the code-body of the function which means they are not declared within the begin and end pairs, but they are declared after the definition of the procedure/function and before the begin keyword. For global variables, they are defined after the program header.
In Pascal, a procedure is set of instructions to be executed, with no return value and a function is a procedure with a return value. The definition of function/procedures will be as follows −
Function Func_Name(params...) : Return_Value;
Procedure Proc_Name(params...);
The multiline comments are enclosed within curly brackets and asterisks as (* ... *). Pascal allows single-line comment enclosed within curly brackets { ... }. 
(* This is a multi-line comments
   and it will span multiple lines. *)

{ This is a single line comment in pascal }
Pascal is a case non-sensitive language, which means you can write your variables, functions and procedure in either case. Like variables A_Variable, a_variable and A_VARIABLE have same meaning in Pascal.
Pascal programs are made of statements. Each statement specifies a definite job of the program. These jobs could be declaration, assignment, reading data, writing data, taking logical decisions, transferring program flow control, etc.
For example −
readln (a, b, c);
s := (a + b + c)/2.0;
area := sqrt(s * (s - a)*(s-b)*(s-c));
writeln(area);        
The statements in Pascal are designed with some specific Pascal words, which are called the reserved words. For example, the words, program, input, output, var, real, begin, readline, writeline and end are all reserved words.
Following is a list of reserved words available in Pascal.
The Pascal character set consists of −
All upper case letters (A-Z)
All upper case letters (A-Z)
All lower case letters (a-z)
All lower case letters (a-z)
All digits (0-9)
All digits (0-9)
Special symbols   - + * / := , . ;. () [] = {} ` white space
Special symbols   - + * / := , . ;. () [] = {} ` white space
The entities in a Pascal program like variables and constants, types, functions, procedures and records, etc., have a name or identifier.  An identifier is a sequence of letters and digits, beginning with a letter. Special symbols and blanks must not be used in an identifier.

    94 Lectures 
     8.5 hours 

 Stone River ELearning
 Print
 Add Notes
 Bookmark this page
Explain else-if ladder statement in C language

This is the most general way of writing a multi-way decision.
Refer the syntax given below −
if (condition1)
stmt1;
else if (condition2)
stmt2;
- - - - -
- - - - -
else if (condition n)
stmtn;
else
stmt x;
Refer the algorithm given below −
START
Step 1: Declare int variables.
Step 2: Read a,b,c,d values at runtime
Step 3: i. if(a>b && a>c && a>d)
Print a is largest
ii.else if(b>c && b>a && b>d)
Print b is largest
iii. else if(c>d && c>a && c>b)
Print c is largest
iv. else
print d is largest
STOP
Following is the C program to execute Else If Ladder conditional operators −
 Live Demo
#include<stdio.h>
void main (){
   int a,b,c,d;
   printf("Enter the values of a,b,c,d: ");
   scanf("%d%d%d%d",&a,&b,&c,&d);
   if(a>b && a>c && a>d){
      printf("%d is the largest",a);
   }else if(b>c && b>a && b>d){
      printf("%d is the largest",b);
   }else if(c>d && c>a && c>b){
      printf("%d is the largest",c);
   }else{
      printf("%d is the largest",d);
   }
}
You will see the following output −
Run 1:Enter the values of a,b,c,d: 2 4 6 8
8 is the largest
Run 2: Enter the values of a,b,c,d: 23 12 56 23
56 is the largest
Consider another C program which display the grade of student using else if ladder −
 Live Demo
#include<stdio.h>
int main(){
   int marks;
   printf("Enter the marks of a student:\n");
   scanf("%d",&marks);
   if(marks <=100 && marks >= 90)
      printf("Grade=A");
   else if(marks < 90 && marks>= 80)
      printf("Grade=B");
   else if(marks < 80 && marks >= 70)
      printf("Grade=C");
   else if(marks < 70 && marks >= 60)
      printf("Grade=D");
   else if(marks < 60 && marks > 50)
      printf("Grade=E");
   else if(marks == 50)
      printf("Grade=F");
   else if(marks < 50 && marks >= 0)
      printf("Fail");
   else
      printf("Enter a valid score between 0 and 100");
   return 0;
}
You will see the following output −
Run 1:
Enter the marks of a student:78
Grade=C
Run 2:
Enter the marks of a student:98
Grade=A
Python | Pandas Timestamp.to_datetime64 - GeeksforGeeks

17 Jan, 2019
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
Pandas Timestamp.to_datetime64() function return a numpy.datetime64 object with ‘ns’ precision for the given Timestamp object.
Syntax :Timestamp.to_datetime64()
Parameters : None
Return : numpy.datetime64 object
Example #1: Use Timestamp.to_datetime64() function to return a numpy.datetime64 object for the given Timestamp object.
# importing pandas as pdimport pandas as pd  # Create the Timestamp objectts = pd.Timestamp(year = 2011,  month = 11, day = 21,                   hour = 10, second = 49, tz = 'US/Central')   # Print the Timestamp objectprint(ts)
Output :
Now we will use the Timestamp.to_datetime64() function to return a numpy.datetime64 object for the given Timestamp.
# return numpy.datetime64 objectts.to_datetime64()
Output :As we can see in the output, the Timestamp.to_datetime64() function has returned a numpy.datetime64 object for the given Timestamp object with ‘ns’ precision. Example #2: Use Timestamp.to_datetime64() function to return a numpy.datetime64 object for the given Timestamp object.
# importing pandas as pdimport pandas as pd  # Create the Timestamp objectts = pd.Timestamp(year = 2009, month = 5, day = 31,                   hour = 4, second = 49, tz = 'Europe/Berlin')  # Print the Timestamp objectprint(ts)
Output :
Now we will use the Timestamp.to_datetime64() function to return a numpy.datetime64 object for the given Timestamp.
# return numpy.datetime64 objectts.to_datetime64()
Output :
As we can see in the output, the Timestamp.to_datetime64() function has returned a numpy.datetime64 object for the given Timestamp object with ‘ns’ precision.
Python Pandas-Timestamp
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python Dictionary
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python String | replace()
Python program to convert a list to string
Reading and Writing to text files in Python
sum() function in Python
Size of ROM for n-bit Adder/Subtractor - GeeksforGeeks

15 Feb, 2021
ROM is a read-only memory which is used to store the data. The memory in the ROM is organized as a two-dimensional array of memory cells. The memory will read or write the contents of one of the rows of the array. This row is specified by an Address which are bits. The value read or written is called Data. 
Figure a) shows a memory array with two address bits and three data bits. The two address bits specify one of the four rows (data words) in the array. Each data word is three bits wide. Figure b) shows some possible contents of the memory array.
An array of memory cells with n-bit addresses and m-bit data will have rows and m columns as shown in the figure. Each row of data is called a word. Thus, the array contains a word x m -bit array.
In the case of figure, the array of memory cells with 2-bit addresses and 3-bit Data will have rows which are 4 and 3 columns, so thus the array contains x m = x 3 = 4-word x 3 -bit array.
To get clear understanding let’s take 10 address bits and 32 Data bits then the size of the ROM would be –
2^(10) x 32 = 1024 x 32 = 32 Kb
Now to find the size of the ROM we need to find the number of inputs and output bits –
Number of inputs = n(A) + n(B) + 1(Cin) = 2n+1 address bits
Number of outputs = n(sum/diff) + 1(Cout) = n+1  
Thus, this would require a 2^(2n+1) x (n+1) -bit ROM.
Here, n(A) means the number of inputs for A and n(B) means the number of inputs for B.
Example-1 : Size of the ROM you could use to program for 16-bit adder/subtractor with Cin and Cout is ____?
Solution : 
Number of inputs = 16 (A) + 16 (B) + 1(Cin) = 2(16)+1 = 33 address bits.
Number of outputs = 16 (sum/diff) + 1(Cout) = 16+1 = 17
Thus, this would require a 2^(2n+1)x(n+1) = 2^(33)x17 bit ROM.
Example-2 : Size of the ROM you could use to program for 8-bit adder/subtractor with Cin and Cout is ____?
Solution :
Number of inputs = 8 (A) + 8 (B) + 1(Cin) = 2(8)+1 = 17 address bits.
Number of outputs = 8 (sum/diff) + 1(Cout) = 8+1 = 9
Thus, this would require a 2^(2n+1)x(n+1) = 2^(17)x9 bit ROM.
Technical Scripter 2020
Computer Organization & Architecture
DIgital Logic & Design
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Direct Access Media (DMA) Controller in Computer Architecture
Computer Organization and Architecture | Pipelining | Set 2 (Dependencies and Data Hazard)
Architecture of 8085 microprocessor
Pin diagram of 8086 microprocessor
I2C Communication Protocol
Basic Conversion of Logic Gates
Advantages and Disadvantages of Embedded System
Introduction of Algorithmic State Machines (ASMs)
Different ways to represent Signed Integer
How to Install Logisim on Windows?
PHP | date_sub() Function - GeeksforGeeks

28 Nov, 2019
The date_sub() is an inbuilt function in PHP which is used to subtract some days, months, years, hours, minutes, and seconds from given date. The function returns a DateTime object on success and returns FALSE on failure.
Syntax:
date_sub($object, $interval)
Parameters: The date_sub() function accepts two parameters as described below:
$object: It is a mandatory parameter which specifies the DateTime object returned by date_create()
$interval: It is a mandatory parameter which specifies the DateInterval object which we want to subtract.
Return Value: It returns a DateTime object after subtracting interval.
Below programs illustrate the date_sub() function:Program 1:
<?php// PHP program to illustrate date_sub() function  // Subtract 5 years from the 25th of June, 2018$date = date_create('2018-06-25');date_sub($date, date_interval_create_from_date_string('5 years'));  echo date_format($date, 'Y-m-d') . "\n";    // Subtract 5 month from the 25th of June, 2018$date = date_create('2018-06-25');date_sub($date, date_interval_create_from_date_string('5 month'));  echo date_format($date, 'Y-m-d'). "\n";  // // Subtract 5 days from the 25th of June, 2018$date = date_create('2018-06-25');date_sub($date, date_interval_create_from_date_string('5 days'));  echo date_format($date, 'Y-m-d');  ?>
Output:
2013-06-25
2013-01-25
2013-01-20

Program 2: When invalid date is passed the date_sub function gives warnings:
<?php// PHP program to illustrate date_sub function  // date_sub function gives warning when// we passing invalid date$date = date_create('2018-25-25');  date_sub($date, date_interval_create_from_date_string('5 years'));  echo date_format($date, 'Y-m-d') . "\n";?>
Output:
PHP Warning: date_sub() expects parameter 1 to be DateTime, boolean given in/home/2662efc623a406b7cb06a7320e7abf50.php on line 8
PHP Warning: date_format() expects parameter 1 to be DateTimeInterface, booleangiven in/home/2662efc623a406b7cb06a7320e7abf50.php on line 9

Reference: http://php.net/manual/en/function.date-sub.php
ManasChhabra2
PHP-date-time
PHP-function
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to execute PHP code using command line ?
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
PHP in_array() Function
How to pop an alert message box using PHP ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Python | sympy.atan() method - GeeksforGeeks

17 Jan, 2022
In simpy, atan() method is an inverse tangent function. Using the atan(x) method in simpy module, we can compute the inverse tangent or arctangent of x.
Syntax : sympy.atan(x)

Return : Returns the arc tangent of x 
Code #1:Below is the example using atan() method to find inverse tangent function.
Python3
# importing sympy libraryfrom sympy import *  # calling atan() method on expressiongeek1 = atan(-1)geek2 = atan(1)  print(geek1)print(geek2)
-pi/4
pi/4

 Code #2:
Python3
# importing sympy libraryfrom sympy import atan    # calling atan() method on expressiongeek = atan(1)print(geek)
pi/4
surindertarika1234
SymPy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get unique values from a list
Python | os.path.join() method
Create a directory in Python
Python | Pandas dataframe.groupby()
Find the size of a Dictionary in Python - GeeksforGeeks

17 May, 2020
Dictionary in Python is an unordered collection of data values, used to store data values like a map, which unlike other Data Types that hold only single value as an element, Dictionary holds key:value pair. Key value is provided in the dictionary to make it more optimized. The size of a Dictionary means the amount of memory (in bytes) occupied by a Dictionary object. In this article, we will learn various ways to get the size of a python Dictionary.
1.Using getsizeof() function:
The getsizeof() function belongs to the python’s sys module. It has been implemented in the below example.
Example 1:
import sys  # sample Dictionariesdic1 = {"A": 1, "B": 2, "C": 3} dic2 = {"Geek1": "Raju", "Geek2": "Nikhil", "Geek3": "Deepanshu"}dic3 = {1: "Lion", 2: "Tiger", 3: "Fox", 4: "Wolf"}  # print the sizes of sample Dictionariesprint("Size of dic1: " + str(sys.getsizeof(dic1)) + "bytes")print("Size of dic2: " + str(sys.getsizeof(dic2)) + "bytes")print("Size of dic3: " + str(sys.getsizeof(dic3)) + "bytes")
Output:
Size of dic1: 216bytes
Size of dic2: 216bytes
Size of dic3: 216bytes
1.Using inbuilt __sizeof__() method:
Python also has an inbuilt __sizeof__() method to determine the space allocation of an object without any additional garbage value. It has been implemented in the below example.Example 2:
# sample Dictionariesdic1 = {"A": 1, "B": 2, "C": 3} dic2 = {"Geek1": "Raju", "Geek2": "Nikhil", "Geek3": "Deepanshu"}dic3 = {1: "Lion", 2: "Tiger", 3: "Fox", 4: "Wolf"}  # print the sizes of sample Dictionariesprint("Size of dic1: " + str(dic1.__sizeof__()) + "bytes")print("Size of dic2: " + str(dic2.__sizeof__()) + "bytes")print("Size of dic3: " + str(dic3.__sizeof__()) + "bytes")
Output:
Size of dic1: 216bytes
Size of dic2: 216bytes
Size of dic3: 216bytes
Python dictionary-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
PyQt5 QDateTimeEdit – Setting Display format - GeeksforGeeks

14 Jul, 2020
In this article we will see how we can set display format of date to the QDateTimeEdit. Display format property holds the format used to display the time/date of the date time edit. By default, we see date in format like 01-01-2000 although by setting display format we can make this date as 1 Jan 2020.
In order to do this we will use setDisplayFormat method with the QDateTimeEdit object.
Syntax : datetimeedit.setDisplayFormat(format)
Argument : It takes string as argument
Return : It returns None
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, 500, 400)          # calling method        self.UiComponents()          # showing all the widgets        self.show()      # method for components    def UiComponents(self):          # creating a QDateTimeEdit widget        datetimeedit = QDateTimeEdit(self)          # setting geometry        datetimeedit.setGeometry(100, 100, 150, 35)          # setting date format        datetimeedit.setDisplayFormat("dd MMM yyyy")          # creating a label        label = QLabel("GeeksforGeeks", self)          # setting geometry to the label        label.setGeometry(100, 200, 300, 80)          # making label multi line        label.setWordWrap(True)           # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
Output :
Python PyQt-QDateTimeEdit
Python-gui
Python-PyQt
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
cal command in Linux with Examples - GeeksforGeeks

28 Jul, 2021
If a user wants a quick view of the calendar in the Linux terminal, cal is the command for you. By default, the cal command shows the current month calendar as output. 
cal command is a calendar command in Linux which is used to see the calendar of a specific month or a whole year. 
Syntax: 
cal [ [ month ] year]
The rectangular bracket means it is optional, so if used without an option, it will display a calendar of the current month and year.  
cal : Shows current month calendar on the terminal with the current date highlighted.  
cal -y : Shows the calendar of the complete current year with the current date highlighted.
cal 08 2000 : Shows calendar of selected month and year.  
cal 2018 : Shows the whole calendar of the year.  
cal 2018 | more : But year may not be visible in the same screen use more with cal use spacebar to scroll down.  
cal -3 : Shows calendar of previous, current and next month  
cal -j : Shows the calendar of the current month in the Julian calendar format not in the default Gregorian calendar format. In Julian calendar format, the date does not reset to 1 after every month’s end i.e. after 31st Jan,  Feb will start as 32nd Feb, not as 1st Feb. But in the Gregorian calendar format, the date is reset to 1 after every month’s end i.e after  31st Jan, Feb will start as of 1st Feb.
YouTubeGeeksforGeeks507K subscribersLinux Tutorials | General Purpose Utilities | GeeksforGeeksWatch 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:000:00 / 4:09•Live•<div class="player-unavailable"><h1 class="message">An error occurred.</h1><div class="submessage"><a href="https://www.youtube.com/watch?v=g6cPFj9ptdc" target="_blank">Try watching this video on www.youtube.com</a>, or enable JavaScript if it is disabled in your browser.</div></div>
sanju6890
Linux-basic-commands
linux-command
Picked
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
ZIP command in Linux with examples
TCP Server-Client implementation in C
tar command in Linux with examples
curl command in Linux with Examples
Conditional Statements | Shell Script
UDP Server-Client implementation in C
Tail command in Linux with examples
echo command in Linux with Examples
Compiling with g++
scp command in Linux with Examples
What is MySQL NOT NULL constraint and how can we declare a field NOT NULL while creating a table?

Actually, MySQL NOT NULL constraint restricts a column of the table from having a NULL value. Once we applied NOT NULL constraint to a column, then we cannot pass a null value to that column. It cannot be declared on the whole table i.e., in other words, we can say that NOT NULL is a column level constraint.
For declaring a field NOT NULL, we have to use NOT NULL keyword while defining the column in CREATE TABLE statement.
mysql> Create table Employee(ID Int NOT NULL, First_Name Varchar(20), Last_name Varchar(20), Designation Varchar(15));
Query OK, 0 rows affected (0.59 sec)
In the query above, we have applied NOT NULL constraint on the field ‘ID’ of ‘Employee’ table. Now, the column ‘ID’ cannot take NULL value. It can be also checked from DESCRIBE statement that ID filed cannot accept NULL values.
mysql> DESCRIBE Employee123\G
*************************** 1. row ***************************
  Field: ID
   Type: int(11)
   Null: NO
    Key:
Default: NULL
  Extra:
*************************** 2. row ***************************
  Field: First_Name
   Type: varchar(20)
   Null: YES
    Key:
Default: NULL
  Extra:
*************************** 3. row ***************************
  Field: Last_name
   Type: varchar(20)
   Null: YES
    Key:
Default: NULL
  Extra:
*************************** 4. row ***************************
  Field: Designation
   Type: varchar(15)
   Null: YES
    Key:
Default: NULL
  Extra:
4 rows in set (0.03 sec)
Node.js v8.deserialize() Method - GeeksforGeeks

28 Jul, 2020
The v8.deserialize() method is an inbuilt application programming interface of the v8 module which is used to deserialize a buffered data into JS value using default deserializer.
Syntax:
v8.deserialize( buffer );
Parameters: This method accepts one parameter as mentioned above and described below:
buffer: This is a required parameter, a Buffer / TypedArray / DataView, refers to a buffered data to be deserialized.
Return Value: This method returns JS value after deserializing the buffered data.
Below examples illustrate the use of v8.deserialize() method in Node.js.
Example 1: Filename: index.js
// Accessing v8 moduleconst v8 = require('v8');  // Calling v8.deserialize() console.log(v8.deserialize(v8.serialize("geeksforgeeks")));
Run index.js file using the following command:
node index.js
Output:
geeksforgeeks

Example 2: Filename: index.js
// Accessing v8 moduleconst v8 = require('v8');  // Calling v8.deserialize() deserialized_data = v8.deserialize(v8.serialize("abcdefg"));console.log("\nDeserialized data is ");console.log(deserialized_data);  deserialized_data = v8.deserialize(v8.serialize(58375693));console.log("\nDeserialized data is ");console.log(deserialized_data);  deserialized_data = v8.deserialize(v8.serialize(73847.0234));console.log("\nDeserialized data is ");console.log(deserialized_data);  deserialized_data = v8.deserialize(v8.serialize('Geek'));console.log("\nDeserialized data is ");console.log(deserialized_data);
Run index.js file using the following command:
node index.js
Output:
Deserialized data is
abcdefg

Deserialized data is
58375693

Deserialized data is
73847.0234

Deserialized data is
Geek

Reference: https://nodejs.org/api/v8.html#v8_v8_deserialize_buffer
Node.js-V8-Module
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Node.js fs.readFileSync() Method
How to update Node.js and NPM to next version ?
Node.js fs.writeFile() Method
How to update NPM ?
Difference between promise and async await in Node.js
Roadmap to Become a Web Developer in 2022
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Convert a string to an integer in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
JavaFX Label setLabelFor() method example

In JavaFX, you can create a label by instantiating the javafx.scene.control.Label class. This class provides a method named labelFor(). Using this method, you can set the current label as a label for another control node.
This method comes handy while setting, mnemonics, and accelerator parsing.
In the following JavaFX example, we have created a label, a text field, and a button. Using the labelFor() method we have associated the label (Text) with a text field, enabling the mnemonic parsing (T). Therefore, on the output window, if you press Alt + t, the text field will be focused.
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class LabelFor_Example extends Application {
   public void start(Stage stage) {
      //Creating nodes
      TextField textField = new TextField();
      Button button = new Button("Click Me");
      //creating labels
      Label label1 = new Label("_Text");
      label1.setMnemonicParsing(true);
      label1.setLabelFor(textField);
      //Adding labels for nodes
      HBox box1 = new HBox(5);
      box1.setPadding(new Insets(25, 5 , 5, 50));
      box1.getChildren().addAll(label1, textField, button);
      //Setting the stage
      Scene scene = new Scene(box1, 595, 150, Color.BEIGE);
      stage.setTitle("JavaFX Example");
      stage.setScene(scene);
      stage.show();
   }
   public static void main(String args[]){
      launch(args);
   }
}
How to create a module in Java 9?

The module is a package of code and data. The module's code has organized into multiple packages and each package contains java classes and interfaces. The module's data includes resource files and other static information. An important feature of the module is that it contains "module-info.class" file that describes the module in the root directory of its artifacts. The artifact format can be a traditional JAR file or a JMOD file. This file is compiled from the source code file module-info.java in the root directory.
We can declare a module in module-info.java file with the new keyword module, the basic module declaration for a module com.company.mymodule is given below.
module com.tutorialspoint.mymodule {
}
Create a folder C:\JAVA\src and then create a folder com.tutorialspoint.greetings with the same name as the module.
Create a module-info.java file in the C:\JAVA\src\com.tutorialspoint.greetings directory with the following code.
module com.tutorialspoint.greetings {
}
Add a source code file to the module, and create a file JavaTest.java in the directory C:\JAVA\src\com.tutorialspoint.greetings\com\tutorialspoint\greetings, the code is as follows:
package com.tutorialspoint.greetings;

public class JavaTest {
   public static void main(String args[]) {
      System.out.println("Hello Tutorialspoint!");
   }
}
Create a folder C:\JAVA\mods, and then create a com.tutorialspoint.greetings folder in this directory, and compile the module to this directory.
C:\JAVA>javac -d mods/com.tutorialspoint.greetings src/com.tutorialspoint.greetings/module-info.java
C:\JAVA>javac -d mods/com.tutorialspoint.greetings src/com.tutorialspoint.greetings/com/tutorialspoint/greetings/JavaTest.java
Execute the module and see the output
C:\JAVA>java --module-path mods -m com.tutorialspoint.greetings/com.tutorialspoint.greetings.JavaTest
Hello Tutorialspoint!
In the above, module-path specifies the path where the module is located and -m specifies the main module.
static Keyword in Java

Static Variables
The static keyword is used to create variables that will exist independently of any instances created for the class. Only one copy of the static variable exists regardless of the number of instances of the class.
Static variables are also known as class variables. Local variables cannot be declared static.
Static Methods
The static keyword is used to create methods that will exist independently of any instances created for the class.
Static methods do not use any instance variables of any object of the class they are defined in. Static methods take all the data from parameters and compute something from those parameters, with no reference to variables.
Class variables and methods can be accessed using the class name followed by a dot and the name of the variable or method.
The static modifier is used to create class methods and variables, as in the following example −
 Live Demo
public class InstanceCounter {

   private static int numInstances = 0;

   protected static int getCount() {
      return numInstances;
   }

   private static void addInstance() {
      numInstances++;
   }

   InstanceCounter() {
      InstanceCounter.addInstance();
   }

   public static void main(String[] arguments) {
      System.out.println("Starting with " + InstanceCounter.getCount() + " instances");

      for (int i = 0; i < 500; ++i) {
         new InstanceCounter();
      }
      System.out.println("Created " + InstanceCounter.getCount() + " instances");
   }
}
This will produce the following result −
Started with 0 instances
Created 500 instances
Design Turing Machine to reverse string consisting of a’s and b’s

Our aim is to design a Turing machine (TM) to reverse a string consisting of a’s and b’s over an alphabet {a,b}.
Input − aabbab
Output − babbaa
Step 1: Move to the last symbol, replace x for a or x for b and move right to convert the corresponding B to          „a‟ or „b‟ accordingly.
Step 2: Move left until the symbol left to x is reached.
Step 3: Perform step 1 and step 2 until „B‟ is reached while traversing left.
Step 4: Replace every x to B to make the cells empty since the reverse of the string is performed by the             previous steps.
The transition diagram for Turing Machine (TM) is as follows −
Let us consider an example to check whether the given input is getting reverse or not −
Input string - abb.
Expected output - {bba}
Therefore, the TM is as follows −