code-rag-bench/online-tutorials huggingface dataset:
How to change the underline color in CSS? - GeeksforGeeks

25 May, 2021
Styling is implemented to HTML text to make it catchy and attractive. The text can be made italic, underline, and bold as per requirement.
Underline tag: To change the color of the underline, we need to add some styling using CSS (inline/internal/external). By default, the color of the underline is black. In CSS, we will use text-decoration property to style underline.Syntax:<u> Some Text Here </u>
Underline tag: To change the color of the underline, we need to add some styling using CSS (inline/internal/external). By default, the color of the underline is black. In CSS, we will use text-decoration property to style underline.
Syntax:
<u> Some Text Here </u>
CSS text-decoration-color Property: This property is used to specify the color of decorations (overlines, underlines, and line-throughs) over the text.Syntax:text-decoration-color: color | initial | inherit ;
CSS text-decoration-color Property: This property is used to specify the color of decorations (overlines, underlines, and line-throughs) over the text.
Syntax:
text-decoration-color: color | initial | inherit ;
Below examples illustrate the approach of changing the underline color by CSS
Example 1:
HTML
<!DOCTYPE html><html><body>     <u style="text-decoration-color:red">      Geeksforgeeks A Computer       Science Portal for Geeks    </u></body></html>
Output:
Example 2:
HTML
<!DOCTYPE html><html>  <head>    <style>      u {        text-decoration-color: red;      }    </style>  </head>  <body>    <h2>      Geeksforgeeks      <u>A Computer Science Portal for Geeks</u>    </h2>  </body></html>
Output:
CSS-Properties
Picked
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Design a web page using HTML and CSS
Form validation using jQuery
How to set space between the flexbox ?
Search Bar using HTML, CSS and JavaScript
How to style a checkbox using CSS?
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
Convert a string to an integer in JavaScript
C Program to check if a number is divisible by any of its digits

Given a number n, task is to find that any of the digit in the number divides the number completely or not. Like we are given a number 128625 is divisible by 5 which is also present in the number.
Input: 53142
Output: yes
Explanation: This number is divisible by 1, 2 and 3
which are the digits of the number
Input: 223
Output: No
Explanation: The number is not divisible by either 2 or 3
The approach used below is as follows −
We will start from the unit place and take the unit place’s number.
Check whether the number is divisible or not
Divide the number with 10
Goto step 1 until the number is 0
Start
In function int divisible(long long int n)
   Step 1-> Declare and initialize temp = n
   Step 2 -> Loop while n {
      Set k as n % 10
      If temp % k == 0 then,
         Return 1
      Set n = n/ 10
   End loop
   Return 0
In Function int main()
   Step 1-> Declare and initialize n = 654123
   Step 2-> If (divisible(n)) then,
      Print "Yes”
   Step 3-> Else
   Print "No”
 Live Demo
#include <stdio.h>
int divisible(long long int n) {
   long long int temp = n;
   // check if any of digit divides n
   while (n) {
      int k = n % 10;
      if (temp % k == 0)
         return 1;
         n /= 10;
   }
   return 0;
}
int main() {
   long long int n = 654123;
   if (divisible(n)) {
      printf("Yes\n");
   }
   else
      printf("No\n");
   return 0;
}
If run the above code it will generate the following output −
Yes
Program to print all substrings of a given string in C++

In this tutorial, we will be discussing a program to print all the substring of a given string.
For this we will be given with a string or an array of characters. Our task is to print all the substrings of that particular string.
 Live Demo
#include<bits/stdc++.h>
using namespace std;
//printing all the substrings
void print_substr(char str[], int n){
   for (int len = 1; len <= n; len++){
      for (int i = 0; i <= n - len; i++){
         int j = i + len - 1;
         for (int k = i; k <= j; k++)
         cout << str[k];
         cout << endl;
      }
   }
}
int main(){
   char str[] = "abca";
   print_substr(str, strlen(str));
   return 0;
}
a
b
c
a
ab
bc
ca
abc
bca
abca
Gerrit - Installing Git-Review

You can work with Gerrit by installing git-review on different platforms as discussed in this chapter.
In Windows, you can install the git-review as listed in the following steps.
Step 1 − First install Python for installing git-review.
Step 2 − Keep the Python installation in the default directory (like C:\Python27) instead of installing in any other directory.
Step 3 − Next, set the environment variables for Python scripts directory using the path as C:\Python27\;C:\Python27\Scripts\;
git_review_install

Step 4 − With version 2.7, Python will install pip automatically. For older version of Python 2.7, you can install pip as described in this link.
Step 5 − Run open Git Bash and install the git-review using the following command.
$ pip install git-review

In Linux, you can install git-review as described in the following steps −
Step 1 Users of Linux platform do not have root access on shared host. Hence, without root access, you can install git-review locally in user directory using the following commands −
virtualenv --python=/usr/bin/python2.6 virtualenv
virtualenv/bin/pip install git-review==1.21

Step 2 − You can extend the path to the local binaries using two ways −
PATH=$PATH:~/virtualenv/bin/
PATH=~/virtualenv/bin/:$PATH

Step 3 − Now, use the following command to set up the work with Gerrit.
git review -s
 or
~/virtualenv/bin/git-review -s

Step 4 − With root access, git-review can be installed using the following command.
sudo apt-get install git-review

Step 5 − If there is no apt-get after installing Python, then use the following commands.
$ sudo easy_install pip
$ sudo pip install git-review==1.21

Step 6 − Run the following command to work with Gerrit.
git review -s

In Mac, you can install the git-review using the following steps.
Step 1 − Install the Homebrew from this link.

Step 2 − Next, install the git-review using the following command.
brew install git-review
Print all sublists of a list in Python

12 Jul, 2022
Given a list, print all the sublists of a list. 
Examples: 
Input  : list = [1, 2, 3] 
Output : [[], [1], [1, 2], [1, 2, 3], [2], 
         [2, 3], [3]]

Input : [1, 2, 3, 4] 
Output : [[], [1], [1, 2], [1, 2, 3], [1, 2, 3, 4], 
         [2], [2, 3], [2, 3, 4], [3], [3, 4], [4]]
 
Approach#1: 
The approach will be run two nested loops till the length of the given list. The outer loop i traverse from 0 to the length of the list and the inner loop goes from 0 to i. Need to add 1 to length because the range only goes from 0 to i-1. To get the subarray we can use slicing to get the subarray. 
Step 1: Run a loop till length+1 of the given list.Step 2: Run another loop from 0 to i.Step 3: Slice the subarray from j to i. Step 4: Append it to a another list to store it Step 5: Print it at the end
Below is the Python implementation of the above approach:
Python
# Python program to print all# sublist from a given list # function to generate all the sub listsdef sub_lists (l):    lists = [[]]    for i in range(len(l) + 1):        for j in range(i):            lists.append(l[j: i])    return lists # driver codel1 = [1, 2, 3]print(sub_lists(l1))
Output: 
[[], [1], [2], [1, 2], [3], [2, 3], [1, 2, 3]]
Approach#2: 
The approach will use for loop and combinations function. For loop is used to iterate till the length of list which is helpful for generating a sub-list of variable ith length. With each iteration combinations function generate the possible combination of list with ith length. 
Python3
# Python program to print all# sublist from a given listfrom itertools import combinations # function to generate all the sub listsdef sub_lists (l):    # initializing empty list    comb = []         #Iterating till length of list    for i in range(len(l)+1):        # Generating sub list        comb += [list(j) for j in combinations([1, 2, 3], i)]    # Returning list    return comb # driver code#Initial listl1 = [1, 2, 3] #Print initial listprint("Initial list is : " + str(l1)) # Calling function to generate all sub listsprint("All sub list is : "+ str(sub_lists(l1)))
Output:
Initial list is : [1, 2, 3]
All sub list is : [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
guydangerous
mongiavishesh1999
abdullahgokcinar
ravinmechux
wastu
satyam00so
Python list-programs
python-list
Python
python-list
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Recursively enumerable sets and Turing machines - GeeksforGeeks

21 Jan, 2014
1. For every non-deterministic Turing machine, 
   there exists an equivalent deterministic Turing machine.
2. Turing recognizable languages are closed under union 
   and complementation.
3. Turing decidable languages are closed under intersection 
   and complementation.
4. Turing recognizable languages are closed under union 
   and intersection. 
A) Always True
(Recursively enumerable - Recursive ) is 
Recursively enumerable

B) Not always true
L1 - L3 = L1 intersection ( Complement L3 )
L1 is recursive , L3 is recursively enumerable 
but not recursive Recursively enumerable languages
are NOT closed under complement.

C) and D) Always true Recursively enumerable languages 
are closed under intersection and union. 
A ≤m B means language A is mapping reducible to language B.Thus, A cannot be harder than B.
Since, A can be reduced to B, instead of deciding A we can now decide B.
So, the first three options are correct.
As B is not recursively enumerable, it doesn't guarantee A is not recursively enumerable.Thus, if A ≤m B and B is not recursively enumerable then A is not recursively enumerable. Therefore, answer is D is correct
L1' --> Complement of L1
L2' --> Complement of L2 
S1 :  L1 is recursive implies L2 is recursive
S2 : L2 is recursive implies L1 is recursive 
Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.
Must Do Coding Questions for Companies like Amazon, Microsoft, Adobe, ...
Learn C++ Programming Step by Step - A 20 Day Curriculum!
Must Do Coding Questions for Product Based Companies
GeeksforGeeks Jobathon - Are You Ready For This Hiring Challenge?
Types of Distributed System
Naming Convention in C++
Floyd’s Cycle Finding Algorithm
TCS Digital Interview Experience | Off-Campus 2021
Samsung R&D Interview Experience
Samsung Internship Interview Experience | On-Campus 2021
How to access a function property as a method in JavaScript?

A javascript object is made up of properties. To access a property as a method, just define a function to a property and include other properties in that function.
In the following example an object called "employee" is created with properties "fullName", "lastName" , "firstName" and "id". A function is defined under property "fullName" and properties such as "firstName" and "lastName" were included in it. So when the property "fullName" is called, the full name of the employee is going to display as shown in the output.
Live Demo
<html>
<body>
<script type="text/javascript">
   var employee = {
      firstName: "raju",
      lastName : "nayak",
      Designation : "Engineer",
      fullName : function() {
         return this.firstName + " " + this.lastName;
      }
   };
   document.write(employee.fullName());
</script>
</body>
</html>
raju nayak
Live Demo
<html>
<body>
<script type="text/javascript">
   var student= {
      Name: "susan",
      country : "USA",
      RollNo : "5",
      details : function() {
         return "the student named" + " " + this.Name + " " +"is allocated with rollno " + " " +              this.RollNo ;
      }
   };
   document.write(student.details());
</script>
</body>
</html>
the student named susan is allocated with rollno 5
Context free languages and Push-down automata - GeeksforGeeks

21 Jan, 2014
NDPDA can handle languages or grammars with ambiguity, but DPDA cannot handle languages with ambiguity and any context-free grammar.
       
        S → AB
        A → 0A|ε
        B → 1B|ε
        S → AB
        A → 0A|ε
        B → 1B|ε
L1 = { | m, n >= 0 }
L2 = { | i, j, k >= 0 }
For each occurrence of ‘0’ , we PUSH X in the stack.
When ‘2’ appears, no stack operation is performed. But, state of the automata is changed.
For each occurrence of ‘1’ , we POP X from the stack.
If at the end Z0 is on the stack top then input string is accepted
When ‘0’ appears in the input string , we replace it with X .Then, traverse to the rightmost corner and replace ‘1’ with Y.
We go back to the leftmost ‘0’ and repeat the above process.
While traversing rightwards from the beginning of the input string, if after X, ‘2’ appears and after ‘2’, Y appears then we reach the HALT state.
Thus, the given language is recursive. Every recursive language is a CFL.
Thus, option (B) is the answer.
Please comment below if you find anything wrong in the above post.
S --> aB        S --> bA
B --> b         A --> a
B --> bS        A --> aS
B --> aBB       A --> bAA
S --> aB        S --> bA
B --> b         A --> a
B --> bS        A --> aS
B --> aBB       A --> bAA
S  -> aB      [Using S --> aB] 
   -> aaBB    [Using B --> aBB]
   -> aabB    [Using B --> b]
   -> aabbS   [Using B --> bS]
   -> aabbaB  [Using S --> aB]
   -> aabbab  [Using B --> b]
Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.
Best Time to Buy and Sell Stock
Must Do Coding Questions for Product Based Companies
Axios in React: A Guide for Beginners
BigInt (BIG INTEGERS) in C++ with Example
How to Install Flutter on Visual Studio Code?
How to calculate MOVING AVERAGE in a Pandas DataFrame?
Retrofit with Kotlin Coroutine in Android
Get Hired With GeeksforGeeks and Win Exciting Rewards!
How to insert a pandas DataFrame to an existing PostgreSQL table?
Difference between sh and bash
HTML Class Attribute

The class attribute in HTML is used to set one or more classnames for an element. With the specified class name you can work it through CSS and point in a stylesheet.
Let us now see an example to implement the class attribute in HTML −
 Live Demo
<!DOCTYPE html>
<html>
<head>
<style>
h2.demo {
   color: orange;
   background-color: black;
}
</style>
</head>
<body>
<h1>Resources</h1>
   <h2 class="demo">Text Tutorials</h1>
   <h2 class="demo">Video Tutorials</h1>
   <h2 class="demo">Interview Questions and Answers</h1>
   <h2 class="demo">Online Quiz</h1>
</body>
</html>
In the above example, we have set a class name for the element <h2> −
<h2 class="demo">Text Tutorials</h1>
<h2 class="demo">Video Tutorials</h1>
This is set with a style to update the text as well as background color of the <h2> element −
h2.demo {
   color: orange;
   background-color: black;
}
How can I set the row height in Tkinter TreeView?

The treeview widget in Tkinter provides a way to represent the data in a hierarchical structure. With the Treeview widget, we can insert our data in the form of a table. The table can have rows and columns in which we can insert the data instantly.
We can also configure the properties of the treeview widget such as its color, size, column width, height, row width & height, etc. To set the row height of the Treeview widget, you can create an instance of ttk themed widget where you can specify the rowheight property. The rowheight property will add internal padding to each row in the table.
# Import the required libraries
from tkinter import *
from tkinter import ttk

# Create an instance of tkinter frame
win=Tk()

# Set the size of the tkinter window
win.geometry("700x350")
s=ttk.Style()
s.theme_use('clam')

# Add the rowheight
s.configure('Treeview', rowheight=40)

# Add a Treeview widget
tree=ttk.Treeview(win, column=("c1", "c2","c3"), show='headings', height=5)
tree.column("# 1",anchor=CENTER)
tree.heading("# 1", text="ID")
tree.column("# 2", anchor=CENTER)
tree.heading("# 2", text="FName")
tree.column("# 3", anchor=CENTER)
tree.heading("# 3", text="LName")

# Insert the data in Treeview widget
tree.insert('', 'end',text="1",values=('1', 'Joe','Nash'))
tree.insert('', 'end',text="2",values=('2', 'Emily','Mackmohan'))
tree.insert('', 'end',text="3",values=('3', 'Estilla','Roffe'))
tree.insert('', 'end',text="4",values=('4', 'Percy','Andrews'))
tree.insert('', 'end',text="5",values=('5', 'Stephan','Heyward'))

tree.pack()

win.mainloop()
If we run the above code, it will display a window with a table and some data in it. In the given table, each row has an assigned row height.
Arithmetic operations in excel file using openpyxl in Python

Python can help us use excel files directly from the python environment. We can refer to the each cell or a range of cells in excel and apply arithmetic operators on those cells. The results of those operations can also be stored at some cells whose location can be specified by the python program.
In the below examples we are performing various arithmetic operations using inbuilt functions of excel. Like sum or average of numbers inside cells. The results are also stored at specific locations. We use the openpyxl module which opens a workbook and marks it active. Then we store certain values in predefined cells and then apply the functions on those cells storing the result in other cells.
import openpyxl

excel = openpyxl.Workbook()

excel_file = excel.active

excel_file['A1'] = 50
excel_file['B1'] = 100
excel_file['C1'] = 150
excel_file['D1'] = 200
excel_file['E1'] = 250

excel_file['A3'] = 20
excel_file['B3'] = 40
excel_file['C3'] = 60
excel_file['D3'] = 80
excel_file['E3'] = 100

excel_file['A5'] = 2
excel_file['B5'] = 4
excel_file['C5'] = 6
excel_file['D5'] = 9
excel_file['E5'] = 15

excel_file['A7'] = 4
excel_file['B7'] = 11
excel_file['C7'] = 27
excel_file['D7'] = 40
excel_file['E7'] = 75

excel_file['F1'] = 'Sum(A1 to E1)'
excel_file['G1'] = '= SUM(A1:E1)'
excel_file['F3'] = 'Sum(A3 to E3)'
excel_file['G3'] = '= AVERAGE(A3:E3)'
excel_file['F5'] = 'Product(A5 to E5)'
excel_file['G5'] = '= PRODUCT(A5:E5)'
excel_file['F7'] = 'Count(A7 to E7)'
excel_file['G7'] = '= COUNT(A7:E7)'

excel.save("D:\\Arithmetic_operations.xlsx")
Running the above code gives us the following result −
How to get the second last record from a table in MySQL?

To get the record before the last one i.e. the second last record in MySQL, you need to use subquery.
The syntax is as follows
SELECT *FROM
(SELECT *FROM yourTableName ORDER BY yourIdColumnName DESC LIMIT 2)
anyAliasName
ORDER BY yourIdColumnName LIMIT 1;
Let us first create a table. The query to create a table is as follows
mysql> create table lastRecordBeforeLastOne
   - > (
   - > Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   - > Name varchar(20) DEFAULT 'John',
   - > Age int DEFAULT 18
   - > );
Query OK, 0 rows affected (0.79 sec)
Now you can insert some records in the table using insert command.
The query is as follows
mysql> insert into lastRecordBeforeLastOne values();
Query OK, 1 row affected (0.21 sec)
mysql> insert into lastRecordBeforeLastOne(Name,Age) values('Larry',23);
Query OK, 1 row affected (0.19 sec)
mysql> insert into lastRecordBeforeLastOne(Name,Age) values('Mike',19);
Query OK, 1 row affected (0.20 sec)
mysql> insert into lastRecordBeforeLastOne(Name,Age) values('Sam',24);
Query OK, 1 row affected (0.22 sec)
mysql> insert into lastRecordBeforeLastOne(Name,Age) values('Bob',26);
Query OK, 1 row affected (0.13 sec)
mysql> insert into lastRecordBeforeLastOne(Name,Age) values('David',22);
Query OK, 1 row affected (0.23 sec)
mysql> insert into lastRecordBeforeLastOne(Name,Age) values('James',29);
Query OK, 1 row affected (0.14 sec)
mysql> insert into lastRecordBeforeLastOne(Name,Age) values('Carol',21);
Query OK, 1 row affected (0.23 sec)
mysql> insert into lastRecordBeforeLastOne(Name,Age) values('Maxwell',29);
Query OK, 1 row affected (0.18 sec)
mysql> insert into lastRecordBeforeLastOne(Name,Age) values('Chris',25);
Query OK, 1 row affected (0.14 sec)
Display all records from the table using select statement.
The query is as follows
mysql> select *from lastRecordBeforeLastOne;
The following is the output
+----+---------+------+
| Id | Name    | Age  |
+----+---------+------+
|  1 | John    |   18 |
|  2 | Larry   |   23 |
|  3 | Mike    |   19 |
|  4 | Sam     |   24 |
|  5 | Bob     |   26 |
|  6 | David   |   22 |
|  7 | James   |   29 |
|  8 | Carol   |   21 |
|  9 | Maxwell |   29 |
| 10 | Chris   |   25 |
+----+---------+------+
10 rows in set (0.00 sec)
Here is the query to get the second last record in MySQL
mysql> SELECT *FROM
   - > (SELECT *FROM lastRecordBeforeLastOne ORDER BY Id DESC LIMIT 2) tbl1
   - > ORDER BY Id LIMIT 1;
The following is the output
+----+---------+------+
| Id | Name    | Age  |
+----+---------+------+
|  9 | Maxwell |   29 |
+----+---------+------+
1 row in set (0.00 sec)
How to get random value out of an array in PHP?

To get random value out of an array in PHP, the code is as follows−
 Live Demo
<?php
   $arr = array( "p"=>"150", "q"=>"100", "r"=>"120", "s"=>"110", "t"=>"115", "u"=>"103", "v"=>"105", "w"=>"125" );
   echo "Array values ...\n";
   echo "Value 1 = " . $arr["p"], "\n";
   echo "Value 2 = " . $arr["q"], "\n";
   echo "Value 3 = " . $arr["r"], "\n";
   echo "Value 4 = " . $arr["s"], "\n";
   echo "Value 5 = " . $arr["t"], "\n";
   echo "Value 6 = " . $arr["u"], "\n";
   echo "Value 7 = " . $arr["v"], "\n";
   echo "Value 8 = " . $arr["w"], "\n";
   echo "Random value from arary = ".$arr[array_rand($arr)];
?>
This will produce the following output −
Array values ...
Value 1 = 150
Value 2 = 100
Value 3 = 120
Value 4 = 110
Value 5 = 115
Value 6 = 103
Value 7 = 105
Value 8 = 125
Random value from arary = 110
Let us now see another example −
 Live Demo
<?php
   $arr = array( "p"=>"150", "q"=>"100", "r"=>"120", "s"=>"110", "t"=>"115", "u"=>"103", "v"=>"105", "w"=>"125" );
   echo "Array values ...\n";
   echo "Value 1 = " . $arr["p"], "\n";
   echo "Value 2 = " . $arr["q"], "\n";
   echo "Value 3 = " . $arr["r"], "\n";
   echo "Value 4 = " . $arr["s"], "\n";
   echo "Value 5 = " . $arr["t"], "\n";
   echo "Value 6 = " . $arr["u"], "\n";
   echo "Value 7 = " . $arr["v"], "\n";
   echo "Value 8 = " . $arr["w"], "\n";
   $res = array_rand($arr, 2);
   echo "Random values from array...";
   echo $arr[$res[0]]." ".$arr[$res[1]];
?>
This will produce the following output−
Array values ...
Value 1 = 150
Value 2 = 100
Value 3 = 120
Value 4 = 110
Value 5 = 115
Value 6 = 103
Value 7 = 105
Value 8 = 125
Random values from array...150 115
Maintain Image Quality When Applying CSS Transform & Scale

The CSS image-rendering property helps us set an algorithm for scaling our image.
The syntax of CSS image-rendering property is as follows −
Selector {
   image-rendering: /*value*/
}
The following examples illustrate CSS image-rendering property.
 Live Demo
<!DOCTYPE html>
<html>
   <head>
      <style>
         img {
            height: 200px;
            width: 200px;
         }
         #one {
            image-rendering: smooth
         }
         #two {
            image-rendering: pixelated
         }
         #three {
            image-rendering: crisp-edges
         }
      </style>
   </head>
   <body>
      <img id="one" src="https://images.unsplash.com/photo-1610208309350-766d71494a03?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=128&ixlib=rb-1.2.1&q=80&w=128" />
      <img id="two" src="https://images.unsplash.com/photo-1610208309350-766d71494a03?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=128&ixlib=rb-1.2.1&q=80&w=128" />
      <img id="three" src="https://images.unsplash.com/photo-1610208309350-766d71494a03?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=128&ixlib=rb-1.2.1&q=80&w=128" />
   </body>
</html>
This gives the following output
 Live Demo
<!DOCTYPE html>
<html>
   <head>
      <style>
         img {
            padding: 5%;
            border-radius: 40%;
            height: 20%;
            width: 20%;
         }
         #one {
            image-rendering: pixelated
         }
         #two {
            image-rendering: smooth
         }
         #three {
            image-rendering: crisp-edges
         }
      </style>
   </head>
   <body>
      <img id="one" src="https://images.unsplash.com/photo-1611090093783-a629a4d9f1a1?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=256&ixlib=rb-1.2.1&q=80&w=256" />
      <img id="two" src="https://images.unsplash.com/photo-1611090093783-a629a4d9f1a1?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=256&ixlib=rb-1.2.1&q=80&w=256" />
      <img id="three" src="https://images.unsplash.com/photo-1611090093783-a629a4d9f1a1?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=256&ixlib=rb-1.2.1&q=80&w=256" />
      <br/>
      pixelated, smooth, crisp
   </body>
</html>
This gives the following output
Get the Name of a Member Object in Java

The getName() method is used to get the names of the entities such as interface, class, array class, void etc. that are represented by the class objects. These names are returned in the form of a string.
A program that gets the name of the member objects using getName() method is given as follows −
 Live Demo
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class Main {
   public static void main(String[] argv) throws Exception {
      Class c = java.lang.Integer.class;
      Method m = c.getMethods()[0];
      Field f = c.getFields()[0];
      Constructor cons = c.getConstructors()[0];
      String name;
      name = c.getName();
      System.out.println("Name of class: " + name);
      name = m.getName();
      System.out.println("Name of method: " + name);
      name = f.getName();
      System.out.println("Name of field: " + name);
      name = cons.getName();
      System.out.println("Name of constructor: " + name);
   }
}
Name of class: java.lang.Integer
Name of method: numberOfLeadingZeros
Name of field: MIN_VALUE
Name of constructor: java.lang.Integer
Now let us understand the above program.
The getName() method is used to get the names of the class, method, field and constructor. Then these are displayed. A code snippet which demonstrates this is as follows −
Class c = java.lang.Integer.class;
Method m = c.getMethods()[0];
Field f = c.getFields()[0];
Constructor cons = c.getConstructors()[0];
String name;
name = c.getName();
System.out.println("Name of class: " + name);
name = m.getName();
System.out.println("Name of method: " + name);
name = f.getName();
System.out.println("Name of field: " + name);
name = cons.getName();
System.out.println("Name of constructor: " + name);
Keras - Model Evaluation and Model Prediction

This chapter deals with the model evaluation and model prediction in Keras.
Let us begin by understanding the model evaluation.
Evaluation is a process during development of the model to check whether the model is best fit for the given problem and corresponding data. Keras model provides a function, evaluate which does the evaluation of the model. It has three main arguments,
Test data
Test data label
verbose - true or false
Let us evaluate the model, which we created in the previous chapter using test data.
score = model.evaluate(x_test, y_test, verbose = 0) 

print('Test loss:', score[0]) 
print('Test accuracy:', score[1])
Executing the above code will output the below information.
0

The test accuracy is 98.28%. We have created a best model to identify the handwriting digits. On the positive side, we can still scope to improve our model.
Prediction is the final step and our expected outcome of the model generation. Keras provides a method, predict to get the prediction of the trained model. The signature of the predict method is as follows,
predict(
   x, 
   batch_size = None, 
   verbose = 0, 
   steps = None, 
   callbacks = None, 
   max_queue_size = 10, 
   workers = 1, 
   use_multiprocessing = False
)
Here, all arguments are optional except the first argument, which refers the unknown input data. The shape should be maintained to get the proper prediction.
Let us do prediction for our MPL model created in previous chapter using below code −
pred = model.predict(x_test) 
pred = np.argmax(pred, axis = 1)[:5] 
label = np.argmax(y_test,axis = 1)[:5] 

print(pred) 
print(label)
Here,
Line 1 call the predict function using test data.
Line 1 call the predict function using test data.
Line 2 gets the first five prediction
Line 2 gets the first five prediction
Line 3 gets the first five labels of the test data.
Line 3 gets the first five labels of the test data.
Line 5 - 6 prints the prediction and actual label.
Line 5 - 6 prints the prediction and actual label.
The output of the above application is as follows −
[7 2 1 0 4] 
[7 2 1 0 4]

The output of both array is identical and it indicate that our model predicts correctly the first five images.

    87 Lectures 
     11 hours 

 Abhilash Nelson

    61 Lectures 
     9 hours 

 Abhishek And Pukhraj

    57 Lectures 
     7 hours 

 Abhishek And Pukhraj

    52 Lectures 
     7 hours 

 Abhishek And Pukhraj

    52 Lectures 
     6 hours 

 Abhishek And Pukhraj

    68 Lectures 
     2 hours 

 Mike West
 Print
 Add Notes
 Bookmark this page
Program to convert Array to List in Java

The array is as follows −
String arr[] = { "One", "Two", "Three", "Four", "Five" };
Now, using the Array.asList() to convert the above array to list −
List<String>myList = Arrays.asList(arr);
Following is the program to convert Array to List in Java −
import java.util.*;
public class Demo {
   public static void main(String[] args) {
      String arr[] = { "One", "Two", "Three", "Four", "Five" };
      System.out.println("Array = "+ Arrays.toString(arr));
      List<String>myList = Arrays.asList(arr);
      System.out.println("List (Array to List) = " + myList);
   }
}
Array = [One, Two, Three, Four, Five]
List (Array to List) = [One, Two, Three, Four, Five]
Knowing the complexity in competitive programming - GeeksforGeeks

24 May, 2018
Prerequisite: Time Complexity Analysis
Generally, while doing competitive programming problems on various sites, the most difficult task faced is writing the code under desired complexity otherwise the program will get a TLE ( Time Limit Exceeded ). A naive solution is almost never accepted. So how to know, what complexity is acceptable?
The answer to this question is directly related to the number of operations that are allowed to perform within a second. Most of the sites these days allow 108 operations per second, only a few sites still allow 107 operations. After figuring out the number of operations that can be performed, search for the right complexity by looking at the constraints given in the problem.
Example:Given an array A[] and a number x, check for a pair in A[] with the sum as x.where N is:
1) 1 <= N <= 103
2) 1 <= N <= 105
3) 1 <= N <= 108

For Case 1A naive solution that is using two for-loops works as it gives us a complexity of O(N2), which even in the worst case will perform 106 operations which are well under 108. Ofcourse O(N) and O(NlogN) is also acceptable in this case.
For Case 2We have to think of a better solution than O(N2), as in worst case, it will perform 1010 operations as N is 105. So complexity acceptable for this case is either O(NlogN) which is approximately 106 (105 * ~10) operations well under 108 or O(N).
For Case 3Even O(NlogN) gives us TLE as it performs ~109 operations which are over 108. So the only solution which is acceptable is O(N) which in worst case will perform 10^8 operations.
The code for the given problem can be found on : https://www.geeksforgeeks.org/write-a-c-program-that-given-a-set-a-of-n-numbers-and-another-number-x-determines-whether-or-not-there-exist-two-elements-in-s-whose-sum-is-exactly-x/
Analysis
Competitive Programming
GBlog
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Types of Complexity Classes | P, NP, CoNP, NP hard and NP complete
Proof that Dominant Set of a Graph is NP-Complete
3-coloring is NP Complete
Difference between Deterministic and Non-deterministic Algorithms
Set partition is NP complete
Practice for cracking any coding interview
Arrow operator -> in C/C++ with Examples
Competitive Programming - A Complete Guide
Modulo 10^9+7 (1000000007)
Prefix Sum Array - Implementation and Applications in Competitive Programming
Tryit Editor v3.7

Tryit: HTML table border
Get Size of the Pandas DataFrame - GeeksforGeeks

28 Nov, 2021
In this article, we will discuss how to get the size of the Pandas Dataframe using Python.
This will return the size of dataframe  i.e. rows*columns
Syntax:
dataframe.size
where, dataframe is the input dataframe
Example: Python code to create a student dataframe and display size
Python3
# import pandas moduleimport pandas as pd  # create a dataframe# with 5 rows and 3 columnsdata = pd.DataFrame({    'name': ['sravan', 'ojsawi', 'bobby', 'rohith', 'gnanesh'],    'subjects': ['java', 'php', 'html/css', 'python', 'R'],    'marks': [98, 90, 78, 91, 87]})  # display dataframeprint(data)  # get the sizedata.size
Output:
This function will return the number of rows and columns in the dataframe
Syntax:
dataframe.shape
where, dataframe is the input dataframe
Example: Python program to get the shape of the dataframe
Python3
# import pandas moduleimport pandas as pd  # create a dataframe# with 5 rows and 3 columnsdata = pd.DataFrame({    'name': ['sravan', 'ojsawi', 'bobby', 'rohith', 'gnanesh'],    'subjects': ['java', 'php', 'html/css', 'python', 'R'],    'marks': [98, 90, 78, 91, 87]})  # display dataframeprint(data)  # get the shapedata.shape
Output:
This will return the number of dimensions present in the dataframe.
Syntax:
data.ndim
where, dataframe is the input dataframe
Example: Python program to get the dimension of the dataframe
Python3
# import pandas moduleimport pandas as pd  # create a dataframe# with 5 rows and 3 columnsdata = pd.DataFrame({    'name': ['sravan', 'ojsawi', 'bobby', 'rohith', 'gnanesh'],    'subjects': ['java', 'php', 'html/css', 'python', 'R'],    'marks': [98, 90, 78, 91, 87]})  # display dataframeprint(data)  # get the dimensionsdata.ndim
Output:
pandas-dataframe-program
Picked
Python pandas-dataFrame
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Python | Get unique values from a list
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
C# Linq Distinct() Method

To get the distinct elements, use the Distinct() method.
The following is our list with duplicate elements.
List<int> points = new List<int> { 5, 10, 5, 20, 30, 30, 40, 50, 60, 70 };
Now to get the distinct elements −
points.AsQueryable().Distinct();
Let us see the entire example −
 Live Demo
using System;
using System.Linq;
using System.Collections.Generic;
class Demo {
   static void Main() {
      List<int> points = new List<int> { 5, 10, 5, 20, 30, 30, 40, 50, 60, 70 };
      // distict elements from the list
      IEnumerable<int> res = points.AsQueryable().Distinct();
      foreach (int a in res) {
         Console.WriteLine(a);
      }
   }
}
5
10
20
30
40
50
60
70
Java ceil() method with Examples

08 Apr, 2018
The java.lang.Math.ceil() returns the double value that is greater than or equal to the argument and is equal to the nearest mathematical integer.Note:
If the argument is Integer, then the result is Integer.
If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
If the argument value is less than zero but greater than -1.0, then the result is negative zero.
Syntax :
public static double ceil(double a)a : the argument whose ceil value is to be determinedReturns : This method returns the double value that is greater than or equalto the argument and is equal to the nearest mathematical integer.
Example :To show working of java.lang.Math.ceil() method.
// Java program to demonstrate working// of java.lang.Math.ceil() methodimport java.lang.Math;  class Gfg {      // driver code    public static void main(String args[])    {        double a = 4.3;        double b = 1.0 / 0;        double c = 0.0;        double d = -0.0;        double e = -0.12;          System.out.println(Math.ceil(a));          // Input Infinity, Output Infinity        System.out.println(Math.ceil(b));          // Input Positive Zero, Output Positive Zero        System.out.println(Math.ceil(c));          // Input Negative Zero, Output Negative Zero        System.out.println(Math.ceil(d));          // Input  less than zero but greater than -1.0        // Output Negative zero        System.out.println(Math.ceil(e));    }}
Output:
5.0
Infinity
0.0
-0.0
-0.0

Java-Library
java-math
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Object Oriented Programming (OOPs) Concept in Java
How to iterate any Map in Java
Interfaces in Java
HashMap in Java with Examples
ArrayList in Java
Stream In Java
Collections in Java
Singleton Class in Java
Multidimensional Arrays in Java
Stack Class in Java
Getter and Setter Methods in Dart

31 Oct, 2021
Getter and setter methods are the class methods used to manipulate the data of the class fields. Getter is used to read or get the data of the class field whereas setter is used to set the data of the class field to some variable.
It is used to retrieve a particular class field and save it in a variable. All classes have a default getter method but it can be overridden explicitly. The getter method can be defined using the get keyword as:
return_type get field_name{
    ...
}
It must be noted we have to define a return type but there is no need to define parameters in the above method.
It is used to set the data inside a variable received from the getter method. All classes have a default setter method but it can be overridden explicitly. The setter method can be defined using the set keyword as:
set field_name{
    ...
}
Example: Using the Getter and Setter method in the dart program.
Dart
// Creating Class named Gfgclass Gfg {  // Creating a Field/Property  String geekName;   // Creating the getter method  // to get input from Field/Property  String get getName {    return geekName;  }   // Creating the setter method  // to set the input in Field/Property  set setName(String name) {    geekName = name;  }} void main() {  // Creating Instance of class  Gfg geek = Gfg();   // Calling the set_name method(setter method we created)  // To set the value in Property "geekName"  geek.setName = "GeeksForGeeks";   // Calling the get_name method(getter method we created)  // To get the value from Property "geekName"  print("Welcome to ${geek.getName}");}
Output:
Welcome to GeeksForGeeks
prateeksrivastav7374
Dart-OOPs
Dart
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Flutter - DropDownButton Widget
Flutter - Custom Bottom Navigation Bar
Flutter - Checkbox Widget
ListView Class in Flutter
Flutter - Stack Widget
Dart Tutorial
How to Append or Concatenate Strings in Dart?
Flutter - Search Bar
Operators in Dart
Flutter - FutureBuilder Widget
Python-Quizzes | Python Dictionary Quiz | Question 25

17 Sep, 2020
Question 25:Find the output of the following program:
counter = {}   def addToCounter(country):     if country in counter:         counter[country] += 1    else:         counter[country] = 1  addToCounter('China') addToCounter('Japan') addToCounter('china')   print (len(counter))
(A) 0(B) 1(C) 2(D) 3Answer: (D)Explanation: The task of “len” function is to return the number of keys in a dictionary. Here 3 keys are added to the dictionary “country” using the “addToCounter” function. The keys to a dictionary are case sensitive.Quiz of this Question
Python-Quizzes
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Why do people prefer Selenium with Python?
Python-Quizzes | Python List Quiz | Question 3
Python-Quizzes | Output Type | Question 10
Python-Quizzes | Miscellaneous | Question 10
Python-Quizzes | Output Type | Question 12
Python-Quizzes | Data Type | Question 3
Python | Animated Banner showing 'GeeksForGeeks'
Python | Word Stretch
Python-Quizzes | Python List Quiz | Question 1
Python-Quizzes | Python List Quiz | Question 2
Searching BETWEEN dates stored as varchar in MySQL?

You can search between dates stored as varchar using STR_TO_DATE(). The syntax is as follows −
select *from yourTableName where STR_TO_DATE(LEFT(yourColumnName,LOCATE('',yourColumnName)),'%m/%d/%Y') BETWEEN 'yourDateValue1' AND 'yourDateValue2’;
To understand the above syntax, let us create a table. The query to create a table is as follows −
mysql> create table SearchDateAsVarchar
   -> (
   -> Id int NOT NULL AUTO_INCREMENT,
   -> ShippingDate varchar(100),
   -> PRIMARY KEY(Id)
   -> );
Query OK, 0 rows affected (0.99 sec)
Insert some records in the table using INSERT command. The query is as follows −
mysql> insert into SearchDateAsVarchar(ShippingDate) values('6/28/2011 9:58 AM');
Query OK, 1 row affected (0.19 sec)
mysql> insert into SearchDateAsVarchar(ShippingDate) values('6/18/2011 10:50:39 AM');
Query OK, 1 row affected (0.55 sec)
mysql> insert into SearchDateAsVarchar(ShippingDate) values('6/22/2011 11:45:40 AM');
Query OK, 1 row affected (0.18 sec)
Display all records from the table using select statement. The query is as follows −
mysql> select *from SearchDateAsVarchar;
The following is the output −
+----+-----------------------+
| Id | ShippingDate          |
+----+-----------------------+
|  1 | 6/28/2011 9:58 AM     |
|  2 | 6/18/2011 10:50:39 AM |
|  3 | 6/22/2011 11:45:40 AM |
+----+-----------------------+
3 rows in set (0.00 sec)
Here is the query to search between dates stored as varchar −
mysql> select *from SearchDateAsVarchar where
STR_TO_DATE(LEFT(ShippingDate,LOCATE(' ',ShippingDate)),'%m/%d/%Y') BETWEEN
'2011-06-20' AND '2011-06-28';
The following is the output −
+----+-----------------------+
| Id | ShippingDate          |
+----+-----------------------+
|  1 | 6/28/2011 9:58 AM     |
|  3 | 6/22/2011 11:45:40 AM |
+----+-----------------------+
2 rows in set (0.00 sec)
JSF - Expression Language

JSF provides a rich expression language. We can write normal operations using #{operation-expression} notation. Following are some of the advantages of JSF Expression languages.
Can reference bean properties where bean can be an object stored in request, session or application scope or is a managed bean.
Can reference bean properties where bean can be an object stored in request, session or application scope or is a managed bean.
Provides easy access to elements of a collection which can be a list, map or an array.
Provides easy access to elements of a collection which can be a list, map or an array.
Provides easy access to predefined objects such as a request.
Provides easy access to predefined objects such as a request.
Arithmetic, logical and relational operations can be done using expression language.
Arithmetic, logical and relational operations can be done using expression language.
Automatic type conversion.
Automatic type conversion.
Shows missing values as empty strings instead of NullPointerException.
Shows missing values as empty strings instead of NullPointerException.
Let us create a test JSF application to test expression language.
package com.tutorialspoint.test;

import java.io.Serializable;
import java.util.Date;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean(name = "userData", eager = true)
@SessionScoped
public class UserData implements Serializable {
   private static final long serialVersionUID = 1L;
   private Date createTime = new Date();
   private String message = "Hello World!";

   public Date getCreateTime() {
      return(createTime);
   }
   
   public String getMessage() {
      return(message);
   }
}
<?xml version = "1.0" encoding = "UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns = "http://www.w3.org/1999/xhtml"
   xmlns:f = "http://java.sun.com/jsf/core"    
   xmlns:h = "http://java.sun.com/jsf/html">
   
   <h:head>
      <title>JSF Tutorial!</title>
   </h:head>
   
   <h:body>
      <h2>Expression Language Example</h2>
      Creation time: 
      <h:outputText value = "#{userData.createTime}"/>
      <br/><br/>
      Message: 
      <h:outputText value = "#{userData.message}"/>
   </h:body>
</html> 
Once you are ready with all the changes done, let us compile and run the application as we did in JSF - First Application chapter. If everything is fine with your application, this will produce the following result.

    37 Lectures 
     3.5 hours 

 Chaand Sheikh
 Print
 Add Notes
 Bookmark this page
Difference between Array and Array of Objects in JavaScript - GeeksforGeeks

02 Nov, 2021
In this article, we will see the differences between Array and Array of Objects in JavaScript.
1. Array:  An Array is a collection of data and a data structure that is stored in a sequence of memory locations. One can access the elements of an array by calling the index number such as 0, 1, 2, 3, ..., etc. The array can store data types like Integer, Float, String, and Boolean all the primitive data types can be stored in an array.
Example:
Javascript
<script>    var myArr = [1, 2, 3, 4, 5];      // Iterating through loop    for (var i = 0; i < myArr.length; i++) {        console.log(myArr[i]);    }      // Pop an element from array    myArr.pop();    console.log("after using pop()" + myArr);</script>
 
Output:
2. Array of objects: It stores multiple values in a single variable. The object can contain anything in the real world such as person names, cars, game characters. Objects are very easy to use in some situations if you know where the data is being processed. The character set of objects are known as Properties. Properties of an object can be called by using DOT notation and [] notation.
Example:
Javascript
<script>      // Array of objects    var myObject = {        jhon: {            name: 'jhon',            age: 12,            gender: 'male'        },        rita: {            name: 'rita',            age: 32,            gender: 'male'        }    };      // Using DOT notation    console.log('using DOT:' + myObject.jhon.gender);      // Using [] notation    console.log('using []:' + myObject.rita['age']);      // Using delete keyword    delete myObject.rita;      // Iterating using for..in loop    for (var key in myObject) {          // logs values in myObject        console.log(myObject[key]);    }</script>
Output:
Difference between Array and Array of objects:
Array
Array of objects
Pushpender007
javascript-array
JavaScript-Questions
TrueGeek-2021
JavaScript
TrueGeek
Web Technologies
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
Remove elements from a JavaScript Array
Difference Between PUT and PATCH Request
How to get character array from string in JavaScript?
How to filter object array based on attributes?
How to redirect to another page in ReactJS ?
How to remove duplicate elements from JavaScript Array ?
SQL Statement to Remove Part of a String
Basics of API Testing Using Postman
Types of Internet Protocols
Measure text height on an HTML5 canvas element

To get the text height, set the font in pt −
context.font="15pt Calibri";
Now, get the height like the following −
var height = parseInt(context.font.match(/\d+/), 10);
Above we have used a match to separate the font size from font face.