code-rag-bench/online-tutorials huggingface dataset:
MySQL IN Operator

The IN operator allows you to specify multiple values in a 
WHERE clause.
The IN operator is a shorthand for multiple 
OR conditions.
or:
The table below shows the complete "Customers" table from the Northwind sample database:
The following SQL statement selects all customers that are located in "Germany", "France" 
or "UK":
The following SQL statement selects all customers that are NOT located in "Germany", "France" or "UK":
The following SQL statement selects all customers that are from the same 
countries as the suppliers:
Use the IN operator to select all the records where Country is either "Norway" or "France".
SELECT * FROM Customers
  'France';

Start the Exercise
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
FROM_UNIXTIME() function in MySQL - GeeksforGeeks

22 Dec, 2020
FROM_UNIXTIME() :This function in MySQL helps to return date /DateTime representation of a Unix timestamp. The format of returning value will be ‘YYYY-MM-DD HH:MM:SS’ or ‘YYYYMMDDHHMMSS’, depending on the context of the function.
Syntax :
FROM_UNIXTIME(unix_timestamp, format)
Parameters :The function can accept two arguments as follows.
unix_timestamp –It is an internal timestamp value and it’s value can be produced by UNIX_TIMESTAMP() function.
format –The way in which the resulting value will be formatted
Result :The function will return date /DateTime representation of a Unix timestamp. And the format of returning value will be ‘YYYY-MM-DD HH:MM:SS’ or ‘YYYYMMDDHHMMSS’, depending on the context of the function.
Example-1 :Working of FROM_UNIXTIME() function with one parameter.
SELECT FROM_UNIXTIME(599462400) 
AS Unix;
Output :
Unix
Example-2 :Working of FROM_UNIXTIME() function with fractional seconds.
SELECT FROM_UNIXTIME(599462445.99999) 
AS Unix;
Output :
Unix
Example-3 :Working of FROM_UNIXTIME() function when both parameters are passed.
When format is ‘%W, %D %M %Y’ –SELECT FROM_UNIXTIME(799462445, '%W, %D %M %Y') 
AS Unix;Output :UnixTuesday, 2nd May 1995
SELECT FROM_UNIXTIME(799462445, '%W, %D %M %Y') 
AS Unix;
Output :
Unix
When format is ‘%h:%i %p, %D %M %Y’ –SELECT FROM_UNIXTIME(799462445, '%h:%i %p, %D %M %Y') 
AS Unix;Output :Unix06:54 PM, 2nd May 1995
SELECT FROM_UNIXTIME(799462445, '%h:%i %p, %D %M %Y') 
AS Unix;
Output :
Unix
Example-4 :Working of FROM_UNIXTIME() function in Numeric context.
SELECT  
FROM_UNIXTIME(846562400) As 'String_form',
FROM_UNIXTIME(846562400) + 1 As 'Numeric_form';
Output :
DBMS-SQL
mysql
Technical Scripter 2020
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?
What is Temporary Table in SQL?
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL using Python
SQL | Subquery
SQL Query to Convert VARCHAR to INT
How to Write a SQL Query For a Specific Date Range and Date Time?
How to Select Data Between Two Dates and Times in SQL Server?
SQL - SELECT from Multiple Tables with MS SQL Server
SQL Query to Delete Duplicate Rows
How to click on image in selenium webdriver Python?

We can click on an image with Selenium webdriver in Python using the method click. First of all, we have to identify the image with the help of any of the locators like id, class, name, css, xpath, and so on. An image in the html code is represented by the img tagname.
Let us see the html code of an image element.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.concurrent.TimeUnit;
public class ImageClk{
   public static void main(String[] args) {
      System.setProperty("webdriver.gecko.driver",
"C:\\Users\\ghs6kor\\Desktop\\Java\\geckodriver.exe");
      WebDriver driver = new FirefoxDriver();
      //implicit wait
      driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
      //URL launch
      driver.get("https://www.tutorialspoint.com/index.htm");
      // identify image
      WebElement l = driver.findElement(By.xpath("//img[@alt='Tutorialspoint']"));
      String s = l.getAttribute("title");
      System.out.println("Title attribute value is :" + s);
      l.click();
      driver.quit();
   }
}
Tryit Editor v3.7

HTML file paths
Tryit: relative url
Python | Extract unique tuples from list, Order Irrespective - GeeksforGeeks

11 Nov, 2019
Sometimes, while working with data, we can have a problem in which we need to check for similar records and eradicate them. When elements are ordered, this case has been discussed before. But sometimes, we might have to ignore the order and has to be removed in case similar elements occur. Let’s discuss certain ways in which this task can be performed.
Method #1 : Using list comprehension + set()The combination of above functionalities can be clubbed to perform this particular task. In this, we check for each pair and add to a set for reference to check if it has existed before and add if it’s a new one.
# Python3 code to demonstrate working of# Extract unique tuples from list(Order Irrespective)# using list comprehension + set()  # initialize tuples list test_list = [(1, 3), (4, 5), (3, 1), (1, 10), (5, 4)]  # printing original list print("The original list : " + str(test_list))  # Extract unique tuples from list(Order Irrespective)# using list comprehension + set()res = set() temp = [res.add((a, b)) for (a, b) in test_list               if (a, b) and (b, a) not in res]  # printing resultprint("The list after duplicated removal : " + str(list(res)))
The original list : [(1, 3), (4, 5), (3, 1), (1, 10), (5, 4)]
The list after duplicated removal : [(4, 5), (1, 3), (1, 10)]

 
Method #2 : Using frozenset()Another method to perform this particular task is to use frozenset(). This function eliminates internally the similar elements irrespective of order.
# Python3 code to demonstrate working of# Extract unique tuples from list(Order Irrespective)# using frozenset()  # initialize tuples list test_list = [(1, 3), (4, 5), (3, 1), (1, 10), (5, 4)]  # printing original list print("The original list : " + str(test_list))  # Extract unique tuples from list(Order Irrespective)# using frozenset()res = set(tuple(frozenset(sub)) for sub in set(test_list))  # printing resultprint("The list after duplicated removal : " + str(list(res)))
The original list : [(1, 3), (4, 5), (3, 1), (1, 10), (5, 4)]
The list after duplicated removal : [(4, 5), (1, 3), (1, 10)]

Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python Dictionary
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Different ways to create Pandas Dataframe
Defaultdict in Python
Python | Split string into list of characters
Python | Convert a list to dictionary
Python program to check whether a number is Prime or not
How to print without newline in Python?
\dagger - Tex Command

\dagger - Used to draw dagger symbol.
{ \dagger }
\dagger command draws dagger symbol.

\dagger

†



\dagger

†


\dagger

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
Stop and Wait protocol, its problems and solutions - GeeksforGeeks

08 Jun, 2021
It is the simplest flow control method in which the sender will send the packet and then wait for the acknowledgement by the receiver that it has received the packet then it will send the next packet. 
Stop and wait protocol is very easy to implement. 
 
Total time taken to send is,  
Ttotal = Tt(data) + Tp + Tq + Tprocess + Tt(ack) + Tp     

( since, Tq and Tprocess = 0)

Ttotal = Tt(data) + 2Tp + Tt(ack)
Ttotal = Tt(data) + 2Tp   

(when Tt(ack) is negligible) 
 
Efficiency 
= useful time / total cycle time 
= Tt / (Tt+2Tp)
= 1 / (1+2a)    [a = Tp/Tt] 
Note: Stop and wait is better for less distance. Hence it is a good protocol for LAN. Stop and wait is favorable for bigger packets. 
What if the data packet is lost in between ? 
 
 
According to sender, receiver is busy but actually data is lost.Receiver will assume, no packet has been sent by sender.Both will be waiting for each other and there will be a deadlock.
According to sender, receiver is busy but actually data is lost.
Receiver will assume, no packet has been sent by sender.
Both will be waiting for each other and there will be a deadlock.
Need for timeout timer: A timer is applied and the receiver will wait till the timeout timer for the data after that it will confirm that the data has been lost. 
What if the data packet has been lost ? After timeout timer expires, sender will assume that the data is lost but actually the acknowledgement is lost. By assuming this it will send the data packet again but according to receiver it is a new data packet, hence it will give rise to duplicate packet problem. 
To eliminate duplicate packet problem sequence number is added to the data packet. So using packet numbers it can easily determine the duplicate packets. 
What if there is a delay in receiving acknowledgement ? 
 
According to sender, the acknowledgement of packet 1 is delayed and packet 2 has been lost. But the receiver assumes that the acknowledgement that has been received was of packet 2. This problem is called missing packet problem. Missing packet problem can be solved if acknowledgements also have numbers. 
sagar0719kumar
Computer Networks
GATE CS
Computer Networks
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
TCP Server-Client implementation in C
RSA Algorithm in Cryptography
Differences between TCP and UDP
Data encryption standard (DES) | Set 1
Socket Programming in Python
ACID Properties in DBMS
Types of Operating Systems
Page Replacement Algorithms in Operating Systems
Normal Forms in DBMS
Differences between TCP and UDP
Get the date/time of the last change to a MySQL database?

You can get the date/time of the last change to a MySQL database with the help of INFORMATION_SCHEMA.TABLES. The syntax is as follows −
SELECT update_time
FROM information_schema.tables
WHERE table_schema = 'yourDatabaseName’'
AND table_name = 'yourTableName’;
To understand the above syntax, let us create a table. The query to create a table is as follows −
mysql> create table TblUpdate
   -> (
   -> Id int not null auto_increment primary key,
   -> Name varchar(20)
   -> );
Query OK, 0 rows affected (0.49 sec)
Insert some records in the table using insert command. The query is as follows −
mysql> insert into TblUpdate(Name) values('John');
Query OK, 1 row affected (0.18 sec)
mysql> insert into TblUpdate(Name) values('Carol');
Query OK, 1 row affected (0.22 sec)
Now you can display all records from the table using select statement. The query is as follows −
mysql> select *from TblUpdate;
+----+-------+
| Id | Name |
+----+-------+
| 1 | John |
| 2 | Carol |
+----+-------+
2 rows in set (0.00 sec)
Now you can update the table using the following query −
mysql> update TblUpdate set Name = 'James' where Id=2;
Query OK, 1 row affected (0.15 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Therefore, we just updated our table above. Now get the date/time of the last change to a MySQL database using the following query −
mysql> SELECT update_time
   -> FROM information_schema.tables
   -> WHERE table_schema = 'sample'
   -> AND table_name = 'TblUpdate'
   -> ;
The following is the output displaying we updated the database on 2019-02-09 22:49:44 −
+---------------------+
| UPDATE_TIME         |
+---------------------+
| 2019-02-09 22:49:44 |
+---------------------+
1 row in set (0.89 sec)
How to declare a pointer to a function?

28 May, 2017
Well, we assume that you know what does it mean by pointer in C. So how do we create a pointer to an integer in C?Huh..it is pretty simple..
int * ptrInteger; /*We have put a * operator between int 
                    and ptrInteger to create a pointer.*/

Here ptrInteger is a pointer to integer. If you understand this, then logically we should not have any problem in declaring a pointer to a function 
So let us first see ..how do we declare a function? For example,
int foo(int);

Here foo is a function that returns int and takes one argument of int type. So as a logical guy will think, by putting a * operator between int and foo(int) should create a pointer to a function i.e.
int * foo(int);

But Oops..C operator precedence also plays role here ..so in this case, operator () will take priority over operator *. And the above declaration will mean – a function foo with one argument of int type and return value of int * i.e. integer pointer. So it did something that we didn’t want to do. 
Chapters
descriptions off, selected
captions settings, opens captions settings dialog
captions off, selected
English
This is a modal window.
Beginning of dialog window. Escape will cancel and close the window.
End of dialog window.
So as a next logical step, we have to bind operator * with foo somehow. And for this, we would change the default precedence of C operators using () operator.
int (*foo)(int);

That’s it. Here * operator is with foo which is a function name. And it did the same that we wanted to do.
So that wasn’t as difficult as we thought earlier!
C-Pointers
pointer
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Substring in C++
Multidimensional Arrays in C / C++
Left Shift and Right Shift Operators in C/C++
Different Methods to Reverse a String in C++
std::string class in C++
Unordered Sets in C++ Standard Template Library
rand() and srand() in C/C++
Enumeration (or enum) in C
Memory Layout of C Programs
C Language Introduction
Random Number Generator in Solidity using keccak256

11 May, 2022
Random numbers are numbers that occur in a sequence with the following two mandatory conditions:
The values are uniformly distributed over a set interval.One cannot predict future values based on past outputs.
The values are uniformly distributed over a set interval.
One cannot predict future values based on past outputs.
Example: In the below example, we have created a contract with a function that will generate a random number. Below is the step by step description of the entire process to be followed.
Step 1: Take the instance of now, the msg.sender, and an incrementing nonce.
Step 2: “pack” the inputs and use keccak256() to convert into 256-bit hash.
Step 3: Convert that hash to an uint, and then use % 100 to take only the last 2 digits. This will give us a totally random number between 0 and 99.
Solidity
// Solidity program to// demonstrate on how// to generate a random numberpragma solidity ^0.6.6; // Creating a contractcontract GeeksForGeeksRandom{ // Initializing the state variableuint randNonce = 0; // Defining a function to generate// a random numberfunction randMod(uint _modulus) internal returns(uint){   // increase nonce   randNonce++;    return uint(keccak256(abi.encodePacked(now,                                          msg.sender,                                          randNonce))) % _                                          modulus; }}
  
Input:
 
100 
Output:
 
Note: The alias “now” for block.timestamp  in  the line below  was removed in the version 0.7.0 ,  you can use block.timestamp in place of now
return uint(keccak256(abi.encodePacked(now, msg.sender, randNonce))) % _modulus;
Possible attacks with this approach:
In Ethereum, all nodes are trying to solve the problem and verify the transaction. Once a node verifies it, it broadcasts it to the network.
 
Suppose we create a DApp where we flip a coin where the head is the winning side. We use the above function to predict heads or tails. If I were running a node, I could publish a transaction only to my own node and not share it. I will run the randMod function or the coin flip function until I will and will only share the transaction after I have won.
 
One way to solve this would be to use an oracle to access a random number function from outside the Ethereum blockchain. There are other cryptographic algorithms and third party functions that can be utilized, but they are not safe or should be audited.
 
simranarora5sos
nirban256
Blockchain
Solidity
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
PyQtGraph – Setting Horizontal Range of Plot Window

13 Sep, 2021
In this article we will see how we can set the horizontal range of the plot window in the PyQtGraph module. PyQtGraph is a graphics and user interface library for Python that provides functionality commonly required in designing and science applications. Its primary goals are to provide fast, interactive graphics for displaying data (plots, video, etc.) and second is to provide tools to aid in rapid application development (for example, property trees such as used in Qt Designer).Plot windows consist of two main parts: the Plot Panel containing the actual plotted graphics and the Control Panel. Horizontal range of the plot window is the range in which the view of horizontal axis lies i.e x-axis. A chart has an x-axis range and a y-axis range to show the correlation between two different data sets. The x-axis is the horizontal category line. Changes to the x-axis adjust the categories within this axis.
We can create a plot window with the help of command given below
# creating a pyqtgraph plot window
window = pg.plot()

In order to do this we use setXRange method with the plot window object
Syntax : window.setXRange(a, b)
Argument : It takes two integer as argument
Return : It returns None
Below is the implementation
# importing pyqtgraph as pgimport pyqtgraph as pg  # importing QtCore and QtGui from the pyqtgraph modulefrom pyqtgraph.Qt import QtCore, QtGui  # importing numpy as npimport numpy as np  import time  # creating a pyqtgraph plot windowwindow = pg.plot()  # titletitle = "GeeksforGeeks PyQtGraph"      # setting window titlewindow.setWindowTitle(title)  # create list for y-axisy1 = [5, 5, 7, 10, 3, 8, 9, 1, 6, 2]  # create horizontal list i.e x-axisx = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]  # create pyqt5graph bar graph item # with width = 0.6# with bar colors = greenbargraph1 = pg.BarGraphItem(x = x, height = y1, width = 0.6, brush ='g')  # add item to plot window# adding bargraph item to the windowwindow.addItem(bargraph1)  # setting horizontal rangewindow.setXRange(0, 30)    # main methodif __name__ == '__main__':          # importing system    import sys          # Start Qt event loop unless running in interactive mode or using     if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):        QtGui.QApplication.instance().exec_()         
Output :
sagar0719kumar
Python-gui
Python-PyQtGraph
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Pandas - Finding the uncommon rows between two DataFrames

To find the uncommon rows between two DataFrames, use the concat() method. Let us first import the required library with alias −
import pandas as pd
Create DataFrame1 with two columns −
dataFrame1 = pd.DataFrame(
   {
      "Car": ['BMW', 'Lexus', 'Audi', 'Tesla', 'Bentley', 'Jaguar'],
      "Reg_Price": [1000, 1500, 1100, 800, 1100, 900]
   }
)
Create DataFrame2 with two columns −
dataFrame2 = pd.DataFrame(
   {
      "Car": ['BMW', 'Lexus', 'Audi', 'Tesla', 'Bentley', 'Jaguar'],
      "Reg_Price": [1000, 1300, 1000, 800, 1100, 800]
   }
)
Finding uncommon rows between two DataFrames and concatenate the result −
print"\nUncommon rows between two DataFrames...\n",pd.concat([dataFrame1,dataFrame2]).drop_duplicates(keep=False)

Following is the code −
import pandas as pd

# Create DataFrame1
dataFrame1 = pd.DataFrame(
   {
      "Car": ['BMW', 'Lexus', 'Audi', 'Tesla', 'Bentley', 'Jaguar'],
      "Reg_Price": [1000, 1500, 1100, 800, 1100, 900]
   }
)

print"DataFrame1 ...\n",dataFrame1

# Create DataFrame2
dataFrame2 = pd.DataFrame(
   {
      "Car": ['BMW', 'Lexus', 'Audi', 'Tesla', 'Bentley', 'Jaguar'],
      "Reg_Price": [1000, 1300, 1000, 800, 1100, 800]
   }
)

print"\nDataFrame2 ...\n",dataFrame2

# finding uncommon rows between two DataFrames and concat the result
print"\nUncommon rows between two DataFrames...\n",pd.concat([dataFrame1,dataFrame2]).drop_duplicates(keep=False)



This will produce the following output −
DataFrame1 ...
       Car   Reg_Price
0      BMW        1000
1    Lexus        1500
2     Audi        1100
3    Tesla         800
4  Bentley        1100
5   Jaguar         900

DataFrame2 ...
       Car   Reg_Price
0      BMW        1000
1    Lexus        1300
2     Audi        1000
3    Tesla         800
4  Bentley        1100
5   Jaguar         800

Uncommon rows between two DataFrames...
      Car   Reg_Price
1   Lexus        1500
2    Audi        1100
5  Jaguar         900
1   Lexus        1300
2    Audi        1000
5  Jaguar         800
Google Charts - Table Chart

Table chart helps in rendering a table which can be sorted and paged. Table cells can be formatted using format strings, or by directly inserting HTML as cell values. Numeric values are right-aligned by default; boolean values are displayed as check marks or cross marks. Users can select single rows either with the keyboard or the mouse. Column headers can be used for sorting. The header row remains fixed during scrolling. The table fires events corresponding to user interaction. We've already seen the configuration used to draw this chart in Google Charts Configuration Syntax chapter. So, let's see the complete example.
We've used Table class to show Table based chart.
//table chart
var chart = new google.visualization.Table(document.getElementById('container'));

googlecharts_table_chart.htm
<html>
   <head>
      <title>Google Charts Tutorial</title>
      <script type = "text/javascript" src = "https://www.gstatic.com/charts/loader.js">
      </script>
      <script type = "text/javascript">
         google.charts.load('current', {packages: ['table']});     
      </script>
   </head>
   
   <body>
      <div id = "container" style = "width: 550px; height: 400px; margin: 0 auto">
      </div>
      <script language = "JavaScript">
         function drawChart() {
            // Define the chart to be drawn.
            var data = new google.visualization.DataTable();
            data.addColumn('string', 'Name');
            data.addColumn('number', 'Salary');
            data.addColumn('boolean', 'Full Time Employee');
            data.addRows([
               ['Mike',  {v: 10000, f: '$10,000'}, true],
               ['Jim',   {v:8000,   f: '$8,000'},  false],
               ['Alice', {v: 12500, f: '$12,500'}, true],
               ['Bob',   {v: 7000,  f: '$7,000'},  true]
            ]);

            var options = {
               showRowNumber: true,
               width: '100%', 
               height: '100%'
            };
                  
            // Instantiate and draw the chart.
            var chart = new google.visualization.Table(document.getElementById('container'));
            chart.draw(data, options);
         }
         google.charts.setOnLoadCallback(drawChart);
      </script>
   </body>
</html>
Verify the result.
How to find a network adapter driver version using PowerShell?

To find the network adapter driver version using PowerShell, we can use the Get-NetAdapter cmdlet. First, let look at how the network adapter driver version looks like from GUI.
Get-NetAdapter will retrieve all the Physical and Virtual network adapters unless specified.
This cmdlet has a property called DriverVersion, DriverDate, and DriverProvider. You can select it.
Get-NetAdapter | Select Name, InterfaceDescription,DriverVersion, DriverDate, DriverProvider
Name                    : Wi-Fi
InterfaceDescription    : Intel(R) Wi-Fi 6 AX201 160MHz
DriverVersion           : 21.80.2.1
DriverDate              : 2020-02-25
DriverProvider          : Intel
Name                    : VMware Network Adapter VMnet1
InterfaceDescription    : VMware Virtual Ethernet Adapter for VMnet1
DriverVersion           : 14.0.0.3
DriverDate              : 2019-08-08
DriverProvider          : VMware, Inc.
Name                    : VMware Network Adapter VMnet8
InterfaceDescription    : VMware Virtual Ethernet Adapter for VMnet8
DriverVersion           : 14.0.0.3
DriverDate              : 2019-08-08
DriverProvider          : VMware, Inc.
How to install a certificate to the certificate store using PowerShell?

To install the certificate using PowerShell, we need to use the Import-Certificate command. For example, we have a certificate stored at the location C:\temp\Mycert.cer and we need to install it in the Personal store of the local machine.
Import-Certificate -FilePath C:\Temp\Mycert.cer `
   -CertStoreLocation Cert:\LocalMachine\My\
You can also use the below method.
PS C:\> Set-Location Cert:\LocalMachine\My\
PS Cert:\LocalMachine\My\> Import-Certificate -FilePath C:\Temp\Mycert.cer
To install a certificate on the remote computer, use the Invoke-Command method.
Invoke-Command -ComputerName  RemoteServer1 -ScriptBlock {Import-Certificate -FilePath C:\Temp\Mycert.cer `
   -CertStoreLocation Cert:\LocalMachine\My\ }
The above command will install the certificate on RemoteServer1 from the path C:\temp of the remote server to the personal store of the remote machine.
Groovy - Continue Statement

The continue statement complements the break statement. Its use is restricted to while and for loops. When a continue statement is executed, control is immediately passed to the test condition of the nearest enclosing loop to determine whether the loop should continue. All subsequent statements in the body of the loop are ignored for that particular loop iteration.
The following diagram shows the diagrammatic explanation of the continue statement −
Following is an example of the continue statement −
class Example {
   static void main(String[] args) {
      int[] array = [0,1,2,3];
		
      for(int i in array) {
         if(i == 2)
         continue;
         println(i);
      }
   }
}
The output of the above code would be −
0 
1 
3


    52 Lectures 
     8 hours 

 Krishna Sakinala

    49 Lectures 
     2.5 hours 

 Packt Publishing
 Print
 Add Notes
 Bookmark this page
Static Variables in C

Static variables are initialized only once. The compiler persists with the variable till the end of the program. Static variables can be defined inside or outside the function. They are local to the block. The default value of static variables is zero. The static variables are alive till the execution of the program.
Here is the syntax of static variables in C language,
static datatype variable_name = value;
Here,
datatype − The datatype of variable like int, char, float etc.
variable_name − This is the name of variable given by user.
value − Any value to initialize the variable. By default, it is zero.
Here is an example of static variable in C language,
 Live Demo
#include <stdio.h>

int main() {
   auto int a = -28;
   static int b = 8;

   printf("The value of auto variable : %d\n", a);
   printf("The value of static variable b : %d\n",b);

   if(a!=0)
   printf("The sum of static variable and auto variable : %d\n",(b+a));

   return 0;
}
Here is the output
The value of auto variable : -28
The value of static variable b : 8
The sum of static variable and auto variable : -20
Counting numbers after decimal point in JavaScript

We are required to write a JavaScript function that takes in a number which may be an integer or a floating-point number. If it's a floating-point number, we have to return the count of numbers after the decimal point. Otherwise we should return 0.
For our example, we are considering two numbers −
const num1 = 1.123456789;
const num2 = 123456789;
Following is the code −
const num1 = 1.123456789;
const num2 = 123456789;
const decimalCount = num => {
   // Convert to String
   const numStr = String(num);
   // String Contains Decimal
   if (numStr.includes('.')) {
      return numStr.split('.')[1].length;
   };
   // String Does Not Contain Decimal
   return 0;
}
console.log(decimalCount(num1)) // 9
console.log(decimalCount(num2)) // 0
This will produce the following output in console −
9
0
Capitalize text with CSS

To capitalize text with CSS, use the capitalize property. You can try to run the following code to capitalize text:
<html>
   <head>
   </head>
   <body>
      <p style = "text-transform:capitalize;">
         India
      </p>
   </body>
</html>
Neo4j - Sum Function

It takes a set of rows and a <property-name> of a node or relationship as an input and finds the summation value from the given <property-name> column of given rows.
Following is the syntax of the SUM() function.
SUM(<property-name>)

Following is a sample Cypher query which demonstrates the usage of the function SUM() in Neo4j. Here we are trying to calculate the SUM of the salaries of the employees
MATCH (n:employee) RETURN SUM(n.sal) 
To execute the above query, carry out the following steps −
Step 1 − Open the Neo4j desktop App and start the Neo4j Server. Open the built-in browser app of Neo4j using the URL http://localhost:7474/ as shown in the following screenshot.
Step 2 − Copy and paste the desired query in the dollar prompt and press the play button (to execute the query) highlighted in the following screenshot.
On executing, you will get the following result.
 Print
 Add Notes
 Bookmark this page
How to catch LookupError Exception in Python?

LookupError Exception is the Base class for errors raised when something can’t be found. The base class for the exceptions that are raised when a key or index used on a mapping or sequence is invalid: IndexError, KeyError.
An IndexError is raised when a sequence reference is out of range.
The given code is rewritten as follows to catch the exception and find its type
import sys
try:
foo = [a, s, d, f, g]
print foo[5]
except IndexError as e:
print e
print sys.exc_type
C:/Users/TutorialsPoint1~.py
list index out of range
<type 'exceptions.IndexError'>
Python - Find dictionary keys present in a Strings List - GeeksforGeeks

08 May, 2020
Sometimes, while working with Python dictionaries, we can have problem in which we need to perform the extraction of dictionary keys from strings list feeded. This problem can have application in many domains including data. Lets discuss certain ways in which this task can be performed.
Method #1 : Using list comprehensionThis is brute force way in which this task can be performed. In this, we use conditional statements to find the strings matching keys in each string and extract keys from string list.
# Python3 code to demonstrate working of # Extract dictionary keys in Strings List# Using list comprehension  # initializing listtest_list = ["GeeksforGeeks is best for geeks", "I love GeeksforGeeks"]  # printing original listprint("The original list is : " + str(test_list))  # initializing dictionarytest_dict = {'Geeks' : 5, 'CS' : 6, 'best' : 7, 'love' : 10}  # Extract dictionary keys in Strings List# Using list comprehensionres = [ele if len(ele) > 0 else [None] for ele in [[key for key in test_dict if key in sub]                                       for sub in test_list]]                                         # printing result print("The matching keys list : " + str(res)) 
The original list is : ['GeeksforGeeks is best for geeks', 'I love GeeksforGeeks']
The matching keys list : [['best', 'Geeks'], ['love', 'Geeks']]

 
Method #2 : Using filter() + lambda + list comprehensionThe combination of above functions can also be used to solve this problem. In this, we perform the task of filtering using filter() and lambda and list comprehension help to reduce one level of nesting.
# Python3 code to demonstrate working of # Extract dictionary keys in Strings List# Using filter() + lambda + list comprehension  # initializing listtest_list = ["GeeksforGeeks is best for geeks", "I love GeeksforGeeks"]  # printing original listprint("The original list is : " + str(test_list))  # initializing dictionarytest_dict = {'Geeks' : 5, 'CS' : 6, 'best' : 7, 'love' : 10}  # Extract dictionary keys in Strings List# Using filter() + lambda + list comprehensionres = [list(filter(lambda ele: ele in sub, test_dict)) for sub in test_list]                                         # printing result print("The matching keys list : " + str(res)) 
The original list is : ['GeeksforGeeks is best for geeks', 'I love GeeksforGeeks']
The matching keys list : [['best', 'Geeks'], ['love', 'Geeks']]

Python list-programs
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Python | Get unique values from a list
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
D3.js symbol.size() Method - GeeksforGeeks

14 Sep, 2020
The symbol.size() method can be used to change the size of the symbol.
Syntax:
symbol.size([size])

Parameters: This function accepts a single parameter as mentioned above and described below:
size: This is the size in square pixels or the area to be set.
Return Value: This method has no return value.
Example 1:
HTML
<!DOCTYPE html><html><head>    <meta charset="utf-8">     <script src=        "https://d3js.org/d3.v5.min.js">    </script></head> <body>     <h1 style="text-align: center; color: green;">        GeeksforGeeks    </h1>     <h3 style="text-align: center;">        D3.js | symbol.size() Method    </h3>     <center>    <svg id="gfg" width="100" height="100"></svg>    </center>     <script>        var sym = d3.symbol().size(300);        d3.select("#gfg")            .append("path")            .attr("d", sym)            .attr("fill", "green")            .attr("transform", "translate(50,50)");     </script></body> </html>
Output:
Example 2:
HTML
<!DOCTYPE html><html><head>    <meta charset="utf-8">     <script src=        "https://d3js.org/d3.v5.min.js">    </script></head> <body>     <h1 style="text-align: center; color: green;">        GeeksforGeeks    </h1>     <h3 style="text-align: center;">        D3.js | symbol.size() Method    </h3>     <center>    <svg id="gfg" width="100" height="100"></svg>    </center>     <script>        var sym = d3.symbol().size(500);        d3.select("#gfg")            .append("path")            .attr("d", sym)            .attr("fill", "none")            .attr("stroke", "green")            .attr("stroke-width", "5px")            .attr("transform", "translate(50,50)");     </script></body> </html>
Output:
D3.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
How to get character array from string in JavaScript?
How to detect browser or tab closing in JavaScript ?
How to get selected value in dropdown list using JavaScript ?
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
LISP - Variables

In LISP, each variable is represented by a symbol. The variable's name is the name of the symbol and it is stored in the storage cell of the symbol.
Global variables have permanent values throughout the LISP system and remain in effect until a new value is specified.
Global variables are generally declared using the defvar construct.
(defvar x 234)
(write x)
When you click the Execute button, or type Ctrl+E, LISP executes it immediately and the result returned is
234

Since there is no type declaration for variables in LISP, you directly specify a value for a symbol with the setq construct.
->(setq x 10)
The above expression assigns the value 10 to the variable x. You can refer to the variable using the symbol itself as an expression.
The symbol-value function allows you to extract the value stored at the symbol storage place.
Create new source code file named main.lisp and type the following code in it.
(setq x 10)
(setq y 20)
(format t "x = ~2d y = ~2d ~%" x y)

(setq x 100)
(setq y 200)
(format t "x = ~2d y = ~2d" x y)
When you click the Execute button, or type Ctrl+E, LISP executes it immediately and the result returned is.
x = 10 y = 20 
x = 100 y = 200

Local variables are defined within a given procedure. The parameters named as arguments within a function definition are also local variables. Local variables are accessible only within the respective function.
Like the global variables, local variables can also be created using the setq construct.
There are two other constructs - let and prog for creating local variables.
The let construct has the following syntax.
(let ((var1  val1) (var2  val2).. (varn  valn))<s-expressions>)
Where var1, var2, ..varn are variable names and val1, val2, .. valn are the initial values assigned to the respective variables.
When let is executed, each variable is assigned the respective value and lastly the s-expression is evaluated. The value of the last expression evaluated is returned.
If you don't include an initial value for a variable, it is assigned to nil.
Create new source code file named main.lisp and type the following code in it.
(let ((x 'a) (y 'b)(z 'c))
(format t "x = ~a y = ~a z = ~a" x y z))
When you click the Execute button, or type Ctrl+E, LISP executes it immediately and the result returned is.
x = A y = B z = C

The prog construct also has the list of local variables as its first argument, which is followed by the body of the prog, and any number of s-expressions.
The prog function executes the list of s-expressions in sequence and returns nil unless it encounters a function call named return. Then the argument of the return function is evaluated and returned.
Create new source code file named main.lisp and type the following code in it.
(prog ((x '(a b c))(y '(1 2 3))(z '(p q 10)))
(format t "x = ~a y = ~a z = ~a" x y z))
When you click the Execute button, or type Ctrl+E, LISP executes it immediately and the result returned is.
x = (A B C) y = (1 2 3) z = (P Q 10)


    79 Lectures 
     7 hours 

 Arnold Higuit
 Print
 Add Notes
 Bookmark this page
Python matplotlib multiple bars

We can use a user-defined method, autolabel, to annotate the axis value. Before that, we can initialize the fig and ax using plt.subplots() method.
Create lists, labels, men_means, and women_means with different data elements.
Create lists, labels, men_means, and women_means with different data elements.
Return evenly spaced values within a given interval, using numpy.arrange() method.
Return evenly spaced values within a given interval, using numpy.arrange() method.
Set the width variable i.e., width=0.35.
Set the width variable i.e., width=0.35.
Create fig and ax variables using subplots method, where default nrows and ncols are 1.
Create fig and ax variables using subplots method, where default nrows and ncols are 1.
The bars are positioned at *x* with the given *align*\ment. Their dimensions are given by *height* and *width*. The vertical baseline is *bottom* (default 0), so create rect1 and rect2 using plt.bar() method.
The bars are positioned at *x* with the given *align*\ment. Their dimensions are given by *height* and *width*. The vertical baseline is *bottom* (default 0), so create rect1 and rect2 using plt.bar() method.
Set the Y-axis label using plt.ylabel() method.
Set the Y-axis label using plt.ylabel() method.
Set a title for the axes using set_title() method.
Set a title for the axes using set_title() method.
Get or set the current tick locations and labels of the X-axis, using set_xticks() method.
Get or set the current tick locations and labels of the X-axis, using set_xticks() method.
Set x axis tick labels of the grid using set_xticklabels() method.
Set x axis tick labels of the grid using set_xticklabels() method.
Place a legend on the figure using legend() method.
Place a legend on the figure using legend() method.
Annotate created bars(rect1 and rect2) with some label using autolabel() method, that is user-defined method.
Annotate created bars(rect1 and rect2) with some label using autolabel() method, that is user-defined method.
To show the figure, use the plt.show() method.
To show the figure, use the plt.show() method.
import matplotlib.pyplot as plt
import numpy as np

labels = ['G1', 'G2', 'G3', 'G4', 'G5']
men_means = [20, 34, 30, 35, 27]
women_means = [25, 32, 34, 20, 25]

x = np.arange(len(labels))
width = 0.35

fig, ax = plt.subplots()
rects1 = ax.bar(x - width / 2, men_means, width, label='Men')
rects2 = ax.bar(x + width / 2, women_means, width, label='Women')

ax.set_ylabel('Scores')
ax.set_title('Scores by group and gender')
ax.set_xticks(x)
ax.set_xticklabels(labels)
ax.legend()

def autolabel(rects):
   for rect in rects:
      height = rect.get_height()
      ax.annotate('{}'.format(height),
         xy=(rect.get_x() + rect.get_width() / 2, height),
         xytext=(0, 3), # 3 points vertical offset
         textcoords="offset points",
         ha='center', va='bottom')

autolabel(rects1)
autolabel(rects2)

plt.show()
Longest Consecutive Sequence in Python

Suppose we have an array of integers. We have to find the length of the longest consecutive elements sequence. So if the input is like [100, 4, 250, 1, 3, 2], answer will be 4, as the longest consecutive sequence is [1,2,3,4].
To solve this, we will follow these steps −
make the array set, longest := 0
make the array set, longest := 0
for i in range array −if i – 1 is not in a −current := i, streak := 0while i in a −increase i by 1, increase streak by 1longest := max of longest and streak
for i in range array −
if i – 1 is not in a −current := i, streak := 0while i in a −increase i by 1, increase streak by 1longest := max of longest and streak
if i – 1 is not in a −
current := i, streak := 0
current := i, streak := 0
while i in a −increase i by 1, increase streak by 1longest := max of longest and streak
while i in a −
increase i by 1, increase streak by 1
increase i by 1, increase streak by 1
longest := max of longest and streak
longest := max of longest and streak
return longest
return longest
Let us see the following implementation to get a better understanding −
 Live Demo
class Solution(object):
   def longestConsecutive(self, a):
      a = set(a)
      longest = 0
      for i in a:
         if i-1 not in a:
            current = i
            streak = 0
            while i in a:
               i+=1
               streak+=1
               longest = max(longest,streak)
      return longest

ob = Solution()
print(ob.longestConsecutive([100,4,250,1,3,2]))
[100,4,250,1,3,2]
4
Bash Script - Write Hello World Program - GeeksforGeeks

08 Dec, 2021
In this article, we are going to see how to write “hello world” program in Bash script.
The bash script is a text file that contains a set of instructions ( i.e. codes or commands ) that can be executed in the terminal. In any programming language, the first program that we learn to write is ” Hello World “.  
We can create an empty file using the following commands:
$ touch HelloWorld.sh
Where:
touch : It is used to create an empty file.
HelloWorld.sh : HelloWorld is file with .sh extension of unix shell executable file.
Here we will open our created file, using the following commands: 
$ nano HelloWorld.sh
Where:
nano : It is used to open files in a text editor ( i.e. GNU nano )
The editor is open, write the following code in a text editor:
#!/bin/sh
# This is bash program to display Hello World
echo " Hello World "
Where:
#! : It is known as shebang.
/bin/sh: It is the executable path of the system shell.
# : It is used to write comments.
echo : It is used to display text on the screen.
$ chmod +x HelloWorld.sh
Where:
chmod +x : It is used to make file executable.
$ ./Helloworld.sh  
Output:
Hello World
Bash-Script
Picked
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
scp command in Linux with Examples
nohup Command in Linux with Examples
mv command in Linux with examples
Thread functions in C/C++
Docker - COPY Instruction
chown command in Linux with Examples
nslookup command in Linux with Examples
SED command in Linux | Set 2
Named Pipe or FIFO with example C program
uniq Command in LINUX with examples
Jackson Annotations - @JsonEnumDefaultValue

@JsonEnumDefaultValue is used to deserialize an unknown enum value using a default value.
import java.io.IOException; 
import java.text.ParseException; 

import com.fasterxml.jackson.annotation.JsonEnumDefaultValue; 
import com.fasterxml.jackson.databind.DeserializationFeature; 
import com.fasterxml.jackson.databind.ObjectMapper; 

public class JacksonTester {
   public static void main(String args[]) throws ParseException{
      ObjectMapper mapper = new ObjectMapper();
      mapper.enable(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE);
      String jsonString = "\"abc\""; 
      try {
         LETTERS value = mapper.readValue(jsonString, LETTERS.class); 
         System.out.println(value); 
      }
      catch (IOException e) { 
         e.printStackTrace(); 
      }   
   }  
}
enum LETTERS {
   A, B, @JsonEnumDefaultValue UNKNOWN 
} 
UNKNOWN 

 Print
 Add Notes
 Bookmark this page
Palindrome numbers in JavaScript

We are required to write a JavaScript function that takes in a number and determines whether or not it is a palindrome number.
Palindrome numbers − A palindrome number is that number which reads the same from both left and right sides.
For example −
343 is a palindrome number
343 is a palindrome number
6789876 is a palindrome number
6789876 is a palindrome number
456764 is not a palindrome number
456764 is not a palindrome number
The code for this will be −
const num1 = 343;
const num2 = 6789876;
const num3 = 456764;
const isPalindrome = num => {
   let length = Math.floor(Math.log(num) / Math.log(10) +1);
   while(length > 0) {
      let last = Math.abs(num − Math.floor(num/10)*10);
      let first = Math.floor(num / Math.pow(10, length −1));
      if(first != last){
         return false;
      };
      num −= Math.pow(10, length−1) * first ;
      num = Math.floor(num/10);
      length −= 2;
   };
   return true;
};
console.log(isPalindrome(num1));
console.log(isPalindrome(num2));
console.log(isPalindrome(num3));
And the output in the console will be −
true
true
false
Is BIGINT(8) the largest integer MySQL can store?

In BIGINT(8), the number 8 represents how the data will be displayed. It does not affect the storage. The number is used to display width.
BIGINT takes 8 bytes i.e. 64 bits. The signed range is -9223372036854775808 to 9223372036854775807 and unsigned range takes positive value. The range of unsigned is 0 to 18446744073709551615.
To understand bigint(8), let us create a table with BIGINT(8) and zerofill column −
mysql> create table BigIntDemo8
   -> (
   -> Number1 BIGINT(8) not null,
   -> Number2 BIGINT(8) unsigned zerofill not null
   -> );
Query OK, 0 rows affected (0.59 sec)
Insert some records for both the columns. The query to insert record is as follows −
mysql> insert into BigIntDemo8 values(1,1);
Query OK, 1 row affected (0.14 sec)

mysql> insert into BigIntDemo8 values(11,11);
Query OK, 1 row affected (0.24 sec)

mysql> insert into BigIntDemo8 values(111,111);
Query OK, 1 row affected (0.14 sec)

mysql> insert into BigIntDemo8 values(1111,1111);
Query OK, 1 row affected (0.18 sec)

mysql> insert into BigIntDemo8 values(11111,11111);
Query OK, 1 row affected (0.10 sec)

mysql> insert into BigIntDemo8 values(111111,111111);
Query OK, 1 row affected (0.21 sec)
Display all records from the table using select statement. The query is as follows −
mysql> select *from BigIntDemo8;
The following is the output −
+---------+----------+
| Number1 | Number2  |
+---------+----------+
|       1 | 00000001 |
|      11 | 00000011 |
|     111 | 00000111 |
|    1111 | 00001111 |
|   11111 | 00011111 |
|  111111 | 00111111 |
+---------+----------+
6 rows in set (0.00 sec)