code-rag-bench/online-tutorials huggingface dataset:
std::oct , std::dec and std::hex in C++ - GeeksforGeeks

24 Nov, 2017
This function is used to set the base to octal, decimal or hexadecimal. It sets the basefield format flag for the str stream to the specified base
std::oct : When basefield is set to octal, integer values inserted into the stream are expressed in octal base (i.e., radix 8). For input streams, extracted values are also expected to be expressed in octal base when this flag is set.
std::hex : When basefield is set to hex, integer values inserted into the stream are expressed in hexadecimal base (i.e., radix 16). For input streams, extracted values are also expected to be expressed in hexadecimal base when this flag is set.
The basefield format flag can take decimal values (each with its own manipulator). This is an I/O manipulator. It may be called with an expression such as out << std::oct, std::hex or std ::dec for any out of type std::basic_ostream or with an expressionSyntax :
ios_base& hex (ios_base& str);
str :
 Stream object whose basefield format flag is affected.
 Return value :
Return the augmented string parsed in the base decimal to base octal

Examples:
Input : 
54
Output :
oct - 66
dec - 54
hex - 36

// CPP program to illustrate// std::oct, std::hex, std::dec#include <iostream> // std::cout, std::dec, std::hex, std::oct  int main(){    int n = 54;    std::cout << std::oct << "oct - " << n << '\n';    std::cout << std::dec << "dec - " << n << '\n';    std::cout << std::hex << "hex - " << n << '\n';    return 0;}
Output:
oct - 66
dec - 54
hex - 36

CPP-Library
STL
C++
STL
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Operator Overloading in C++
Polymorphism in C++
Friend class and function in C++
Sorting a vector in C++
std::string class in C++
Inline Functions in C++
Pair in C++ Standard Template Library (STL)
Array of Strings in C++ (5 Different Ways to Create)
Convert string to char array in C++
Pure Virtual Functions and Abstract Classes in C++
Check whether a given number is even or odd in PL/SQL - GeeksforGeeks

02 Jul, 2018
Prerequisite – PL/SQL introductionIn PL/SQL code groups of commands are arranged within a block. A block group related declarations or statements. In declare part, we declare variables and between begin and end part, we perform the operations.
Examples:
Input: 2 
Output: even

Input: 5
Output: odd

The approach is to divide the given number by 2 and if the remainder is 0 then the given number is even else odd.
Below is the required implementation:
DECLARE    -- Declare variable n, s, r, len    -- and m of datatype number    n NUMBER := 1634;    r NUMBER;BEGIN    -- Calculating modulo    r := MOD(n, 2);      IF r = 0 THEN      dbms_output.Put_line('Even');    ELSE      dbms_output.Put_line('Odd');    END IF;END;--End program 
Output:
Even

SQL-PL/SQL
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Update Multiple Columns in Single Update Statement in SQL?
How to Create a Table With Multiple Foreign Keys in SQL?
What is Temporary Table in SQL?
SQL | Subquery
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL Query to Convert VARCHAR to INT
SQL using Python
How to Write a SQL Query For a Specific Date Range and Date Time?
How to Select Data Between Two Dates and Times in SQL Server?
SQL Query to Compare Two Dates
HTML Styles

Style sheets describe how documents are presented on screens, in print, or perhaps how they are pronounced. W3C has actively promoted the use of style sheets on the Web since the Consortium was founded in 1994.
Cascading Style Sheets (CSS) is a style sheet mechanism that has been specifically developed to meet the needs of Web designers and users.
With CSS, you can specify a number of style properties for a given HTML element. Each property has a name and a value, separated by a colon (:). Each property declaration is separated by a semi-colon (;).
This will produce following result:
Using Style Sheet Rules
There are three ways of using a style sheet in an HTML document:
If you have to give same look and feel to many pages then it is a good idea to keep all the style sheet rules in a single style sheet file and include this file in all the HTML pages. You can incluse a style sheet file into HTML document using <link> element. Below is an example:
<head>
<link rel="stylesheet" type="text/css"
href="yourstyle.css">
</head>

If you want to apply Style Sheet rules to a single document only then you can include those rules into that document only. Below is an example:
<head>
<style type="text/css">
body{background-color: pink;}
p{color:blue; 20px;font-size:24px;}
</style>
</head>

To become more comfortable  - Do Online Practice
You can apply style sheet rules directly to any HTML element. This should be done only when you are interested to make a particular change in any HTML element only. To use inline styles you use the style attribute in the relevant tag. Below is an example:
This will produce following result:
Using Style Sheet Rules

Advertisements


    19 Lectures 
     2 hours 

 Anadi Sharma

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    18 Lectures 
     1.5 hours 

 Frahaan Hussain

    57 Lectures 
     5.5 hours 

 DigiFisk (Programming Is Fun)

    54 Lectures 
     6 hours 

 DigiFisk (Programming Is Fun)

    45 Lectures 
     5.5 hours 

 DigiFisk (Programming Is Fun)
 Print
 Add Notes
 Bookmark this page
How to find the inverse of a matrix in R?

The inverse of a matrix can be calculated in R with the help of solve function, most of the times people who don’t use R frequently mistakenly use inv function for this purpose but there is no function called inv in base R to find the inverse of a matrix.
Consider the below matrices and their inverses −
> M1<-1:4
> M1<-matrix(1:4,nrow=2)
> M1
   [,1] [,2]
[1,] 1   3
[2,] 2   4
> solve(M1)
   [,1] [,2]
[1,] -2 1.5
[2,] 1 -0.5
> M2<-matrix(1:4,nrow=2,byrow=TRUE)
> M2
   [,1] [,2]
[1,] 1   2
[2,] 3   4
> solve(M2)
   [,1]   [,2]
[1,] -2.0 1.0
[2,] 1.5 -0.5
> M3<-matrix(c(12,14,16,18,20,22,24,26,28,30,32,34),nrow=3)
> M3
   [,1] [,2] [,3] [,4]
[1,] 12  18   24   30
[2,] 14  20   26   32
[3,] 16  22   28   34
> solve(M3)
Error in solve.default(M3) : 'a' (3 x 4) must be square
Here, the function solve is giving an error because the inverse of a non-square matrix cannot be calculated.
> M4<-matrix(c(12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42),nrow=4)
> M4
   [,1] [,2] [,3] [,4]
[1,] 12  20   28   36
[2,] 14  22   30   38
[3,] 16  24   32   40
[4,] 18  26   34   42
> solve(M4)
Error in solve.default(M4) :
Lapack routine dgesv: system is exactly singular: U[3,3] = 0
This output is showing an error because the inverse of the matrix M4 does not exists, although it is a square matrix but sometimes even the inverse of a square does not exist.
Let’s have a look at some matrices with higher dimensions that have their inverses −
> M5<-matrix(c(1,8,4,2,4,5,5,1,2,2,5,4,4,1,1,2),nrow=4)
> M5
   [,1] [,2] [,3] [,4]
[1,] 1   4    2    4
[2,] 8   5    2    1
[3,] 4   5    5    1
[4,] 2   1    4    2
> solve(M5)
      [,1]          [,2]        [,3]     [,4]
[1,] -0.07086614  0.17322835 -0.1417323  0.1259843
[2,]  0.11023622 -0.04724409  0.2204724 -0.3070866
[3,] -0.09448819 -0.10236220  0.1443570  0.1679790
[4,]  0.20472441  0.05511811 -0.2572178  0.1916010
> M6<-matrix(c(2,3,5,4,7,4,5,6,5,2,1,4,5,6,6,2,5,5,4,5,4,7,5,7,3),ncol=5)
> M6
   [,1] [,2] [,3] [,4] [,5]
[1,] 2   4     1    2    4
[2,] 3   5     4    5    7
[3,] 5   6     5    5    5
[4,] 4   5     6    4    7
[5,] 7   2     6    5    3
> solve(M6)
            [,1]         [,2]       [,3]        [,4]        [,5]
[1,]  5.000000e-01 -0.24000000 -0.2200000  1.194481e-16  0.260000000
[2,]  1.457168e-16 -0.20000000  0.4000000 -8.500145e-17 -0.200000000
[3,] -4.285714e-01 -0.12571429  0.1942857  2.857143e-01 -0.125714286
[4,] -3.571429e-01  0.50857143  0.1685714 -4.285714e-01  0.008571429
[5,]  2.857143e-01  0.09714286 -0.4228571  1.428571e-01  0.097142857
How to remove hidden files and folders using Python?

On Unix OS(OSX, Linux, etc) hidden files start with a '.' so we can filter them out using a simple startswith check. On windows, we need to check file attributes and then determine whether the file/folder is hidden or not.
For example, you can use the following code to delete all hidden files:
import os
if os.name == 'nt':
    import win32api, win32con
def file_is_hidden(p):
    if os.name== 'nt':
        attribute = win32api.GetFileAttributes(p)
        return attribute & (win32con.FILE_ATTRIBUTE_HIDDEN | win32con.FILE_ATTRIBUTE_SYSTEM)
    else:
        return p.startswith('.') #linux-osx
[os.remove(f) for f in os.listdir('.') if file_is_hidden(f)]
How to use getline() in C++ when there are blank lines in input?

03 Jun, 2022
In C++, if we need to read a few sentences from a stream, the generally preferred way is to use the getline() function as it can read string streams till it encounters a newline or sees a delimiter provided by the user. Also, it uses <string.h> header file to be fully functional.
Here is a sample program in c++ that reads four sentences and displays them with “: newline” at the end 
CPP
// A simple C++ program to show working of getline#include <cstring>#include <iostream>using namespace std;int main(){    string str;    int t = 4;    while (t--) {        // Read a line from standard input in str        getline(cin, str);        cout << str << " : newline" << endl;    }    return 0;}
Sample Input :
 This
 is
 Geeks
 for
As the expected output is:
This : newline
is  : newline
Geeks : newline
for : newline
The above input and output look good, there may be problems when the input has blank lines in between. 
Sample Input :
This

is 

Geeks

for
Output:
This : newline
 : newline
is  : newline
 : newline
It doesn’t print the last 3 lines. The reason is that getline() reads till enter is encountered even if no characters are read. So even if there is nothing in the third line, getline() considers it as a single line. Further, observe the problem in the second line. The code can be modified to exclude such blank lines. Modified code: 
CPP
// A simple C++ program that uses getline to read// input with blank lines#include <cstring>#include <iostream>using namespace std;int main(){    string str;    int t = 4;    while (t--) {        getline(cin, str);         // Keep reading a new line while there is        // a blank line        while (str.length() == 0)            getline(cin, str);         cout << str << " : newline" << endl;    }    return 0;}
Input:
This

is 

Geeks

for
Output:
This : newline
is  : newline
Geeks : newline
for : newline
This article is contributed by Sarin Nanda. If you like GeeksforGeeks and would like to contribute, you can also write an article on write.geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
harsh_shokeen
cpp-input-output
CPP-Library
C Language
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to overlay one div over another div using CSS

13 Jun, 2022
Creating an overlay effect simply means putting two div together at the same place but both the div appear when needed i.e while hovering or while clicking on one of the div to make the second one appear. Overlays are very clean and give the webpage a tidy look. It looks sophisticated and is simple to design. Overlays can create using two simple CSS properties:
z-index
position
Example 1:
HTML
<!DOCTYPE html><html> <head>    <title>overlay div</title>    <style>        .geeks {            position: absolute;            justify-content: center;            text-align: center;            align-items: center;            height: 250px;            width: 500px;            background-color: rgb(36, 168, 36);        }         .gfg1 {            margin-top: 80px;            color: white;            font-size: 40px;            font-weight: bold;        }               .gfg2{              font-size: 20px;          }    </style></head> <body>       <div class="geeks">        <div class="gfg1">GeeksforGeeks</div>        <div class="gfg2">A computer science portal for geeks</div>    </div>   </body> </html>
Output:
 
Note: Customize the overlay effects by adding more CSS to the page to make it look more elegant.
Example 2:
HTML
<!DOCTYPE html><html> <head>    <title>overlay div</title>    <style>        .geeks {            position: absolute;            justify-content: center;            text-align: center;            align-items: center;            height: 250px;            width: 500px;            background-color: rgb(36, 168, 36);              font-size: 20px;        }         .gfg1 {            margin-top: 80px;            color: white;            font-size: 40px;            font-weight: bold;        }         .gfg1:hover {            z-index: -1;            opacity: 0.5;            font-size: 20px;            text-align: center;            transform-style: all;            transition-duration: 1s;        }         .gfg2:hover {            z-index: -1;            font-size: 40px;            text-align: center;            transform-style: all;            transition-duration: 1s;        }    </style></head> <body>       <div class="geeks">        <div class="gfg1">GeeksforGeeks</div>        <div class="gfg2">A computer science portal for geeks</div>    </div>   </body> </html>
Output:
Before hovering:
 
After hovering:
 
 
Supported Browsers are listed below:
Google Chrome
Internet Explorer
Firefox
Opera
Safari
HTML is the foundation of web pages and is used for webpage development by structuring websites and web apps. You can learn HTML from the ground up by following this HTML Tutorial and HTML Examples.
CSS is the foundation of web pages and is used for webpage development by styling websites and web apps. You can learn CSS from the ground up by following this CSS Tutorial and CSS Examples.
sanjyotpanure
CSS-Misc
Picked
Technical Scripter 2018
CSS
HTML
Technical Scripter
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
JavaScript | Function expression

08 Oct, 2021
Function Expression  allows us to create an anonymous function which doesn’t have any function name which is the main difference between Function Expression and Function Declaration. A function expression can be used as an IIFE (Immediately Invoked Function Expression)which runs as soon as it is defined. A function expression has to be stored in a variable and can be accessed using variableName.  With the ES6 features introducing Arrow Function, it becomes more easier to declare function expression.
Syntax for Function Declaration: 
function functionName(x, y) { statements... return (z) };
Syntax for Function Expression (anonymous) :  
let variableName = function(x, y) { statements... return (z) };
Syntax for Function Expression (named) :  
let variableName = function functionName(x, y) 
{ statements... return (z) };
Syntax for Arrow Function: 
let variableName = (x, y) => { statements... return (z) }; 
Note: 
A function expression has to be defined first before calling it or using it as a parameter.
An arrow function must have an return statement.
Below examples illustrate the function expression in JavaScript:
Example 1: Code for Function Declaration.
Javascript
<script>    function callAdd(x, y){        let z = x + y;        return z;       }    console.log("Addition : " + callAdd(7, 4));</script>
Output: 
Addition : 11
Example 2: Code for Function Expression (anonymous) 
Javascript
<script>    var calSub = function(x, y){        let z = x - y;        return z;    }     console.log("Subtraction : " + calSub(7, 4)); </script>
Output: 
Subtraction : 3
Example 3: Code for Function Expression (named) 
Javascript
<script>    var calMul = function Mul(x, y){        let z = x * y;        return z;    }     console.log("Multiplication : " + calMul(7, 4));</script>
Output: 
Multiplication : 28
Example 4: Code for Arrow Function 
Javascript
<script>    var calDiv = (x, y) => {        let z = x / y;        return z;    }     console.log("Division : " + calDiv(24, 4));</script>
Output: 
Division : 6
Supported Browser:
Chrome 1 and above
Edge 12 and above
Firefox 1 and above
Internet Explorer 3 and above
Opera 3 and above
Safari 1 and above
simmytarika5
gulshankumarar231
surindertarika1234
ysachin2314
javascript-functions
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to display image using Plotly? - GeeksforGeeks

01 Oct, 2020
A Plotly is a Python library that is used to design graphs, especially interactive graphs. It can plot various graphs and charts like histogram, barplot, boxplot, spreadplot, and many more. It is mainly used in data analysis as well as financial analysis. plotly is an interactive visualization library.
The Imshow method is the fastest method to show the 2d data. This method is used to generate an image from the numerical data. The numerical data can be in the form of NumPy array.
Syntax: imshow(labels={}, x=None, y=None, color_continuous_scale=None, color_continuous_midpoint=None, range_color=None,width=None, height=None)
This function can also show RGB data as an image. The data is provided in the format of NumPy array.
Example:
Python3
import plotly.express as pximport numpy as np    # RGB Data as numpy arrayimg_rgb = np.array([[[255, 0, 0], [0, 255, 0], [0, 0, 255]],                    ], dtype=np.uint8)  fig = px.imshow(img_rgb)fig.show()
Output:
A third-party library can be used like PIL, scikit-image, or OpenCV to read the image as an array.
Example:
Image used:
Python3
import plotly.express as pximport cv2     # You can give path to the # image as first argument img = cv2.imread('GFG.png')  fig = px.imshow(img)fig.show()
Output:
 
Python-Plotly
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Check if element exists in list in Python
Python | os.path.join() method
Selecting rows in pandas DataFrame based on conditions
Defaultdict in Python
Python | Get unique values from a list
Create a directory in Python
Python | Pandas dataframe.groupby()
How to Export SQL Server Data to a Text File Format?

16 Nov, 2021
In this article, we will see how to export SQL Server data to a Flat file using three different techniques. Before we proceed let’s setup our database.
Step 1: Create a database
Query:
CREATE DATABASE geeks;
Step 2: Select the newly created database
USE geeks;
Step 3: Table Definition
We have the following brands in our geeks database.
Query:
CREATE TABLE brands(
brand_id INT PRIMARY KEY,  
brand_name VARCHAR(30) NOT NULL);
Step 4: Inserting records
Query:
INSERT INTO brands VALUES
(1, 'Electra'),
(2, 'Haro'),
(3, 'Heller'),
(4, 'Pure Cycles'),
(5, 'Ritchey'),
(6, 'Strider'),
(7, 'Sun Bicycles'),
(8, 'Surly'),
(9, 'Trek');
Output:
Step 1: First, let’s have a look at our brand’s table.
Query:
SELECT * FROM brands;
Step 2: Write down the query onto the editor whose output needs to be saved. If you want to save the results in a flat file, you can do this in SSMS. Right Click on Editor > Results to > Results to File:
Query:
Select TOP (1000) [brand_id],[brand_name]
from [sample].[production].[brands];
Step 3: Execute the query. An option to specify the name and path will be displayed. Change the type to All Files and Save it with the .txt extension:
Step 4: Result.txt file looks like this:
Step 1: When we right-click a database in SSMS. It is possible to import or export data. Navigate to Tasks>Export Data:
Step 2: The SQL Server Import and Export wizard will be launched. We will export from SQL Server to a Flat file. Select the SQL Server Native Client 11.0 as the Data Source:
If necessary, specify the Server name and connection information:
Step 3: Select Flat File Destination from the destination drop-down menu and hit Browse to set the file name and path:
Step 4: The flat file name in our case would be Result.txt:
Step 5: Once we have determined the file name and path, proceed as follows:
Step 6: Choose “Copy data from one or more table or views” or select second option to specify our own query:
Step 7: To export the data instantly, choose Run immediately:
Step 8: The Result.txt file will contain the output:
The SQL Server Command Line tool is SQLCMD. This tool allows you to store the results in a file. When utilizing batch files to automate processes, this option comes in handy.
Step 1: Here’s how our SaveOutputToText.sql file look’s like:
Query:
SELECT TOP (1000) [brand_id]
      ,[brand_name]
  FROM [sample].[production].[brands];
Step 2: Use the following command on your terminal to save the results of any query onto file:
Query:
sqlcmd -i SaveOutputToText.sql -o Result.txt
Step 3: The Result.txt file contains the output:
Picked
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Primary and secondary prompt in Python

10 May, 2020
The ">>>" sign seen on the Python’s interactive shell is called a prompt. Python’s interactive shell, which appears after firing command “python3” (if we are working on python version 3) on the terminal, has two such prompts.
">>>" - Primary prompt
"..." - Secondary prompt
When we fire command ‘python3’ on terminal, >>> sign is immediately seen on screen. This “>>>” sign is nothing but the primary prompt.
Whenever cursor is blinking next to a primary prompt on terminal, it means interpreter will take ‘one and only one’ instruction and execute it immediately if the instruction is found valid
Example:
Firstly interpreter will immediately execute a = 10 while doing so it will create an integer object, store 10 inside that integer object and bind that particular object to a variable called ‘a’
After executing the first instruction, the interpreter moves to the next instruction b = 20 and immediately executes it, just like it executed a = 10, and finally prints the output.
However, once we get to see a secondary prompt that is “...”, it means that now we have entered a block, that block can be if block, else block, elif block, while, for or any other block. Once inside a block, ‘...’ signifies, all the instructions of the block, entered in front of “...” will be executed by interpreter together “as a series of instructions”.
Example:
Hereafter writing if statement, naturally interpreter enters in if block and starts showing “...”(secondary prompt) to indicate that now the interpreter is ready to take ‘series of instructions’, which will be executed altogether as a group if, ‘if’ statement is found valid.
python-basics
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
SQL - CREATE Database

The SQL CREATE DATABASE statement is used to create a new SQL database.
The basic syntax of this CREATE DATABASE statement is as follows −
CREATE DATABASE DatabaseName;

Always the database name should be unique within the RDBMS.
If you want to create a new database <testDB>, then the CREATE DATABASE statement would be as shown below −
SQL> CREATE DATABASE testDB;
Make sure you have the admin privilege before creating any database. Once a database is created, you can check it in the list of databases as follows −
SQL> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| AMROOD             |
| TUTORIALSPOINT     |
| mysql              |
| orig               |
| test               |
| testDB             |
+--------------------+
7 rows in set (0.00 sec)


    42 Lectures 
     5 hours 

 Anadi Sharma

    14 Lectures 
     2 hours 

 Anadi Sharma

    44 Lectures 
     4.5 hours 

 Anadi Sharma

    94 Lectures 
     7 hours 

 Abhishek And Pukhraj

    80 Lectures 
     6.5 hours 

 Oracle Master Training | 150,000+ Students Worldwide

    31 Lectures 
     6 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page
ByteArrayInputStream available() method in Java with Examples - GeeksforGeeks

13 Sep, 2021
The available() method is a built-in method of the Java.io.ByteArrayInputStream returns the number of remaining bytes that can be read (or skipped over) from this input stream. It tells the total no. of bytes from the Input Stream to be read. 
Syntax: 
public int available()
Parameters: The function does not accept any parameter.Return Value: The function returns the total no of bytes from the Input Stream to be read. 
Below is the implementation of the above function:
Program 1:  
Java
// Java program to implement// the above functionimport java.io.*; public class Main {    public static void main(String[] args) throws Exception    {         // Array        byte[] buffer = { 71, 69, 69, 75, 83 };         // Create InputStream        ByteArrayInputStream geek            = new ByteArrayInputStream(buffer);         // Use the function to get the number        // of available        int number = geek.available();         // Print        System.out.println("Use of available() method : "                           + number);    }}
Use of available() method : 5
 
Program 2: 
Java
// Java program to implement// the above functionimport java.io.*; public class Main {    public static void main(String[] args) throws Exception    {         // Array        byte[] buffer = { 1, 2, 3, 4 };         // Create InputStream        ByteArrayInputStream geek            = new ByteArrayInputStream(buffer);         // Use the function to get the number        // of available        int number = geek.available();         // Print        System.out.println("Use of available() method : "                           + number);    }}
Use of available() method : 4
 
Reference: https://docs.oracle.com/javase/10/docs/api/java/io/ByteArrayInputStream.html#available() 
avtarkumar719
Java-ByteArrayInputStream
Java-Functions
Java-IO package
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
ArrayList in Java
How to iterate any Map in Java
Multidimensional Arrays in Java
Stack Class in Java
Stream In Java
Singleton Class in Java
Tryit Editor v3.7

HTML Computer Code
Tryit: HTML code element
What is a sealed class in C#?

Sealed class in C# with the sealed keyword cannot be inherited. In the same way, the sealed keyword can be added to the method.
When you use sealed modifiers in C# on a method, then the method loses its capabilities of overriding. The sealed method should be part of a derived class and the method must be an overridden method.
Let us see an example of sealed class in C# −
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Demo {
   class Program {
      static void Main(string[] args) {
         Result ob = new Result();
         string str = ob.Display();

         Console.WriteLine(str);
         Console.ReadLine();
      }
   }

   public sealed class Result {
      public string Display() {
         return "Passed";
      }
   }
}
To access the members of the sealed class, we need to create the object. The method created inside the sealed class cannot be inherited −
public sealed class Result {
   public string Display() {
      return "Passed";
   }
}
Apache Pig - PluckTuple()

After performing operations like join to differentiate the columns of the two schemas, we use the function PluckTuple(). To use this function, first of all, we have to define a string Prefix and we have to filter for the columns in a relation that begin with that prefix.
Given below is the syntax of the PluckTuple() function.
DEFINE pluck PluckTuple(expression1) 
DEFINE pluck PluckTuple(expression1,expression3) 
pluck(expression2)

Assume that we have two files namely emp_sales.txt and emp_bonus.txt in the HDFS directory /pig_data/. The emp_sales.txt contains the details of the employees of the sales department and the emp_bonus.txt contains the employee details who got bonus.
emp_sales.txt
1,Robin,22,25000,sales 
2,BOB,23,30000,sales 
3,Maya,23,25000,sales 
4,Sara,25,40000,sales 
5,David,23,45000,sales 
6,Maggy,22,35000,sales

emp_bonus.txt
1,Robin,22,25000,sales 
2,Jaya,23,20000,admin 
3,Maya,23,25000,sales 
4,Alia,25,50000,admin 
5,David,23,45000,sales
6,Omar,30,30000,admin

And we have loaded these files into Pig, with the relation names emp_sales and emp_bonus respectively.
grunt> emp_sales = LOAD 'hdfs://localhost:9000/pig_data/emp_sales.txt' USING PigStorage(',')
   as (sno:int, name:chararray, age:int, salary:int, dept:chararray);
	
grunt> emp_bonus = LOAD 'hdfs://localhost:9000/pig_data/emp_bonus.txt' USING PigStorage(',')
   as (sno:int, name:chararray, age:int, salary:int, dept:chararray);
Join these two relations using the join operator as shown below.
grunt> join_data = join emp_sales by sno, emp_bonus by sno;
Verify the relation join_data using the Dump operator.
grunt> Dump join_data;
 
(1,Robin,22,25000,sales,1,Robin,22,25000,sales)
(2,BOB,23,30000,sales,2,Jaya,23,20000,admin)
(3,Maya,23,25000,sales,3,Maya,23,25000,sales)
(4,Sara,25,40000,sales,4,Alia,25,50000,admin) 
(5,David,23,45000,sales,5,David,23,45000,sales) 
(6,Maggy,22,35000,sales,6,Omar,30,30000,admin)

Now, define the required expression by which you want to differentiate the columns using PluckTupe() function.
grunt> DEFINE pluck PluckTuple('a::');
Filter the columns in the join_data relation as shown below.
grunt> data = foreach join_data generate FLATTEN(pluck(*));
Describe the relation named data as shown below.
grunt> Describe data;
 
data: {emp_sales::sno: int, emp_sales::name: chararray, emp_sales::age: int,
   emp_sales::salary: int, emp_sales::dept: chararray, emp_bonus::sno: int,
   emp_bonus::name: chararray, emp_bonus::age: int, emp_bonus::salary: int,
   emp_bonus::dept: chararray}

Since we have defined the expression as “a::”, the columns of the emp_sales schema are plucked as  emp_sales::column name and the columns of the emp_bonus schema are plucked as emp_bonus::column name

    46 Lectures 
     3.5 hours 

 Arnab Chakraborty

    23 Lectures 
     1.5 hours 

 Mukund Kumar Mishra

    16 Lectures 
     1 hours 

 Nilay Mehta

    52 Lectures 
     1.5 hours 

 Bigdata Engineer

    14 Lectures 
     1 hours 

 Bigdata Engineer

    23 Lectures 
     1 hours 

 Bigdata Engineer
 Print
 Add Notes
 Bookmark this page
Set characters at a specific position within the string in Arduino

In case you don’t want to overwrite a string, but just change a character at a specific position, Arduino provides the setCharAt() function exactly for that.
String1.setCharAt(ind, new_char);
String 1 is the string to modify. ind is the index where the character needs to be set. new_char is the value of the new character that needs to be set.
This function returns nothing, and modifies the string in place.
The following example illustrates the use of this function.
void setup() {
   // put your setup code here, to run once:
   Serial.begin(9600);
   Serial.println();

   String string1 = "Hello World!";
   Serial.println(string1);
   string1.setCharAt(4,'p');
   Serial.println(string1);
   string1.setCharAt(11,'y');
   Serial.println(string1);
   string1.setCharAt(12,'i');
   Serial.println(string1);
}

void loop() {
   // put your main code here, to run repeatedly:
}
The Serial Monitor output is shown below −
As you can see, in the first two cases, we set characters within the length of the string, and they got set at the correct indices (string index starts at 0). When we tried to set a character outside the length of the string, it had no effect on the string. Thus, this experiment also shows that this function cannot be used to extend the length of a string. You should only set characters within the existing length of a string.
How to set character encoding for document in HTML5 ?

01 Apr, 2021
Character encoding is a method of defining a mapping between bytes and text. To display an HTML document correctly, we must choose a proper character encoding.  
The different types of character encoding include:
ASCII Character Set: It is the first ever character encoding standard. The major disadvantage with ASCII is that it contained only a limited range of characters (128 characters).
ANSI Character Set: This standard was an extended version of standard ASCII character set. It supports 256 characters.
ISO-8859-1 Character Set: It is the default character encoding in HTML 2.0. It is also an extension of ASCII standard with International characters. This used full bytes (8-bits) to show characters.
UTF-8 Character Set: This standard covers almost all of the characters and symbols in the world. The limitations of ANSI and ISO-8859-1 were satisfied by the UTF-8 Character Set. The default character encoding for HTML5 is UTF-8.
The HTML5 specification encourages developers to use the UTF-8 character set.
A character can be 1-4 bytes long in the UTF-8 Encoding Standard. This is also the most preferred encoding for email and web pages.
Character encoding can be specified in the meta tag in HTML.
The meta tag is used for specifying metadata about the webpage and will not be displayed in the web pages.
The meta tag helps search engines to understand what a web page is about.
The meta tag should be placed with the head tag in HTML.
Syntax:
1. For HTML4
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 
2. For HTML5
The default character encoding for HTML5 is UTF-8, but you can still specify this to be extra cautious. 
<meta charset="UTF-8">  
Example:
HTML
<!DOCTYPE html><html>  <head>    <!-- NOTE: <meta charset="UTF-8">         is also applicable. -->    <meta charset="utf-8">    <title>Page Title</title></head>  <body>    <h2>Welcome To GFG</h2>      <p>        Default code has been loaded         into the Editor.    </p></body>  </html>
HTML-Questions
HTML-Tags
HTML5
Picked
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
REST API (Introduction)
Design a Tribute Page using HTML & CSS
Make a div horizontally scrollable using CSS
DOM (Document Object Model)
How to get values from html input array using JavaScript ?
Installation of Node.js on Linux
How to create footer to stay at the bottom of a Web page?
How do you run JavaScript script through the Terminal?
Node.js fs.readFileSync() Method
How to set space between the flexbox ?
CSS Child vs Descendant selectors

10 Jun, 2022
Child Selector: Child Selector is used to match all the elements which are children of a specified element. It gives the relation between two elements. The element > element selector selects those elements which are the children of the specific parent. The operand on the left side of > is the parent and the operand on the right is the children element. 
Syntax: 
element > element {
    // CSS Property
}
Example: Match all <p> element that are child of only <div> element. 
html
<!DOCTYPE html><html>    <head>        <title>            CSS child Selector        </title>        <style>            div > p {                color:white;                background: green;                padding:2px;            }        </style>    </head>         <body style = "text-align: center;">        <div>            <h2 style = "color:green;">                CSS Child Selector            </h2>                         <p>                A computer science portal for geeks.            </p>        </div>                 <p>Geeks Classes is a quick course to cover        algorithms questions.</p>                 <p>This paragraph will not be styled.</p>    </body></html>
Output:
  
Descendant selector: Descendant selector is used to select all the elements which are child of the element (not a specific element). It selects the elements inside the elements i.e it combines two selectors such that elements matched by the second selector are selected if they have an ancestor element matching the first selector. 
Syntax: 
element element {
    // CSS Property
}
Example: It selects all the <h2> elements which are child element of <div>. 
html
<!DOCTYPE html><html> <head>    <title>        CSS Descendant Selector    </title>         <style>        div h2 {            font-size:26px;        }    </style></head> <body style = "text-align:center;">    <div>        <h2 style = "color:green;" >            GeeksForGeeks        </h2>                 <div>            <h2>GeeksForGeeks</h2>        </div>    </div>         <p>        GeeksforGeeks in green color is        example of child Selector        <br>other GeekforGeeks is example        of descendant Selector    </p></body> </html>                   
Output:
 
user282
CSS-Misc
Picked
CSS
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Design a Tribute Page using HTML & CSS
How to set space between the flexbox ?
Build a Survey Form using HTML and CSS
CSS | :not(:last-child):after Selector
Create a Responsive Navbar using ReactJS
REST API (Introduction)
Hide or show elements in HTML using display property
How to set the default value for an HTML <select> element ?
How to set input type date in dd-mm-yyyy format using HTML ?
Design a Tribute Page using HTML & CSS
Node.js Chalk Module

07 Oct, 2021
Chalk module in Node.js is the third-party module that is used for styling the format of text and allows us to create our own themes in the node.js project.
Advantages of Chalk Module:
It helps to customize the color of the output of the command-line outputIt helps to improve the quality of the output by providing several color options like for warning message red color and many more
It helps to customize the color of the output of the command-line output
It helps to improve the quality of the output by providing several color options like for warning message red color and many more
Chalk Module: https://www.npmjs.com/package/chalk
Installing Module:
npm install chalk
Project Structure:
Example 1:
index.js
// Importing moduleconst chalk=require("chalk");  // Printing the textconsole.log(chalk.red("aayush"))console.log(chalk.red.underline("aayush"))console.log(chalk.red.underline.bold("GFG"))
Run index.js file using below command:
node index.js
Output: This will be the console output.
Example 2: Defining own themes.
index.js
// Importing chalk moduleconst chalk=require("chalk");  // Creating themeconst warning=chalk.red;  // Printing theme textconsole.log(warning("Restricted Zone"));const welcome=chalk.greenconsole.log(welcome("GFG"))
Run index.js file using below command:
node index.js
Output: This will be the console output.
Picked
Technical Scripter 2020
Node.js
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to convert string to char array in C++?

This is a C++ program to convert string to char array in C++. This can be done in multiple different ways
Begin
   Assign a string value to a char array variable m.
   Define and string variable str
   For i = 0 to sizeof(m)
      Copy character by character from m to str.
      Print character by character from str.
End
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
   char m[]="Tutorialspoint";
   string str;
   int i;
   for(i=0;i<sizeof(m);i++)
   {
      str[i]=m[i];
      cout<<str[i];
   }
   return 0;
}
We can simply call strcpy() function to copy the string to char array.
Begin
   Assign value to string s.
   Copying the contents of the string to char array using strcpy() .
End
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main()
{
   string str = "Tutorialspoint";
   char c[str.size() + 1];
   strcpy(c, str.c_str());
   cout << c << '\n';
   return 0;
}
Tutorialspoint
We can avoid using strcpy() which is basically used in c by std::string::copy instead.
Begin
   Assign value to string s.
   Copying the contents of the string to char array using copy().
End
#include <iostream>
#include <string>
using namespace std;
int main()
{
   string str = "Tutorialspoint";
   char c[str.size() + 1];
   str.copy(c, str.size() + 1);
   c[str.size()] = '\0';
   cout << c << '\n';
   return 0;
}
Tutorialspoint
JavaBean class in Java

14 Sep, 2017
JavaBeans are classes that encapsulate many objects into a single object (the bean). It is a java class that should follow following conventions:
Must implement Serializable.It should have a public no-arg constructor.All properties in java bean must be private with public getters and setter methods.
Must implement Serializable.
It should have a public no-arg constructor.
All properties in java bean must be private with public getters and setter methods.
// Java program to illustrate the// structure of JavaBean classpublic class TestBean {private String name;public void setName(String name)    {        this.name = name;    }public String getName()    {        return name;    }}
Syntax for setter methods:
It should be public in nature.The return-type should be void.The setter method should be prefixed with set.It should take some argument i.e. it should not be no-arg method.
It should be public in nature.
The return-type should be void.
The setter method should be prefixed with set.
It should take some argument i.e. it should not be no-arg method.
Syntax for getter methods:
It should be public in nature.The return-type should not be void i.e. according to our requirement we have to give return-type.The getter method should be prefixed with get.It should not take any argument.
It should be public in nature.
The return-type should not be void i.e. according to our requirement we have to give return-type.
The getter method should be prefixed with get.
It should not take any argument.
For Boolean properties getter method name can be prefixed with either “get” or “is”. But recommended to use “is”.
// Java program to illustrate the// getName() method on boolean type attributepublic class Test {private boolean empty;public boolean getName()    {        return empty;    }public boolean isempty()    {        return empty;    }}
Implementation
// Java Program of JavaBean classpackage geeks;public class Student implements java.io.Serializable{private int id;private String name;public Student()    {    }public void setId(int id)    {        this.id = id;    }public int getId()    {        return id;    }public void setName(String name)    {        this.name = name;    }public String getName()    {        return name;    }}
// Java program to access JavaBean classpackage geeks;public class Test {public static void main(String args[])    {        Student s = new Student(); // object is created        s.setName("GFG"); // setting value to the object        System.out.println(s.getName());    }}
Output:
GFG

This article is contributed by Bishal Kumar Dubey. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Java-Class and Object
Java
Java-Class and Object
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
time.Time.Local() Function in Golang with Examples

19 Apr, 2020
In Go language, time packages supplies functionality for determining as well as viewing time. The Time.Local() function in Go language is used to find “t” with the location that is set to local time. Moreover, this function is defined under the time package. Here, you need to import the “time” package in order to use these functions.
Syntax:
func (t Time) Local() Time

Here, “t” is the stated time.
Return Value: It returns “t” along with the location that is set to local time.
Example 1:
// Golang program to illustrate the usage of// Time.Local() function  // Including main packagepackage main  // Importing fmt and timeimport "fmt"import "time"  // Calling mainfunc main() {      // Defining t parameter of Local method    t := time.Date(2019, 2, 11, 10,               03, 00, 00, time.UTC)      // Calling Local method    local := t.Local()      // Prints output    fmt.Printf("%v\n", local)}
Output:
2019-02-11 10:03:00 +0000 UTC

Example 2:
// Golang program to illustrate the usage of// Time.Local() function  // Including main packagepackage main  // Importing fmt and timeimport "fmt"import "time"  // Calling mainfunc main() {      // Defining location using FixedZone method    location := time.FixedZone("UTC-7", -6*56*34)      // Defining t for calling Local method    t := time.Date(2019, 2, 11, 10, 03, 00, 00, location)      // Calling Local method    local := t.Local()      // Prints output    fmt.Printf("%v\n", local)}
Output:
2019-02-11 13:13:24 +0000 UTC

Here, FixedZone() method is used in order to define the location parameter of the Date() method so the time in output is returned according to that location.
GoLang-time
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Parse JSON in Golang?
How to iterate over an Array using for loop in Golang?
Structures in Golang
Loops in Go Language
Time Durations in Golang
Constants- Go Language
Strings in Golang
time.Parse() Function in Golang With Examples
Go Variables
Class and Object in Golang
Changing Nginx Port in Linux - GeeksforGeeks

24 Feb, 2021
Nginx, written by Igor Sysoev and released on October 4th, 2003, is a fast, open-source multi-functional web server. It also acts as a reverse proxy and loads balancer, apart from being a web server, allowing it to handle large numbers of concurrent HTTP connections and is mostly preferred to Apache in the hosting of high-traffic enterprise websites. It is used in high-traffic websites such as Netflix and Dropbox to deliver their content in a quick, reliable, and secure manner.
By default, the Nginx HTTP server listens for inbound connections and connects to port 80, which is the default web port. However, the TLS configuration, which is not supported in Nginx by default, listens to port 443 for secure connections.
You need to look at a single directory to adjust Nginx’s default port number, unlike Apache2 this is Nginx’s default virtual host directory /etc/nginx/sites-available. This is where you can find individual virtual host configuration files in this directory.
Let’s change the port with stepwise implementation:
Step 1: First, run the commands below to open the port.conf file
$ sudo nano /etc/nginx/sites-available/default
Open config file
Step 2: Then change the Listen line from 80 to 8082
Change Nginx port
Now change the port number:
Change the port to 8082
Step 3: Now that you’ve changed the port number in the config files, run the commands below to restart Nginx.
$ sudo systemctl restart nginx.service
Restart Nginx
Step 4: Check the table of local network sockets with the netstat or ss command. Port 8082 should be shown on the local network table of your computer.
$ netstat -tlpn| grep nginx
OR
$ ss -tlpn| grep nginx
Check the port
Open a window and navigate to your server’s IP address or domain name on port 8082 to verify if the webserver can be accessed from the computers on your network. As seen in the screenshot below, you can see the default Nginx web page.
Check port in browser
Picked
Technical Scripter 2020
Linux-Unix
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Thread functions in C/C++
nohup Command in Linux with Examples
scp command in Linux with Examples
chown command in Linux with Examples
Array Basics in Shell Scripting | Set 1
mv command in Linux with examples
Basic Operators in Shell Scripting
SED command in Linux | Set 2
Docker - COPY Instruction
Named Pipe or FIFO with example C program