code-rag-bench/online-tutorials huggingface dataset:
JavaScript Map forEach() Method - GeeksforGeeks

21 Jan, 2022
Below is the  example of Map.forEach() Method
Javascript
<script>    // Creating a map using Map object    let mp=new Map()         // Adding values to the map    mp.set("a",1);    mp.set("b",2);    mp.set("c",3);         // Logging map object to console    mp.forEach((values,keys)=>{      document.write(values,keys+"<br>")    })</script>
Output: 
1a
2b
3c
The Map.forEach method is used to loop over the map with the given function and executes the given function over each key-value pair.
Syntax:
myMap.forEach(callback, value, key, thisArg)
Parameters: This method accepts four parameters as mentioned above and described below:
callback: This is the function that executes on each function call.
value: This is the value for each iteration.
key: This is the key to reach iteration.
thisArg: This is the value to use as this when executing callback.
Returns: It returns the undefined value.
Code for the above method is provided below:Program 1:
HTML
<script>     // Creating a map using Map object    let mp=new Map()         // Adding values to the map    mp.set("a",65);    mp.set("b",66);    mp.set("c",67);    mp.set("d",68);    mp.set("e",69);    mp.set("f",70);         // Logging map object    document.write(mp+ "<br>");    mp.forEach((values,keys)=>{      document.write("values: ",values+                     ", keys: ",keys+ "<br>")    })</script>
Output: 
[object Map]
values: 65, keys: a
values: 66, keys: b
values: 67, keys: c
values: 68, keys: d
values: 69, keys: e
values: 70, keys: f
Program 2:
HTML
<!DOCTYPE html><html lang="en"><head>  <meta charset="UTF-8">  <meta name="viewport"        content="width=device-width,                 initial-scale=1.0">  <title>Document</title></head><body>  <ul class="list">  </ul>  <script>    // Creating a map using Map object    let mp=new Map()    //adding values to the map    mp.set("a",65);    mp.set("b",66);    mp.set("c",67);    mp.set("d",68);    mp.set("e",69);    mp.set("f",70);    //logging map object to console    document.log(mp);    let ul=document.querySelector("ul");    mp.forEach((values,keys)=>{      ul.innerHTML+=ul.innerHTML="<li>"+keys+" =>"+values+"</li>"    })  </script></body></html>
Output:
Browsers Supported: 
Google Chrome 38 and above
Microsoft Edge 12 and above
Mozilla Firefox 25 and above
Internet Explorer 11 and above
Safari 8 and above
Opera 25 and above
ysachin2314
JavaScript-Methods
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Convert.ChangeType Method in C#

The ChangeType() method returns an object of the specified type and whose value is equivalent to the specified object.
Let’s say we have a double type.
double val = -3.456
Now, use the ChangeType method to change the type to integer.
num = (int)Convert.ChangeType(val, TypeCode.Int32);
Let us see the complete example.
 Live Demo
using System;
public class Demo {
   public static void Main() {
      double val = -3.456;
      int num = (int)Convert.ChangeType(val, TypeCode.Int32);
      Console.WriteLine("{0} converted to an Int32: {1}", val, num);
   }
}
-3.456 converted to an Int32: -3
Python List remove() Method

Python list method remove() searches for the given element in the list and removes the first matching element.
Following is the syntax for remove() method −
list.remove(obj)

obj − This is the object to be removed from the list.
obj − This is the object to be removed from the list.
This Python list method does not return any value but removes the given object from the list.
The following example shows the usage of remove() method.
#!/usr/bin/python

aList = [123, 'xyz', 'zara', 'abc', 'xyz'];
aList.remove('xyz');
print "List : ", aList
aList.remove('abc');
print "List : ", aList
When we run above program, it produces following result −
List :  [123, 'zara', 'abc', 'xyz']
List :  [123, 'zara', 'xyz']


    187 Lectures 
     17.5 hours 

 Malhar Lathkar

    55 Lectures 
     8 hours 

 Arnab Chakraborty

    136 Lectures 
     11 hours 

 In28Minutes Official

    75 Lectures 
     13 hours 

 Eduonix Learning Solutions

    70 Lectures 
     8.5 hours 

 Lets Kode It

    63 Lectures 
     6 hours 

 Abhilash Nelson
 Print
 Add Notes
 Bookmark this page
Connecting two points on a 3D scatter plot in Python and Matplotlib

To connect two points on a 3D scatter plot, we can take the following steps
Set the figure size and adjust the padding between and around the subplots.
Create a new figure or activate an existing figure using figure() method.
Add an axes to the current figure as a subplot arrangement.
Create lists for x, y and z.
Plot x, y and z data points using scatter() method
To connect the points, use plot() method with x, y and z data points with black color line.
To display the figure, use show() method.
from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
fig = plt.figure()
ax = fig.add_subplot(projection="3d")
x, y, z = [1, 1.5], [1, 2.4], [3.4, 1.4]
ax.scatter(x, y, z, c='red', s=100)
ax.plot(x, y, z, color='black')
plt.show()
Python program to list the difference between two lists.

In this problem given two lists. Our tasks is to display difference between two lists. Python provides set() method. We use this method here. A set is an unordered collection with no duplicate elements. Set objects also support mathematical operations like union, intersection, difference, and symmetric difference.
Input::A = [10, 15, 20, 25, 30, 35, 40]
B = [25, 40, 35] 
Output:
[10, 20, 30, 15]

difference list = A - B

Step 1: Input of two arrays.
Step 2: convert the lists into sets explicitly.
Step 3: simply reduce one from the other using the subtract operator.

# Python code to get difference of two lists 
# Using set() 
def Diff(A, B):
   print("Difference of two lists ::>")
   return (list(set(A) - set(B))) 

# Driver Code 
A=list()
n1=int(input("Enter the size of the first List ::"))

print("Enter the Element of first List ::")
for i in range(int(n1)):
   k=int(input(""))
   A.append(k)
B=list()
n2=int(input("Enter the size of the second List ::"))
print("Enter the Element of second List ::")
for i in range(int(n2)):
   k=int(input(""))
   B.append(k)
print(Diff(A, B)) 
Enter the size of the first List ::5
Enter the Element of first List ::
11
22
33
44
55
Enter the size of the second List ::4
Enter the Element of second List ::
11
55
44
99
Difference of two lists ::>
[33, 22]
How to sort an ArrayList in C#?

To sort an ArrayList in C#, use the Sort() method.
The following is the ArrayList.
ArrayList arr = new ArrayList();
arr.Add(32);
arr.Add(12);
arr.Add(55);
arr.Add(8);
arr.Add(13);
Now the Sort() method is used to sort the ArrayList.
arr.Sort();
You can try to run the following code to sort an ArrayList in C#.
 Live Demo
using System;
using System.Collections;
namespace Demo {
   class Program {
      static void Main(string[] args) {
         ArrayList arr = new ArrayList();
         arr.Add(32);
         arr.Add(12);
         arr.Add(55);
         arr.Add(8);
         arr.Add(13);
         Console.Write("List: ");
         foreach (int i in arr) {
            Console.Write(i + " ");
         }
         Console.WriteLine();
         Console.Write("Sorted List: ");
         arr.Sort();
         foreach (int i in arr) {
            Console.Write(i + " ");
         }
         Console.WriteLine();
         Console.ReadKey();
      }
   }
}
List: 32 12 55 8 13
Sorted List: 8 12 13 32 55
do...while loop examples

C - Programming HOME
C - Basic Introduction
C - Program Structure
C - Reserved Keywords
C - Basic Datatypes
C - Variable Types
C - Storage Classes
C - Using Constants
C - Operator Types
C - Control Statements
C - Input and Output
C - Pointing to Data
C - Using Functions
C - Play with Strings
C - Structured Datatypes
C - Working with Files
C - Bits Manipulation
C - Pre-Processors
C - Useful Concepts
C - Built-in Functions
C - Useful Resources
Computer Glossary
Who is Who
Copyright © 2014 by tutorialspoint
Try following example to understand do...while loop. You can put the following code into a test.c file and then compile it and then run it.
#include <stdio.h>

main()
{
    int i = 10;

    do{
       printf("Hello %d\n", i );
       i = i -1;
    }while ( i > 0 );
}

This will produce following output:
Hello 10
Hello 9
Hello 8
Hello 7
Hello 6
Hello 5
Hello 4
Hello 3
Hello 2
Hello 1

You can make use of break to come out of do...while loop at any time.
#include <stdio.h>

main()
{
    int i = 10;

    do{
       printf("Hello %d\n", i );
       i = i -1;
       if( i == 6 )
       {
          break;
       }
    }while ( i > 0 );
}

This will produce following output:
Hello 10
Hello 9
Hello 8
Hello 7
Hello 6


Advertisements


    6 Lectures 
     1.5 hours 

 Mr. Pradeep Kshetrapal

    41 Lectures 
     5 hours 

 AR Shankar

    11 Lectures 
     58 mins

 Musab Zayadneh

    59 Lectures 
     15.5 hours 

 Narendra P

    11 Lectures 
     1 hours 

 Sagar Mehta

    39 Lectures 
     4 hours 

 Vikas Yadav
 Print
 Add Notes
 Bookmark this page
Powershell - Invoke-Expression Cmdlet

Invoke-Expression cmdlet is used to perform a command or expression on local computer.
In these example, we're see the Invoke-Expression cmdlet in action.
In this example, we'll show how to invoke an expression.
> $Command = 'Get-Process'
 
> $Command
Get-Process
 
> Invoke-Expression $Command 
Here you can notice that $Command print the expression where as Invoke-Expression executes the expression.
Handles  NPM(K)    PM(K)     WS(K)    VM(M)   CPU(s)       Id   ProcessName 
-------  ------    -----     -----    -----   ------     ----   ----------- 
     78       8     1288      3892       43     0.02     2556        armsvc 
    119       9    15808     15572       50               600       audiodg 
     88       8     2512      5860       73     0.02     3144        chrome  
    186      19    23360     31580      740     0.23     3148        chrome 
    218      22    28432     44848      769     0.86     3492        chrome 


    15 Lectures 
     3.5 hours 

 Fabrice Chrzanowski

    35 Lectures 
     2.5 hours 

 Vijay Saini

    145 Lectures 
     12.5 hours 

 Fettah Ben
 Print
 Add Notes
 Bookmark this page
IntStream mapToLong() method in Java

The mapToLong() function in IntStream class returns a LongStream consisting of the results of applying the given function to the elements of this stream.
The syntax is as follows.
LongStream mapToLong(IntToLongFunction mapper)
Here, the parameter mapper is a stateless function to apply to each element.
Create an IntStream with some elements in the Stream.
IntStream intStream = IntStream.of(50, 100, 150, 200);
Now create a LongStream and use the mapToLong() with a condition.
LongStream longStream = intStream.mapToLong(num → (long)num);
The following is an example to implement IntStream mapToLong() method in Java.
import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
public class Demo {
   public static void main(String[] args) {
      IntStream intStream = IntStream.of(50, 100, 150, 200);
      LongStream longStream = intStream.mapToLong(num → (long)num);
      longStream.forEach(System.out::println);
   }
}
50
100
150
200
Python Program for factorial of a number

In this article, we will learn about the solution and approach to solve the given problem statement.
Problem statement −Our task to compute the factorial of n.
Factorial of a non-negative number is given by −
n! = n*n-1*n-2*n-3*n-4*.................*3*2*1
We have two possible solutions to the problem
Recursive approach
Iterative approach
 Live Demo
def factorial(n): # recursive solution
   if (n==1 or n==0):
      return 1
   else:
      return n * factorial(n - 1)
# main
num = 6
print("Factorial of",num,"is", factorial(num))
('Factorial of', 6, 'is', 720)
All the variables are declared in global scope as shown in the image below
Approach 2 −Iterative Approach
 Live Demo
def factorial(n):# iterative solution
   fact=1
   for i in range(2,n+1):
      fact=fact*i
   return fact
# main
num = 6
print("Factorial of",num,"is", factorial(num))
('Factorial of', 6, 'is', 720)
All the variables are declared in global scope as shown in the image below
In this article, we learned about the approach to compute the factorial of a number n.
How to embed images in New Google Sites ? - GeeksforGeeks

10 Sep, 2020
Introduction: Images are very crucial in a well-developed website as they help to display something that even words can’t express. There are two ways to insert an image in Google sites:
Through uploading itUsing iframes to insert it
Through uploading it
Using iframes to insert it
If you insert by the first method, there is not much you can edit in it but if you go with the second you can set the size of the image, add a border to it or even create a clickable image.
 
Method 1:
First, click on images option from the insert panel. It will ask you to either upload or choose select upload.
After that just select the image you want to upload from your PC and your image will get uploaded.
Now on this image, you can insert a link, add alternate or caption text or even resize it.
Method 2: Select embed option from the insert panel and then go to embed code division of the dialogue box appeared.
Write your code in the space provided.
To insert a simple image just add the following code:
<img src="https://pbs.twimg.com/profile_images/1138375574726955008/1fNUyEdv.png" />

To add height and width to the image just add the following code:
<img src="https://pbs.twimg.com/profile_images/1138375574726955008/1fNUyEdv.png" 
width="300" height="300" />

To add border-style just add the following code:
<img src="https://pbs.twimg.com/profile_images/1138375574726955008/1fNUyEdv.png" 
style="border:4px solid green;" width="300" height="300" />

There are nine different styles of border available, they are – solid, double, groove, dotted, dashed, inset, outset, ridge, hidden.
Google Sites
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Top 10 Front End Developer Skills That You Need in 2022
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
Convert a string to an integer in JavaScript
Differences between Functional Components and Class Components in React
How to redirect to another page in ReactJS ?
How to Insert Form Data into Database using PHP ?
How to pass data from child component to its parent in ReactJS ?
How to execute PHP code using command line ?
REST API (Introduction)
Compare date strings in MySQL

To compare date strings, use STR_TO_DATE() from MySQL.
Let us first create a table −
mysql> create table DemoTable712 (
   Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   ArrivalDate varchar(100)
);
Query OK, 0 rows affected (0.65 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable712(ArrivalDate) values('10.01.2019');
Query OK, 1 row affected (0.14 sec)
mysql> insert into DemoTable712(ArrivalDate) values('11.12.2018');
Query OK, 1 row affected (0.11 sec)
mysql> insert into DemoTable712(ArrivalDate) values('01.11.2017');
Query OK, 1 row affected (0.15 sec)
mysql> insert into DemoTable712(ArrivalDate) values('20.06.2016');
Query OK, 1 row affected (0.23 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable712;
This will produce the following output -
+----+-------------+
| Id | ArrivalDate |
+----+-------------+
| 1  | 10.01.2019  |
| 2  | 11.12.2018  |
| 3  | 01.11.2017  |
| 4  | 20.06.2016  |
+----+-------------+
4 rows in set (0.00 sec)
Following is the query to compare date strings −
mysql> select *from DemoTable712 where str_to_date(ArrivalDate,'%d.%m.%Y')='2017-11-01';
This will produce the following output -
+----+-------------+
| Id | ArrivalDate |
+----+-------------+
| 3  | 01.11.2017  |
+----+-------------+
1 row in set (0.00 sec)
Bash Scripting - How to Run Bash Scripting in Terminal - GeeksforGeeks

28 Nov, 2021
In this article, we are going to see how to run bash script in terminal. For example, we create a bash file set of instructions or commands ( known as bash script ), and through command, we can run this file in terminal.
Let see how to run bash script in terminal.
Example 1 : 
In this example we print or echo some text on screen with the help of a terminal.
$ echo "Geeks For Geeks"
Output : 
Print the text using echo command
Note : ” echo” this command will display the text on screen.
Example 2 :
In this example, we print the date of command execution with the help of terminal.
$ date
Print date using date command in terminal
Example 3 :
In this example, we will see that how to run a bash script file through a terminal. First, create a bash file named ” welcome.sh ” by the following command.
$ touch welcome.sh
Here, you can see that the file name is ” welcome.sh “. Whenever you create a bash script file use “.sh ” extension.
Note : ” touch “ is used to create file.
Now to write bash script, we should open this file in text editor using terminal.
$ nano welcome.sh
Note : ” nano ” is used to open file in text editor ( i.e. GNU nano )
Now, the text editor is opened. Write the following bash script into ” welcome.sh “
#!/bin/sh

echo "Enter Your Name : "

read name

echo "Hello $name ! Welcome to our Geeks for Geeks site." 
Note : Where,
#! : It is known as shebang.
/bin/sh : It is executable path of the system shell.
read : It will read the data from user.
Now, save and run this file using terminal.
$ chmod +x ./welcome.sh
$ ./welcome.sh
Note : Where,
chmod +x : It is used to make file executable.
./welcome : Here, “./” will run the bash script file.
Output : 
Output Of above bash script
Here, we can see clearly that how to run bash script in terminal.
Bash-Script
Picked
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Named Pipe or FIFO with example C program
Thread functions in C/C++
SED command in Linux | Set 2
Array Basics in Shell Scripting | Set 1
Introduction to Linux Shell and Shell Scripting
Linux system call in Detail
Looping Statements | Shell Script
chown command in Linux with Examples
mv command in Linux with examples
Basic Shell Commands in Linux
Reading and displaying images using OpenCV

In this article, we will learn how to read and display images using the OpenCV library.
OpenCV is a library of programming functions mainly aimed at real time computer vision. Before reading an image, make sure that the image is in the same directory as your program.
Step 1: Import OpenCV.
Step 2: Read an image using imread().
Step 3: Display the image using imshow().
import cv2 as cv
image = cv.imread ('ronaldo.jpg')
cv.imshow('Cristiano Ronaldo', image)
Python | os.uname() method - GeeksforGeeks

20 May, 2019
os.uname() method in python is used to get information about current operating system. This method returns information like name, release and version of current operating system, name of machine on network and hardware identifier in the form of attributes of a tuple-like object.
Syntax: os.uname()
Parameters: Not required
Return Type: This method returns a tuple-like object which has five attributes:
sysname – operating system name
nodename – name of machine on network (implementation-defined)
release – operating system release
version – operating system version
machine – hardware identifier
Code #1: use of os.uname() method
# Python program to explain os.uname() method     # importing os module import os  # Get the information of current# operating systemos_info = os.uname()  # print the informationprint(os_info) 
posix.uname_result(sysname='Linux', nodename='pppContainer', release='4.4.0-1075-aws', 
version='#85-Ubuntu SMP Thu Jan 17 17:15:12 UTC 2019', machine='x86_64')

python-os-module
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
Python | Get dictionary keys as a list
Bar Plot in Matplotlib
Multithreading in Python | Set 2 (Synchronization)
Python Dictionary keys() method
loops in python
Python - Call function from another file
Ways to filter Pandas DataFrame by column values
Python | Convert set into a list
Python program to find number of days between two given dates
mcopy - Unix, Linux Command

The mcopy command is used to copy MS-DOS files to and from
Unix. It uses the following syntax:






mcopy [-bspanvmQT] [-D clash_option] sourcefile targetfile
mcopy [-bspanvmQT] [-D clash_option] sourcefile [ sourcefiles... ] targetdirectory
mcopy [-tnvm] MSDOSsourcefile




Mcopy copies the specified file to the named file, or copies
multiple files to the named directory.  The source and target can be
either MS-DOS or Unix files.


The use of a drive letter designation on the MS-DOS files, ’a:’ for
example, determines the direction of the transfer.  A missing drive
designation implies a Unix file whose path starts in the current
directory.  If a source drive letter is specified with no attached file
name (e.g. mcopy a: .), all files are copied from that drive.


If only a single, MS-DOS source parameter is provided (e.g. "mcopy
a:foo.exe"), an implied destination of the current directory
(‘.’) is assumed.


A filename of ‘-’ means standard input or standard output, depending
on its position on the command line.


Mcopy accepts the following command line options:




mtype a:file1 a:file2 a:file3 >unixfile
mtype a:file1 a:file2 a:file3 | mcopy - a:msdosfile








    ./configure; make dvi; dvips mtools.dvi






    ./configure; make html


A premade html can be found at:
oohttp://mtools.linux.luI
and also at:
oohttp://www.tux.org/pub/knaff/mtoolsI




    ./configure; make info















Advertisements


    129 Lectures 
     23 hours 

 Eduonix Learning Solutions

    5 Lectures 
     4.5 hours 

 Frahaan Hussain

    35 Lectures 
     2 hours 

 Pradeep D

    41 Lectures 
     2.5 hours 

 Musab Zayadneh

    46 Lectures 
     4 hours 

 GUHARAJANM

    6 Lectures 
     4 hours 

 Uplatz
 Print
 Add Notes
 Bookmark this page
Difference Between System.out.print() and System.out.println() Function in Java - GeeksforGeeks

07 Oct, 2021
In Java, we have the following functions to print anything in the console.
System.out.print() and
System.out.println()
But there is a slight difference between both of them, i.e. 
System.out.println() prints the content and switch to the next line after execution of the statement whereas 
System.out.print() only prints the content without switching to the next line after executing this statement.
The following examples will help you in understanding the difference between them more prominently.
Example 1:
Java
import java.io.*;  class GFG {    public static void main(String[] args)    {        System.out.println("Welcome to JAVA (1st line)");                   // this print statement will be printed in a new line.        System.out.print("Welcome to GeeksforGeeks (2nd line) ");                   // this print statement will be printed in the same line.        System.out.print("Hello Geeks (2nd line)");    }}
Welcome to JAVA (1st line)
Welcome to GeeksforGeeks (2nd line) Hello Geeks (2nd line)
Example 2:
Java
import java.io.*;  class GFG {    public static void main(String[] args)    {        System.out.print("Welcome to JAVA (1st line) ");                   // this print statement will be printed in the same line.        System.out.println("Welcome to GeeksforGeeks (1st line)");                   // this print statement will be printed in a new line.        System.out.print("Hello Geeks (2nd line)");    }}
Welcome to JAVA (1st line) Welcome to GeeksforGeeks (1st line)
Hello Geeks (2nd line)
Difference Between
Java
Java
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 Method Overloading and Method Overriding in Java
Difference between Informed and Uninformed Search in AI
Difference between HashMap and HashSet
Difference between Internal and External fragmentation
Arrays in Java
Split() String method in Java with examples
For-each loop in Java
Reverse a string in Java
Arrays.sort() in Java with examples
Can a method local inner class access the local final variables in Java?

Yes, we can access the local final variables using the method local inner class because the final variables are stored on the heap and live as long as the method local inner class object may live.
A local inner class instance can be delivered as an argument and retrieved from the methods and it is available inside a valid scope.
The only limitation in method local inner class is that a local parameter can be executed only when it is defined as final.
The method executing the local parameters can be called after the execution of the method, within which the local inner class was declared. As a result, the local parameters will no longer retain their values.
The values must be fixed before creating the local inner class object. If required, a non-final variable can be copied into a final variable which is subsequently executed by the local inner class.
Live Demo
class MainClassTest {
   private int x = 10;
   public void sampleMethod() {
      final int y = 20;
      class MethodLocalInnerClassTest {
         public void accessMainClassVar() {
            System.out.println(x);
            // accessing the final variable
            System.out.println(c);
         }
      }
      MainClassTest mainTest = new MethodLocalInnerClassTest();
      mainTest.accessMainClassVar();
   }
}

// Test.java
public class Test {
   public static void main(String args[]) {
      MainClassTest test = new MainClassTest();
      test.sampleMethod();
   }
}
10
20
Display Sequence of Numbers in SQL Using LEVEL - GeeksforGeeks

30 Jan, 2019
The term LEVEL refers to a Pseudocolumn in Oracle which is used in a hierarchical query to identify the hierarchy level (parent->child) in numeric format. The LEVEL returns 1 for root row, 2 for child of root row and so on, as tree like structure. LEVEL must be used with CONNECT BY Clause. The CONNECT BY clause defines the hierarchical relationship between the parent rows and the child rows of the hierarchy. DUAL is a dummy table automatically generated by Oracle database along with data dictionary.
Example-1:
SELECT Level AS Sequence FROM DualCONNECT BY Level <= 5
Explanation:Above query will execute Level having initial value 1 from dual, which is dummy table. ‘Sequence’ act as an ALias Name i.e., Temporary name of column. In query, condition will be checked and relationship created using Connect By between Level having value 1 and the specified condition. It will display values till it pass that specified condition.
Output:
Start Sequence from specific number:Level can be helpful to start a sequence of number from any particular initial value. Only need to add up one less than that value to Level with having condition in Connect By.
Syntax:
SELECT Level+(n-1) AS Alias NameFROM DualCONNECT BY Level <= 10
Where n is initial specific number and Alias Name is temporary defined name of column.
Example-2:
SELECT Level+(6-1) AS Sequence FROM DualCONNECT BY Level <= 10
Explanation:For display of sequence of numbers from 6 to 10. In above example, add up one less than 6 to Level and having condition till 10 using Connect By. It will execute and display range specified value as column name ‘Sequence’ from dummy table Dual.
Output:
Example-3:
SELECT Level AS Sequence, Sysdate AS System_date  FROM DualCONNECT BY Level <= 5
Explanation:Above query will execute and display both Sequence of Numbers as well as Date. Level have Temporary column name Sequence and Date have column name System_date, as defined. It will retrieve data from dummy table called Dual. It will have 5 numbers of rows according to the condition specified in Connect By, from 1 to 5 in Sequence column and have Same date in all 5 rows in System_date column.
Output:
DBMS-SQL
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
SQL | Views
CTE in SQL
Difference between DELETE, DROP and TRUNCATE
How to Update Multiple Columns in Single Update Statement in SQL?
Difference between DDL and DML in DBMS
SQL Interview Questions
What is Temporary Table in SQL?
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
Difference between Where and Having Clause in SQL
SQL - ORDER BY
How to prevent scientific notation in R?

05 Jan, 2022
Scientific notations in R Programming Language are considered equivalent to the exponential formats. Scientific notations are used for numbers that are extremely large or small to be handled in the decimal form. In R Language, the E-notation is used for such numbers. In this article, we are going to see how to prevent scientific notation in R programming.
Method 1: Using scipen option
In order to eliminate the exponential notation of the integer, we can use the global setting using options() method, by setting the scipen argument, that is options(scipen = n).
Scipen: A penalty to be applied when deciding to print numeric values in fixed or exponential notation. Positive values bias towards fixed and negative towards scientific notation: fixed notation will be preferred unless it is more than scipen digits wider.
The scipen value is an indicator of the integer’s prompt for exponential notation. In order to prevent the triggering of scientific notation, any large positive number can be used, for all practical purposes. However, this method makes changes to the entire R configurational settings.
options(scipen=999)
This option can be reset by using 0 as the scipen value. 
Code:
R
num = 12383828281831342print ("original number :")print (num) # after global setting for# optionsoptions(scipen = 100, digits = 4) # declaring the numbernum = 12383828281831342print ("Modified number :")print (num)
 Output: 
[1] "original number :"
[1] 1.238383e+16
[1] "Modified number :"
[1] 12383828281831342
Method 2: Using format() method
In order to disable the scientific option for any function output or numerical integer, the format method in R can be customized. Modification is made to the original integer. This eliminates the automatic exponential representation of the number. This method can be used in case, we wish to eliminate the scientific notation for a specific number and not set it globally.  
Syntax: format(number, scientific = FALSE)
Returns : The exponential number with the exactly same number of digits. However, the output is returned as a character variable object. So, it needs to be converted to an integer explicitly, in order to use it for further purposes. 
Example 1: 
R
# declaring an integer numbernum = 1000000000000print ("original number")print (num) print ("modified number")format(num, scientific = F)
Output:
[1] "original number"
[1] 1e+12
[1] "modified number"
[1] "1000000000000"
Example 2:
R
# declaring an exponential numbernum =2.21e+09print ("original number")print (num) print ("modified number")format(num, scientific = FALSE)
Output
[1] "original number"
[1] 2.21e+09
[1] "modified number"
[1] "2210000000"
gulshankumarar231
khushboogoyal499
Picked
R String-Functions
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install glob in Python in Windows?

21 Sep, 2021
The Python Glob module searches all path names looking for files matching a specified pattern according to the rules dictated by the Unix shell.
In this article, we will look into, how to install the glob module on Windows.
The only thing that you need for installing the glob module on Windows are:
Python
PIP or Conda (depending upon user preference)
If you want the installation to be done through conda,  open up the Anaconda Powershell Prompt and use the below command:
conda install -c anaconda glob2
Type y for yes when prompted.
You will get a similar message once the installation is complete:
Make sure you follow the best practices for installation using conda as:
Use an environment for installation rather than in the base environment using the below command:
conda create -n my-env
conda activate my-env
Note: If your preferred method of installation is conda-forge, use the below command:
conda config --env --add channels conda-forge
To verify if glob library has been successfully installed in your system run the below command in Anaconda Powershell Prompt:
conda list glob2
You’ll get the below message if the installation is complete:
If you want the installation to be done through PIP,  open up the Command Prompt and use the below command:
pip install glob2
You will get a similar message once the installation is complete:
To verify if glob module has been successfully installed in your system run the below command in Command Prompt:
python -m pip show glob2
You’ll get the below message if the installation is complete:
Blogathon-2021
how-to-install
Picked
Blogathon
How To
Installation Guide
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
PostgreSQL – HAVING clause

28 Aug, 2020
PostgreSQL has a HAVING clause that is used to eliminate groups of rows that do not meet specific criteria or conditions. Ii generally used in conjunction with the GROUP BY clause to filter group rows that do not satisfy a specified condition.
Syntax:
SELECT
    column_1,
    aggregate_function (column_2)
FROM
    tbl_name
GROUP BY
    column_1
HAVING
    condition;
Now let’s analyze the above syntax:
In the above syntax the aggregate_function represents functions like SUM(), COUNT() etc.
The HAVING clause provides the condition for group rows created by the GROUP BY clause.
The WHERE clause sets the condition fro each row before the GROUP BY clause is applied.
For the sake of this article we will be using the sample DVD rental database, which is explained here and can be downloaded by clicking on this link in our examples.Example 1:Here we will query to selects the only customer who has been spending more than 200 USD using the HAVING clause in the “payment” table of our sample database.
SELECT
    customer_id,
    SUM (amount)
FROM
    payment
GROUP BY
    customer_id
HAVING
    SUM (amount) > 200;
Output:
Example 2:
Here we will query to select the stores that has more than 200 customers using the HAVING clause in the “customer” table of our sample database.
SELECT
    store_id,
    COUNT (customer_id)
FROM
    customer
GROUP BY
    store_id
HAVING
    COUNT (customer_id) > 200;
Output:
postgreSQL-clauses
PostgreSQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Convert Excel to PDF Using Python

24 Feb, 2021
Python is a high-level, general-purpose, and very popular programming language. Python programming language (latest Python 3) is being used in web development, Machine Learning applications, along with all cutting-edge technology in Software Industry.
In this article, we will learn how to convert an Excel File to PDF File Using Python
Here we will use the win32com module for file conversion.
Python extensions for Microsoft Windows Provide access to much of the Win32 API, the ability to create and use COM objects, and the Pythonwin environment.
pip install pywin32
Approach:
First, we will create a COM Object Using Dispatch() method.
Then we will read the Excel file pass “Excel.Application” inside the Dispatch method
Pass Excel file path
Then we will convert it into PDF using the ExportAsFixedFormat() method
ExportAsFixedFormat():- The ExportAsFixedFormat method is used to publish a workbook in either PDF or XPS format.
Syntax:
ExportAsFixedFormat (Type, FileName, Quality, IncludeDocProperties, IgnorePrintAreas, From, To, 
OpenAfterPublish, FixedFormatExtClassPtr)
Excel File click here
Input:
EXCEL FILE
Below is the Implementation:
Python3
# Import Modulefrom win32com import client  # Open Microsoft Excelexcel = client.Dispatch("Excel.Application")  # Read Excel Filesheets = excel.Workbooks.Open('Excel File Path')work_sheets = sheets.Worksheets[0]  # Convert into PDF Filework_sheets.ExportAsFixedFormat(0, 'PDF File Path')
Output:
PDF FILE
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Enumerate() in Python
Read a file line by line in Python
Different ways to create Pandas Dataframe
How to Install PIP on Windows ?
Python String | replace()
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
*args and **kwargs in Python
Create a HashMap in Java

To create a HashMap, use the HashMap map and new −
HashMap hm = new HashMap();
Now, set elements −
hm.put("Finance", new Double(999.87));
hm.put("Operations", new Double(298.64));
hm.put("Marketing", new Double(39.56));
Display the elements now using the following code −
 Live Demo
import java.util.*;
public class Demo {
   public static void main(String args[]) {
      // Create a hash map
      HashMap hm = new HashMap();
      // Put elements to the map
      hm.put("Finance", new Double(999.87));
      hm.put("Operations", new Double(298.64));
      hm.put("Marketing", new Double(39.56));
      // Get a set of the entries
      Set set = hm.entrySet();
      // Get an iterator
      Iterator i = set.iterator();
      // Display elements
      while(i.hasNext()) {
         Map.Entry me = (Map.Entry)i.next();
         System.out.print(me.getKey() + ": ");
         System.out.println(me.getValue());
      }
      System.out.println();
   }
}
Finance: 999.87
Operations: 298.64
Marketing: 39.56
Installing Realtek RTL8821CE Driver to use the Wireless Network Interface in Ubuntu - GeeksforGeeks

24 Dec, 2020
If you dual boot your Laptop or PC with any other OS and you restart Ubuntu then it will show Error[Wireless connection is not present or no network devices are available]. This issue may happen also due to the installations of unwanted software in Ubuntu.
Problem: Wireless network (Wi-Fi) option is not available.
Follow the below steps to get back the Wi-Fi option on Ubuntu
Note: First connect a wired device to your laptop so that you can use internet services to follow further steps.
Step 1: Open Terminal using Ctrl+Alt+T.
Step 2: Update system packages using the following command.
sudo apt-get update
Step 3: Install the required packages using the following command.
sudo apt install git build-essential dkms
Step 4: Clone the Realtek RTL8821CE Driver using the following command.
git clone https://github.com/tomaspinho/rtl8821ce
Step 5: Move to the repository directory using the following command.
cd rtl8821ce
Step 6: Use the following command to make the script of dkms-installation executable.
chmod +x dkms-install.sh
Step 7: Make the dkms-remove script executable.
chmod +x dkms-remove.sh
Step 8: Execute the installation script using the below-mentioned command.
sudo ./dkms-install.sh
After doing these steps restart your PC, and now you can see that the wireless network option is available.
                               
Technical Scripter 2020
Linux-Unix
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
scp command in Linux with Examples
mv command in Linux with examples
Docker - COPY Instruction
SED command in Linux | Set 2
chown command in Linux with Examples
nohup Command in Linux with Examples
Named Pipe or FIFO with example C program
Thread functions in C/C++
uniq Command in LINUX with examples
Start/Stop/Restart Services Using Systemctl in Linux
Python | Repeating tuples N times - GeeksforGeeks

03 Nov, 2019
Sometimes, while working with data, we might have a problem in which we need to replicate, i.e construct duplicates of tuples. This is important application in many domains of computer programming. Let’s discuss certain ways in which this task can be performed.
Method #1 : Using * operatorThe multiplication operator can be used to construct the duplicates of a container. This also can be extended to tuples even though tuples are immutable.
# Python3 code to demonstrate working of# Repeating tuples N times# using * operator  # initialize tuple test_tup = (1, 3)  # printing original tuple print("The original tuple : " + str(test_tup))  # initialize N N = 4  # Repeating tuples N times# using * operatorres = ((test_tup, ) * N)  # printing resultprint("The duplicated tuple elements are : " + str(res))
The original tuple : (1, 3)
The duplicated tuple elements are : ((1, 3), (1, 3), (1, 3), (1, 3))

 
Method #2 : Using repeat()The internal function of itertools library, repeat() can be used to achieve the solution to the above problem.
# Python3 code to demonstrate working of# Repeating tuples N times# using repeat()from itertools import repeat  # initialize tuple test_tup = (1, 3)  # printing original tuple print("The original tuple : " + str(test_tup))  # initialize N N = 4  # Repeating tuples N times# using repeat()res = tuple(repeat(test_tup, N))  # printing resultprint("The duplicated tuple elements are : " + str(res))
The original tuple : (1, 3)
The duplicated tuple elements are : ((1, 3), (1, 3), (1, 3), (1, 3))

Python tuple-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
How to Install PIP on Windows ?
Read a file line by line in Python
Different ways to create Pandas Dataframe
Python String | replace()
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
HTML | <ol> type Attribute - GeeksforGeeks

27 Mar, 2020
The HTML <ol> type Attribute defines which type(1, A, a, I and i) of order you want in your list numeric, alphabetic or roman numbers.
Syntax:
<ol type="1 | a | A | i | I">
Attribute Values
1: This is the default value. It defines the list items in decimal number.(1, 2, 3, 4 .).
a: It defines the list items in alphabetically ordered lowercase letters .(a, b, c, d ...)
A: It defines the list items in alphabetically ordered uppercase letters.(A, B, C, D ..)
i: It defines the list items in lowercase roman number order.(i, ii, iii, iv, v, vi ...)
I: It defines the list items in uppercase roman number order.(I, II, III, IV, V, VI ..)
Example:
<!DOCTYPE html> <html>   <head>     <title>HTML ol type attribute</title> </head>   <body>     <h1 style="color:green;">GeeksforGeeks</h1>     <h3>HTML ol Type attribute</h3>       <p>Type attribute</p>             <p>start attribute</p>     <ol type="1">         <li>HTML</li>         <li>CSS</li>         <li>JS</li>     </ol>     </body>   </html>   
Output:
Supported Browsers: The browser supported by ol type attribute listed below:
Google Chrome
Internet Explorer
Firefox
Opera
Safari
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
REST API (Introduction)
How to Insert Form Data into Database using PHP ?
Types of CSS (Cascading Style Sheet)
How to position a div at the bottom of its container using CSS?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
How message authentication code works? - GeeksforGeeks

09 Aug, 2019
Prerequisite – Message authentication codesApart from intruders, the transfer of message between two people also faces other external problems like noise, which may alter the original message constructed by the sender. To ensure that the message is not altered there’s this cool method MAC.
MAC stands for Message Authentication Code. Here in MAC, sender and receiver share same key where sender generates a fixed size output called Cryptographic checksum or Message Authentication code and appends it to the original message. On receiver’s side, receiver also generates the code and compares it with what he/she received thus ensuring the originality of the message. These are components:
Message
Key
MAC algorithm
MAC value
There are different types of models Of Message Authentication Code (MAC) as following below:
MAC without encryption –This model can provide authentication but not confidentiality as anyone can see the message.Internal Error Code –In this model of MAC, sender encrypts the content before sending it through network for confidentiality. Thus this model provides confidentiality as well as authentication.M' = MAC(M, k)External Error Code –For cases when there is an alteration in message, we decrypt it for waste, to overcome that problem, we opt for external error code. Here we first apply MAC on the encrypted message ‘c’ and compare it with received MAC value on the receiver’s side and then decrypt ‘c’ if they both are same, else we simply discard the content received. Thus it saves time.c = E(M, k')
M' = MAC(c, k)
MAC without encryption –This model can provide authentication but not confidentiality as anyone can see the message.
Internal Error Code –In this model of MAC, sender encrypts the content before sending it through network for confidentiality. Thus this model provides confidentiality as well as authentication.M' = MAC(M, k)
M' = MAC(M, k)
External Error Code –For cases when there is an alteration in message, we decrypt it for waste, to overcome that problem, we opt for external error code. Here we first apply MAC on the encrypted message ‘c’ and compare it with received MAC value on the receiver’s side and then decrypt ‘c’ if they both are same, else we simply discard the content received. Thus it saves time.c = E(M, k')
M' = MAC(c, k)
c = E(M, k')
M' = MAC(c, k)
Problems in MAC –If we do reverse engineering we can reach plain text or even the key. Here we have mapped input to output, to overcome this we move on to hash functions which are “One way”.
Note – symbol “E” denotes symmetric key encryption.
Computer Networks
Computer Networks
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Differences between IPv4 and IPv6
Socket Programming in Python
Caesar Cipher in Cryptography
UDP Server-Client implementation in C
Socket Programming in Java
Advanced Encryption Standard (AES)
Intrusion Detection System (IDS)
Secure Socket Layer (SSL)
Cryptography and its Types
Wireless Sensor Network (WSN)