code-rag-bench/online-tutorials huggingface dataset:
GATE | GATE-CS-2015 (Set 3) | Question 61 - GeeksforGeeks

07 Dec, 2021
Consider the following reservation table for a pipeline having three stages S1, S2 and S3.
     Time -->
-----------------------------
      1    2   3    4     5
-----------------------------
S1  | X  |   |   |    |  X |    
S2  |    | X |   | X  |    |
S3  |    |   | X |    |    |
The minimum average latency (MAL) is __________(A) 3(B) 2(C) 1(D) 4Answer: (A)Explanation:
S1 | X | Y |   |   | X | Y | X | Y |   |   | X | Y |
S2 |   | X | Y | X | Y |   |   | X | Y | X | Y |   |
S3 |   |   | X | Y |   |   |   |   | X | Y |   |   |

We can interleave instructions like the above pattern.
Latency between X and Y is 1.
Latency between first and second X is 5.
The pattern repeats after that.So, MAL is (1 + 5)/2;Quiz of this Question
sweetyty
GATE-CS-2015 (Set 3)
GATE-GATE-CS-2015 (Set 3)
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
GATE | GATE-CS-2016 (Set 2) | Question 48
GATE | GATE-CS-2014-(Set-1) | Question 30
GATE | GATE-CS-2001 | Question 23
GATE | GATE-CS-2015 (Set 1) | Question 65
GATE | GATE CS 2010 | Question 45
GATE | GATE-CS-2015 (Set 3) | Question 65
C++ Program to count Vowels in a string using Pointer
GATE | GATE-CS-2014-(Set-1) | Question 65
GATE | GATE-CS-2004 | Question 3
GATE | GATE-CS-2015 (Set 1) | Question 42
Difference Between Bubble Sort and Selection Sort

In this post, we will understand the difference between Bubble Sort and Selection Sort
It is a simple sorting algorithm.
It is a simple sorting algorithm.
It iterates through the list, and compares adjacent pairs of elements to sort them.
It iterates through the list, and compares adjacent pairs of elements to sort them.
Based on the adjacent elements, swaps are made.
Based on the adjacent elements, swaps are made.
It is efficient in comparison to selection sort.
It is efficient in comparison to selection sort.
It is slower in comparison to selection sort.
It is slower in comparison to selection sort.
It uses item exchanging to swap elements.
It uses item exchanging to swap elements.
The elements are repeatedly swapped until all the elements are in the right order.
The elements are repeatedly swapped until all the elements are in the right order.
Following is the Bubble Sort Algorithm
begin BubbleSort(list)
   for all elements of list
      if list[i] > list[i+1]
         swap(list[i], list[i+1])
end if
end for

return list

end BubbleSort
First, the minimum or the maximum number from the list is obtained.
First, the minimum or the maximum number from the list is obtained.
The list is sorted in ascending or descending order.
The list is sorted in ascending or descending order.
It selects the minimum or maximum element from unsorted sub-array and puts it in the next position of the sorted sub-array.
It selects the minimum or maximum element from unsorted sub-array and puts it in the next position of the sorted sub-array.
It is considered as an unstable sorting algorithm.
It is considered as an unstable sorting algorithm.
The time complexity in all cases is O(n squared).
The time complexity in all cases is O(n squared).
It is less efficient in comparison to insertion sort.
It is less efficient in comparison to insertion sort.
The number of comparisons made during iterations is more than the element swapping that is done.
The number of comparisons made during iterations is more than the element swapping that is done.
The location of every element in the list is previously known.
The location of every element in the list is previously known.
This means the user only searches for the element that needs to be inserted at the specific position.
This means the user only searches for the element that needs to be inserted at the specific position.
It is efficient compared to the bubble sort
It is efficient compared to the bubble sort
It is quick in comparison to bubble sort.
It is quick in comparison to bubble sort.
It uses item selection.
It uses item selection.
Following is the Selection Sort Algorithm
Step 1 - Set MIN to location 0
Step 2 - Search the minimum element in the list
Step 3 - Swap with value at location MIN
Step 4 - Increment MIN to point to next element
Step 5 - Repeat until list is sorted
How can grid plot in Bokeh library be created with Python?

Bokeh is a Python package that helps in data visualization. It is an open source project. Bokeh renders its plot using HTML and JavaScript. This indicates that it is useful while working with web-based dashboards.
Bokeh converts the data source into a JSON file. This file is used as an input to BokehJS, which is a JavaScript library. This BokehJS is written in TypeScript that helps render visualization on modern browsers.
Dependencies of Bokeh −
Numpy
Pillow
Jinja2
Packaging
Pyyaml
Six
Tornado
Python−dateutil
Installation of Bokeh on Windows command prompt
pip3 install bokeh

Installation of Bokeh on Anaconda prompt
conda install bokeh
import numpy as np

from bokeh.plotting import figure, output_file, show

N = 420
x = np.linspace(0, 14, N)
y = np.linspace(0, 14, N)
x1, y1 = np.meshgrid(x, y)
d = np.sin(x1)*np.cos(y1)

p = figure(tooltips=[("x", "$x"), ("y", "$y"), ("value", "@image")])
p.x_range.range_padding = p.y_range.range_padding = 0

p.image(image=[d], x=0, y=0, dw=11, dh=11, palette="Spectral11", level="image")
p.grid.grid_line_width = 0.6

output_file("gridplot.html", title="grid plot example")

show(p)
The required packages are imported, and aliased.
The required packages are imported, and aliased.
The figure function is called along with plot width and height.
The figure function is called along with plot width and height.
The data is defined using NumPy library.
The data is defined using NumPy library.
The ‘output_file’ function is called to mention the name of the html file that will be generated.
The ‘output_file’ function is called to mention the name of the html file that will be generated.
The ‘image’ function present in Bokeh is called, along with data.
The ‘image’ function present in Bokeh is called, along with data.
The ‘show’ function is used to display the plot.
The ‘show’ function is used to display the plot.
How to get HTML content of an element using jQuery?

To get HTML content of an element using jQuery, use the html() method. The html() method gets the html contents of the first matched element.
You can try to run the following code to get HTML content of an element using jQuery:
Live Demo
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("#button1").click(function(){
    var res = $('#demo').html();
    alert(res);
  });
});
</script>
</head>
<body>

<div id="demo"> This is <b>demo</b> text.
</div>
<button id="button1">Get</button>
</body>
</html>
How to create an empty file using Python?

The easiest way to simply create a file without truncating it in case it exists is −
open('my_file.txt', 'a').close()
In Python 3.4+, you can directly use the pathlib module to touch files. For example,
from pathlib import Path
Path('my_file.txt').touch()
You can also create new files without opening them using the os module. The method mknod() creates a filesystem node (file, device special file or named pipe) named filename. For example,
import os
os.mknod("my_file.txt")
C# Program to get the last access time of a file

To get the last access time of a file in C#, use the LastAccessTime() method.
For this, use the FileInfo as well as DateTime classes.Create an object of each −
FileInfo file = new FileInfo("new.txt");
DateTime dt = file.CreationTime;
dt = file.LastAccessTime;
Let us see the complete code −
 Live Demo
using System.IO;
using System;
public class Program {
   public static void Main() {
      using (StreamWriter sw = new StreamWriter("quiz.txt")) {
         sw.WriteLine("Quizzes!");
      }
      FileInfo file = new FileInfo("quiz.txt");
      // last access time
      DateTime dt = file.LastAccessTime;
      Console.WriteLine(dt);
   }
}
9/5/2018 5:21:43 AM
C++ Program to Display Fibonacci Series

The fibonacci series contains numbers in which each term is the sum of the previous two terms. This creates the following integer sequence −
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377.......
The recurrence relation that defines the fibonacci numbers is as follows −
F(n) = F(n-1) + F(n-2) F(0)=0 F(1)=1
There are two methods to display fibonacci series i.e. using dynamic programming and recursive programming. These are further explained as follows −
#include<iostream>
using namespace std;
void fib(int n) {
   int f[n];
   int i;
   f[0] = 0;
   f[1] = 1;
   for (i = 2; i < n; i++) {
      f[i] = f[i-1] + f[i-2];
   }
   for (i = 0; i < n; i++) {
      cout<<f[i]<<" ";
   }
}
int main () {
   int n = 10;
   fib(n);
   getchar();
   return 0;
}
The output of the above program is as follows.
0 1 1 2 3 5 8 13 21 34
In the program, main() is the driver function. The actual code for the creation of the fibonacci series is stored in the function fib() which is called from main.
An array f[n] is created which will store the first n terms of the fibonacci series. The first and second elements of this array are initialized to 0 and 1 respectively.
f[0] = 0;
f[1] = 1;
Then for loop is used to store each element in the array as the sum of its previous two elements.
for (i = 2; i < n; i++) {
   f[i] = f[i-1] + f[i-2];
}
Finally the fibonacci series is displayed.
for (i = 0; i < n; i++) {
   cout<<f[i]<<" ";
}
Let us see how to display fibonacci series using recursion.
#include<iostream>
using namespace std;
int fib(int n) {
   if (n <= 1)
   return n;
   return fib(n-1) + fib(n-2);
}
int main () {
   int n = 10, i;
   for(i=0;i<n;i++)
   cout<<fib(i)<<" ";
   return 0;
}
0 1 1 2 3 5 8 13 21 34
In the above program, a for loop is set that creates each term of the fibonacci series using recursion. This is done by calling the function fib() for each term in the series.
for(i=0;i<n;i++)
cout<<fib(i)<<" ";
The function fib() returns 0 or 1 if n is 0 or 1 respectively. If not, it calls itself recursively as the sum of the previous two terms until the correct value is returned.
if (n <= 1)
return n;
return fib(n-1) + fib(n-2);
TypeScript - Array slice()

slice() method extracts a section of an array and returns a new array.
array.slice( begin [,end] );

begin − Zero-based index at which to begin extraction. As a negative index, start indicates an offset from the end of the sequence.
begin − Zero-based index at which to begin extraction. As a negative index, start indicates an offset from the end of the sequence.
end − Zero-based index at which to end extraction.
end − Zero-based index at which to end extraction.
Returns the extracted array based on the passed parameters.
var arr = ["orange", "mango", "banana", "sugar", "tea"]; 
console.log("arr.slice( 1, 2) : " + arr.slice( 1, 2) );  
console.log("arr.slice( 1, 3) : " + arr.slice( 1, 3) );

On compiling, it will generate the same code in JavaScript.
Its output is as follows −
arr.slice( 1, 2) : mango 
arr.slice( 1, 3) : mango,banana


    45 Lectures 
     4 hours 

 Antonio Papa

    41 Lectures 
     7 hours 

 Haider Malik

    60 Lectures 
     2.5 hours 

 Skillbakerystudios

    77 Lectures 
     8 hours 

 Sean Bradley

    77 Lectures 
     3.5 hours 

 TELCOMA Global

    19 Lectures 
     3 hours 

 Christopher Frewin
 Print
 Add Notes
 Bookmark this page
ES6 - Array Method push()

push() method appends the given element(s) in the last of the array and returns the length of the new array.
array.push(element1, ..., elementN);    

element1, ..., elementN: The elements to add to the end of the array.
element1, ..., elementN: The elements to add to the end of the array.
Returns the length of the new array.
var numbers = new Array(1, 4, 9);
var length = numbers.push(10); 
console.log("new numbers is : " + numbers );  
length = numbers.push(20); 
console.log("new numbers is : " + numbers );    
new numbers is : 1,4,9,10 
new numbers is : 1,4,9,10,20


    32 Lectures 
     3.5 hours 

 Sharad Kumar

    40 Lectures 
     5 hours 

 Richa Maheshwari

    16 Lectures 
     1 hours 

 Anadi Sharma

    50 Lectures 
     6.5 hours 

 Gowthami Swarna

    14 Lectures 
     1 hours 

 Deepti Trivedi

    31 Lectures 
     1.5 hours 

 Shweta
 Print
 Add Notes
 Bookmark this page
PHP program to check if a year is leap year or not

To check if a year is leap year or not in PHP, the code is as follows −
 Live Demo
<?php
   function year_check($my_year){
      if ($my_year % 400 == 0)
         print("It is a leap year");
      else if ($my_year % 100 == 0)
         print("It is not a leap year");
      else if ($my_year % 4 == 0)
         print("It is a leap year");
      else
         print("It is not a leap year");
   }
   $my_year = 1900;
   year_check($my_year);
?>
It is not a leap year
A function named ‘year_check’ is defined that takes a year as a parameter. It checks to see if the year can be divided by 400 or 4 completely, if yes, it means it is a leap year. Otherwise, it is a leap year. The value for year is defined outside the function, and the function is called by passing this year as a parameter to it. Relevant output is displayed on the console.
What is onsubmit event in JavaScript?

The onsubmit event is an event that occurs when you try to submit a form. You can put your form validation against this event type. The following example shows how to use onsubmit. Here we are calling a validate() function before submitting a form data to the web server. If validate() function returns true, the form will be submitted, otherwise, it'll not submit the data.
The following example is a code snippet showing the usage of the onsubmit event −
<html>
   <head>
      <script>
         <!--
            function validation() {
               all validation goes here
               .........
               return either true or false
            }
         //-->
      </script>
   </head>
   <body>
      <form method = "POST" action = "t.cgi" onsubmit = "return validate()">
         .......
         <input type = "submit" value = "Submit" />
      </form>
   </body>
</html>
Tryit Editor v3.7

HTML Input types
Tryit: input type = url
How to find the second largest element in a user-input JavaScript array?

Let’s say following is our array −
var numbers=[10,50,80,60,89];
To find the second largest element, the code is as follows −
var numbers=[10,50,80,60,89];
var firstLargerNumber = Number.MIN_SAFE_INTEGER;
var secondlargerNumber = firstLargerNumber;
for(var tempNumber of numbers){
   if(tempNumber > firstLargerNumber){
      secondlargerNumber = firstLargerNumber;
      firstLargerNumber = tempNumber;
   }
   else if(tempNumber > secondlargerNumber){
      secondlargerNumber = tempNumber;
   }
}
console.log("The second largest number="+secondlargerNumber);
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo138.js.
This will produce the following output −
PS C:\Users\Amit\JavaScript-code> node demo138.js
The second largest number=80
How to print a name multiple times without loop statement using C language?

Try to print a name 10 times without using any loop or goto statement in C programming language.
Generally, looping statements are used to repeat the block of code until condition is false.
In this program, we are trying to print a name 10 times without using loop or goto statements.
 Live Demo
#include <stdio.h>
void printname(char* name,int count){
   printf("%03d : %s\n",count+1,name);
   count+=1;
   if(count<10)
      printname(name,count);
}
int main(){
   char name[50];
   printf("\nEnter you name :");
   scanf("%s",name);
   printname(name,0);
   return 0;
}
Enter you name :tutorialspoint
001 : tutorialspoint
002 : tutorialspoint
003 : tutorialspoint
004 : tutorialspoint
005 : tutorialspoint
006 : tutorialspoint
007 : tutorialspoint
008 : tutorialspoint
009 : tutorialspoint
010 : tutorialspoint
Below is the program to print your name 10 times using any loop or goto statement −
 Live Demo
#include <stdio.h>
int main(){
   char name[50],i;
   printf("\nEnter you name :");
   scanf("%s",name);
   for(i=0;i<10;i++){
      printf("%s\n",name);
   }
   return 0;
}
Enter you name :TutorialsPoint
TutorialsPoint
TutorialsPoint
TutorialsPoint
TutorialsPoint
TutorialsPoint
TutorialsPoint
TutorialsPoint
TutorialsPoint
TutorialsPoint
TutorialsPoint
Change the order of a Pandas DataFrame columns in Python - GeeksforGeeks

11 Aug, 2021
Let us see how to change the order of a DataFrame’s columns. 
Algorithm :  
Create a DataFrame.
Reassign the same DataFrame with the order of the columns changed.
Print the DataFrame.
Example 1 :
Python3
# importing the modulesimport pandas as pdimport numpy as np # creating the DataFramemy_data = {'Sr.no': [1, 2, 3, 4, 5],           'Name': ['Ram', 'Sham', 'Sonu',                    'Tinu', 'Monu'],           'Maths Score': [45, 67, 89, 74, 56]}df = pd.DataFrame(data = my_data) # printing the original DataFrameprint("My Original DataFrame")print(df) # altering the DataFramedf = df[['Sr.no', 'Maths Score', 'Name']] # printing the altered DataFrameprint('After altering Name and Maths Score')print(df)
Output:  
 
Example 2 :
Python3
# importing the modulesimport pandas as pd  # creating the DataFramel1 =["Amar", "Barsha", "Carlos", "Tanmay", "Misbah"]l2 =["Alpha", "Bravo", "Charlie", "Tango", "Mike"]l3 =[23, 25, 22, 27, 29]l4 =[69, 54, 73, 70, 74]df = pd.DataFrame(list(zip(l1, l2, l3, l4)))df.columns =['Name', 'Code', 'Age', 'Weight'] # printing the original DataFrameprint("My Original DataFrame")print(df)  # altering the DataFramedf = df[['Name', 'Code', 'Weight', 'Age']]  # printing the altered DataFrameprint('After altering Weight and Age')print(df)
Output :  
 
 
saurabh1990aror
surinderdawra388
Python pandas-dataFrame
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
How to Install PIP on Windows ?
Enumerate() in Python
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python String | replace()
Python program to convert a list to string
Create a Pandas DataFrame from Lists
Reading and Writing to text files in Python
Tryit Editor v3.6 - Show Node.js

var http = require('http');
var url = require('url');
​
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/html'});
  /*Use the url module to turn the querystring into an object:*/
  var q = url.parse(req.url, true).query;
  /*Return the year and month from the query object:*/
  var txt = q.year + " " + q.month;
How to Install Scipy In Python on Linux? - GeeksforGeeks

17 Oct, 2021
In this article, we are going to see how to install Scipy in Python on Linux, SciPy is a python library that is useful in solving many mathematical equations and algorithms, it is a free and open-source Python library built on top of the popular NumPy library.
There are generally two easy methods using which we can install SciPy on our Linux machine. One is simply using the inbuilt package manager that comes with the installation of Linux and the second is using the pip, the python package manager. Both the methods take merely a single command to install SciPy.
Step 1: To install the SciPy run the following command, this command will install the SciPy and the required dependencies as well:
pip3 install numpy scipy matplotlib ipython jupyter pandas sympy nose
Installing scipy
Step 2: To verify the installation, run the following command:
python3 -m pip show scipy
Scipy installed
Step 1: Install Aptitude package manager using the following command, Aptitude package manager is an interactive package manager for installing packages in the Linux system.
sudo apt install aptitude
Installation using aptitude
Step 2: Install Scipy using the aptitude package manager.
sudo aptitude install python3-scipy  
Installing the scipy using aptitude
Note: You can also use the inbuilt package manager apt-get.
sudo apt-get install python3-scipy
Both the command will result, the successful installation of the scipy.
Installing the scipy using apt-get
Step 3: To verify the installation, run the following command:
Verifying the installation
how-to-install
linux
Picked
How To
Installation Guide
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install FFmpeg on Windows?
How to Set Git Username and Password in GitBash?
How to Install Jupyter Notebook on MacOS?
How to Add External JAR File to an IntelliJ IDEA Project?
How to Create and Setup Spring Boot Project in Eclipse IDE?
Installation of Node.js on Linux
How to Install FFmpeg on Windows?
How to Install Pygame on Windows ?
How to Install Jupyter Notebook on MacOS?
How to Add External JAR File to an IntelliJ IDEA Project?
What is batch processing in JDBC?

Grouping related SQL statements into a batch and executing/submitting them at once is known as batch processing.
While executing a set of statements one after other the execution switches from the database to program simultaneously.
Using batch processing we can reduce this communication overhead and increase the performance of our Java application.
For Example, if we have a table named Emp with the following description:
+----------+--------------+------+-----+---------+-------+
| Field    | Type         | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| Name     | varchar(255) | YES  |     | NULL    |       |
| DOB      | String       | YES  |     | NULL    |       |
| Location | varchar(255) | YES  |     | NULL    |       |
+----------+--------------+------+-----+---------+-------+
And if you want to insert data we will generally do it using the statement as:
Stmt.execute("INSERT INTO Emp VALUES ('Amit', '30-9-1989', 'Hyderabad')");
Stmt.execute("INSERT INTO Emp VALUES ('Amit', '1-9-1989', 'Vishakhapatnam')");
And using PreparedStatement as:
String query = "INSERT INTO Emp(Name, String, Location) VALUES (?, ?, ?)";
PreparedStatement pstmt = con.prepareStatement(query);
pstmt.setString(1, "Amit");
pstmt.setDate(2, "30-9-1989"));
pstmt.setString(3, "Hyderabad");
pstmt.execute();
pstmt.setString(1, "Sumith");
pstmt.setDate(2, "1-9-1989"); //Friday, Sept 1, 1989 12:00:00 AM
pstmt.setString(3, "Vishakhapatnam");
pstmt.execute();
If you observe carefully in both scenarios, we are executing each insert statement individually. Which implies for each insert statement in the program, when the execute() method invoked, the insert statement is executed in the database and reverts back to the program.
This is ok for less number of inserts. But if this happens while inserting huge number of records this may occur communication overhead and the program takes more time to execute.
Using Batch Processing you can simply add the statements to the batch using the addBatch() method of the Statement Interface and execute them later using the executeBatch() method as shown below:
Stmt.addBatch("INSERT INTO Emp VALUES ('Amit', '30-9-1989', 'Hyderabad')");
Stmt.addBatch("INSERT INTO Emp VALUES ('Amit', '1-9-1989', 'Vishakhapatnam')");
Stmt.executeBatch();
pstmt.setString(1, "Amit");
pstmt.setDate(2, "30-9-1989"));
pstmt.setString(3, "Hyderabad");
pstmt.addBatch();
pstmt.setString(1, "Sumith");
pstmt.setDate(2, "1-9-1989"); //Friday, Sept 1, 1989 12:00:00 AM
pstmt.setString(3, "Vishakhapatnam");
pstmt.addBatch();
pstmt.executeBatch();
How to create minor ticks for a polar plot in matplotlib?

To create minor ticks for a polar plot in matplotlib, we can take the following steps
Set the figure size and adjust the padding between and around the subplots.
Set the figure size and adjust the padding between and around the subplots.
Create r (radius) and theta data points using numpy.
Create r (radius) and theta data points using numpy.
Add a subplot to the current figure.
Add a subplot to the current figure.
Iterate the points between 0 to 360 with step=10 and plot them to get the ticks.
Iterate the points between 0 to 360 with step=10 and plot them to get the ticks.
To display the figure, use Show() method.
To display the figure, use Show() method.
import numpy as np
import matplotlib.pyplot as plt

# Set the figure size
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True

# radius and theta for the polar plot
r = np.arange(0, 5, 0.1)
theta = 2 * np.pi * r

# Add a subplot
ax = plt.subplot(111, projection='polar')

tick = [ax.get_rmax(), ax.get_rmax() * 0.97]

# Iterate the points between 0 to 360 with step=10
for t in np.deg2rad(np.arange(0, 360, 10)):
    ax.plot([t, t], tick, lw=1, color="red")

# Display the plot
plt.show()

It will produce the following output −
Remove the child node of a specific element in JavaScript?

To remove the child node of a list javascript has provided removeChild() method. Using this method we can remove any list item using its index position. Let's discuss it in a nutshell.
node.removeChild(node);
In the following example, there are 3 elements in the provided list but after removing a child there are only two elements in the list and they were displayed in the output.  
Live Demo
<html>
<body>
<ul id = "list"><li>Tesla</li><li>Spacex</li><li>Solarcity</li></ul>
<script>
   var list = document.getElementById("list");
   list.removeChild(list.childNodes[1]);
</script>
</body>
</html>
Tesla
Solarcity
In the following example, there are 3 elements in the provided list but after removing the first child using method removeChild() the other remaining two elements left were displayed as shown in the output.  
Live Demo
<html>
<body>
<ul id = "list"><li>Tesla</li><li>Spacex</li><li>Solarcity</li></ul>
<script>
   var list = document.getElementById("list");
   list.removeChild(list.childNodes[0]);
</script>
</body>
</html>
Spacex
Solarcity
Remove and add new HTML Tags with JavaScript?

To remove and add new HTML tags, use the concept of hide() and show().
Let’s say the following are our buttons −
<button type="submit" id="hide">Click Me To hide above content </button>
<button type="submit" id="show">Click Me To show above content </button>
To remove and add tags on button clicks, use hie() and show() −
$(document).ready(function(){
   $("#hide").click(function(){
      $("h1").hide();
   });
   $("#show").click(function(){
      $("h1").show();
   });
});
 Live Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initialscale=1.0">
<title>Document</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
<body>
<h1>Test JavaScript</h1>
<button type="submit" id="hide">Click Me To hide above content
</button>
<button type="submit" id="show">Click Me To show above content
</button>
<script>
   $(document).ready(function(){
      $("#hide").click(function(){
         $("h1").hide();
      });
      $("#show").click(function(){
         $("h1").show();
      });
   });
</script>
</body>
</html>
To run the above program, save the file name “anyName.html(index.html)” and right click on the
file. Select the option “Open with Live Server” in VS Code editor.
This will produce the following output −
Case 1
When you click on the button “Click Me To hide above content”, you will get the following output.
Case 2
When you click on the button “Click Me To show above content”, you will get the following
output.
wxPython - Destroy button widget using Destroy() function - GeeksforGeeks

26 Jun, 2020
In this article we will learn that, how can we destroy a button widget from a window using Destroy() function in wx.Button class of wxPython. Destroy() function is used to simply destroy a window or widget safely.Destroy() returns True if the window has either been successfully deleted, or it has been added to the list of windows pending real deletion.
Syntax: wx.StaticText.Destroy(self)
Parameters: Destroy() function takes no arguments.
Return Type: bool
Returns: True if the window has either been successfully deleted, or it has been added to the list of windows pending real deletion.
Code Example:
import wx    class Example(wx.Frame):      def __init__(self, *args, **kwargs):        super(Example, self).__init__(*args, **kwargs)        self.InitUI()      def InitUI(self):        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)          # create parent panel        self.pnl = wx.Panel(self)                 # create a button at point (20, 50)        self.btn1 = wx.Button(self.pnl, id = 1, label ="Remove Text", pos =(20, 50))          # create button to destroy        self.btn0 = wx.Button(self.pnl, id = 1, label ="Click button to remove", pos =(20, 20))          # bind Onclick() function with button        self.btn1.Bind(wx.EVT_BUTTON, self.Onclick)            self.SetSize((350, 250))        self.SetTitle('wx.Button')        self.Centre()      def Onclick(self, e):        # destroy btn0 button        self.btn0.Destroy()  def main():    app = wx.App()    ex = Example(None)    ex.Show()    app.MainLoop()    if __name__ == '__main__':    main()
Output Window:before Destroy()
after Destroy()
Python wxPython-Button
Python-gui
Python-wxPython
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Box Plot in Python using Matplotlib
Bar Plot in Matplotlib
Python | Get dictionary keys as a list
Python | Convert set into a list
Ways to filter Pandas DataFrame by column values
Python - Call function from another file
loops in python
Multithreading in Python | Set 2 (Synchronization)
Python Dictionary keys() method
Python Lambda Functions
Insert Euro and Dollar symbol to a column in MySQL?

For this, use CASE statement with UPDATE command. Let us first create a table −
mysql> create table DemoTable1874
   (
   Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   Amount varchar(100)
   );
Query OK, 0 rows affected (0.00 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1874(Amount) values('3450');
Query OK, 1 row affected (0.00 sec)
mysql> insert into DemoTable1874(Amount) values('190');
Query OK, 1 row affected (0.00 sec)
mysql> insert into DemoTable1874(Amount) values('7600');
Query OK, 1 row affected (0.00 sec)
mysql> insert into DemoTable1874(Amount) values('4500');
Query OK, 1 row affected (0.00 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1874;
This will produce the following output −
+----+--------+
| Id | Amount |
+----+--------+
|  1 | 3450   |
|  2 | 190    |
|  3 | 7600   |
|  4 | 4500   |
+----+--------+
4 rows in set (0.00 sec)
Here is the query to insert Euro and Dollar symbol to a column in MySQL −
mysql> UPDATE DemoTable1874 SET Amount=
   CASE
      WHEN Id = 1 THEN Concat('$','',Amount)
      WHEN Id = 3 THEN Concat('€','',Amount)
   else
      Amount
      END
   ;
Query OK, 2 rows affected (0.00 sec)
Rows matched: 4  Changed: 2 Warnings: 0
Let us check the table records once again −
mysql> select * from DemoTable1874;
This will produce the following output −
+----+---------+
| Id | Amount  |
+----+---------+
|  1 | $3450   |
|  2 | 190     |
|  3 | €7600   |
|  4 | 4500    |
+----+---------+
4 rows in set (0.00 sec)
What is the difference between implicit and explicit type conversion in C#?

The following is the difference between implicit and explicit type conversion −
These conversions are performed by C# in a type-safe manner.
To understand the concept, let us implicitly convert int to long.
int val1 = 11000;
int val2 = 35600;
long sum;

sum = val1 + val2;
Above, we have two integer variable and when we sum it in a long variable, it won’t show an error. Since the compiler does the implicit conversion on its own.
Let us print the values now.
using System;
using System.IO;

namespace Demo {
   class Program {
      static void Main(string[] args) {
         int val1 =34567;
         int val2 =56743;
         long sum;

         sum = val1 + val2;

         Console.WriteLine("Sum= " + sum);

         Console.ReadLine();
      }
   }
}
These conversions are done explicitly by users using the pre-defined functions.
Let us see an example to typecast double to int −
using System;

namespace Program {
   class Demo {
      static void Main(string[] args) {
         double d = 1234.89;
         int i;

         // cast double to int.
         i = (int)d;
         Console.WriteLine(i);
         Console.ReadKey();
      }
   }
}
How  to Check if a Number is Odd or Even using Python?

Python's modulo (%) operator (also called remainder operator) is useful to determine if a number is odd or even. We obtain remainder of division of a number by 2. If it is 0 , it is even otherwise it is odd
no=int(input('enter number'))
if no%2==0:
    print ('{} is even'.format(no))
else:
    print ('{} is odd'.format(no))
The output
enter number25
25 is odd

enter number40
40 is even
F# - Modules

As per MSDN library, an F# module is a grouping of F# code constructs, such as types, values, function values, and code in do bindings. It is implemented as a common language runtime (CLR) class that has only static members.
Depending upon the situation whether the whole file is included in the module, there are two types of module declarations −
Top-level module declaration
Local module declaration
In a top-level module declaration the whole file is included in the module. In this case, the first declaration in the file is the module declaration. You do not have to indent declarations in a top-level module.
In a local module declaration, only the declarations that are indented under that module declaration are part of the module.
Syntax for module declaration is as follows −
// Top-level module declaration.
module [accessibility-modifier] [qualified-namespace.]module-name
   declarations

// Local module declaration.
module [accessibility-modifier] module-name =
   declarations

Please note that the accessibility-modifier can be one of the following − public, private, internal. The default is public.
The following examples will demonstrate the concepts −
The module file Arithmetic.fs −
module Arithmetic
let add x y =
   x + y

let sub x y =
   x - y
	
let mult x y =
   x * y
	
let div x y =
   x / y
The program file main.fs −
// Fully qualify the function name.
open Arithmetic
let addRes = Arithmetic.add 25 9
let subRes = Arithmetic.sub 25 9
let multRes = Arithmetic.mult 25 9
let divRes = Arithmetic.div 25 9

printfn "%d" addRes
printfn "%d" subRes
printfn "%d" multRes
printfn "%d" divRes
When you compile and execute the program, it yields the following output −
34
16
225
2
110
90
1000
10

// Module1
module module1 =
   // Indent all program elements within modules that are declared with an equal sign.
   let value1 = 100
   let module1Function x =
      x + value1

// Module2
module module2 =
   let value2 = 200

   // Use a qualified name to access the function.
   // from module1.
   let module2Function x =
      x + (module1.module1Function value2)

let result = module1.module1Function 25
printfn "%d" result

let result2 = module2.module2Function 25
printfn "%d" result2
When you compile and execute the program, it yields the following output −
125
325

 Print
 Add Notes
 Bookmark this page
Instruction type RLC in 8085 Microprocessor

In 8085 Instruction set, there is one mnemonic RLC stands for “Rotate Left Accumulator”. It rotates the Accumulator contents to the left by 1-bit position. The following Fig. shows the operation explicitly.
In this fig. it has been depicted that the most significant bit of the Accumulator will come out and left rotate will create an empty space at the least significant bit place and this come out bit will be copied at the empty bit place and also on the Cy bit in the flag register. Thus, Cy flag gets a copy of the bit moved out from the MS bit position. Notice that Cy flag is not involved in the rotation, and it is only 8-bit rotation of Accumulator contents. Only Cy flag is affected by this instruction execution.
This instruction can be used in following different case studies.
To check whether the number is positive or negative. As the most significant of the Accumulator content holds the sign bit.
To check whether the number is positive or negative. As the most significant of the Accumulator content holds the sign bit.
To perform multiplication by 2, rotate the Accumulator to left. It works correctly for unsigned numbers, as long as the MS bit of Accumulator is a 0 before rotation. As we know that multiplication by 2n results n-bit left shift of the number.
To perform multiplication by 2, rotate the Accumulator to left. It works correctly for unsigned numbers, as long as the MS bit of Accumulator is a 0 before rotation. As we know that multiplication by 2n results n-bit left shift of the number.
Let us discuss some examples on this mnemonic usage.
35H --->    0011 0101
          0 0110 1010 ---> 6AH

(A)
(Cy)
Here the accumulation content has been doubled as we had 1-bit left shift and the MSB was 0.
95H --->    1001 0101
1 0010 1011 ---> 2BH

(A)
(Cy)
Here, in this example, the Accumulator value has not been doubled, as most significant bit of  theAccumulator was a 1 before the rotation.
The timing diagram against this instruction RLC execution is as follows −
Summary − So this instruction RLC requires 1-Byte, 1-Machine Cycle (Opcode Fetch) and 4 T-States for execution as shown in the timing diagram.
How to define and query json columns in PostgreSQL?

The ability to define JSON columns in PostgreSQL makes it very powerful and helps PostgreSQL users experience the best of both worlds: SQL and NoSQL.
Creating JSON columns is quite straightforward. You just have to create/ define it like any other column and use the data type as JSON.
Let us create a new table in PostgreSQL, called json_test −
CREATE TABLE json_test(
   serial_no SERIAL PRIMARY KEY,
   name VARCHAR,
   metadata JSON
);
Now, let us populate it with some data −
INSERT INTO json_test(name, metadata)
VALUES ('Yash','{"marks_scored":{"science":50,"maths":65}}'),
('Isha', '{"marks_scored":{"science":70,"maths":45}}');
As you can see, the JSON values are added within single quotes, just like we add VARCHAR/TEXT values.
Now, if you query the table (SELECT * from json_test), you will see the following output −
However, we can do better than this. Suppose I want to know the marks scored in science by both Yash and Isha. All I need to do is use the -> operator. See the example below −
SELECT name, metadata->'marks_scored'->'science' as science_marks
from json_test
The output will be
Please note that over here, the output column science_marks is of type JSON and not INTEGER. This is because → operator always returns a json. Apart from the → operator, the->> operator is also commonly used. The difference between the two is that while → returns a json, ->> returns a text.
Thus,
metadata→'marks_scored'→'science' will return a JSON, even though we have integers for science_marks
metadata→'marks_scored'→'science' will return a JSON, even though we have integers for science_marks
metadata→'marks_scored'->>' science' will return text
metadata→'marks_scored'->>' science' will return text
metadata->>'marks_scored'→'science' will give an error. Because the 'marks_scored' output is no longer JSON, and thus, the → operator doesn’t work on it.
metadata->>'marks_scored'→'science' will give an error. Because the 'marks_scored' output is no longer JSON, and thus, the → operator doesn’t work on it.
If you explicitly want the science_marks in integer format, you first get the result in text format, and then cast it to an integer, as shown below −
SELECT name, CAST(metadata->'marks_scored'->>'science' as integer)
as science_marks from json_test
Note that you cannot cast JSON to an integer. You need to use the ->> operator at the last step to get text output, and only then can you cast the text to an integer.
Just like you can use the JSON columns in the select part of the query, you can also use them in the WHERE part of the query. If we wish to find out the students who have scored > 60 marks in Science, your query would look like
SELECT name from json_test
WHERE CAST(metadata->'marks_scored'->>'science' as integer) > 60
And the output would be
What is the use of $ErrorView in PowerShell?

$Errorview variable determines the display format of the error message in PowerShell. Before PowerShell 7 there were mainly two views,
Normal View (Default view)
Normal View (Default view)
Category View
Category View
With PowerShell version 7, one new additional error view category is included and now there are 3 $ErrorView categories for version 7.
Concise View (Default)
Concise View (Default)
Normal View
Normal View
Category View
Category View
We will understand each view one by one.
It is the default view before PowerShell version 7 and it produces the detailed multiline errors and bit noisy. It includes the exception name, category, line number of the error, etc.
$ErrorView = 'NormalView'
Get-ChildItem C:\NoDirectory
Get-ChildItem : Cannot find path 'C:\NoDirectory' because it does not exist.
At line:1 char:1
+ Get-ChildItem C:\NoDirectory
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\NoDirectory:String) [Get-ChildItem],
ItemNotFoundException
+ FullyQualifiedErrorId :
PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
Single liner and structured view, designed for the production environment. Its format is as below.
{Category}: ({TargetName}:{TargetType}):[{Activity}], {Reason}
$ErrorView = 'CategoryView'
Get-ChildItem C:\NoDirectory
ObjectNotFound: (C:\NoDirectory:String) [Get-ChildItem], ItemNotFoundException
The default view in PowerShell version 7. It provides a concise error message. If the error is from thecommand line it’s a single line error message.
$ErrorView = 'ConciseView'
Get-ChildItem C:\NoDirectory
Get-ChildItem: Cannot find path 'C:\NoDirectory' because it does not exist.
If the error is from the script then it is a multiline error message that contains the error message and the line number for the error.
$ErrorView = 'ConciseView'
PS C:\> C:\Temp\TestPS1.ps1
Error message in Concise view
Get-ChildItem: C:\Temp\TestPS1.ps1:2
Line |
2 | Get-ChildItem c:\nonDirectory
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\nonDirectory' because it does not exist.
Download webpage in Java

We can download a web page using its URL in Java. Following are the steps needed.
Create URL object using url string.Download webpage in Java
Create URL object using url string.
Download webpage in Java
Create a BufferReader object using url.openStream() method.BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
Create a BufferReader object using url.openStream() method.
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
Create a BufferWriter object to write to a file.BufferedWriter writer = new BufferedWriter(new FileWriter("page.html"));
Create a BufferWriter object to write to a file.
BufferedWriter writer = new BufferedWriter(new FileWriter("page.html"));
Read each line using BufferReader and write using BufferWriter.String line;
while ((line = reader.readLine()) != null) {
writer.write(line);
}
Read each line using BufferReader and write using BufferWriter.
String line;
while ((line = reader.readLine()) != null) {
writer.write(line);
}
Following is the complete program to download a given URL page at current location.
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;

public class Tester {
   public static void main(String args[]) throws IOException {
      download("http://www.google.com");
   }
   public static void download(String urlString) throws IOException {
      URL url = new URL(urlString);
      try(
         BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
         BufferedWriter writer = new BufferedWriter(new FileWriter("page.html"));
      ) {
         String line;
         while ((line = reader.readLine()) != null) {
            writer.write(line);
         }
         System.out.println("Page downloaded.");
      }
   }
}
Page downloaded.
IntStream map() method in Java

The IntStream map() method returns the new stream consisting of the results of applying the given function to the elements of this stream.
The syntax is as follows
IntStream map(IntUnaryOperator mapper)
Here, mapper parameter is a non-interfering, stateless function to apply to each element
Create an IntStream and add some elements
IntStream intStream1 = IntStream.of(20, 35, 40, 55, 60);
Now, map it with the new IntStream and display the updated stream elements applying the condition in the map() function
IntStream intStream2 = intStream1.map(a -> (a + a));
The following is an example to implement IntStream map() method in Java
 Live Demo
import java.util.*;
import java.util.stream.IntStream;
public class Demo {
   public static void main(String[] args) {
      IntStream intStream1 = IntStream.of(20, 35, 40, 55, 60);
      IntStream intStream2 = intStream1.map(a -> (a + a));
      System.out.println("Updated Stream...");
      intStream2.forEach(System.out::println);
   }
}
Updated Stream...
40
70
80
110
120
How to draw a rectangle in OpenCV using Java?

The org.opencv.imgproc package of Java OpenCV library contains a class named Imgproc. To draw a rectangle you need to invoke the rectangle() method of this class. This method accepts the following parameters −
A Mat object representing the image on which the rectangle is to be drawn.
A Mat object representing the image on which the rectangle is to be drawn.
Two Point objects representing the vertices of the rectangle that is to be
drawn.
Two Point objects representing the vertices of the rectangle that is to be
drawn.
A Scalar object representing the color of the rectangle(BGR).
A Scalar object representing the color of the rectangle(BGR).
An integer representing the thickness of the rectangle(default:1).
An integer representing the thickness of the rectangle(default:1).
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.highgui.HighGui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
public class DrawingRectangle {
   public static void main(String args[]) {
      // Loading the OpenCV core library
      System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
      //Loading the OpenCV core library
      System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
      //Reading the source image in to a Mat object
      Mat src = Imgcodecs.imread("D:\\images\\blank.jpg");
      //Drawing a Rectangle
      Point point1 = new Point(100, 100);
      Point point2 = new Point(500, 300);
      Scalar color = new Scalar(64, 64, 64);
      int thickness = 10;
      Imgproc.rectangle (src, point1, point2, color, thickness);
      //Saving and displaying the image
      Imgcodecs.imwrite("arrowed_line.jpg", src);
      HighGui.imshow("Drawing a rectangle", src);
      HighGui.waitKey();
   }
}
On executing, the above program generates the following window −
How to split a string in Java?

Java provides a split() methodology you'll be able to split the string around matches of the given regular expression.
The array returned by this method contains each substring of this string that is terminated by another substring that matches the given expression or is terminated by the end of the string. 
If the expression doesn't match any a part of the input then the ensuing array has the only 1part, specifically this string.
Live Demo
import java.lang.*;

public class StringDemo {
   public static void main(String[] args) {

      String str = "a d, m, i.n";
      String delimiters = "\\s+|,\\s*|\\.\\s*";
      String[] tokensVal = str.split(delimiters);
     
      // prints the count of tokens
      System.out.println("Count of tokens = " + tokensVal.length);    
     
      for(String token : tokensVal) {
         System.out.print(token);
      }      
      tokensVal = str.split(delimiters, 3);
      System.out.println("\nCount of tokens = " + tokensVal.length);    
     
      for(String token : tokensVal) {
         System.out.print(token);
      }    
   }
}
Count of tokens = 5
admin
Count of tokens = 3
adm, i.n