code-rag-bench/online-tutorials huggingface dataset:
MySQL Tryit Editor v1.0

Edit the SQL Statement, and click "Run SQL" to see the result.
This SQL-Statement is not supported in the WebSQL Database.
The example still works, because it uses a modified version of SQL.
Your browser does not support WebSQL.
Your are now using a light-version of the Try-SQL Editor, with a read-only Database.
If you switch to a browser with WebSQL support, you can try any SQL statement, and play with the Database as much as you like. The Database can also be restored at any time.
Our Try-SQL Editor uses WebSQL to demonstrate SQL.
A Database-object is created in your browser, for testing purposes.
You can try any SQL statement, and play with the Database as much as you like. The Database can be restored at any time, simply by clicking the "Restore Database" button.
WebSQL stores a Database locally, on the user's computer. Each user gets their own Database object.
WebSQL is supported in Chrome, Safari, and Opera.
If you use another browser you will still be able to use our Try SQL Editor, but a different version, using a server-based ASP application, with a read-only Access Database, where users are not allowed to make any changes to the data.
How can we MySQL LOAD DATA INFILE statement with ‘ENCLOSED BY’ option to import data from text file into MySQL table?

Sometimes the input text files have the text fields enclosed by double quotes and to import data from such kind of files we need to use the ‘ENCLOSED BY’ option with LOAD DATA INFILE statement. We are considering the following example to make it understand −
Followings are the comma-separated values in A.txt file −
100,”Ram”,”INDIA”,25000
101,”Mohan”,”INDIA”,28000
We want to import this data into the following file named employee2_tbl −
mysql> Create table employee2_tbl(Id Int, Name Varchar(20), Country Varchar(20),Salary Int);

Query OK, 0 rows affected (0.1 sec)
Now, the transfer of data from a file to a database table can be done with the help of the following table −
mysql> LOAD DATA LOCAL INFILE 'd:\A.txt' INTO table employee2_tbl FIELDS TERMINATED BY ',' ENCLOSED BY ‘“’;
Query OK, 2 rows affected (0.16 sec)
Records: 2 Deleted: 0 Skipped: 0 Warnings: 0

mysql> Select * from employee2_tbl;
+------+-------+---------+--------+
| Id   | Name  | Country | Salary |
+------+-------+---------+--------+
| 100  | Ram   | INDIA   |  25000 |
| 101  | Mohan | INDIA   |  28000 |
+------+-------+---------+--------+
2 rows in set (0.00 sec)
The above result set shows that the data from A.txt file has been transferred to the table.
C - Pointer to Pointer

A pointer to a pointer is a form of multiple indirection, or a chain of pointers. Normally, a pointer contains the address of a variable. When we define a pointer to a pointer, the first pointer contains the address of the second pointer, which points to the location that contains the actual value as shown below.
A variable that is a pointer to a pointer must be declared as such. This is done by placing an additional asterisk in front of its name. For example, the following declaration declares a pointer to a pointer of type int −
int **var;

When a target value is indirectly pointed to by a pointer to a pointer, accessing that value requires that the asterisk operator be applied twice, as is shown below in the example −
#include <stdio.h>
 
int main () {

   int  var;
   int  *ptr;
   int  **pptr;

   var = 3000;

   /* take the address of var */
   ptr = &var;

   /* take the address of ptr using address of operator & */
   pptr = &ptr;

   /* take the value using pptr */
   printf("Value of var = %d\n", var );
   printf("Value available at *ptr = %d\n", *ptr );
   printf("Value available at **pptr = %d\n", **pptr);

   return 0;
}
When the above code is compiled and executed, it produces the following result −
Value of var = 3000
Value available at *ptr = 3000
Value available at **pptr = 3000

 Print
 Add Notes
 Bookmark this page
NPDA for L = {0i1j2k | i==j or j==k ; i , j , k >= 1} - GeeksforGeeks

31 Aug, 2018
Prerequisite – Pushdown automata, Pushdown automata acceptance by final stateThe language L = {0i1j2k | i==j or j==k ; i , j , k >= 1} tells that every string of ‘0’, ‘1’ and ‘2’ have certain number of 0’s, then certain number of 1’s and then certain number of 2’s. The condition is that count of each of these 3 symbols should be atleast 1. Two important conditions for this language are that either count of 0 should be equal to count of 1 OR count of 1 should be equal to count of 2. Assume that string is ending with ‘$’.
Examples:
Input: 0 0 0 1 1 1 2 2 2 2 2  
        Here 0's = 3, 1's  = 3 so i = j, 2's = 5 
Output: Accepted 
          
Input: 0 0 1 1 1 2 2 2
        Here 0's = 2, 1's = 3, 2's = 3 so j = k
Output: Accepted

Input : 0 0 1 1 1 2 2 2 2
        Here 0's = 2, 1's = 3, 2's = 4 
Output: Not accepted 
There are 2 approaches for the solution. First is for i==j and second is for j==k. These are:
Steps for i == j :
Input all 0’s in the stackWhen we get 1 as input pop a 0 from stack and goto next state.If input is 1 then pop 0 from stack.If stack becomes empty (i.e., every 0 corresponding to a 1 has been popped so i = j) and input is 2 then ignore it and goto next state.If input is 2 then ignore it . If input is finished and $ is received then goto final state.
Input all 0’s in the stack
When we get 1 as input pop a 0 from stack and goto next state.
If input is 1 then pop 0 from stack.
If stack becomes empty (i.e., every 0 corresponding to a 1 has been popped so i = j) and input is 2 then ignore it and goto next state.
If input is 2 then ignore it . If input is finished and $ is received then goto final state.
Steps for j == k :
Input all 0’s in the stackWhen we get 1 as input push it onto stack and goto next state.If input is 1 then push it onto stack.If input is 2 pop a 1 from stack and goto next state.If input is 2 then pop 1 from stack. If input is finished and $ is received then pop a 0 from stack.Pop all remaining 0’s from the stack. If stack becomes empty then goto final state .
Input all 0’s in the stack
When we get 1 as input push it onto stack and goto next state.
If input is 1 then push it onto stack.
If input is 2 pop a 1 from stack and goto next state.
If input is 2 then pop 1 from stack. If input is finished and $ is received then pop a 0 from stack.
Pop all remaining 0’s from the stack. If stack becomes empty then goto final state .
GATE CS
Theory of Computation & Automata
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Layers of OSI Model
ACID Properties in DBMS
Normal Forms in DBMS
Types of Operating Systems
TCP/IP Model
Difference between DFA and NFA
Design 101 sequence detector (Mealy machine)
Closure properties of Regular languages
Conversion of Epsilon-NFA to NFA
Regular expression to ∈-NFA
Display tick marks in a JSlider with Java

To display tick marks in a JSlider, you need to use the setPaintTicks() method and set it to TRUE −
JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 75);
slider.setPaintTicks(true);
The following is an example to display tick marks in a slider in Java −
package my;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.WindowConstants;
public class SwingDemo {
   public static void main(String[] args) {
      JFrame frame = new JFrame("Frame with Slider");
      JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 75);
      slider.setMinorTickSpacing(5);
      slider.setMajorTickSpacing(20);
      slider.setPaintTicks(true);
      slider.setPaintLabels(true);
      slider.setBackground(Color.yellow);
      slider.setForeground(Color.red);
      Font font = new Font("Serif", Font.BOLD, 18);
      slider.setFont(font);
      JPanel panel = new JPanel();
      panel.add(slider);
      frame.add(panel);
      frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
      frame.setSize(600, 300);
      frame.setVisible(true);
   }
}
Python | Remove empty tuples from a list

When it is required to remove empty tuples from a list of tuples, a simple loop can be used.
A list can be used to store heterogeneous values (i.e data of any data type like integer, floating point, strings, and so on).
A list of tuple basically contains tuples enclosed in a list.
Below is a demonstration for the same −
 Live Demo
def remove_empty(my_tuple):
   my_tuple = [t for t in my_tuple if t]
   return my_tuple
my_tuple = [(), (), (''), (" " , " "), (45, 67, 35, 66, 74, 89, 100) , 'jane']
print("The tuple is : ")
print(my_tuple)
print("The method to remove empty tuples is being called...")
my_result = remove_empty(my_tuple)
print("The list of tuple after remvoing empty tuples is : ")
print(my_result)
The tuple is :
[(), (), '', (' ', ' '), (45, 67, 35, 66, 74, 89, 100), 'jane']
The method to remove empty tuples is being called...
The list of tuple after remvoing empty tuples is :
[(' ', ' '), (45, 67, 35, 66, 74, 89, 100), 'jane']
A method named ‘remove_empty’ is defined, that takes a list of tuple as parameter.
It iterates through the tuple and returns values only if they are non-empty.
A list of tuple is defined, and is displayed on the console.
The method is called by passing this list of tuple.
This operation’s data is assigned to a variable.
It is then displayed as output on the console.
Assigning an integer to float and comparison in C/C++ - GeeksforGeeks

29 May, 2017
Consider the below C++ program and predict the output.
#include <iostream>using namespace std;  int main(){    float f = 0xffffffff;    unsigned int x = 0xffffffff; // Value 4294967295    if (f == x)         cout << "true";    else         cout << "false";    return 0;}
The output of above program is false if the “IEEE754 32-bit single float type” is used by compiler. If we define:
float f = 0xffffffff;
We are basically trying to assign a 32-bit integer (signed or unsigned) to a 32-bit float. The compiler will first convert the integer 0xffffffff to a nearest 32-bit float, and the memory representation of the float f is not the same as the integer 0xffffffff. We can see the above values by printing f and x.
#include <iostream>using namespace std;  int main(){    float f = 0xffffffff;    unsigned int x = 0xffffffff;     cout << "f = " << f << endl;    cout << "x = " << x << endl;    return 0;}
Output :
f = 4.29497e+09
x = 4294967295

Even if we copy the memory directly, for example, we have an integer (value equal to 0xffffffff), and we copy over the content (memory values). Since the 0xffffffff in IEEE754 is not a valid float number, so if you compare this invalid representation to itself, it is not equal.
unsigned int x = 0xffffffff;memoryCopy(&f, &x, sizeof(x));
This article is contributed by Rishav Raj. 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.
cpp-data-types
C Language
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Exception Handling in C++
TCP Server-Client implementation in C
'this' pointer in C++
Input-output system calls in C | Create, Open, Close, Read, Write
Multithreading in C
Vector in C++ STL
Inheritance in C++
Iterators in C++ STL
Initialize a vector in C++ (6 different ways)
Socket Programming in C/C++
Convert an ArrayList of String to a String array in Java

At first, let us set an ArrayList of string −
ArrayList<String> arrList = new ArrayList<String>();
arrList.add("Bentley");
arrList.add("Audi");
arrList.add("Jaguar");
arrList.add("Cadillac");
Now, use toArray() to convert to a string array −
int size = arrList.size();
String res[] = arrList.toArray(new String[size]);
Following is the program to convert an ArrayList of String to a String array in Java −
import java.util.*;
public class Demo {
   public static void main(String[] args) {
      ArrayList<String> arrList = new ArrayList<String>();
      arrList.add("Bentley");
      arrList.add("Audi");
      arrList.add("Jaguar");
      arrList.add("Cadillac");
      arrList.add("Mazda");
      arrList.add("Land Rover");
      arrList.add("Porsche");
      int size = arrList.size();
      String res[] = arrList.toArray(new String[size]);
      System.out.println("String Array...");
      for(String s: res) {
         System.out.println(s);
      }
   }
}
String Array...
Bentley
Audi
Jaguar
Cadillac
Mazda
Land Rover
Porsche
Programming examples of 6800

Now, in this section, we will see how we can use the Motorola M6800 Microprocessor to add multi-Byte numbers.
AddingMulti-Byte Number
In this example, we are using 4-Byte numbers (56 2F 7A 89)16 and (21 FB A9 AF)16
In the memory, at first, we are storing the Byte counts, and then the numbers (from least significant Bytes to Most significant Bytes) in different segments. So after storing the data, the memory structure will be looking like this
Now, we are writing a program to add these two 4-Byte number and store the result at location 5090H onwards.
      CLC
      LDX#$5050

LOOP: LDAA $0, X
      ADCA $20, X
      STAA $40, X


      INX
      DEC$5000
      BNELOOP

      CLR$40, X
      BCCDONE
      INC$40, X
DONE: WAI

BlockExchange Program
Now we will see how we can use the M6800 Microprocessor to Exchange the contents of each element from two different blocks.
The number of items in each block is given at location 5000H, and the blocks are at position 5050H and 5070H.
So before swapping the items in the memory is looking like this
Now, we are writing a program to exchange the block contents.
      LDX#$5050
     
LOOP: LDAA 0, X
      LDAB $20 X

      STAA $20, X
      STAB $0, X

      INX
      DEC$5000
      BNELOOP
      WAI
Move block of data
Let us see another example of the M6800 Microprocessor Program. Here the program is to move a block of data to another location. There is one assumption, there is sufficient distance between source and destination. So blocks are not-overlapping. Basically, the block movement is not exactly moving, itis copying the data to other locations.
The number of items in the block is given at location 5000H, and the block is located at position 5050H.
So before movement, the items in the memory is looking like this.
Now, we are writing a program to move the block contents to other locations.
LDX#$5050
LOOP: LDAA 0, X
STAA $20, X
INX
DEC$5000
BNELOOP

      WAI
Create a BigDecimal via string in Java

Let us see how we can create BigDecimal values via string. Here, we have set string as a parameter to the BigDecimal constructor.
BigDecimal val1 = new BigDecimal("375789755.345778656");
BigDecimal val2 = new BigDecimal("525678755.155778656");
We can also perform mathematical operations on it −
val2 = val2.subtract(val1);
The following is an example −
 Live Demo
import java.math.BigDecimal;
public class Demo {
   public static void main(String[] argv) throws Exception {
      BigDecimal val1 = new BigDecimal("375789755.345778656");
      BigDecimal val2 = new BigDecimal("525678755.155778656");
      System.out.println("Value 1 : "+val1);
      System.out.println("Value 2 : "+val2);
      val2 = val2.subtract(val1);
      System.out.println("Result (Subtraction) = "+val2);
   }
}
Value 1 : 375789755.345778656
Value 2 : 525678755.155778656
Result (Subtraction) = 149888999.810000000
Electron - Packaging Apps

Packaging and distributing apps is an integral part of the development process of a desktop application. Since Electron is a cross-platform desktop application development framework, packaging and distribution of apps for all the platforms should also be a seamless experience.
The electron community has created a project, electron-packager that takes care of the same for us. It allows us to package and distribute our Electron app with OS-specific bundles (.app, .exe etc) via JS or CLI.
Electron Packager runs on the following host platforms −
Windows (32/64 bit)
OS X
Linux (x86/x86_64)
It generates executables/bundles for the following target platforms −
Windows (also known as win32, for both 32/64 bit)
OS X (also known as darwin) / Mac App Store (also known as mas)
Linux (for x86, x86_64, and armv7l architectures)
Install the electron packager using −
# for use in npm scripts
$ npm install electron-packager --save-dev

# for use from cli
$ npm install electron-packager -g

In this section, we will see how to run the packager from the command line. The basic form of the command is −
electron-packager <sourcedir> <appname> --platform=<platform> --arch=<arch> [optional flags...]

This will −
Find or download the correct release of Electron.
Find or download the correct release of Electron.
Use that version of Electron to create a app in <output-folder>/<appname>-<platform>-<arch>.
Use that version of Electron to create a app in <output-folder>/<appname>-<platform>-<arch>.
--platform and --arch can be omitted, in two cases. If you specify --all instead, bundles for all valid combinations of target platforms/architectures will be created. Otherwise, a single bundle for the host platform/architecture will be created.

    251 Lectures 
     35.5 hours 

 Gowthami Swarna

    9 Lectures 
     41 mins

 Ashraf Said

    8 Lectures 
     32 mins

 Ashraf Said

    25 Lectures 
     1 hours 

 Ashraf Said

    17 Lectures 
     1 hours 

 Ashraf Said

    8 Lectures 
     25 mins

 Ashraf Said
 Print
 Add Notes
 Bookmark this page
Perl substr Function

This function returns a substring of EXPR, starting at OFFSET within the string. If OFFSET is negative, starts that many characters from the end of the string. If LEN is specified, returns that number of bytes, or all bytes up until end-of-string if not specified. If LEN is negative, leaves that many characters off the end of the string.
If REPLACEMENT is specified, replaces the substring with the REPLACEMENT string.
If you specify a substring that passes beyond the end of the string, it returns only the valid element of the original string.
Following is the simple syntax for this function −
substr EXPR, OFFSET, LEN, REPLACEMENT

substr EXPR, OFFSET, LEN

substr EXPR, OFFSET

This function returns string.
Following is the example code showing its basic usage −
#!/usr/bin/perl -w

$temp = substr("okay", 2);
print "Substring valuye is $temp\n";

$temp = substr("okay", 1,2);
print "Substring valuye is $temp\n";
When above code is executed, it produces the following result −
Substring valuye is ay
Substring valuye is ka


    46 Lectures 
     4.5 hours 

 Devi Killada

    11 Lectures 
     1.5 hours 

 Harshit Srivastava

    30 Lectures 
     6 hours 

 TELCOMA Global

    24 Lectures 
     2 hours 

 Mohammad Nauman

    68 Lectures 
     7 hours 

 Stone River ELearning

    58 Lectures 
     6.5 hours 

 Stone River ELearning
 Print
 Add Notes
 Bookmark this page
Data Link Layer in OSI Model - GeeksforGeeks

28 Jun, 2021
Below are some common GATE CS topics of data link layer.
Carrier Sense Multiple Access (CSMA)
Carrier Sense Multiple Access or CSMA method was developed to minimize the probability of collision and thus, to increase the performance. The probability of collision can be minimized if a station senses or reads the medium before trying to use it for sending data. CSMA is based on the principle of sensing before transmitting.
CSMA/CD (Carrier sense multiple access with collision detection)The CSMA method does not tells us what to do in case there is a collision. Carrier sense multiple access with collision detection (CSMA/CD) adds on to the CSMA algorithm to deal with collision. For CSMA/CD to work, we need a particular frame size. Before sending the last bit of the frame, the sending station must detect a collision, if any, and abort the transmission because the station, once the entire frame is sent, does not keep a copy of the frame and does not monitor the channel for collision detection.
In CSMA/CD, the size of a frame must be large enough so that collision can be detected by sender while sending the frame. So, the frame transmission delay must be at least two times the maximum propagation delay.
  

 Tt >= 2*Tp
Here Tt is transmission delay and Tp is propagation delay.
   
Tt = S/B
Here S is size of frame and B is bandwidth or transmission speed.
  
 Tp = L/P
Here L is distance between the farthest nodes and P is propagation speed, putting above values we get
  
S/B >= 2*(L/P)

Frame size 'S' should be 
   S >= 2BL/P 

Or cable length 'L' should be
   L <= SP/2B
Example: A network using CSMA/CD has a bandwidth of 10 Mbps. If the maximum propagation time including the device delays is 25.6 μs, what is the minimum size of the frame?Solution: Frame Transmission Time, Tt = 2 * Tp = 2 * 25.6 = 51.2 μsMinimum frame size, S = 10 Mbps * 51.2 μs = 512 bits = 64 bytes
Below questions have been asked in previous GATE exam on above topic.
GATE | GATE CS 2003 | Question 90
GATE | GATE-CS-2005 | Question 74GATE | GATE CS 2013 | Question 65
GATE | GATE CS 2015 Set 3 | Question 65
 
CRC (Cyclic Redundancy Check)Please refer this for examples and detailed explanation.
GATE | GATE-CS-2007 | Question 68GATE | GATE CS 2009 | Question 48
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Articles
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
GTest Framework
How to use gotoxy() in codeblocks?
Asymptotic Notations and how to calculate them
File globbing in Linux
Print all subsequences of a string using ArrayList
HQL | Introduction
Construct an array from its pair-sum array
Draw a circle without floating point arithmetic
MAQ Software most Frequently Asked Questions
What's difference between Microcontroller (μC) and Microprocessor (μP)?
Python | List of float to string conversion

29 Oct, 2019
Sometimes, while working with Python list, we can have a problem in which we have to transform the list elements to string. This is easier in case of integral list, as they can be joined easily with join(), and their contents can be displayed. But the case with floats is different, there are additional undesired spaces among it’s values that can cause it’s unsuccess. Let’s discuss a ways in which this error situation can be handled.
Method #1 : Using list comprehension + join() + str()This task can be performed using combination of above functions. In this, we firstly convert each element of list i.e float point number to string and then join the resultant strings using the join().
# Python3 code to demonstrate working of# List of float to string conversion# using list comprehension + str() + join()  # initialize listtest_list = [5.8, 9.6, 10.2, 45.3, 6.0]  # printing original listprint("The original list is : " + str(test_list))  # List of float to string conversion# using list comprehension + str() + join()res = " ".join([str(i) for i in test_list])  # printing resultprint("Conversion of float list to string : " + str(res))
The original list is : [5.8, 9.6, 10.2, 45.3, 6.0]
Conversion of float list to string : 5.8 9.6 10.2 45.3 6.0

 
Method #2 : Using join() + map() + str()The root method is similar by using the combination of join() + str(), but important function which helps to perform this task is map(). This first converts each element to string and then constructs the master string.
# Python3 code to demonstrate working of# List of float to string conversion# using join() + map() + str()  # initialize listtest_list = [5.8, 9.6, 10.2, 45.3, 6.0]  # printing original listprint("The original list is : " + str(test_list))  # Convert float list to string# using join() + map() + str()res1 = " ".join(str(test_list))  # List of float to string conversion# using join() + map() + str()res2 = " ".join(map(str, test_list))  # printing resultprint("Conversion using join + str : " + str(res1))print("Conversion using join + str + map : " + str(res2))
The original list is : [5.8, 9.6, 10.2, 45.3, 6.0]
Conversion using join + str : [ 5 . 8,   9 . 6,   1 0 . 2,   4 5 . 3,   6 . 0 ]
Conversion using join + str + map : 5.8 9.6 10.2 45.3 6.0

Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
HTML frameset Tag

17 Mar, 2022
The <frameset> tag in HTML is used to define the frameset. The <frameset> element contains one or more frame elements. It is used to specify the number of rows and columns in frameset with their pixel of spaces. Each element can hold a separate document. 
Note: The <frameset> tag is not supported in HTML5.
Syntax: 
<frameset cols = "pixels|%|*">
Attributes: The list of frameset attributes are given below:  
cols: The cols attribute is used to create vertical frames in a web browser. This attribute is basically used to define the no. of columns and their size inside the frameset tag.
rows: The rows attribute is used to create horizontal frames in the web browser. This attribute is used to define the no. of rows and their size inside the frameset tag.
border: This attribute of frameset tag defines the width of the border of each frame in pixels. Zero value is used for no border.
frameborder: This attribute of frameset tag is used to specify whether a three-dimensional border should be displayed between the frames or not for this use two values 0 and 1, where 0 defines no border and value 1 signifies for yes there will be a border.
framespacing: This attribute of frameset tag is used to specify the amount of spacing between the frames in a frameset. This can take any integer value as a parameter which basically denotes the value in pixel.
Below examples illustrate the <frameset> element in HTML:Example 1: 
HTML
<!DOCTYPE html><html>    <head>        <title>frameset attribute</title>    </head>         <!-- frameset attribute starts here -->       <frameset rows = "20%, 60%, 20%">        <frame name = "top" src = "attr1.png" />        <frame name = "main" src = "gradient3.png" />        <frame name = "bottom" src = "col_last.png" />        <noframes>            <body>The browser you are working does not                                  support frames.</body>        </noframes>    </frameset>    <!-- frameset attribute ends here --></html>                               
Output: The above example basically used to create three horizontal frames: top, middle, and bottom using row attribute of frameset tag, and the noframe tag is used for that browser that doesn’t support noframe.  
Example 2:  
HTML
<!DOCTYPE html><html>        <head>        <title>frameset attribute</title>    </head>             <frameset cols = "30%, 40%, 30%">        <frame name = "top" src = "attr1.png" />        <frame name = "main" src = "gradient3.png" />        <frame name = "bottom" src = "col_last.png" />                <noframes>            <body>The browser you are working does            not support frames.</body>        </noframes>    </frameset></html>
Output: The above example basically used to create three vertical frames: left, center, and right using col attribute of frameset tag.  
Supported Browsers: 
Google Chrome
Internet Explorer
Firefox
Opera
Safari
 
shubhamyadav4
HTML-Tags
Picked
Technical Scripter 2018
HTML
Technical Scripter
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
UGC-NET | UGC NET CS 2016 Aug – II | Question 38

11 Apr, 2018
Consider a system having ‘m’ resources of the same type. These resources are shared by three processes P1, P2and P3 which have peak demands of 2, 5 and 7 resources respectively. For what value of ‘m’ deadlock will not occur ?(A) 70(B) 14(C) 13(D) 7Answer: (B)Explanation: To avoid deadlock ‘m’ >= peak demands(P1 + P2 + P3)i.e. m >= peak demands(2 + 5 + 7)m >= peak demands(14)So, option (B) is correct.Quiz of this Question
UGC-NET
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python time gmtime() Method

Pythom time method gmtime() converts a time expressed in seconds since the epoch to a struct_time in UTC in which the dst flag is always zero. If secs is not provided or None, the current time as returned by time() is used.
Following is the syntax for gmtime() method −
time.gmtime([ sec ])

sec − These are the number of seconds to be converted into structure struct_time representation.
sec − These are the number of seconds to be converted into structure struct_time representation.
This method does not return any value.
The following example shows the usage of gmtime() method.
#!/usr/bin/python
import time

print "time.gmtime() : %s" % time.gmtime()
When we run above program, it produces following result −
time.gmtime() : (2009, 2, 17, 17, 3, 38, 1, 48, 0)
How to Set Java Path in Windows and Linux?

02 Feb, 2021
PATH is an environment variable that is used by Operating System to locate the exe files (.exe) or java binaries ( java or javac command). The path once it is set, cannot be overridden. The PATH variable prevents us from having to write out the entire path to a program on the Command Line Interface every time we run it. Moreover, the path is just a variable that stores a bunch of shortcuts.
To execute java console-based programs in windows or Linux environments we have to use java and javac commands. The commands java, javac are not known to the operating system as we don’t specify where the executables reside. Hence, we need to specify the path where the executables are located. This is the reason we set the path and specify the path of the bin folder because the bin contains all binary executable files. After setting the path it can load all necessary items in the program including the compiler or interpreter itself. 
Below is the procedure for setting the path for both Windows and Linux:
1. Go to the Search box and type advanced system settings in it. Now click on the View advanced system settings.
2. Select the Advanced tab and then click environment variables.
3. In the system, variables click the New button. Now in the edit system variable, type variable name as JAVA_PATH and variable path as the path where the JDK folder is saved and click on OK button Usually the path of the JDK file will be C:\Program Files\Java\jdk1.8.0_60.
4. Now in the system variables go to the path and click the edit button.
5. Click the New button.
6. Now add the following path: %JAVA_HOME%\bin
Open the terminal and enter the following command: 
sudo nano /etc/environment.
A file will be opened and add the following command to that file:
JAVA_HOME = "YOUR_PATH". 
Replace YOUR_PATH with the JDK bin file path.
Now restart your computer or virtual machine that you are using (or) reload the file: source /etc/environment
You can test the path by executing
 echo $JAVA_HOME
If you get the output without any error, then you’ve set the path correctly.
If you get any errors, try repeating the procedure again.
Picked
Technical Scripter 2020
How To
Java
Technical Scripter
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Tryit Editor v3.7

Tryit: HTML table - striped rows
Check two ArrayList for equality in Java

Two ArrayList can be compared to check if they are equal or not using the method java.util.ArrayList.equals(). This method has a single parameter i.e. an ArrayList that is compared with the current object. It returns true if the two ArrayList are equal and false otherwise.
A program that demonstrates this is given as follows −
 Live Demo
import java.util.ArrayList;
import java.util.List;
public class Demo {
   public static void main(String[] args) {
      List aList1 = new ArrayList();
      aList1.add("Sun");
      aList1.add("Moon");
      aList1.add("Stars");
      List aList2 = new ArrayList();
      aList2.add("Sun");
      aList2.add("Moon");
      aList2.add("Stars");
      System.out.println("The two ArrayList are equal? " + aList1.equals(aList2));
   }
}
The two ArrayList are equal? true
Now let us understand the above program.
The ArrayList aList1 and aList2 are created and ArrayList.add() is used to add the elements to the two ArrayList. Then ArrayList.equals() method is used to check if the ArrayList are equal or not and the result is displayed. A code snippet which demonstrates this is as follows −
List aList1 = new ArrayList();
aList1.add("Sun");
aList1.add("Moon");
aList1.add("Stars");
List aList2 = new ArrayList();
aList2.add("Sun");
aList2.add("Moon");
aList2.add("Stars");
System.out.println("The two ArrayList are equal? " + aList1.equals(aList2));
How to check a String for palindrome using arrays in java?

To verify whether the given string is a palindrome (using arrays)
Convert the given string into a character array using the toCharArray() method.
Make a copy of this array.
Reverse the array.
Compare the original array and the reversed array.
in case of match given string is a palindrome.
import java.util.Arrays;
import java.util.Scanner;

public class Palindrome {
   public static void main(String args[]) {
      System.out.println("Enter a string ");
      Scanner sc = new Scanner(System.in);
      String s = sc.nextLine();
      char[] myArray = s.toCharArray();
      int size = myArray.length;
      char [] original = Arrays.copyOf(myArray,myArray.length);

      for (int i = 0; i < size / 2; i++) {
         char temp = myArray[i];
         myArray[i] = myArray[size-i-1];
         myArray[size-i-1] = temp;
      }
      System.out.println("Original Array"+Arrays.toString(original));
      System.out.println("Reverse Array"+Arrays.toString(myArray));

      if(Arrays.equals(myArray, original)) {
         System.out.println("Entered string is a palindrome");
      } else {
         System.out.println("Entered string is not a palindrome");
      }
   }
}
Enter a string
mam
Original Array[m, a, m]
Reverse Array[m, a, m]
Entered string is a palindrome
How does pipelining improve performance in computer architecture?

Performance in an unpipelined processor is characterized by the cycle time and the execution time of the instructions. In the case of pipelined execution, instruction processing is interleaved in the pipeline rather than performed sequentially as in non-pipelined processors. Therefore the concept of the execution time of instruction has no meaning, and the in-depth performance specification of a pipelined processor requires three different measures: the cycle time of the processor and the latency and repetition rate values of the instructions.
The cycle time defines the time accessible for each stage to accomplish the important operations. The cycle time of the processor is specified by the worst-case processing time of the highest stage.
Latency defines the amount of time that the result of a specific instruction takes to become accessible in the pipeline for subsequent dependent instruction. Latency is given as multiples of the cycle time.
If the latency of a particular instruction is one cycle, its result is available for a subsequent RAW-dependent instruction in the next cycle. In this case, a RAW-dependent instruction can be processed without any delay. If the latency is more than one cycle, say n-cycles an immediately following RAW-dependent instruction has to be interrupted in the pipeline for n-1 cycles.
There are two different kinds of RAW dependency such as define-use dependency and load-use dependency and there are two corresponding kinds of latencies known as define-use latency and load-use latency.
The define-use latency of instruction is the time delay occurring after decoding and issue until the result of an operating instruction becomes available in the pipeline for subsequent RAW-dependent instructions. If the value of the define-use latency is one cycle, and immediately following RAW-dependent instruction can be processed without any delay in the pipeline.
The define-use delay of instruction is the time a subsequent RAW-dependent instruction has to be interrupted in the pipeline. The define-use delay is one cycle less than the define-use latency.
The term load-use latencyload-use latency is interpreted in connection with load instructions, such as in the sequence
load r1,  x;
ad   r5,  r1,  r2;
In this example, the result of the load instruction is needed as a source operand in the subsequent ad. The notion of load-use latency and load-use delay is interpreted in the same way as define-use latency and define-use delay.
The latency of an instruction being executed in parallel is determined by the execute phase of the pipeline. It can illustrate this with the FP pipeline of the PowerPC 603 which is shown in the figure.
The Power PC 603 processes FP additions/subtraction or multiplication in three phases. Two cycles are needed for the instruction fetch, decode and issue phase. The subsequent execution phase takes three cycles. At the end of this phase, the result of the operation is forwarded (bypassed) to any requesting unit in the processor. Finally, in the completion phase, the result is written back into the architectural register file.
MySQL filtering by multiple columns?

To perform filtering by multiple columns, use where clause along with OR. Let us first create a table −
mysql> create table DemoTable
   (
   Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   Name varchar(10),
   Score int
   );
Query OK, 0 rows affected (0.28 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable(Name,Score) values('John',80);
Query OK, 1 row affected (0.04 sec)

mysql> insert into DemoTable(Name,Score) values('John',90);
Query OK, 1 row affected (0.06 sec)

mysql> insert into DemoTable(Name,Score) values('Carol',89);
Query OK, 1 row affected (0.04 sec)

mysql> insert into DemoTable(Name,Score) values('John',86);
Query OK, 1 row affected (0.04 sec)

mysql> insert into DemoTable(Name,Score) values('Carol',98);
Query OK, 1 row affected (0.06 sec)

mysql> insert into DemoTable(Name,Score) values('David',99);
Query OK, 1 row affected (0.06 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+----+-------+-------+
| Id | Name  | Score |
+----+-------+-------+
| 1  | John  | 80    |
| 2  | John  | 90    |
| 3  | Carol | 89    |
| 4  | John  | 86    |
| 5  | Carol | 98    |
| 6  | David | 99    |
+----+-------+-------+
6 rows in set (0.00 sec)
Following is the query to perform filtering by multiple columns −
mysql> select *from DemoTable where (Name,Score)=('John', 90) or (Name,Score)=('Carol', 98);
This will produce the following output −
+----+-------+-------+
| Id | Name  | Score |
+----+-------+-------+
| 2  | John  | 90    |
| 5  | Carol | 98    |
+----+-------+-------+
2 rows in set (0.00 sec)
Python | Pandas Dataframe.duplicated()

29 Sep, 2021
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.An important part of Data analysis is analyzing Duplicate Values and removing them. Pandas duplicated() method helps in analyzing duplicate values only. It returns a boolean series which is True only for Unique elements.Syntax:  
DataFrame.duplicated(subset=None, keep='first')
Parameters:  
subset: Takes a column or list of column label. It’s default value is none. After passing columns, it will consider them only for duplicates. keep: Controls how to consider duplicate value. It has only three distinct value and default is ‘first’. –> If ‘first’, it considers first value as unique and rest of the same values as duplicate. –> If ‘last’, it considers last value as unique and rest of the same values as duplicate. –> If False, it consider all of the same values as duplicates.  
To download the CSV file used, Click Here.Example #1: Returning a boolean seriesIn the following example, a boolean series is returned on the basis of duplicate values in the First Name column. 
Python
# importing pandas packageimport pandas as pd # making data frame from csv filedata = pd.read_csv("employees.csv") # sorting by first namedata.sort_values("First Name", inplace = True) # making a bool seriesbool_series = data["First Name"].duplicated() # displaying datadata.head() # display datadata[bool_series]
Output: As shown in the output image, since the keep parameter was default that is ‘first’, hence whenever the name is occurred, the first one is considered Unique and res Duplicate. 
 Example #2: Removing duplicates In this example, the keep parameter is set to False, so that only Unique values are taken and the duplicate values are removed from data. 
Python
# importing pandas packageimport pandas as pd # making data frame from csv filedata = pd.read_csv("employees.csv") # sorting by first namedata.sort_values("First Name", inplace = True) # making a bool seriesbool_series = data["First Name"].duplicated(keep = False) # bool seriesbool_series # passing NOT of bool series to see unique values onlydata = data[~bool_series] # displaying datadata.info()data
Output: Since the duplicated() method returns False for Duplicates, the NOT of the series is taken to see unique value in Data Frame.  
 
khushboogoyal499
Python pandas-dataFrame
Python pandas-dataFrame-methods
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
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
Python OOPs Concepts
What is right shift (>>) operator in Python?

In Python >> is called right shift operator. It is a bitwise operator. It requires a bitwise representation of object as first operand. Bits are shifted to right by number of bits stipulated by second operand. Leading bits as towards left as a result of shifting are set to 0.
>>> bin(a)     #binary equivalent 0110 0100
'0b1100100'
>>> b=a>>2     #binary equivalent 0001 1101
>>> b
25
>>> bin(b)
'0b11001'
SQL – SELECT DATE

19 May, 2021
In Microsoft SQL Server, SELECT DATE is used to get the data from the table related to the date, the default format of date is ‘YYYY-MM-DD’.
Syntax:
SELECT * FROM table_name
WHERE condition1, condition2,..;
Now we will execute queries on SELECT DATE on database student in detail step-by-step:
Step 1: Creating a database university:
CREATE DATABASE student;
Step 2: Using the database student:
USE student;
Step 3: Creating a table assignment_details with 5 columns:
In MSSQL there is data type DATE which accepts date.
CREATE TABLE assignment_details
(
    stu_id VARCHAR(20),
    stu_name VARCHAR(20),
    assn_name VARCHAR(20),
    due_date DATE,
    submission_date DATE
);
Step 4: Adding rows into table assignment_details :
INSERT INTO assignment_details VALUES
('191021','SUJITH','DBMS','2021-04-21','2021-04-25'),
('191022','SUDEEP','DBMS','2021-04-21','2021-04-20'),
('191023','SARASWAT','O.S','2021-04-22','2021-04-24'),
('191024','SATWIK','C++','2021-04-23','2021-04-19'),
('191025','KOUSHIK','C++','2021-04-23','2021-04-21'),
('191026','ABHISHEK','O.S','2021-04-22','2021-04-20');
Step 5: Viewing the rows in the table:
SELECT * FROM assignment_details;
Query 1:  Display students who have submitted on ‘2021-04-20’.
SELECT * FROM assignment_details
WHERE submission_date='2021-04-20';
Query 2: Display students who have submitted after duedate.
SELECT * FROM assignment_details
WHERE due_date<submission_date;
Query 3: Display students who have submitted before duedate.
SELECT * FROM assignment_details
WHERE due_date>=submission_date;
Query 4: Display students who have submitted O.S assignment on time.
SELECT stu_id,stu_name,submission_date FROM assignment_details
WHERE assn_name='O.S' AND due_date>=submission_date;
Picked
SQL-Clauses
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Update Multiple Columns in Single Update Statement in SQL?
Window functions in SQL
What is Temporary Table in SQL?
SQL using Python
SQL | Sub queries in From Clause
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
RANK() Function in SQL Server
SQL Query to Convert VARCHAR to INT
SQL Query to Compare Two Dates
SQL Query to Insert Multiple Rows
How to Import a CSV file into a SQLite database Table using Python?

28 Oct, 2021
In this article, we are going to discuss how to import a CSV file content into an SQLite database table using Python.
At first, we import csv module (to work with csv file) and sqlite3 module (to populate the database table).
Then we connect to our geeks database using the sqlite3.connect() method.
At this point, we create a cursor object to handle queries on the database table.
We first create our person table and create a csv file with the contents inside which we will be inserting into our table.
We open the above-created csv file using the open() function.
We extract all the contents of the csv file into our contents variable through csv.reader() method.
Then we insert our row-wise contents of csv file into our database through executemany() method which will replace (?,?) with the next two comma-separated data of the csv file and insert it as a record into the person table.
Finally, we verify that the data of the csv file has been successfully inserted into our table with the SELECT statement and commit the changes and close the database connection.
For the purpose of implementation, we will be creating a person table in our geeks.db database. We are going to insert the content of the person_records.csv in our person table. Below is the CSV file we are going to use:
Below is the complete program based on the above approach:
Python3
# Import required modulesimport csvimport sqlite3 # Connecting to the geeks databaseconnection = sqlite3.connect('g4g.db') # Creating a cursor object to execute# SQL queries on a database tablecursor = connection.cursor() # Table Definitioncreate_table = '''CREATE TABLE person(                id INTEGER PRIMARY KEY AUTOINCREMENT,                name TEXT NOT NULL,                age INTEGER NOT NULL);                ''' # Creating the table into our# databasecursor.execute(create_table) # Opening the person-records.csv filefile = open('person-records.csv') # Reading the contents of the# person-records.csv filecontents = csv.reader(file) # SQL query to insert data into the# person tableinsert_records = "INSERT INTO person (name, age) VALUES(?, ?)" # Importing the contents of the file# into our person tablecursor.executemany(insert_records, contents) # SQL query to retrieve all data from# the person table To verify that the# data of the csv file has been successfully# inserted into the tableselect_all = "SELECT * FROM person"rows = cursor.execute(select_all).fetchall() # Output to the console screenfor r in rows:    print(r) # Committing the changesconnection.commit() # closing the database connectionconnection.close()
Output:
SQLite:
gabaa406
Picked
Python-SQLite
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How can we return a dictionary from a Python function?

There can be any number of ways we can return a dictionary from a python function. Consider the one given below.
# This function returns a dictionary
def foo():
     d = dict();
     d['str'] = "Tutorialspoint"
     d['x']   = 50
     return d
print foo()
{'x': 50, 'str': 'Tutorialspoint'}