code-rag-bench/online-tutorials huggingface dataset:
How to create a vector with zero values in R?

In data analysis, sometimes we need to use zeros for certain calculations, either to nullify the effect of a variable or for some other purpose based on the objective of the analysis. To deal with such type of situations, we need a zero value or a vector of zeros. There are many ways to create a vector with zeros in R. The important thing is the length of the vector.
> x1<-integer(10)
> x1
[1] 0 0 0 0 0 0 0 0 0 0
> x2<-integer(20)
> x2
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> x3<-numeric(10)
> x3
[1] 0 0 0 0 0 0 0 0 0 0
> x4<-numeric(20)
> x4
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> x5<-replicate(10,0)
> x5
[1] 0 0 0 0 0 0 0 0 0 0
> x6<-replicate(100,0)
> x6
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[38] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[75] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> x7<-(1:10)*0
> x7
[1] 0 0 0 0 0 0 0 0 0 0
> x8<-(1:50)*0
> x8
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[39] 0 0 0 0 0 0 0 0 0 0 0 0
> x9<-rep(0,10)
> x9
[1] 0 0 0 0 0 0 0 0 0 0
> x10<-rep(0,40)
> x10
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[39] 0 0
> x11<-rep(0L,10)
> x11
[1] 0 0 0 0 0 0 0 0 0 0
> x12<-rep(0L,100)
> x12
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[38] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[75] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Checking whether each of these objects are vector or not −
> is.vector(x1)
[1] TRUE
> is.vector(x2)
[1] TRUE
> is.vector(x3)
[1] TRUE
> is.vector(x4)
[1] TRUE
> is.vector(x5)
[1] TRUE
> is.vector(x6)
[1] TRUE
> is.vector(x7)
[1] TRUE
> is.vector(x8)
[1] TRUE
> is.vector(x9)
[1] TRUE
> is.vector(x10)
[1] TRUE
> is.vector(x11)
[1] TRUE
> is.vector(x12)
[1] TRUE
JSF - f:convertDateTime

f:convertDateTime tag is used to convert a string value to a date of required format. It also acts as a validator, a required date format.
<f:convertDateTime pattern = "dd-mm-yyyy" />
type
date (default), time, or both
dateStyle
default, short, medium, long, or full
timeStyle
default, short, medium, long, or full
pattern
Formatting pattern, as defined in java.text.SimpleDateFormat
locale
Locale whose preferences are to be used for parsing and formatting
Time zone to use for parsing and formatting
Let us create a test JSF application to test the above tag.
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;
   public Date date;

   public Date getDate() {
      return date;
   }

   public void setDate(Date date) {
      this.date = date;
   }
}
<?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:h = "http://java.sun.com/jsf/html"
   xmlns:f = "http://java.sun.com/jsf/core">
   
   <h:head>
      <title>JSF tutorial</title>
   </h:head>
   
   <h:body>
      <h2>ConvertDateTime Example</h2>
      
      <h:form>
         <h:inputText id = "dateInput" value = "#{userData.date}"
            label = "Date" >
            <f:convertDateTime pattern = "dd-mm-yyyy" />
         </h:inputText>
         <h:commandButton value = "submit" action = "result"/>
      </h:form>
      <br/>
      <h:message for = "dateInput" style = "color:red" />
      
      <h:outputText value = "12-01-2012" >
         <f:convertDateTime pattern = "dd-mm-yyyy" />
      </h:outputText>
   
   </h:body>
</html>
<?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"
   xmlns:ui = "http://java.sun.com/jsf/facelets">
   
   <h:body>
      <h2>Result</h2>
      <hr />
      #{userData.date}
   </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.
Enter any invalid value and press Submit button. See the following error message.
Enter any valid value and press Submit button. See the following result.

    37 Lectures 
     3.5 hours 

 Chaand Sheikh
 Print
 Add Notes
 Bookmark this page
Data Types in C - GeeksforGeeks

28 Jun, 2021
Each variable in C has an associated data type. Each data type requires different amounts of memory and has some specific operations which can be performed over it. Let us briefly describe them one by one:Following are the examples of some very common data types used in C:
char: The most basic data type in C. It stores a single character and requires a single byte of memory in almost all compilers.
int: As the name suggests, an int variable is used to store an integer.
float: It is used to store decimal numbers (numbers with floating point value) with single precision.
double: It is used to store decimal numbers (numbers with floating point value) with double precision. 
Different data types also have different ranges upto which they can store numbers. These ranges may vary from compiler to compiler. Below is list of ranges along with the memory requirement and format specifiers on 32 bit gcc compiler. 
We can use the sizeof() operator to check the size of a variable. See the following C program for the usage of the various data types: 
C
#include <stdio.h>int main(){    int a = 1;    char b = 'G';    double c = 3.14;    printf("Hello World!\n");     // printing the variables defined    // above along with their sizes    printf("Hello! I am a character. My value is %c and "           "my size is %lu byte.\n",           b, sizeof(char));    // can use sizeof(b) above as well     printf("Hello! I am an integer. My value is %d and "           "my size is %lu  bytes.\n",           a, sizeof(int));    // can use sizeof(a) above as well     printf("Hello! I am a double floating point variable."           " My value is %lf and my size is %lu bytes.\n",           c, sizeof(double));    // can use sizeof(c) above as well     printf("Bye! See you soon. :)\n");     return 0;}
Output: 
Hello World!
Hello! I am a character. My value is G and my size is 1 byte.
Hello! I am an integer. My value is 1 and my size is 4  bytes.
Hello! I am a double floating point variable. My value is 3.140000 and my size i
s 8 bytes.
Bye! See you soon. :)

 
Srichandrahaas
pantpawan
C Basics
C-Data Types
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
rand() and srand() in C/C++
Left Shift and Right Shift Operators in C/C++
fork() in C
Command line arguments in C/C++
Core Dump (Segmentation fault) in C/C++
Substring in C++
Function Pointer in C
Different methods to reverse a string in C/C++
TCP Server-Client implementation in C
Structures in C
Difference between jquery.size() and jquery.length - GeeksforGeeks

22 Jul, 2021
JQuery.size() method gives us the number of elements present. For Example, if we are calling the size() method for “p” tag, then it will return the number of “p” tags present on our page.
Syntax:
$(selector).size()
Return value: It returns the number of “selector” present.
Example:
HTML
<!DOCTYPE html><html lang="en">  <head>    <!-- Using jquery v1.6 library -->    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js">    </script></head>  <body>    <p>para-1</p>    <p>para-2</p>    <p>para-3</p>    <p>para-4</p>    <p>para-5</p>      <script>        console.log($("p").size())    </script></body>  </html>
Output:
5
Note: This method has been removed in jQuery 3.0. So, the above code will not work in the latest version of jQuery. Now, you have to use length property.
JQuery.size() implementation:
size()->function()
{
  return this.length; 
}
Here, We can clearly see that size() method is internally calling the length property. So, it is quite obvious that when we have to find the size of an element, we can directly call the length property instead of the calling method.
jQuery.length Property: The JQuery.length property is faster than JQuery.size() because here we are not calling any function. 
Syntax:
$(selector).length
Return value: It returns the length of the selector.
Example:
HTML
<!DOCTYPE html><html lang="en">  <head>    <!-- using jquery library -->    <script src="https://code.jquery.com/jquery-git.js">    </script></head>  <body>    <p>para-1</p>    <p>para-2</p>    <p>para-3</p>    <p>para-4</p>    <p>para-5</p>          <script>        console.log($("p").length)    </script></body>  </html>
Output:
5
Difference between jQuery.size() and jQuery.length:
jQuery-Methods
jQuery-Questions
Picked
Difference Between
JQuery
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
Difference Between Method Overloading and Method Overriding in Java
Difference between Prim's and Kruskal's algorithm for MST
Difference between Internal and External fragmentation
Difference between Mealy machine and Moore machine
JQuery | Set the value of an input text field
How to change selected value of a drop-down list using jQuery?
Form validation using jQuery
How to change the background color after clicking the button in JavaScript ?
How to Dynamically Add/Remove Table Rows using jQuery ?
MySQL query to display columns name first name, last name as full name in a single column?

For this, use CONCAT() method in MySQL. Let us first create a table −
mysql> create table DemoTable
(
   FirstName varchar(50),
   LastName varchar(50)
);
Query OK, 0 rows affected (0.63 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('Chris','Brown');
Query OK, 1 row affected (0.21 sec)
mysql> insert into DemoTable values('David','Miller');
Query OK, 1 row affected (0.18 sec)
mysql> insert into DemoTable values('John','Doe');
Query OK, 1 row affected (0.08 sec)
mysql> insert into DemoTable values('Adam','Smith');
Query OK, 1 row affected (0.25 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+-----------+----------+
| FirstName | LastName |
+-----------+----------+
| Chris     | Brown    |
| David     | Miller   |
| John      | Doe      |
| Adam      | Smith    |
+-----------+----------+
4 rows in set (0.00 sec)
Following is the query to concatenate first name and last name to full name −
mysql> select concat(FirstName,' ',LastName) AS FullName from DemoTable;
This will produce the following output −
+--------------+
| FullName     |
+--------------+
| Chris Brown  |
| David Miller |
| John Doe     |
| Adam Smith   |
+--------------+
4 rows in set (0.00 sec)
What is the use of sprintf() and sscanf() functions in C language?

It reads data from a character string.
sscanf(string,formatspecifier,&var1,&var2,........)
String refers to the char string to read from.
Format string refers to char string containing certain required formatting information.
Var1,var2 etc., represent the individual input data items.
For example, sscanf(string,"%d%d",&hours,&minutes);
This function is used to write data to a character string.
sprintf(string,format specifier,&var1,&var2.......);
String refers to char string to write.
Format specifier refers to char string containing certain required formatting information.
Var1,var2 etc., represent the individual input data items.
Example − sprint(value,"cube of two is %d and square of two is %d\n", 2*2*2 ,2*2);
//value=cube of two is 8 and square of two is 4.
 Live Demo
#include<stdio.h>
int main(){
   char instring[]="Tutorials Point";
   char outstring[50],string1[10],string2[10];
   sscanf(instring,"%s %s",string1,string2);
   printf("%s\n",string1);
   printf("%s",instring);
   return 0;
}
Tutorials
Tutorials Point
 Live Demo
#include <stdio.h>
int main(){
   char value[50];
   int p = 20, q = 30, r;
   r= p + q;
   sprintf(value, "adding two numbers %d and %d the result is %d", p, q,r);
   printf("%s", value);
   return 0;
}
adding two numbers 20 and 30 the result is 50
Count Negative Numbers in a Column-Wise and Row-Wise Sorted Matrix using Python?

In this section we are going to see a python program that counts negative numbers in Row-wise and Column-wise sorted matrix with optimal solution.
Row-wise and column-wise sorted array means, each value at any index is small or equal to the value at the index in next column and next row. 
M = [[-40, -12, 1, 5],
[-20, -2, 5, 15],
[-22, -1, 13, 18],
[-12, 0, 15, 38]]
In above matrix M, the first column of first row is -40, which is smaller than the value at next column value in same row i.e. -12 and is also smaller than the value in next row in the same column i.e. -20 and so on.
# The matrix must be sorted in ascending order. If not, the algorithm will not work properly
matrix = [
   [-40, -12, 1, 5],
   [-20, -2, 5, 15],
   [-22, -1, 13, 18],
   [-12, 0, 15, 38]]
# To obtain the number of row
rowCount = len(matrix)
columnCount = 0

# To obtain the number of column
for i in matrix[0]:
   columnCount += 1
   a = 0
   b = 0
   count_Of_Negative_Integer = 0
while a < rowCount and b < columnCount:
   if matrix[a][b] >= 0:
      a += 1
      b = 0
   else:
      count_Of_Negative_Integer += 1
   b += 1
print("Count of Negative Integers in sorted Matrix is: ",count_Of_Negative_Integer)
Count of Negative Integers in sorted Matrix is: 7
In above program,
>=0: first we try to find the count of negative integer, less than 0.
>=0: first we try to find the count of negative integer, less than 0.
Because in above program, we are trying to get negative integers, however, same program can be used to find the count of integer that is less than any particular integers(n). For example to find the count of integer that is less than or equal to 5 using >5.
Because in above program, we are trying to get negative integers, however, same program can be used to find the count of integer that is less than any particular integers(n). For example to find the count of integer that is less than or equal to 5 using >5.
Count occurrences of an element in a list in Python

In this article we are given a list and a string. We are required to find how many times the given string is present as an element in the list.
The counter function from collections module will give us the count of each element present in the list. From the counting result we can extract only that account fair the index matches with the value of the element we are searching for.
 Live Demo
from collections import Counter
Alist = ['Mon', 'Wed', 'Mon', 'Tue', 'Thu']
elem = 'Mon'
# Given list and element
print("Given list:\n", Alist)
print("Given element:\n",elem)
cnt = Counter(Alist)
print("Number of times the element is present in list:\n",cnt[elem])
Running the above code gives us the following result −
Given list:
['Mon', 'Wed', 'Mon', 'Tue', 'Thu']
Given element:
Mon
Number of times the element is present in list:
2
The count function takes in in the given stream as a parameter and searches for that stream in the given list.
 Live Demo
Alist = ['Mon', 'Wed', 'Mon', 'Tue', 'Thu']
elem = 'Mon'
# Given list and element
print("Given list:\n", Alist)
print("Given element:\n",elem)
cnt = Alist.count('Mon')
print("Number of times the element is present in list:\n",cnt)
Running the above code gives us the following result −
Given list:
['Mon', 'Wed', 'Mon', 'Tue', 'Thu']
Given element:
Mon
Number of times the element is present in list:
2
CSS | Animation to Change the Hover State of a Button/Image - GeeksforGeeks

29 Jul, 2021
1. To change the color/size of the button in hover state.
Approach:
Set the animation and time duration of hover state
Set background color using @keyframes
Syntax:
button:hover {
    animation-name: background-color;
    animation-duration: 500ms;
    }

    @keyframes background-color {
        100% {
        background-color:#4065F3;
    }
}
Examples:
HTML
<!DOCTYPE html><html> <head>    Color Change of button on hovering</head><style>    button {        border-radius: 5px;        color: white;        background-color: #368508;        padding: 5px 10px 8px 10px;    }       /*Button hover state*/    button:hover {        animation-name: background-color;        animation-duration: 500ms;    }       /*keyframes*/    @keyframes background-color {        100% {            background-color: #4065F3;        }    }</style> <body>    <br>    <br>    <button>GeeksforGeeks</button></body> </html>
Output:Initially, the button looks like this: 
On hovering it changes to this:
2. To change the color/size of the image in the hover state
.Approach:
Set the animation and time duration of hover state
Set the image size using @keyframes
Syntax:
 img:hover {
       animation-name: breadth;
       animation-duration: 500ms;
     }

      @keyframes breadth {
      50% {
       width: 400px;
      }
      100% {
       width: 600px;
      }
    }
HTML
<!DOCTYPE html><html> <head>  Size Change of image on hovering  </head><style>    img:hover {        animation-name: breadth;        animation-duration: 500ms;    }         @keyframes breadth {        50% {            width: 400px;        }        100% {            width: 600px;        }    }</style> <body>    <img src="https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-6.png"         alt="GeeksforGeeks Logo" /></body> </html>
Output:Initially, the size of image is this:
On hovering its size diminishes to this at half duration time:
And then again to original size on completion of duration of time: 
 
kapoorsagar226
CSS-Misc
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Types of CSS (Cascading Style Sheet)
Create a Responsive Navbar using ReactJS
Design a web page using HTML and CSS
How to position a div at the bottom of its container using CSS?
How to Upload Image into Database and Display it using PHP ?
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
Get second largest marks from a MySQL table using subquery?

Let us first create a table −
mysql> create table DemoTable(
   Marks int
);
Query OK, 0 rows affected (1.34 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values(78);
Query OK, 1 row affected (0.16 sec)
mysql> insert into DemoTable values(88);
Query OK, 1 row affected (0.10 sec)
mysql> insert into DemoTable values(67);
Query OK, 1 row affected (0.13 sec)
mysql> insert into DemoTable values(76);
Query OK, 1 row affected (0.25 sec)
mysql> insert into DemoTable values(98);
Query OK, 1 row affected (0.13 sec)
mysql> insert into DemoTable values(86);
Query OK, 1 row affected (0.11 sec)
mysql> insert into DemoTable values(89);
Query OK, 1 row affected (0.13 sec)
mysql> insert into DemoTable values(99);
Query OK, 1 row affected (0.12 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+-------+
| Marks |
+-------+
| 78    |
| 88    |
| 67    |
| 76    |
| 98    |
| 86    |
| 89    |
| 99    |
+-------+
8 rows in set (0.00 sec)
Following is the query to get a second-largest mark from MySQL table −
mysql> select Marks from DemoTable
where Marks=(select MAX(Marks) from DemoTable where Marks < (select MAX(Marks) from DemoTable));
This will produce the following output −
+-------+
| Marks |
+-------+
| 98    |
+-------+
1 row in set (0.03 sec)
Java Connection getAutoCommit() method with example

If you commit a database, it saves all the changes that have been done till that particular point. By default, some databases commits/saves the changes done automatically. You can turn off/on the auto-commit using the setAutoCommit() method of the Connection interface.
The getAutocommit() method of the Connection interface is used to get the current value of the auto-commit in this connection.
To get the auto-commit value −
Register the driver using the registerDriver() method of the DriverManager class as −
//Registering the Driver
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
Get the connection using the getConnection() method of the DriverManager class as −
//Getting the connection
String url = "jdbc:mysql://localhost/mydatabase";
Connection con = DriverManager.getConnection(url, "root", "password");
Turn off/on the auto-commit using the setAutoCommit() method as −
//Setting the auto commit on
con.setAutoCommit(true);
//Setting the auto commit off
con.setAutoCommit(false);
Get the current auto-commit value using the getAutoCommit() method as −
con.getAutoCommit();
Following JDBC program establishes a connection with the database and turns off the auto-commit and retrieves the current auto-commit value (which is false ).
import java.sql.Connection;
import java.sql.DriverManager;
public class Connection_getAutoCommit {
   public static void main(String args[])throws Exception {
      //Getting the connection
      String mysqlUrl = "jdbc:mysql://localhost/sampleDB";
      Connection con = DriverManager.getConnection(mysqlUrl, "root", "password");
      System.out.println("Connection established......");
      //Setting auto-commit false
      con.setAutoCommit(false);
      //Retrieving the current value of the auto-commit in this connection
      boolean autoCommit = con.getAutoCommit();
      System.out.println("Auto commit value is: "+autoCommit);
   }
}
Connection established......
Auto commit value is: false
\geq - Tex Command

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

\geq

≥



\geq

≥


\geq

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
Tryit Editor v3.7

Tryit: Center vertically with padding
C/C++ program to print Hello World without using main() and semicolon - GeeksforGeeks

25 Nov, 2019
The task is to write a program to print Hello World without using main() and semicolon.
As we already know how to print Hello World without the use of a semicolon. Now for writing without main() method, we will need a Macro.
C
C++
// C program to print Hello World// without using main() and semicolon  #include <stdio.h>  #define x main  void x(){    if (printf("Hello World")) {    }}
// C++ program to print Hello World// without using main() and semicolon  #include <bits/stdc++.h>using namespace std;  #define x main  void x(){    if (cout << "Hello World") {    }}
Hello World

C/C++ program to print Hello World without using main() and semicolon
c-input-output
cpp-input-output
C Programs
C++ Programs
School Programming
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
C Program to read contents of Whole File
Producer Consumer Problem in C
C program to find the length of a string
Exit codes in C/C++ with Examples
Regular expressions in C
C++ Program for QuickSort
Sorting a Map by value in C++ STL
cin in C++
delete keyword in C++
CSV file management using C++
Sass - Output Style

In this chapter, we will study about SASS Output Style. The CSS file that the SASS generates consists of default CSS style, which reflects the structure of document. The default CSS styling is good but might not be suitable for all situations; on other hand, SASS supports many other styles.
It supports the following different output styles −
Nested style is default styling of SASS. This way of styling is very useful when you are dealing with large CSS files. It makes the structure of the file more readable and can be easily understood. Every property takes its own line and indentation of each rule is based on how deeply it is nested.
For instance, we can nest the code in SASS file as shown below −
#first {
   background-color: #00FFFF;
   color: #C0C0C0; 
}

#first p {
   width: 10em; 
}

.highlight {
   text-decoration: underline;
   font-size: 5em;
   background-color: #FFFF00; 
}
In expanded type of CSS styling each property and rule has its own line. It takes more space compared to the Nested CSS style. The Rules section consists of properties, which are all intended within the rules, whereas rules does not follow any indentation.
For instance, we can expand the code in the SASS file as shown below −
#first {
   background-color: #00FFFF;
   color: #C0C0C0;
}

#first p {
   width: 10em;
}

.highlight {
   text-decoration: underline;
   font-size: 5em;
   background-color: #FFFF00;
}
Compact CSS style competitively takes less space than Expanded and Nested. It focuses mainly on selectors rather than its properties. Each selector takes up one line and its properties are also placed in the same line. Nested rules are positioned next to each other without a newline and the separate groups of rules will have new lines between them.
For instance, we can compact the code in the SASS file as shown below −
#first { 
   background-color: #00FFFF; color: #C0C0C0; 
}

#first p { 
   width: 10em; 
}

.highlight { 
   text-decoration: underline; font-size: 5em; background-color: #FFFF00; 
}
Compressed CSS style takes the least amount of space compared to all other styles discussed above. It provides whitespaces only to separate selectors and newline at the end of the file. This way of styling is confusing and is not easily readable.
For instance, we can compress the code in SASS file as shown below −
#first { 
   background-color:#00FFFF;color:#C0C0C0
} 

#first p { 
   width:10em 
} 

.highlight { 
   text-decoration:underline;font-size:5em;background-color:#FFFF00 
}

    50 Lectures 
     5.5 hours 

 Code And Create

    124 Lectures 
     30 hours 

 Juan Galvan

    162 Lectures 
     31.5 hours 

 Yossef Ayman Zedan

    167 Lectures 
     45.5 hours 

 Muslim Helalee
 Print
 Add Notes
 Bookmark this page
Node.js Local Module - GeeksforGeeks

13 Oct, 2021
Node.js comes with different predefined modules (e.g. http, fs, path, etc.) that we use and scale our project. We can define modules locally as Local Module. It consists different functions declared inside a JavaScript object and we reuse them according to the requirement. We can also package it and distribute it using NPM.
Defining local module: Local module must be written in a separate JavaScript file. In the separate file, we can declare a JavaScript object with different properties and methods.
Step 1: Creating a local module with filename Welcome.js
const welcome = {      sayHello : function() {        console.log("Hello GeekforGeeks user");  },    currTime : new Date().toLocaleDateString(),    companyName : "GeekforGeeks"}  module.exports = welcome
Explanation: Here, we declared an object ‘welcome’ with a function sayHello and two variables currTime and companyName. We use the module.export to make the object available globally.
Part 2: In this part, use the above module in app.js file.
var local = require("./Welcome.js");local.sayHello();console.log(local.currTime);console.log(local.companyName);
Explanation: Here, we import our local module ‘sayHello’ in a variable ‘local’ and consume the function and variables of the created modules.Output:
Hello GeekforGeeks user
12/6/2019
GeekforGeeks

Node.js-Basics
Picked
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Node.js fs.readFileSync() Method
How to update Node.js and NPM to next version ?
Node.js fs.writeFile() Method
How to update NPM ?
Difference between promise and async await in Node.js
Roadmap to Become a Web Developer in 2022
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Convert a string to an integer in JavaScript
How to search for the exact string value in MySQL?

To search for the exact string value, use the concept of COLLATE. Let us first create a table −
mysql> create table DemoTable1620
    -> (
    -> Subject varchar(20)
    -> );
Query OK, 0 rows affected (0.42 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1620 values('mysql');
Query OK, 1 row affected (0.13 sec)
mysql> insert into DemoTable1620 values('MySql');
Query OK, 1 row affected (0.11 sec)
mysql> insert into DemoTable1620 values('mYSQL');
Query OK, 1 row affected (0.16 sec)
mysql> insert into DemoTable1620 values('MySQL');
Query OK, 1 row affected (0.26 sec)
mysql> insert into DemoTable1620 values('MYSQL');
Query OK, 1 row affected (0.20 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1620;
This will produce the following output −
+---------+
| Subject |
+---------+
| mysql   |
| MySql   |
| mYSQL   |
| MySQL   |
| MYSQL   |
+---------+
5 rows in set (0.00 sec)
Following is the query to search for the exact string value in MySQL −
mysql> select * from DemoTable1620 where Subject collate utf8_bin = 'MySQL';
This will produce the following output −
+---------+
| Subject |
+---------+
| MySQL   |
+---------+
1 row in set (0.00 sec)
C++ Boolean Expressions

A Boolean expression is a C++ expression that returns a boolean value: 1 (true) or 0 (false).
You can use a comparison operator, such as the greater than (>) operator to find out if an expression (or a variable) is true:
Or even easier:
In the examples below, we use the equal to (==) operator to evaluate an expression:
Booleans are the basis for all C++ comparisons and conditions.
You will learn more about conditions (if...else) in the next chapter.
Fill in the missing parts to print the values 1 (for true) and 0 (for false):
 isCodingFun = true;
 isFishTasty = false;
cout << ;
cout << ;

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

Python provides two built-in functions to read a line of text from standard input, which by default comes from the keyboard. These functions are −
raw_input
input
The raw_input([prompt]) function reads one line from standard input and returns it as a string (removing the trailing newline).
#!/usr/bin/python
str = raw_input("Enter your input: ")
print "Received input is : ", str
This prompts you to enter any string and it would display same string on the screen. When I typed "Hello Python!", its output is like this −
Enter your input: Hello Python
Received input is : Hello Python
The input([prompt]) function is equivalent to raw_input, except that it assumes the input is a valid Python expression and returns the evaluated result to you.
#!/usr/bin/python
str = input("Enter your input: ")
print "Received input is : ", str
This would produce the following result against the entered input −
Enter your input: [x*5 for x in range(2,10,2)]
Recieved input is : [10, 20, 30, 40]
Writing OS Independent Code in C/C++

A program that can interact with the operating system irrespective of the OS on which it runs.
Most of the compilers of c/c++ have the power to define macros that detect OS.
Some Macros of GCC compiler are −
_WIN32: macros for 32 bit and 64-bit Windows OS.
_WIN32: macros for 32 bit and 64-bit Windows OS.
_WIN64: macros for 64-bit Windows OS.
_WIN64: macros for 64-bit Windows OS.
_UNIX: macros for UNIX OS.
_UNIX: macros for UNIX OS.
_APPLE_: macros for macOS.
_APPLE_: macros for macOS.
Based on these macros defined, let’s create a program that will work irrespective of the OS −
 Live Demo
#include <iostream>
using namespace std;
int main() {
   #ifdef _WIN32
      system("dir");
   #else
      system("ls");
   #endif
      return 0;
}
This lists all files of the directory to the output screen irrespective of OS.
What are the differences between public, protected and private access specifiers in C#?

Public access specifier allows a class to expose its member variables and member functions to other functions and objects. Any public member can be accessed from outside the class.
 Live Demo
using System;
namespace Demo {
   class Rectangle {
      public double length;
      public double width;
      public double GetArea() {
         return length * width;
      }  
      public void Display() {
         Console.WriteLine("Length: {0}", length);
         Console.WriteLine("Width: {0}", width);
         Console.WriteLine("Area: {0}", GetArea());
      }
   } //end class Rectangle
   class ExecuteRectangle {
      static void Main(string[] args) {
         Rectangle r = new Rectangle();
         r.length = 7;
         r.width = 10;
         r.Display();
         Console.ReadLine();
      }
   }
}
Length: 7
Width: 10
Area: 70
Protected access specifier allows a child class to access the member variables and member functions of its base class.
Let us see an example of protected access modifier, accessing the protected members.
 Live Demo
using System;
namespace MySpecifiers {
   class Demo {
      protected string name = "Website";
      protected void Display(string str) {
         Console.WriteLine("Tabs: " + str);
      }
   }
   class Test : Demo {
      static void Main(string[] args) {
         Test t = new Test();
         Console.WriteLine("Details: " + t.name);
         t.Display("Product");
         t.Display("Services");
         t.Display("Tools");
         t.Display("Plugins");
      }
   }
}
Details: Website
Tabs: Product
Tabs: Services
Tabs: Tools
Tabs: Plugins
Private access specifier allows a class to hide its member variables and member functions from other functions and objects. Only functions of the same class can access its private members. Even an instance of a class cannot access its private members.
 Live Demo
using System;
namespace Demo {
   class Rectangle {
      //member variables
      private double length;
      private double width;
      public void Acceptdetails() {
         length = 10;
         width = 15;
      }
      public double GetArea() {
         return length * width;
      }
      public void Display() {
         Console.WriteLine("Length: {0}", length);
         Console.WriteLine("Width: {0}", width);
         Console.WriteLine("Area: {0}", GetArea());
      }
   }//end class Rectangle
   class ExecuteRectangle {
      static void Main(string[] args) {
         Rectangle r = new Rectangle();
         r.Acceptdetails();
         r.Display();
         Console.ReadLine();
      }  
   }
}
Length: 10
Width: 15
Area: 150
Tryit Editor v3.7

HTML Computer Code
Tryit: HTML var element
Tryit Editor v3.7

Tryit: SVG polygon
Dart Programming - List.reversed Method

Returns an iterable object containing the list values in the reverse order.
List.reversed 

void main() { 
   var lst = new List(); 
   lst.add(12); 
   lst.add(13); 
   print("The list values in reverse order: ${lst.reversed}"); 
}  
It will produce the following output −
The list values in reverse order: (13, 12) 


    44 Lectures 
     4.5 hours 

 Sriyank Siddhartha

    34 Lectures 
     4 hours 

 Sriyank Siddhartha

    69 Lectures 
     4 hours 

 Frahaan Hussain

    117 Lectures 
     10 hours 

 Frahaan Hussain

    22 Lectures 
     1.5 hours 

 Pranjal Srivastava

    34 Lectures 
     3 hours 

 Pranjal Srivastava
 Print
 Add Notes
 Bookmark this page
How to prevent class inheritance in C++

Here we will see how to prevent inheritance in C++. The concept of preventing the inheritance is known as final class.
In Java or C#, we can use final classes. In C++ there are no such direct way. Here we will see how to simulate the final class in C++.
Here we will create one extra class called MakeFinalClass (its default constructor is private). This function is used to solve our purpose. The main Class MyClass can call the constructor of the MakeFinalClass as they are friend classes.
One thing we have to notice, that the MakeFinalClass is also a virtual base class. We will make it virtual base class because we want to call the constructor of the MakeFinalClass through the constructor of MyDerivedClass, not MyClass (The constructor of a virtual base class is not called by the class that inherits from it, instead of the constructor that is called by the constructor of the concrete class).
#include <iostream>
using namespace std;
class MyClass;
class MakeFinalClass {
   private:
      MakeFinalClass() {
         cout << "This is constructor of the MakeFinalClass" << endl;
      }
      friend class MyClass;
};
class MyClass : virtual MakeFinalClass { //this will be final class
   public:
      MyClass() {
         cout << "This is constructor of the final Class" << endl;
      }
};
//try to make derived class
class MyDerivedClass : MyClass {
   public:
      MyDerivedClass() {
         cout << "Constructor of the Derived Class" << endl;
      }
};
main() {
   MyDerivedClass derived;
}
In constructor 'MyDerivedClass::MyDerivedClass()':
[Error] 'MakeFinalClass::MakeFinalClass()' is private
We can create the objects of the MyClass as this is friend of the MakeFinalClass, and has access to its constructors.
#include <iostream>
using namespace std;
class MyClass;
class MakeFinalClass {
   private:
      MakeFinalClass() {
         cout << "This is constructor of the MakeFinalClass" << endl;
      }
      friend class MyClass;
};
class MyClass : virtual MakeFinalClass { //this will be final class
   public:
      MyClass() {
         cout << "This is constructor of the final Class" << endl;
      }
};
main() {
   MyClass obj;
}
This is constructor of the MakeFinalClass
This is constructor of the final Class
How to prepare a Python date object to be inserted into MongoDB?

You can use the pymongo library in Python to connect to a MongoDB database and use it to insert, update, delete, etc objects in Python. The library supports Python datetime objects out of the box and you dont need to do anything special to insert dates in Mongo using PyMongo.
from pymongo import MongoClient
# This will try to connect to MongoDB on the default port and host
client = MongoClient()
db = client.test_database
# Insert the given dictionary to the objects collection:
result = db.objects.insert_one({"last_modified": datetime.datetime.utcnow()})
print("Object inserted!")
This will give the output −
Object inserted!
Note − Always use datetime.datetime.utcnow(), which returns the current time in UTC, instead of datetime.datetime.now(), which returns the current local time.
F# - Options

The option type in F# is used in calculations when there may or may not exist a value for a variable or function. Option types are used for representing optional values in calculations. They can have two possible values − Some(x) or None.
For example, a function performing a division will return a value in normal situation, but will throw exceptions in case of a zero denominator. Using options here will help to indicate whether the function has succeeded or failed.
An option has an underlying type and can hold a value of that type, or it might not have a value.
Let us take the example of division function. The following program explains this −
Let us write a function div, and send two arguments to it 20 and 5 −
let div x y = x / y
let res = div 20 5
printfn "Result: %d" res
When you compile and execute the program, it yields the following output −
Result: 4

If the second argument is zero, then the program throws an exception −
let div x y = x / y
let res = div 20 0
printfn "Result: %d" res
When you compile and execute the program, it yields the following output −
Unhandled Exception:
System.DivideByZeroException: Division by zero

In such cases, we can use option types to return Some (value) when the operation is successful or None if the operation fails.
The following example demonstrates the use of options −
let div x y =
   match y with
   | 0 -> None
   | _ -> Some(x/y)

let res : int option = div 20 4
printfn "Result: %A " res
When you compile and execute the program, it yields the following output −
Result: Some 5

The option type supports the following properties and methods −
let checkPositive (a : int) =
   if a > 0 then
      Some(a)
   else
      None

let res : int option = checkPositive(-31)
printfn "Result: %A " res
When you compile and execute the program, it yields the following output −
Result: <null>

let div x y =
   match y with
   | 0 -> None
   | _ -> Some(x/y)

let res : int option = div 20 4
printfn "Result: %A " res
printfn "Result: %A " res.Value
When you compile and execute the program, it yields the following output −
Result: Some 5
Result: 5

let isHundred = function
   | Some(100) -> true
   | Some(_) | None -> false

printfn "%A" (isHundred (Some(45)))
printfn "%A" (isHundred (Some(100)))
printfn "%A" (isHundred None)
When you compile and execute the program, it yields the following output −
false
true
false

 Print
 Add Notes
 Bookmark this page
What is MIME in the Computer Network?

MIME represents Multi-Purpose Internet Mail Extensions. It is a development to the Internet email protocol that enables its users to exchange several kinds of data files over the Internet, including images, audio, and video.
The MIME is required if the text in character sets other than the American Standard Code for Information Interchange (ASCII). Virtually, all human-written Internet email and a fairly large proportion of automated email is transmitted via Simple Mail Transfer Protocol (SMTP) in MIME format.
MIME was designed mainly for SMTP, but the content types defined by MIME standards are important also in communication protocols outside of email, such as Hypertext Transfer Protocol (HTTP).
There are five header fields represented in MIME which are as follows −
MIME-version − It denotes the MIME version being used. The current version is 1.1. It is defined as MIME-version: 1.1.
MIME-version − It denotes the MIME version being used. The current version is 1.1. It is defined as MIME-version: 1.1.
Content-type − It defines the type and subtype of the data in the body of the message. The content type and content subtype are divided by a slash. This field defines how the object in the body is to be executed. The default value is plaintext in US ASCII.
Content-type − It defines the type and subtype of the data in the body of the message. The content type and content subtype are divided by a slash. This field defines how the object in the body is to be executed. The default value is plaintext in US ASCII.
The content-type field is represented as follows −
Context-type: <type/subtype; parameters>
Content-transfer encoding − It defines how the object inside the body has been encoded to US ASCII to create it acceptable for mail transfer. Thus, it determines the method used to encode the message into 0s and 1s for transport.
Content-transfer encoding − It defines how the object inside the body has been encoded to US ASCII to create it acceptable for mail transfer. Thus, it determines the method used to encode the message into 0s and 1s for transport.
The content transfer encoding field is represented as follows −
Content-transfer-encoding : <type>
Content-Description − This field tells what the message is. It is the form of ASCII recipient will know whether it is worth decoding and reading the message.
Content-Description − This field tells what the message is. It is the form of ASCII recipient will know whether it is worth decoding and reading the message.
Content-ID − This field identifies the contents. Its format is the same as the format of the standard Message-Id header.
Content-ID − This field identifies the contents. Its format is the same as the format of the standard Message-Id header.
Function Overloading and Return Type in C++ - GeeksforGeeks

03 Jan, 2022
Function overloading is possible in C++ and Java but only if the functions must differ from each other by the types and the number of arguments in the argument list. However, functions can not be overloaded if they differ only in the return type. 
Why is Function overloading not possible with different return types? 
Function overloading comes under the compile-time polymorphism. During compilation, the function signature is checked. So, functions can be overloaded, if the signatures are not the same. The return type of a function has no effect on function overloading, therefore the same function signature with different return type will not be overloaded. 
Example: if there are two functions: int sum() and float sum(), these two will generate a compile-time error as function overloading is not possible here.
Let’s understand this further through the following programs in C++ and Java:
C++ Program:
CPP
// CPP Program to demonstrate that function overloading// fails if only return types are different#include <iostream>int fun() { return 10; }  char fun() { return 'a'; }// compiler error as it is a new declaration of fun()  // Driver Codeint main(){    char x = fun();    getchar();    return 0;}
Output
prog.cpp: In function ‘char fun()’:
prog.cpp:6:10: error: ambiguating new declaration of ‘char fun()’
char fun() { return 'a'; }
         ^
prog.cpp:4:5: note: old declaration ‘int fun()’
int fun() { return 10; }
    ^
Java Program:
Java
// Java Program to demonstrate that function overloading// fails if only return types are different  // filename Main.javapublicclass Main {public    int foo() { return 10; }public    char foo() { return 'a'; }    // compiler error as it is a new declaration of fun()public    static void main(String args[]) {}}
Output
prog.java:10: error: method foo() is already defined in class Main
   char foo() { return 'a'; }
        ^
1 error
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
anshikajain26
CPP-Functions
cpp-overloading
C++
Java
Java
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Virtual Function in C++
Templates in C++ with Examples
Constructors in C++
Operator Overloading in C++
Socket Programming in C/C++
Arrays in Java
Split() String method in Java with examples
For-each loop in Java
HashMap in Java with Examples
Reverse a string in Java