code-rag-bench/online-tutorials huggingface dataset:
How to Export SQL Server Data to a CSV File?

18 Oct, 2021
Here we will see, how to export SQL Server Data to CSV file by using the ‘Import and Export wizard’ of SQL Server Management Studio (SSMS).
CSV (Comma-separated values): It is a file that consists of plain text data in which data is separated using comma(,). It is also known as Comma Delimited Files because comma act as a delimiter for CSV files.
Step 1: Creating the Database
Use the below SQL statement to create a database called geeks.
Query:
CREATE DATABASE geeks;
Step 2: Using the Database
Use the below SQL statement to switch the database context to geeks.
Query:
USE geeks;
Step 3: Table definition
We have the following demo_table in our geek’s database.
Query:
CREATE TABLE demo_table
(FIRSTNAME VARCHAR(20),
LASTNAMENAME VARCHAR(20),
AGE INT,GENDER VARCHAR(20));
Step 4: Insert data into the table
Query:
INSERT INTO demo_table VALUES
('Romy', 'Kumari', 22, 'female'),
('Sujata', 'Jha', 20, 'female'),
('Shalini', 'Jha', 22, 'female'),
('Ayushi', 'Chaudhary', 23, 'female'),
('Rinkle', 'Arora', 23, 'female'),
('Kajal', 'Sharma' ,24, 'female');
Step 5: See the content of the table
Use the below command to see the content of the demo_table:
Query:
SELECT * FROM demo_table;
Output:
Now we see steps to Export SQL Server Data into a CSV file.
Step 1: Open object Explorer from View option in the menu bar.
It appears on the left side of the screen. 
We can see the ‘geeks’ database inside the database folder.
Step 2: Right click on the geeks database, Click on Tasks-> Export Data. 
Step 3: Import and Export wizard will open, fill the details like server name, database etc. Then click on Next.
Step 4: Choose ‘Flat File destination’ as destination and choose file path. One can choose any text file as destination file. We have selected hello.txt as destination file to save the SQL Server data. Then Click Next
Step 5: choose table name and select comma as delimiter. then Click Next to proceed.
Step 6: No changes required in Save and Run package window. Click Next.
Step 7: On the “Complete” Wizard window, check all the settings set during of exporting process. Click “Finish” to start exporting SQL database to CSV.
Step 8: Below window shows the successful execution
Step 9: Check the destination file which is “hello” in this case.
We can see the content is same as the content of demo_table separated by comma.
Picked
SQL-Server
TrueGeek-2021
SQL
TrueGeek
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Update Multiple Columns in Single Update Statement in SQL?
Window functions in SQL
What is Temporary Table in SQL?
SQL using Python
SQL | Sub queries in From Clause
How to redirect to another page in ReactJS ?
How to remove duplicate elements from JavaScript Array ?
How to Convert Char to String in Java?
Basics of API Testing Using Postman
Types of Internet Protocols
PHP | uniqid( ) Function

29 Aug, 2021
The uniqid() function in PHP is an inbuilt function which is used to generate a unique ID based on the current time in microseconds (micro time). The ID generated from the uniqid() function is not optimal since it is based on the system time and is not cryptographically secured. Thus it should not be for cryptographical purposes.The uniqid( ) function accepts prefix and more_entropy as parameters and returns timestamp based unique identifier as a string. 
Syntax:  
 uniqid($prefix, $more_entropy) 
Parameters Used: The uiqid() function in PHP accepts two parameters. 
$prefix : It is an optional parameter which specifies a prefix to the unique id. It must be string.$more_entropy : It is an optional parameter which specifies more entropy at the end of the return value which makes the id more unique.The default value is FALSE, which returns 13 characters long string whereas when it is set to TRUE, the return string is 23 characters long.
$prefix : It is an optional parameter which specifies a prefix to the unique id. It must be string.
$more_entropy : It is an optional parameter which specifies more entropy at the end of the return value which makes the id more unique.The default value is FALSE, which returns 13 characters long string whereas when it is set to TRUE, the return string is 23 characters long.
Return Value: It returns timestamp based unique identifier as a string.Errors And Exceptions: 
The uniqid() function tries to create unique identifier, but it does not guarantee 100% uniqueness of return value.Since most systems adjust system clock by NTP or like, system time is changed constantly. Therefore, it is possible that this function does not return unique ID for the process/thread.
The uniqid() function tries to create unique identifier, but it does not guarantee 100% uniqueness of return value.
Since most systems adjust system clock by NTP or like, system time is changed constantly. Therefore, it is possible that this function does not return unique ID for the process/thread.
Below programs illustrate the uniqid() function:Program 1: 
php
<?php// generating unique idecho uniqid();?>
Output:  
3b2c662647f18
Program 2: 
php
<?php// generating unique id with prefix gfg$myuid = uniqid('gfg'); echo $myuid;?>
Output:  
gfg5b2b451823970
Program 3: 
php
<?php// generating unique id with prefix gfg// and higher entropy$myuid = uniqid('gfg', true); echo $myuid;?>
Output:  
gfg5b2b4555ab6bd7.27884925
Reference : http://php.net/manual/en/function.uniqid.php
raghurajendran
simmytarika5
PHP-function
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to convert array to string in PHP ?
PHP | Converting string to Date and DateTime
Comparing two dates in PHP
Split a comma delimited string into an array in PHP
Download file from URL using PHP
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
Python – Merge Dictionaries List with duplicate Keys

02 Dec, 2020
Given two List of dictionaries with possible duplicate keys, write a Python program to perform merge.
Examples:
Input : test_list1 = [{“gfg” : 1, “best” : 4}, {“geeks” : 10, “good” : 15}, {“love” : “gfg”}], test_list2 = [{“gfg” : 6}, {“better” : 3, “for” : 10, “geeks” : 1}, {“gfg” : 10}] Output : [{‘gfg’: 1, ‘best’: 4}, {‘geeks’: 10, ‘good’: 15, ‘better’: 3, ‘for’: 10}, {‘love’: ‘gfg’, ‘gfg’: 10}] Explanation : gfg while merging retains value of 1, and “best” is added to dictionary as key from other list’s 1st dictionary ( same index ). 
Input : test_list1 = [{“gfg” : 1, “best” : 4}, {“love” : “gfg”}], test_list2 = [{“gfg” : 6}, {“gfg” : 10}] Output : [{‘gfg’: 1, ‘best’: 4}, {‘love’: ‘gfg’, ‘gfg’: 10}] Explanation : gfg while merging retains value of 1, and “best” is added to dictionary as key from other list’s 1st dictionary ( same index ). 
Approach : Using loop + keys()
In this we reconstruct the key value pair in accordance of all the keys not recurring, checking using in operator and extracting keys using keys().
Python3
# Python3 code to demonstrate working of# Merge Dictionaries List with duplicate Keys# Using loop + keys()  # initializing liststest_list1 = [{"gfg": 1, "best": 4}, {"geeks": 10, "good": 15},              {"love": "gfg"}]  test_list2 = [{"gfg": 6}, {"better": 3, "for": 10, "geeks": 1},              {"gfg": 10}]  # printing original listsprint("The original list 1 is : " + str(test_list1))print("The original list 2 is : " + str(test_list2))    for idx in range(0, len(test_list1)):      # getting keys of corresponding index    id_keys = list(test_list1[idx].keys())    for key in test_list2[idx]:          # checking for keys presence        if key not in id_keys:            test_list1[idx][key] = test_list2[idx][key]  # printing resultprint("The Merged Dictionary list : " + str(test_list1))
Output:
The original list 1 is : [{‘gfg’: 1, ‘best’: 4}, {‘geeks’: 10, ‘good’: 15}, {‘love’: ‘gfg’}]The original list 2 is : [{‘gfg’: 6}, {‘better’: 3, ‘for’: 10, ‘geeks’: 1}, {‘gfg’: 10}]The Merged Dictionary list : [{‘gfg’: 1, ‘best’: 4}, {‘geeks’: 10, ‘good’: 15, ‘better’: 3, ‘for’: 10}, {‘love’: ‘gfg’, ‘gfg’: 10}]
Python dictionary-programs
Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
Python | os.path.join() method
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python Program for Fibonacci numbers
Python | Convert string dictionary to dictionary
How to fix SSL_ERROR_RX_RECORD_TOO_LONG on Mozilla Firefox ?

05 Nov, 2020
What Is the Mozilla Firefox Error Message SSL_ERROR_RX_RECORD_TOO_LONG ?
Firefox SSL_ERROR_RX_RECORD_TOO_LONG message is displayed because a certain mis-configuration has been occurred on the server. Most of the time, because of the following two reasons, the SSL_ERROR_RX_RECORD_TOO_LONG error message is displayed from the server-side:
The listening port is misconfigured. For example, the website you may want to establish a secure connection is not configured to use Port 443.
Adequate TLS version may not be supported by your system.
Mostly, SSL_ERROR_RX_RECORD_TOO_LONG may occur due to any one of the issues mentioned above. Now let’s learn how to fix this issue.
Upgrade Your Support for TLS Version: TLS 1.3, called as RFC 8446, is the latest TLS version. So, check whether the SSL/TLS library is updated or not. Most systems and servers use the Open SSL library, which will support TLS 1.3. If due to any reason, your system or server cannot support TLS 1.3, then make sure that it supports for TLS 1.2 is available.
To Solve the SSL_ERROR_RX_RECORD_TOO_LONG, use the Correct Listening Port: As mentioned above, 443 is the correct listening port for HTTPS traffic. If your port doesn’t match or the trusted SSL/TLS certificate is not on that port, it’s likely you’ll face this SSL_ERROR_RX_RECORD_TOO_LONG error message.
Fixing the SSL_ERROR_RX_RECORD_TOO_LONG From a User’s Standpoint: Let’s see a user what you can do to solve this Mozilla Firefox error message SSL_ERROR_RX_RECORD_TOO_LONG.
1. Clearing the Cache- Sometimes, clearing the cache can solve this issue. One of the best and better way is to check whether the website in an Incognito or Private Window. Additionally, you can also use:
Ctrl+ Shift + R
  or
Shift + click Reload current page
Mostly, it will fail. But, there’s nothing to lose, as it’s a safe and better way to check whether it solves the issue or not.
2. Changing the Preference of the security.tls.version.max- It’s not recommended but it can be useful in certain scenarios. For example, the website supports TLS 1.3 and Firefox also assumes it does but your Operating System on which Mozilla Firefox is running doesn’t support it. At that time, this SSL_ERROR_RX_RECORD_TOO_LONG error can occur.
So, if you’re using Microsoft Windows operating system and want to drop support for TLS 1.3 on a temporary basis, follow the steps given below.
In Mozilla Firefox, open a tab and in the address bar type “about:config” and click on “I accept the risk!” button.
In the search field, type: security.tls.version.max and then double-click on it.
A pop-up will be displayed, in that change the value from 4 to 3.
Another thing to note is that the values in Firefox support the TLS version. For example, 1 is for TLS 1.0, 3 is for TLS 1.3, and 3 is for TLS 1.2. Also, make sure you don’t go below TLS 1.2 as the versions below TLS 1.2 are not supported due to vulnerability issues.
Web Technologies
Web technologies Questions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to add elements to an existing array dynamically in JavaScript ?

16 Jul, 2020
An array is a JavaScript object that can hold multiple values at a time, irrespective of the data type.
Example:
var a = ['Geeks', 'For', 'Geeks', 1];

In the above example, “Geeks” is of type “string” while 1 is of “integer” type. An array can also store JavaScript objects. JavaScript arrays are dynamic in nature, they do not need the size during initialization. They are accessed using numbered indexes.
console.log(a[1]);

Above statement prints ‘For’ from the above example in the console window.
Output:
For
or
document.write(a[1]);
Output:
For
To add elements into an array dynamically in JavaScript, the programmer can use any of the following methods.
Method 1: Use number indexes to add an element to the specified index.
JavaScript
<script>    // JavaScript Array Initialization    var a = ['Hi', 'There'];      // New element added dynamically.    a[3] = 'Geeks';      document.write(a[3]);    document.write("<br>");    document.write(a[2]);</script>
Output: On the console window
It can be seen that index of {0, 1} was declared only. Index 3 was dynamically created and initialized to ‘Geeks’. Index 2 was created automatically and initialized to undefined, to keep up the ordering.
Method 2: Use push() method is used to add element at the end of the array.
JavaScript
<script>    // JavaScript Array Declared    var a = [];      // Elements pushed into the     // array using push() method    a.push('Geeks');    a.push('For');    a.push('Geeks');      // Obtaining the value    document.write(a);</script>
Output:
The console window shows an array object containing 3 values, they are [‘Geeks’, ‘For’, ‘Geeks’]. The push() method maintains the ordering of indexes by adding the new elements at the end of the array and returns the new length of the array.
javascript-array
JavaScript-Misc
Picked
JavaScript
Web Technologies
Web technologies Questions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
Difference Between PUT and PATCH Request
How to Open URL in New Tab using JavaScript ?
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
PyQt5 – Capsule shaped Progress Bar

22 Apr, 2020
In this article we will see how to create capsule shaped progress bar. By default when we create progress bar, it is in rectangular shape although we can change the shape with the help of resize method. But this will only allows to change the shape from rectangle to square. Below is representation of normal progress bar vs the capsule shaped progress bar.
 
In order to do so we have to change the radius of the border of both background and the bar of progress bar, this is done by changing the CSS style sheet, below is the style sheet code.
QProgressBar
{
border: solid grey;
border-radius: 15px;
color: black;
}
QProgressBar::chunk 
{
background-color: #05B8CC;
border-radius :15px;
}      

This style sheet is used which setStyleSheet method, below is the implementation.
# importing librariesfrom PyQt5.QtWidgets import * from PyQt5 import QtCore, QtGuifrom PyQt5.QtGui import * from PyQt5.QtCore import * import sys    class Window(QMainWindow):      def __init__(self):        super().__init__()          # setting title        self.setWindowTitle("Python ")          # setting background color to window        # self.setStyleSheet("background-color : yellow")          # setting geometry        self.setGeometry(100, 100, 600, 400)          # calling method        self.UiComponents()          # showing all the widgets        self.show()      # method for widgets    def UiComponents(self):        # creating progress bar        bar = QProgressBar(self)          # setting geometry to progress bar        bar.setGeometry(200, 100, 200, 30)          # setting the value        bar.setValue(70)          # setting alignment to center        bar.setAlignment(Qt.AlignCenter)          # setting background to color and radius        # and bar color and bar radius        bar.setStyleSheet("QProgressBar"                          "{"                          "border: solid grey;"                          "border-radius: 15px;"                          " color: black; "                          "}"                          "QProgressBar::chunk "                          "{background-color: # 05B8CC;"                          "border-radius :15px;"                          "}")    App = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
Output :
Python-gui
Python-PyQt
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Different ways to create Pandas Dataframe
Enumerate() in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
Convert integer to string in Python
How to drop one or multiple columns in Pandas Dataframe
Tryit Editor v3.6 - Show React

import React from 'react';
import ReactDOM from 'react-dom/client';

ReactDOM.render(<p>Hello</p>, document.getElementById('root'));




<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport"
      content="width=device-width, initial-scale=1" />
How to have actual values in Matplotlib Pie Chart displayed?

To have actual or any custom values in Matplotlib pie chart displayed, we can take the following steps −
Set the figure size and adjust the padding between and around the subplots.
Make lists of labels, fractions, explode position and get the sum of fractions to calculate the percentage
Make a pie chart using labels, fracs and explode with autopct=lambda p: <calculation for percentage>.
To display the figure, use show() method.
import matplotlib.pyplot as plt

plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True

labels = ('Read', 'Eat', 'Sleep', 'Repeat')

fracs = [5, 3, 4, 1]
total = sum(fracs)
explode = (0, 0.05, 0, 0)

plt.pie(fracs, explode=explode, labels=labels,
   autopct=lambda p: '{:.0f}%'.format(p * total / 100),
   shadow=True, startangle=90)

plt.show()
Difference between IEnumerator and IEnumerable Interface in C#

IEnumerable and IEnumerator both are interfaces in C#.
IEnumerable is an interface defining a single method GetEnumerator() that returns an IEnumerator interface.
This works for readonly access to a collection that implements that IEnumerable can be used with a foreach statement.
IEnumerator has two methods MoveNext and Reset. It also has a property called Current.
The following shows the implementation of IEnumerable and IEnumerator.
class Demo : IEnumerable, IEnumerator {
   // IEnumerable method GetEnumerator()
   IEnumerator IEnumerable.GetEnumerator() {
      throw new NotImplementedException();
   }
   public object Current {
      get { throw new NotImplementedException(); }
   }
   // IEnumertor method
   public bool MoveNext() {
      throw new NotImplementedException();
   }
   // IEnumertor method
      public void Reset() {
      throw new NotImplementedException();
   }
}
Above you can see the two methods of IEnumerator.
// IEnumertor method
public bool MoveNext() {
   throw new NotImplementedException();
}

// IEnumertor method
public void Reset() {
   throw new NotImplementedException();
}
Write a Golang program to print the Fibonacci series

Definition: In a Fibonacci series, the next number would be the summation of its two previous numbers, series starting from 0 and 1.
Print a fibonacci series up to num = 10;
Series: 1, 2, 3, 5, 8, next is 13 but greater than 10;
Step 1: Define a function that accepts a numbers(num) type is int, till then need to print the series.
Step 2: Take two initial numbers for the series, i.e., 0 and 1.
Step 3: Start a true for loop and declare a third variable to store previous two values.
Step 4: Print the summation of two numbers until the summation is lesser than the given num.
Live Demo
package main
import "fmt"

func printFibonacciSeries(num int){
   a := 0
   b := 1
   c := b
   fmt.Printf("Series is: %d %d", a, b)
   for true{
      c = b
      b = a + b
      if b >= num{
         fmt.Println()
         break
      }
      a = c
      fmt.Printf(" %d", b)
   }
}

func main(){
   printFibonacciSeries(10)
   printFibonacciSeries(16)
   printFibonacciSeries(100)
}
Series is: 0 1 1 2 3 5 8
Series is: 0 1 1 2 3 5 8 13
Series is: 0 1 1 2 3 5 8 13 21 34 55 89
Laravel - Blade Templates

Laravel 5.1 introduces the concept of using Blade, a templating engine to design a unique layout. The layout thus designed can be used by other views, and includes a consistent design and structure.
When compared to other templating engines, Blade is unique in the following ways −
It does not restrict the developer from using plain PHP code in views.
It does not restrict the developer from using plain PHP code in views.
The blade views thus designed, are compiled and cached until they are modified.
The blade views thus designed, are compiled and cached until they are modified.
The complete directory structure of Laravel is shown in the screenshot given here.
You can observe that all views are stored in the resources/views directory and the default view for Laravel framework is welcome.blade.php.
Please note that other blade templates are also created similarly.
You will have to use the following steps to create a blade template layout −
Create a layout folder inside the resources/views folder. We are going to use this folder to store all layouts together.
Create a layout folder inside the resources/views folder. We are going to use this folder to store all layouts together.
Create a file name master.blade.php which will have the following code associated with it −
Create a file name master.blade.php which will have the following code associated with it −
<html>
   <head>
      <title>DemoLaravel - @yield('title')</title>
   </head>
   <body>
      @yield('content')
   </body>
</html>
In this step, you should extend the layout. Extending a layout involves defining the child elements. Laravel uses the Blade @extends directive for defining the child elements.
When you are extending a layout, please note the following points −
Views defined in the Blade Layout injects the container in a unique way.
Views defined in the Blade Layout injects the container in a unique way.
Various sections of view are created as child elements.
Various sections of view are created as child elements.
Child elements are stored in layouts folder as child.blade.php
Child elements are stored in layouts folder as child.blade.php
An example that shows extending the layout created above is shown here −
@extends('layouts.app')
@section('title', 'Page Title')
@section('sidebar')
   @parent
<p>This refers to the master sidebar.</p>
@endsection
@section('content')
<p>This is my body content.</p>
@endsection
To implement the child elements in views, you should define the layout in the way it is needed.
Observe the screenshot shown here. You can find that each of links mentioned in the landing page are hyperlinks. Please note that you can also create them as child elements with the help of blade templates by using the procedure given above.

    13 Lectures 
     3 hours 

 Sebastian Sulinski

    35 Lectures 
     3.5 hours 

 Antonio Papa

    7 Lectures 
     1.5 hours 

 Sebastian Sulinski

    42 Lectures 
     1 hours 

 Skillbakerystudios

    165 Lectures 
     13 hours 

 Paul Carlo Tordecilla

    116 Lectures 
     13 hours 

 Hafizullah Masoudi
 Print
 Add Notes
 Bookmark this page
DayOfWeek getValue() method in Java with Examples - GeeksforGeeks

19 Mar, 2019
The getValue() method of java.time.DayOfWeek is an in-built function in Java which return the integer value assigned to the 7 days of the week, i.e, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday. The int value follows the ISO-8601 standard, from 1 (Monday) to 7 (Sunday).
Method Declaration:
public int getValue()

Syntax:
int val = DayOfWeekObject.getValue()

Parameters: This method does not accepts any parameters.
Return Value: The function returns int value of the day of the week, e.g, 1 for Monday, 2 for Tuesday and so on.
Below program illustrate the above method:Program 1:
// Java Program Demonstrate getValue()// method of DayOfWeekimport java.time.*;import java.time.DayOfWeek;  class DayOfWeekExample {    public static void main(String[] args)    {        // Set a local date whose day is found        LocalDate localDate            = LocalDate.of(1947,                           Month.AUGUST, 15);          // Find the day from the local date        DayOfWeek dayOfWeek            = DayOfWeek.from(localDate);          // Printing the day of the week        // and its Int value        System.out.println("Day of the Week on"                           + " 15th August 1947 - "                           + dayOfWeek.name());          int val = dayOfWeek.getValue();          System.out.println("Int Value of "                           + dayOfWeek.name()                           + " - " + val);    }}
Day of the Week on 15th August 1947 - FRIDAY
Int Value of FRIDAY - 5

Program 2:
// Java Program Demonstrate getValue()// method of DayOfWeekimport java.time.*;import java.time.DayOfWeek;  class DayOfWeekExample {    public static void main(String[] args)    {        // Set a local date whose day is found        LocalDate localDate            = LocalDate.of(2015,                           Month.JULY, 13);          // Find the day from the local date        DayOfWeek dayOfWeek            = DayOfWeek.from(localDate);          // Printing the day of the week        // and its Int value        System.out.println("Day of the Week on"                           + " 13th July 2015 - "                           + dayOfWeek.name());          int val = dayOfWeek.getValue();          System.out.println("Int Value of "                           + dayOfWeek.name()                           + " - " + val);    }}
Day of the Week on 13th July 2015 - MONDAY
Int Value of MONDAY - 1

Reference: https://docs.oracle.com/javase/8/docs/api/java/time/DayOfWeek.html#getValue–
Java - util package
Java-DayOfWeek
Java-Functions
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Initialize an ArrayList in Java
Object Oriented Programming (OOPs) Concept in Java
HashMap in Java with Examples
Interfaces in Java
How to iterate any Map in Java
ArrayList in Java
Multidimensional Arrays in Java
Stream In Java
Stack Class in Java
Singleton Class in Java
Tryit Editor v3.7

Tryit: HTML picture source
How to Install Nose 2 in Python on Windows? - GeeksforGeeks

22 Sep, 2021
Nose 2 is a successor of Nose package and is used for testing python applications. In this article, we will look into the process of installing Nose2 Package on Windows.
The only thing that you need for installing the Scrapy 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 conda-forge nose2
Note: The best way to install this module in conda is through coda-forge.
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
To verify if Nose2 Package has been successfully installed in your system run the below command in Anaconda Powershell Prompt:
conda list nose2
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 nose2
You will get a similar message once the installation is complete:
To verify if the Nose2 package has been successfully installed in your system run the below command in Command Prompt:
python -m pip show nose2
You’ll get the below message if the installation is complete:
how-to-install
Picked
How To
Installation Guide
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install FFmpeg on Windows?
How to Install Jupyter Notebook on MacOS?
How to Install Flutter on Visual Studio Code?
How to Override compareTo Method in Java?
How to Install Python Pandas on MacOS?
Installation of Node.js on Linux
How to Install FFmpeg on Windows?
How to Install Selenium on MacOS?
How to Install Pygame on Windows ?
How to Add External JAR File to an IntelliJ IDEA Project?
gmtime() Function in C/C++ - GeeksforGeeks

20 Jul, 2020
The gmtime() function in C++ change the time, which is given to UTC(Universal Time Coordinated) time (i.e., the time at the GMT timezone). The gmtime() is defined in ctime header file.
Syntax:
tm* gmtime ( const time_t* current_time )
The hours can be accessed using tm_hour
The minutes can be accessed using tm_min
The seconds can be accessed using tm_sec
Parameters: The function accepts one mandatory parameter current_time : which specifies a pointer to a time_t object.
Return Value: The function returns two type of values described below:
On Success, returns a pointer to a tm object
Otherwise, Null pointer is returned
Below programs illustrate the above function.
Program 1:
// C++ program to illustrate the// gmtime() function#include <stdio.h>#include <time.h>#define CST (+8)#define IND (-5)  int main(){      // object    time_t current_time;      // pointer    struct tm* ptime;      // use time function    time(¤t_time);      // gets the current-time    ptime = gmtime(¤t_time);      // print the current time    printf("Current time:\n");      printf("Beijing ( China ):%2d:%02d:%02d\n",           (ptime->tm_hour + CST) % 24, ptime->tm_min, ptime->tm_sec);      printf("Delhi ( India ):%2d:%02d:%02d\n",           (ptime->tm_hour + IND) % 24, ptime->tm_min, ptime->tm_sec);    return 0;}
Current time:
Beijing ( China ):16:40:21
Delhi ( India ): 3:40:21

Program 2:
// C++ program to illustrate the// gmtime() function#include <stdio.h>#include <time.h>#define UTC (0)#define ART (-3)  int main(){    time_t current_time;    struct tm* ptime;    time(¤t_time);    ptime = gmtime(¤t_time);    printf("Current time:\n");    printf("Monrovia ( Liberia ) :%2d:%02d:%02d\n",           (ptime->tm_hour + UTC) % 24, ptime->tm_min, ptime->tm_sec);      printf("Buenos Aires ( Argentina ) :%2d:%02d:%02d\n",           (ptime->tm_hour + ART) % 24, ptime->tm_min, ptime->tm_sec);    return 0;}
Current time:
Monrovia ( Liberia ) : 8:40:22
Buenos Aires ( Argentina ) : 5:40:22

Akanksha_Rai
C-Library
CPP-Functions
C Programs
C++ Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
C Program to read contents of Whole File
Producer Consumer Problem in C
C program to find the length of a string
Exit codes in C/C++ with Examples
Difference between break and continue statement in C
C++ Program for QuickSort
C++ program for hashing with chaining
Sorting a Map by value in C++ STL
cin in C++
delete keyword in C++
Bootstrap 5 Tutorial

Bootstrap 5 is the newest version of Bootstrap, which is the most popular HTML, CSS, and JavaScript framework for creating responsive, mobile-first websites.
Bootstrap 5 is completely free to download and use!
Start learning Bootstrap 5 now »
Learn Bootstrap 5
This tutorial contains hundreds of Bootstrap 5 examples.
With our online editor, you can edit the code, and click on a button to view the result.
Resize this responsive page to see the effect!
Lorem ipsum dolor sit amet, consectetur adipisicing elit...
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris...
Lorem ipsum dolor sit amet, consectetur adipisicing elit...
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris...
Lorem ipsum dolor sit amet, consectetur adipisicing elit...
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris...
Click on the "Try it Yourself" button to see how it works.
Bootstrap 5 is the newest version of Bootstrap; with new components, faster stylesheet and more responsiveness.
Bootstrap 5 supports the latest, stable releases of all major browsers and 
platforms. However, Internet Explorer 11 and down is not supported.
The main differences between Bootstrap 5 and Bootstrap 3 & 4, is that 
Bootstrap 5 has switched to JavaScript instead of jQuery.
Note: Bootstrap 3 and Bootstrap 4 is still supported by the team for critical bugfixes and documentation changes, 
and it is perfectly safe to continue to use them. However, new features will NOT be added to 
them.
Use a Bootstrap class to center the following text:
<p class=""> Hello World!</p>

Start the Exercise
Test your Bootstrap 5 skills at W3Schools!
Start Bootstrap 5 Quiz!
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.
C# program to find maximum and minimum element in an array


Set the minimum and maximum element to the first element so that you can compare all the elements.
For maximum.
if(arr[i]>max) {
   max = arr[i];
}
For minimum.
if(arr[i]<min) {
   min = arr[i];
}
You can try to run the following code to find maximum and minimum elements’ position.
 Live Demo
using System;
public class Demo {
   public static void Main() {
      int[] arr = new int[5] {99, 95, 93, 89, 87};
      int i, max, min, n;
      // size of the array
      n = 5;
      max = arr[0];
      min = arr[0];
      for(i=1; i<n; i++) {
         if(arr[i]>max) {
            max = arr[i];
         }
         if(arr[i]<min) {
            min = arr[i];
         }
      }
      Console.Write("Maximum element = {0}\n", max);
      Console.Write("Minimum element = {0}\n\n", min);
   }
}
Maximum element = 99
Minimum element = 87
Python – Count elements in tuple list

27 Dec, 2019
Sometimes, while working with data in form of records, we can have a problem in which we need to find the count of all the records received. This is a very common application that can occur in Data Science domain. Let’s discuss certain ways in which this task can be performed.
Method #1 : Using len() + generator expressionThis is the most basic method to achieve solution to this task. In this, we iterate over whole nested lists using generator expression and get the count using len().
# Python3 code to demonstrate working of# Tuple list elements count# using len() + generator expression  # initialize list test_list = [(2, 4), (6, 7), (5, 1), (6, 10), (8, 7)]  # printing original list print("The original list : " + str(test_list))  # Tuple list elements count# using len() + generator expressiontemp = list((int(j) for i in test_list for j in i))res = len(temp)  # printing resultprint("The tuple list elements count : " + str(res))
The original list : [(2, 4), (6, 7), (5, 1), (6, 10), (8, 7)]
The tuple list elements count : 10

 
Method #2 : Using len() + map() + chain.from_iterable()The combination of above methods can also be used to perform this task. In this, the extension of finding count is done by combination of map() and from_iterable().
# Python3 code to demonstrate working of# Tuple list elements count# using len() + map() + chain.from_iterable()from itertools import chain  # initialize list test_list = [(2, 4), (6, 7), (5, 1), (6, 10), (8, 7)]  # printing original list print("The original list : " + str(test_list))  # Tuple list elements count# using len() + map() + chain.from_iterable()res = len(list(map(int, chain.from_iterable(test_list))))  # printing resultprint("The tuple list elements count : " + str(res))
The original list : [(2, 4), (6, 7), (5, 1), (6, 10), (8, 7)]
The tuple list elements count : 10

Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Combining DataFrames with Pandas

11 Dec, 2020
Pandas DataFrame consists of three principal components, the data, rows, and columns. To combine these DataFrames, pandas provides multiple functions like concat() and append().
Method #1: Using concat() method
Initially, creating two datasets and converting them into dataframes. 
Python3
# import required moduleimport pandas as pd  # making  a datasetdata1 = {    'Serial_No.': ['1', '2', '3', '4', '5'],    'First': ['F0', 'F1', 'F2', 'F3', 'F4'],    'Second': ['S0', 'S1', 'S2', 'S3', 'S4'],}  # creating a dataframedf1 = pd.DataFrame(data1, columns=['Serial_No.',                                    'First',                                    'Second'])  # display dataframedf1    # making  a datasetdata2 = {    'Serial_No.': ['6', '7', '8', '9', '10'],    'First': ['F10', 'F11', 'F12', 'F13', 'F14'],    'Second': ['S10', 'S11', 'S12', 'S13', 'S14'],}  # creating  a datasetdf2 = pd.DataFrame(data2, columns=['Serial_No.',                                    'First',                                    'Second'])  # display datasetdf2
Output: 
Now, concatenating the two dataframes, we will use concat() to combine two dataframes. If ignore_index = True the index of df will be in a continuous order. 
Python3
# combining the two dataframesdf = pd.concat([df1, df2], ignore_index=True)  # display combined dataframesdf
Output:
Using keys we can specify the labels of the dataframes.
Python3
# we can also separate 2 datasets using keysframes = [df1, df2]df_keys = pd.concat(frames, keys=['x', 'y'])  # display dataframedf_keys
Output:
Method #2: Using append() method
Initially, creating two datasets and converting them into dataframes. 
Python3
# import required moduleimport pandas as pd  # making  a datasetdata1 = {    'Serial_No.': ['1', '2', '3', '4', '5'],    'First': ['F0', 'F1', 'F2', 'F3', 'F4'],    'Second': ['S0', 'S1', 'S2', 'S3', 'S4'],}  # creating a dataframedf1 = pd.DataFrame(data1, columns=['Serial_No.',                                    'First',                                    'Second'])  # display dataframedf1    # making  a datasetdata2 = {    'Serial_No.': ['6', '7', '8', '9', '10'],    'First': ['F10', 'F11', 'F12', 'F13', 'F14'],    'Second': ['S10', 'S11', 'S12', 'S13', 'S14'],}  # creating  a datasetdf2 = pd.DataFrame(data2, columns=['Serial_No.',                                    'First',                                    'Second'])  # display datasetdf2
Output: 
The dataframe.append() method performs the operation of combining two dataframes similar to that of the contcat() method.
Python3
# combining dataframesresult = df1.append(df2, sort=False, ignore_index=True)  # display combined dataframeresult
Output:
Python pandas-dataFrame
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
What is the difference between g++ and gcc?

GNU C++ Compiler ( g++ ) is a compiler in Linux which is used to compile C++ programs. It compiles both files with extension .c and .cpp as C++ files.
The following is the compiler command to compile C++ program.
g++ program.cpp -o filename
Here,
filename − The name of file with .c or .cpp extension.
The following is an example of using g++ compiler.
 Live Demo
#include <iostream>
using namespace std;
int main() {
   int a = 20;
   cout << "The value of a : " << a;
   return 0;
}
$g++ -o main *.cpp
$main
The value of a : 20
GNU C Compiler ( gcc ) is a compiler in Linux which is used to compile C programs. It compiles files with extension “.c”.
The following is the compiler command to compile C program.
gcc program.c -o filename
Here,
filename − The name of file with .c extension.
The following is an example of using gcc compiler.
 Live Demo
#include <stdio.h>
int main() {
   int a = 20;
   printf("The value of a : %d", a);
   return 0;
}
$gcc -o main *.c
$main
The value of a : 20
How to convert Java array or ArrayList to JsonArray using Gson in Java?

The Java Arrays are objects which store multiple variables of the same type, it holds primitive types and object references and an ArrayList can represent a resizable list of objects. We can add, remove, find, sort and replace elements using the list. A JsonArray can parse text from a string to produce a vector-like object. We can convert an array or ArrayList to JsonArray using the toJsonTree().getAsJsonArray() method of Gson class.
public JsonElement toJsonTree(java.lang.Object src)
import com.google.gson.*;
import java.util.*;
public class JavaArrayToJsonArrayTest {
   public static void main(String args[]) {
      String[][] strArray = {{"elem1-1", "elem1-2"}, {"elem2-1", "elem2-2"}};
      ArrayList<ArrayList<String>> arrayList = new ArrayList<>();
      for(int i = 0; i < strArray.length; i++) {
         ArrayList<String> nextElement = new ArrayList<>();
         for(int j = 0; j < strArray[i].length; j++) {
            nextElement.add(strArray[i][j] + "-B");
         }
         arrayList.add(nextElement);
      }
      JsonObject jsonObj = new JsonObject();
      // array to JsonArray
      JsonArray jsonArray1 = new Gson().toJsonTree(strArray).getAsJsonArray();
      // ArrayList to JsonArray
      JsonArray jsonArray2 = new Gson().toJsonTree(arrayList).getAsJsonArray();
      jsonObj.add("jsonArray1", jsonArray1);
      jsonObj.add("jsonArray2", jsonArray2);
      System.out.println(jsonObj.toString());
   }
}
{"jsonArray1":[["elem1-1","elem1-2"],["elem2-1","elem2-2"]],"jsonArray2":[["elem1-1-B","elem1-2-B"],["elem2-1-B","elem2-2-B"]]}
Java Internalization - Date Format Patterns

Followings is the use of characters in date formatting patterns.
G
To display Era.
y
To display Year. Valid values yy, yyyy.
M
To display Month. Valid values MM, MMM or MMMMM.
d
To display day of month. Valid values d, dd.
h
To display hour of day (1-12 AM/PM). Valid value hh.
H
To display hour of day (0-23). Valid value HH.
m
To display minute of hour (0-59). Valid value mm.
s
To display second of minute (0-59). Valid value ss.
S
To display milliseconds of minute (0-999). Valid value SSS.
E
To display Day in week (e.g Monday, Tuesday etc.)
D
To display Day in year (1-366).
F
To display Day of week in month (e.g. 1st Thursday of December).
w
To display Week in year (1-53).
W
To display Week in month (0-5)
a
To display AM / PM
k
To display Hour in day (1-24).
K
To display Hour in day, AM / PM (0-11).
z
To display Time Zone.
In this example, we're formatting dates based on different patterns.
IOTester.java
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class I18NTester {
   public static void main(String[] args) throws ParseException {

      String pattern = "dd-MM-yy";
      SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
      Date date = new Date();
      System.out.println(simpleDateFormat.format(date));

      pattern = "MM-dd-yyyy";
      simpleDateFormat = new SimpleDateFormat(pattern);
      System.out.println(simpleDateFormat.format(date));

      pattern = "yyyy-MM-dd HH:mm:ss";
      simpleDateFormat = new SimpleDateFormat(pattern);
      System.out.println(simpleDateFormat.format(date));

      pattern = "EEEEE MMMMM yyyy HH:mm:ss.SSSZ";
      simpleDateFormat = new SimpleDateFormat(pattern);
      System.out.println(simpleDateFormat.format(date));
}
}
It will print the following result.
29-11-17
11-29-2017
2017-11-29 18:47:42
Wednesday November 2017 18:47:42.787+0530


    16 Lectures 
     2 hours 

 Malhar Lathkar

    19 Lectures 
     5 hours 

 Malhar Lathkar

    25 Lectures 
     2.5 hours 

 Anadi Sharma

    126 Lectures 
     7 hours 

  Tushar Kale

    119 Lectures 
     17.5 hours 

 Monica Mittal

    76 Lectures 
     7 hours 

 Arnab Chakraborty
 Print
 Add Notes
 Bookmark this page
Initialization of static variables in C

When static keyword is used, variable or data members or functions can not be modified again. It is allocated for the lifetime of program. Static functions can be called directly by using class name.
Static variables are initialized only once. Compiler persist the variable till the end of the program. Static variable can be defined inside or outside the function. They are local to the block. The default value of static variable 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 variables in C language,
 Live Demo
#include <stdio.h>
int main() {
   static int a = 8;
   int b = 10;
   printf("Value of static variable : %d\n", a);
   printf("Value of non-static variable : %d\n", b);
   return 0;
}
Value of static variable : 8
Value of non-static variable : 10
In the above program, two variables are declared, one is static and another is non-static. The variables are initialized with values and displayed as follows −
static int a = 8;
int b = 10;
printf("Value of static variable : %d\n", a);
printf("Value of non-static variable : %d\n", b);
How to read a text file from resources in Kotlin?

In this article, we will see how we can read a text file using Kotlin library functions. Kotlin is based on Java, hence we can use different Java library functions in Kotlin too.
Go ahead and create a Kotlin file in your workspace and name it " ReadFile.kt". Keep a text file with some data in the same directory. For this example, our Text file looks like this −
Welcome to the best tutorial website - www.tutorialsPoint.com
This is the Text file that we want to read via Kotlin
Execute the following piece of code to read the above text file.
// importing java library function
// to read files from different sources
import java.io.File
import java.io.BufferedReader

fun main(args: Array<String>) {
   val bufferedReader: BufferedReader = File("Text.txt").bufferedReader()
   val inputString = bufferedReader.use { it.readText() }
   println(inputString)
}
The above program will read the text file in the same directory and give us the following output
Running] cd "<<Your workspace>>" && kotlinc readFile.kt
-include-runtime -d readFile.jar && java -jar readFile.jar
Welcome to the best tutorial website - www.tutorialsPoint.com
This is the Text file that we want to read via Kotlin
File information can be read using another library function, that is, InputStream. In the following example, we will read the same text file using InputStream.
import java.io.File
import java.io.InputStream
fun main(args: Array<String>) {
   val inputStream: InputStream = File("Text.txt").inputStream()
   val inputString = inputStream.bufferedReader().use { it.readText() }
   println(inputString)
}
It will produce the following output
[Running] cd "<<Your workspace>>" && kotlinc readFile.kt
-include-runtime -d readFile.jar && java -jar readFile.jar
Welcome to the best tutorial website - www.tutorialsPoint.com
This is the Text file that we want to read via Kotlin
How to split JavaScript Number into individual digits?

To spilt a number into digits and print their sum, try to run the following code −
Live Demo
<!DOCTYPE html>
<html>
   <body>
      <script>
         var a = 28573;
         var sum = 0;
         while(a > 0) {
            sum += a % 10;
            a = Math.floor(a / 10);
         }
         document.write("Sum of digits = "+sum);
      </script>
   </body>
</html>
Sum of digits = 25
How to change the color of box of boxplot in base R?

To change the color of box of boxplot in base R, we can use col argument inside boxplot function.
For example, if we have a vector called V and we want to create a boxplot of V without red colored box then we can use the following command −
boxplot(x,col="red")
To change the color of box of boxplot in base R, use the code given below −
x<-rnorm(100)
boxplot(x)
If you execute the above given code, it generates the following output −
To change the color of box of boxplot in base R, use the code given below −
x<-rnorm(100)
boxplot(x,col="blue")
If you execute the above given code, it generates the following output −
To change the color of box of boxplot in base R, use the code given below −
x<-rnorm(100)
boxplot(x,col="red")
If you execute the above given code, it generates the following output −
Tryit Editor v3.7

Tryit: HTML font-size