code-rag-bench/online-tutorials huggingface dataset:
How to create a Circular/Rounded images using CSS ?

20 Dec, 2020
In this article, we will create a rounded image with CSS. It can be done by using the CSS border-radius property. This property is mainly used to make round shapes. It contains a numeric value in the form of pixels.
Example 1:
HTML
<!DOCTYPE html><html>  <head>    <style>        img {            border-radius: 58%;        }    </style></head>  <body>    <h2>GeeksForGeeks</h2>      <h2>        How to create a Circular/        Rounded images using CSS?    </h2>      <img src="https://media.geeksforgeeks.org/wp-content/cdn-uploads/20190710102234/download3.png"        alt="GeeksforGeeks logo"             width="200" height="160"             border="5"></body>  </html>
Output:
Example 2:
HTML
<!DOCTYPE html><html>  <head>    <style>        img {            border-radius: 38%;        }    </style></head>  <body>    <h2>GeeksForGeeks</h2>      <h2>        How to create a Circular/        Rounded images using CSS?    </h2>      <img src="img_avatar.png"         alt="GeeksforGeeks logo"         width="200" height="160"         border="5"></body>  </html>
Output:
Supported Browsers:
Google Chrome
Internet Explorer
Firefox
Safari
Opera
CSS-Misc
CSS-Properties
CSS
HTML
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | sympy.totient() method - GeeksforGeeks

17 Sep, 2019
With the help of sympy.totient() method, we can find Euler totient function or phi(n) of a given integer. Euler totient function is the number of positive integers less than or equal to a given integer that are relatively prime to it. In other words, it is the number of integers k in the range 1 <= k <= n for which the greatest common divisor gcd(n, k) is equal to 1.
Syntax: totient(n)
Parameter:n – It denotes an integer.
Returns: Returns the number of integers less than or equal to that integer n that are relatively prime to it.
Example #1:
# import totient() method from sympyfrom sympy.ntheory.factor_ import totient  n = 24  # Use totient() method totient_n = totient(n)       print("phi({}) =  {} ".format(n, totient_n)) # 1 5 7 11 13 17 19 23
Output:
phi(24) =  8

Example #2:
# import totient() method from sympyfrom sympy.ntheory.factor_ import totient  n = 19  # Use totient() method totient_n = totient(n)       print("phi({}) =  {} ".format(n, totient_n))
Output:
phi(19) =  18

SymPy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Python String | replace()
Reading and Writing to text files in Python
*args and **kwargs in Python
Convert integer to string in Python
Check if element exists in list in Python
Create a Pandas DataFrame from Lists
Python | os.path.normpath() method - GeeksforGeeks

16 Sep, 2021
OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality. os.path module is sub module of OS module in Python used for common path name manipulation.
os.path.normpath() method in Python is used to normalize the specified path. All redundant separator and up-level references are collapsed in the process of path normalization. 
For example: A//B, A/B/, A/./B and A/foo/../B all will be normalized to A/B. 
On Windows operating system, any forward slash (‘/’) in the path is converted to backslash (‘\’).
Syntax: os.path.normpath(path)Parameter: path: A path-like object representing a file system path. Return Type: This method returns a string value which represents the normalized path.  
Code #1: Use of os.path.normpath() method 
Python3
# Python program to explain os.path.normpath() method   # importing os.path moduleimport os.path # Pathpath = '/home//user/Documents'  # Normalize the specified path# using os.path.normpath() methodnorm_path = os.path.normpath(path) # Print the normalized path print(norm_path) # Pathpath = '/home/./Documents'  # Normalize the specified path# using os.path.normpath() methodnorm_path = os.path.normpath(path) # Print the normalized path print(norm_path) # Pathpath = '/home/user/temp/../Documents' # Normalize the specified path# using os.path.normpath() methodnorm_path = os.path.normpath(path) # Print the normalized path print(norm_path)
/home/user/Documents
/home/Documents
/home/user/Documents
Code #2: Use of os.path.normpath() method (On Windows) 
Python3
# Python program to explain os.path.normpath() method   # importing os.path moduleimport os.path # Pathpath = r'C:/Users'  # Normalize the specified path# using os.path.normpath() methodnorm_path = os.path.normpath(path) # Print the normalized path print(norm_path) # Pathpath = r'C:\Users\.\Documents'  # Normalize the specified path# using os.path.normpath() methodnorm_path = os.path.normpath(path) # Print the normalized path print(norm_path) # Pathpath = r'C:\Users\admin\temp\..\Documents' # Normalize the specified path# using os.path.normpath() methodnorm_path = os.path.normpath(path) # Print the normalized path print(norm_path)
C:\\Users
C:\\Users\\Documents
C:\\Users\\admin\\Documents
 
Reference: https://docs.python.org/3/library/os.path.html 
anikakapoor
Python OS-path-module
python-os-module
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
Reading and Writing to text files in Python
*args and **kwargs in Python
Convert integer to string in Python
GATE | GATE CS 2021 | Set 2 | Question 62 - GeeksforGeeks

23 May, 2021
Consider a Boolean function f(w,x,y,z) such that
f(w,0,0,z) = 1
f(1,x,1,z) = x+z
f(w,1,y,z) = wz+y

The number of literals in the minimal sum-of-products expression of f is _________ .(A) 6(B) 3(C) 8(D) 1Answer: (A)Explanation: f(w,0,0,z) = 1When x = 0, and y = 0, the min-term will be 1 irrespective of w and z.
f(1,x,1,z) = x+zWhen w = 1 and y = 1, the min-term will be x or’d with z.
Similarly for the last one.
f(w, x, y, z) = sigma(0,1,6,7,8,9,11,13,14,15) + don’t(2,3)f(w, x, y, z) = x’y’ + wz + xy
Thus, the number of literals will be 6.Quiz of this Question
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | Gate IT 2007 | Question 25
GATE | GATE-CS-2001 | Question 39
GATE | GATE-CS-2000 | Question 41
GATE | GATE-CS-2005 | Question 6
GATE | GATE MOCK 2017 | Question 21
GATE | GATE MOCK 2017 | Question 24
GATE | GATE-CS-2006 | Question 47
GATE | Gate IT 2008 | Question 43
GATE | GATE-CS-2009 | Question 38
GATE | GATE-CS-2003 | Question 90
Properties clear() method in Java with Examples - GeeksforGeeks

28 Jun, 2021
The Java.util.Properties.clear() method is used to remove all the elements from this Properties instance. Using the clear() method only clears all the element from the Properties and does not delete the Properties. In other words, we can say that the clear() method is used to only empty an existing Properties.
Syntax:
public void clear()
Parameters: The method does not take any parameter
Return Value: The function does not returns any value.
Below programs illustrate the Java.util.Properties.clear() method.
Example 1:
// Java code illustrating clear() method  import java.util.*;  class PropertiesDemo {    public static void main(String arg[])    {        Properties gfg = new Properties();        Set URL;        String str;          gfg.put("ide",                "ide.geeksforgeeks.org");        gfg.put("contribute",                "write.geeksforgeeks.org");        gfg.put("quiz",                "quiz.geeksforgeeks.org");          // checking what's in table        System.out.println("Current Properties: "                           + gfg.toString());          System.out.println("\nClearing the Properties");        gfg.clear();          // checking what's in table now        System.out.println("New Properties: "                           + gfg.toString());    }}
Current Properties: {contribute=write.geeksforgeeks.org, quiz=quiz.geeksforgeeks.org, ide=ide.geeksforgeeks.org}
Clearing the PropertiesNew Properties: {}
Example 2:
// Java code illustrating clear() method  import java.util.*;  class PropertiesDemo {    public static void main(String arg[])    {        Properties gfg = new Properties();        Set URL;        String str;          gfg.put(1, "Geeks");        gfg.put(2, "GeeksforGeeks");        gfg.put(3, "Geek");          // checking what's in table        System.out.println("Current Properties: "                           + gfg.toString());          System.out.println("\nClearing the Properties");        gfg.clear();          // checking what's in table now        System.out.println("New Properties: "                           + gfg.toString());    }}
Current Properties: {3=Geek, 2=GeeksforGeeks, 1=Geeks}
Clearing the PropertiesNew Properties: {}
Reference: https://docs.oracle.com/javase/9/docs/api/java/util/Properties.html#clear–
Java-Functions
Java-Properties
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
HashMap in Java with Examples
Interfaces in Java
Stream In Java
How to iterate any Map in Java
ArrayList in Java
Initialize an ArrayList in Java
Stack Class in Java
Multidimensional Arrays in Java
Singleton Class in Java
Python | Pandas DatetimeIndex.weekofyear - GeeksforGeeks

24 Dec, 2018
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
Pandas DatetimeIndex.weekofyear attribute outputs the ordinal value of the week of the year for each entries of the DatetimeIndex object.
Syntax: DatetimeIndex.weekofyear
Return: Index object
Example #1: Use DatetimeIndex.weekofyear attribute to find the ordinal value of the week for each entries in the DatetimeIndex object.
# importing pandas as pdimport pandas as pd  # Create the DatetimeIndex# Here 'W' represents Weekly frequencydidx = pd.DatetimeIndex(start ='2000-01-10 06:30', freq ='W',                            periods = 3, tz ='Asia/Calcutta')  # Print the DatetimeIndexprint(didx)
Output :
Now we want to find ordinal value of the week for each entries in the DatetimeIndex object.
# find the ordinal value of the week # for each entries present in the objectdidx.weekofyear
Output :As we can see in the output, the function has returned an Index object containing the ordinal values of the weeks present in each entry of the DatetimeIndex object. Example #2: Use DatetimeIndex.weekofyear attribute to find the ordinal value of the week for each entries in the DatetimeIndex object.
# importing pandas as pdimport pandas as pd  # Create the DatetimeIndex# Here 'M' represents monthly frequencydidx = pd.DatetimeIndex(start ='2014-08-01 10:05:45', freq ='M',                               periods = 5, tz ='Asia/Calcutta')  # Print the DatetimeIndexprint(didx)
Output :
Now we want to find ordinal value of the week for each entries in the DatetimeIndex object.
# find the ordinal value of the week# for each entries present in the objectdidx.weekofyear
Output :As we can see in the output, the function has returned an Index object containing the ordinal values of the weeks present in each entry of the DatetimeIndex object.
Python pandas-datetimeIndex
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?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get unique values from a list
Python | os.path.join() method
Create a directory in Python
Python | Pandas dataframe.groupby()
Python - API.verify_credentials() in Tweepy - GeeksforGeeks

10 Jun, 2020
Twitter is a popular social network where users share messages called tweets. Twitter allows us to mine the data of any user using Twitter API or Tweepy. The data will be tweets extracted from the user. The first thing to do is get the consumer key, consumer secret, access key and access secret from twitter developer available easily for each user. These keys will help the API for authentication.
The verify_credentials() method of the API class in Tweepy module is used to verify whether the supplied user credentials are valid or invalid.
Syntax : API.verify_credentials(include_entities, skip_status, include_email)
Parameter :
include_entities : entities node will not be included when set to false, defaults to true.
skip_status : statuses will not be included in the returned user objects, defaults to false.
include_email : email will be returned in the user objects as a string.
Returns : an object of class User
Example 1 :
# import the moduleimport tweepy  # assign the values accordinglyconsumer_key = ""consumer_secret = ""access_token = ""access_token_secret = ""  # authorization of consumer key and consumer secretauth = tweepy.OAuthHandler(consumer_key, consumer_secret)  # set access to user's access key and access secret auth.set_access_token(access_token, access_token_secret)  # calling the api api = tweepy.API(auth)  if api.verify_credentials() == False:    print("The user credentials are invalid.")else:    print("The user credentials are valid.")
Output :
The user credentials are valid.

Example 2 : Fetching the verified user.
# fetching the verified useruser = api.verify_credentials()  # printing the informationprint("The user has " + str(user.followers_count) + " followers.")print("The user has " + str(user.friends_count) + " friends.")
Output :
The user has 44 followers.
The user has 1016 friends.

Python-Tweepy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
Convert integer to string in Python
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python-Quizzes | Python List Quiz | Question 10 - GeeksforGeeks

17 Sep, 2020
Question 10: Find the output of the following program:
list1 = ['physics', 'chemistry', 1997, 2000]   print (list1[1][-1])
(A) p(B) y(C) 7(D) 2Answer: (B)Explanation: In python, we can slice a list but we can also slice an element within the list if it is a string. The declaration list[x][y] will mean that ‘x’ is the index of the element within a list and ‘y’ is the index of an entity within that string.Quiz of this Question
Python-Quizzes
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python-Quizzes | Python Dictionary Quiz | Question 23
Python | Animated Banner showing 'GeeksForGeeks'
Why do people prefer Selenium with Python?
Python | Miscellaneous | Question 4
Python | Miscellaneous | Question 6
Python | Output Type | Question 4
Python-Quizzes | Python Dictionary Quiz | Question 1
Python | Output Type | Question 3
Python-Quizzes | Output Type | Question 12
Python-Quizzes | Python List Quiz | Question 2
What is a dot operator in Python?

Almost everything in Python is an object. Every object has certain attributes and methods. The connection between the attributes or the methods with the object is indicated by a “dot” (”.”) written between them.
For example if dog is a class, then a dog named Fido would be its instance/object.
class Dog:
Fido = Dog()
If methods of the class are like eats(), runs(), sleeps() we can write Fido.eats(), Fiido.runs(), Fido.sleeps() and say Fido has attributes like Fido.size = tall, Fido.hair_color = brown
So dot notation makes it possible to access the attributes, methods and instances of a class and to access attributes and methods of the class instances.
WML - Server Side Scripts

If you already know how to write server side scripts for Web Application, then for you this is very simple to write Server Side program for WML applications. You can use your favorite server-side technology to do the processing required by your mobile Internet application.
At the server side, the parameter name will be used to retrieve the form data.
Consider the following example from previous chapter to submit name, age and sex of a person:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">

<wml>

<card id="card1" title="WML Form">
<p>
   Name: <input name="name" size="12"/>
   Sex : <select name="sex">
      <option value="male">Male</option>
      <option value="female">Female</option>
      </select>
   Age :  <input name="age" size="12" format="*N"/>
   <anchor>
      <go method="get" href="process.php">
          <postfield name="name" value="$(name)"/>
          <postfield name="age" value="$(age)"/>
          <postfield name="sex" value="$(sex)"/>
      </go>
      Submit Data
    </anchor>
</p>
</card>

</wml>
Now, we can write a server side script to handle this submitted data in using either PHP, PERL, ASP or JSP. I will show you a server side script written in PHP with HTTP GET method.
Put the following PHP code in process.php file in same directory where you have your WML file.
<?php echo 'Content-type: text/vnd.wap.wml'; ?>
<?php echo '<?xml version="1.0"?'.'>'; ?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">

<wml>
  
  <card id="card1" title="WML Response">
    <p>
      Data received at the server:<br/>
      Name: <?php echo $_GET["name"]; ?><br/>
      Age: <?php echo $_GET["age"]; ?><br/>
      Sex: <?php echo $_GET["sex"]; ?><br/>
    </p>
  </card>

</wml>
If you are using HTTP POST method, then you have to write PHP script accordingly to handle received data. While sending output back to the browser, remember to set the MIME type of the document to "text/vnd.wap.wml".
This way, you can write full fledged Web Application where lot of database transactions are involved.
You can use PERL CGI Concepts to write a dynamic WAP site.
 Print
 Add Notes
 Bookmark this page
JavaScript code to find nth term of a series - Arithmetic Progression (AP)

We are required to write a JavaScript function that takes in three numbers as argument (first two numbers are supposed to be the starting two consecutive terms of an arithmetic progression).
And the third number, say n, is the 1 index-based element of the series whose value we are required to calculate
For example −
If the input is 2, 5, 7
Then the series will be −
2, 5, 8, 11, 14, 17, 20
And the output should be 20.
Following is the code −
const a = 2, b = 5;
const N = 7;
const findNthTerm = (first, second, num) => {
   const diff = second - first;
   const fact = (num - 1) * diff;
   const term = first + fact;
   return term;
};
console.log(findNthTerm(a, b, N));
Following is the output in the console −
20
Count of N-digit Palindrome numbers - GeeksforGeeks

10 Mar, 2022
Given an integer N, the task is to find the count of N-digit Palindrome numbers.Examples:  
Input: N = 1 Output: 9 {1, 2, 3, 4, 5, 6, 7, 8, 9} are all the possible single digit palindrome numbers.Input: N = 2 Output: 9  
 
Approach: The first digit can be any of the 9 digits (not 0) and the last digit will have to be same as the first in order for it to be palindrome, the second and the second last digit can be any of the 10 digits and same goes for the rest of the digits. So, for any value of N, the count of N-digit palindromes will be 9 * 10(N – 1) / 2.Below is the implementation of the above approach:  
C++
Java
Python3
C#
Javascript
// C++ implementation of the approach#include <bits/stdc++.h>using namespace std; // Function to return the count// of N-digit palindrome numbersint nDigitPalindromes(int n){    return (9 * pow(10, (n - 1) / 2));} // Driver codeint main(){    int n = 2;     cout << nDigitPalindromes(n);     return 0;}
// Java implementation of the approachclass GFG{     // Function to return the count// of N-digit palindrome numbersstatic int nDigitPalindromes(int n){    return (9 * (int)Math.pow(10,           (n - 1) / 2));} // Driver codepublic static void main(String []args){    int n = 2;     System.out.println(nDigitPalindromes(n));}} // This code is contributed by Code_Mech
# Python3 implementation of the approach # Function to return the count# of N-digit palindrome numbersdef nDigitPalindromes(n) :     return (9 * pow(10, (n - 1) // 2)); # Driver codeif __name__ == "__main__" :     n = 2;     print(nDigitPalindromes(n)); # This code is contributed by AnkitRai01
// C# implementation of the approachusing System;     class GFG{     // Function to return the count// of N-digit palindrome numbersstatic int nDigitPalindromes(int n){    return (9 * (int)Math.Pow(10,           (n - 1) / 2));} // Driver codepublic static void Main(String []args){    int n = 2;     Console.WriteLine(nDigitPalindromes(n));}} // This code is contributed by Rajput-Ji
<script> // Javascript implementation of the approach // Function to return the count// of N-digit palindrome numbersfunction nDigitPalindromes(n){    return (9 * Math.pow(10, parseInt((n - 1) / 2)));} // Driver codevar n = 2;document.write(nDigitPalindromes(n)); </script>
9
 
Time Complexity: O(log n)
Auxiliary Space: O(1)
ankthon
Code_Mech
Rajput-Ji
noob2000
subhammahato348
palindrome
Mathematical
Mathematical
palindrome
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Program to find sum of elements in a given array
Modulo Operator (%) in C/C++ with Examples
Merge two sorted arrays
The Knight's tour problem | Backtracking-1
Operators in C / C++
Algorithm to solve Rubik's Cube
Prime Numbers
Program for factorial of a number
Find minimum number of coins that make a given value
Calculation of address of element of 1-D, 2-D, and 3-D using row-major and column-major order
Batch Script - Mid String

This is used to extract a substring via the position of the characters in the string.
@echo off 
set str = Helloworld 
echo %str%

set str = %str:~5,10% 
echo %str%
The key thing to note about the above program is, ~5,10 is used to specify the characters which needs to be displayed. In this case, we want character 5 to 10 should be displayed.
The above command produces the following output.
Helloworld 
world

 Print
 Add Notes
 Bookmark this page
Write a program to reverse an array or string in C++

Here, we are given an array or a string of characters. We will create a program to reverse the elements of an array or string.
Let’s take an example to understand the problem,
array = {2, 5, 7, 1, 9}
{9, 1, 7, 5, 2}
string = “Hello!”
!0lleH
To create a program, we will loop through the elements of the array/string(both work in the same way). Taking one variable for start and one of end. And swap both elements. Increment the start variable and decrement the end variable. The swapping will continue till start variable’s value is less than end variable.
The program can be created in two ways, one is iterative and the other is recursive. We will create program that will demonstrate the working of both methods.
 Live Demo
Program :
#include <iostream>
using namespace std;
void revereseArrayIt(int arr[], int start, int end){
   while (start < end){
      int temp = arr[start];
      arr[start] = arr[end];
      arr[end] = temp;
      start++;
      end--;
   }
}
int main() {
   int arr[] = {6, 9, 1, 4, 0, 5};
   int n = sizeof(arr) / sizeof(arr[0]);
   cout<<"Orignal Array : ";
   for (int i = 0; i < n; i++)
      cout<<arr[i]<<" ";
   cout<<endl;
      revereseArrayIt(arr, 0, n-1);
      cout << "Reversed array : ";
      for (int i = 0; i < n; i++)
         cout<<arr[i]<<" ";
   cout<<endl;
   return 0;
}

Orignal Array : 6 9 1 4 0 5
Reversed array : 5 0 4 1 9 6
 Live Demo
#include <iostream>
using namespace std;
void revereseArrayRec(int arr[], int start, int end){
   if(start >= end)
      return;
   int temp = arr[start];
   arr[start] = arr[end];
   arr[end] = temp;
   revereseArrayRec(arr,start+1, end-1);
}
int main() {
   int arr[] = {6, 9, 1, 4, 0, 5};
   int n = sizeof(arr) / sizeof(arr[0]);
   cout<<"Orignal Array : ";
   for (int i = 0; i < n; i++)
      cout<<arr[i]<<" ";
   cout<<endl;
      revereseArrayRec(arr, 0, n-1);
      cout << "Reversed array : ";
      for (int i = 0; i < n; i++)
         cout<<arr[i]<<" ";
   cout<<endl;
   return 0;
}
Orignal Array : 6 9 1 4 0 5
Reversed array : 5 0 4 1 9 6
I want to round a number to 2 decimal places in SAPUI5. Could anyone help?

RoundingMode function is used for rounding the number and it uses these parameters: number and how many decimal digits.
You can roundoff and your code will be like this:
<Input value="{
   path: 'helloPanel>/recipient/amount',
   type: 'sap.ui.model.type.Float',
   formatOptions: {
      maxFractionDigits: 2,
      roundingMode: 'away_from_zero'
   }
}"/>
Cube - CUBESETCOUNT Function

The CUBESETCOUNT function returns the number of items in a set.
CUBESETCOUNT (set)

A text string of a Microsoft Excel expression that evaluates to a set defined by the CUBESET function.
OR
The CUBESET function.
OR
A reference to a cell that contains the CUBESET function.
When the CUBESETCOUNT function evaluates, it temporarily displays a "#GETTING_DATA..." message in the cell before all of the data is retrieved.
Excel 2007, Excel 2010, Excel 2013, Excel 2016

    296 Lectures 
     146 hours 

 Arun Motoori

    56 Lectures 
     5.5 hours 

 Pavan Lalwani

    120 Lectures 
     6.5 hours 

 Inf Sid

    134 Lectures 
     8.5 hours 

 Yoda Learning

    46 Lectures 
     7.5 hours 

 William Fiset

    25 Lectures 
     1.5 hours 

 Sasha Miller
 Print
 Add Notes
 Bookmark this page
How to modify an array value of a JSON object in JavaScript?

Modifying an array is just like modifying an object when that array is inside the object. The normal general principles will apply here.
In the following example, Initially in the 'companies' array, the first element is 'Tesla'. But after modifying the first element is changed to 'SolarCity' and the result is displayed in the output.
Live Demo
<html>
<body>
<script>
   var res1 = "";
   var res2 = "";
   var obj = {
      "name":"Elon musk",
      "age":48,
      "companies": [
         "Tesla", "Spacex", "Neuralink"
      ]
   }
   for (var i in obj.companies) {
      res1 += obj.companies[i] + "</br>"
   }
   document.write("Before change: " +" "+res1);
   obj.companies[0] = "SolarCity";
   for (var i in obj.companies) {
      res2 += obj.companies[i] + "</br>"
   }
   document.write("After change:" +" "+res2);
</script>
</body>
</html>
Before change: Tesla
Spacex
Neuralink
After change: SolarCity
Spacex
Neuralink
time.Time.UTC() Function in Golang with Examples - GeeksforGeeks

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

Here, “t” is the stated time in UTC.
Return Value: It returns t with the location that is set to UTC.
Example 1:
// Golang program to illustrate the usage of// Time.UTC() function  // Including main packagepackage main  // Importing fmt and timeimport (    "fmt"    "time")  // Calling mainfunc main() {      // Defining t for UTC method    t := time.Date(2020, 11, 14, 11, 30, 32, 0, time.UTC)      // Calling UTC method    utc := t.UTC()      // Prints output    fmt.Printf("%v\n", utc)}
Output:
2020-11-15 21:23:32 +0000 UTC

Example 2:
// Golang program to illustrate the usage of// Time.UTC() function  // Including main packagepackage main  // Importing fmt and timeimport (    "fmt"    "time")  // Calling mainfunc main() {      // Defining t for UTC method    t := time.Date(2020, 23, 40, 56, 70, 0, 0, time.UTC)      // Calling UTC method    utc := t.UTC()      // Prints output    fmt.Printf("%v\n", utc)}
Output:
2021-12-12 09:10:00 +0000 UTC

Here, the time “t” stated in the above code have values that are out of usual range but they are normalized while conversion.
GoLang-time
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
strings.Replace() Function in Golang With Examples
fmt.Sprintf() Function in Golang With Examples
How to Split a String in Golang?
Arrays in Go
Golang Maps
Slices in Golang
How to convert a string in lower case in Golang?
How to compare times in Golang?
How to Trim a String in Golang?
Inheritance in GoLang
How to calculate combination and permutation in C++?

Combination and permutation are a part of Combinatorics. Permutation is the different arrangements that a set of elements can make if the elements are taken one at a time, some at a time or all at a time. Combination is is the different ways of selecting elements if the elements are taken one at a time, some at a time or all at a time.
Number of permutations when there are total n elements and r elements need to be arranged.
Number of combinations when there are total n elements and r elements need to be selected.
A program that calculates combination and permutation in C++ is given as follows.
#include <iostream>
using namespace std;
int fact(int n) {
   if (n == 0 || n == 1)
   return 1;
   else
   return n * fact(n - 1);
}
int main() {
   int n, r, comb, per;
   cout<<"Enter n : ";
   cin>>n;
   cout<<"\nEnter r : ";
   cin>>r;
   comb = fact(n) / (fact(r) * fact(n-r));
   cout << "\nCombination : " << comb;
   per = fact(n) / fact(n-r);
   cout << "\nPermutation : " << per;
   return 0;
}
The output of the above program is as follows.
Enter n : 5
Enter r : 3
Combination : 10
Permutation : 60
Difference between concat() and + operator in Java

Java provides two ways in order to append strings and make them one. These two methods are namely Concat() method and + operator. Both are developed for the same functionality but still have some major differences.
The following are the important differences between concat method and + operator.
ConcatDemo.java
public class ConcatDemo {
   public static void main(String args[]){
      String s = "I am ";
      s = s.concat("Indian");
      System.out.println(s);
   }
}
I am Indian
 Live Demo
OperatorDemo.java
public class OperatorDemo {
   public static void main(String args[]){
      String s1 = "I am ";
      String s2 = "Indian";
      String s3 = s2 + s1;
      System.out.println(s3);
   }
}
Indian I am
Convert set into a list in Python

As part of data analysis using Python we may be required to to convert the data container from set to list. In this article we'll see e how to solve this requirement.
This is a straightforward approach in which we directly apply the list function on the given set. The elements get converted into elements of a list.
 Live Demo
setA = {'Mon', 'day', '7pm'}
# Given Set
print("Given set : \n", setA)
res = (list(setA) )
# Result
print("Final list: \n",res)
Running the above code gives us the following result −
Given set :
['7pm', 'Mon', 'day']
Final list:
['7pm', 'Mon', 'day']
The star operator can take in the list and by applying the square brackets around it we get a list.
setA = {'Mon', 'day', '7pm'}
# Given Set
print("Given set : \n", setA)
res = [*setA, ]
# Result
print("Final list: \n",res)
Running the above code gives us the following result −
Given set :
{'Mon', '7pm', 'day'}
Final list:
['Mon', '7pm', 'day']
C++ List Library - swap() Function

The C++ function std::list::swap() exchanges the contents of the first list with another. This function changes size of list if necessary.
Following is the declaration for std::list::swap() function form std::list header.
template <class T, class Alloc>
void swap (list<T,Alloc>& first, list<T,Alloc>& second);

first − First list object.
first − First list object.
second − Second list object.
second − Second list object.
None.
This function never throws exception.
Linear i.e. O(n)
The following example shows the usage of std::list::swap() function.
#include <iostream>
#include <list>

using namespace std;

int main(void) {
   list<int> l1 = {1, 2, 3};
   list<int> l2 = {10, 20, 30, 40, 50};

   cout << "List l1 contains following elements before swap operation" << endl;
   for (auto it = l1.begin(); it != l1.end(); ++it)
      cout << *it << endl;

   cout << "List l2 contains following elements before swap operation" << endl;
   for (auto it = l2.begin(); it != l2.end(); ++it)
      cout << *it << endl;

   swap(l1, l2);

   cout << "List l1 contains following elements after swap operation" << endl;
   for (auto it = l1.begin(); it != l1.end(); ++it)
      cout << *it << endl;

   cout << "List l2 contains following elements after swap operation" << endl;
   for (auto it = l2.begin(); it != l2.end(); ++it)
      cout << *it << endl;

   return 0;
}
Let us compile and run the above program, this will produce the following result −
List l1 contains following elements before swap operation
1
2
3
List l2 contains following elements before swap operation
10
20
30
40
50
List l1 contains following elements after swap operation
10
20
30
40
50
List l2 contains following elements after swap operation
1
2
3

 Print
 Add Notes
 Bookmark this page
How to set location of JLabel in a JFrame with Java?

To set location of a component in a JFrame, use the setBounds() method. Let us first create a frame and a panel −
JFrame frame = new JFrame("Demo Frame");
JPanel panel = new JPanel();
frame.getContentPane();
Create a component i.e. label and set the dimensions using setBounds(). Here, you can set the location in the form of x and y coordinates −
JLabel label = new JLabel("Demo Label!");
Dimension size = label.getPreferredSize();
label.setBounds(150, 100, size.width, size.height);
The following is an example to set location of a label in a JFrame −
package my;
import java.awt.Dimension;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
public class SwingDemo {
   public static void main(String[] args) {
      JFrame frame = new JFrame("Demo Frame");
      JPanel panel = new JPanel();
      frame.getContentPane();
      JLabel label = new JLabel("Demo Label!");
      Dimension size = label.getPreferredSize();
      label.setBounds(150, 100, size.width, size.height);
      panel.setLayout(null);
      panel.add(label);
      panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
      frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
      frame.add(panel);
      frame.setSize(500, 300);
      frame.setVisible(true);
   }
}
C++ User Input

You have already learned that cout is used to output (print) values. Now we will use cin to get user input.
cin is a predefined variable that reads data from the keyboard with the extraction operator (>>).
In the following example, the user can input a number, which is stored in the 
variable x. Then we print the value of x:
cout is pronounced "see-out". Used for output, and uses the insertion operator (<<)
cin is pronounced "see-in". Used for input, and uses the extraction operator (>>)
In this example, the user must input two numbers. Then we print the 
sum by calculating (adding) the two numbers:
There you go! You just built a basic calculator!
Use the correct keyword to get user input, stored in the variable x:
int x;
cout << "Type a number: ";
 >> ;

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.
Angular 2 - CLI

Command Line Interface (CLI) can be used to create our Angular JS application. It also helps in creating a unit and end-to-end tests for the application.
The official site for Angular CLI is https://cli.angular.io/
If you click on the Get started option, you will be directed to the github repository for the CLI https://github.com/angular/angular-cli
Let’s now look at some of the things we can do with Angular CLI.
Note − Please ensure that Python is installed on the system. Python can be downloaded from the site https://www.python.org/
The first step is to install the CLI. We can do this with the following command −
npm install –g angular-cli

Now, create a new folder called angularCLI in any directory and issue the above command.
Once done, the CLI will be installed.
Angular JS project can be created using the following command.
ng new Project_name

Project_name − This is the name of the project which needs to be created.
None.
Let’s execute the following command to create a new project.
ng new demo2

It will automatically create the files and start downloading the necessary npm packages.
Now in Visual Studio code, we can open the newly created project.
To run the project, you need to issue the following command −
ng server

The default port number for the running application is 4200. You can browse to the port and see the application running.

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    28 Lectures 
     2.5 hours 

 Anadi Sharma

    11 Lectures 
     7.5 hours 

 SHIVPRASAD KOIRALA

    16 Lectures 
     2.5 hours 

 Frahaan Hussain

    69 Lectures 
     5 hours 

 Senol Atac

    53 Lectures 
     3.5 hours 

 Senol Atac
 Print
 Add Notes
 Bookmark this page
Convert String into Binary Sequence in C++

In this tutorial, we will be discussing a program to convert string into Binary sequence.
For this we will be provided with a string of characters. Our task is to convert each of the character into its binary equivalent and print it out spaced between for different characters.
 Live Demo
#include <bits/stdc++.h>
using namespace std;
//converting into binary equivalent
void convert_binary(string s){
   int n = s.length();
   for (int i = 0; i <= n; i++){
      //converting to ascii value
      int val = int(s[i]);
      //converting ascii to binary equivalent
      string bin = "";
      while (val > 0){
         (val % 2)? bin.push_back('1') :
         bin.push_back('0');
         val /= 2;
      }
      reverse(bin.begin(), bin.end());
      cout << bin << " ";
   }
}
int main(){
   string s = "tutorialspoint";
   convert_binary(s);
   return 0;
}
1110100 1110101 1110100 1101111 1110010 1101001 1100001 
1101100 1110011 1110000 1101111 1101001 1101110 1110100
Find the Smallest Divisor Given a Threshold in C++

Suppose we have an array of integers called nums and an integer k, that is threshold value, we will choose a positive integer divisor and divide all the array by it and sum the result of the division. We have to find the smallest divisor such that the result mentioned above is less than or equal to threshold value k. For example − if nums = [1,2,5,9] and k = 6, then the output will be 5. We can get the sum as (1+2+5+9) = 17 when the divisor is 1. If the divisor is 4, then we can get the sum 7 as (1+1+2+3), when the divisor is 5, then the sum will be (1+1+1+2) = 5
It is guaranteed that there will be an answer.
To solve this, we will follow these steps −
define one method called check, this will take three parameters like x, array nums and k, this will be as follows −
sum := 0
for i in range 0 to size of nums – 1sum := sum + ceiling value of nums[i] / x
sum := sum + ceiling value of nums[i] / x
return true, if sum <= k, otherwise false
The actual method will be like below −
set low := 1 and high := inf
while low < highmid := low + (high – low)/2if check(mid, nums, k), then high := mid, otherwise low := mid + 1
mid := low + (high – low)/2
if check(mid, nums, k), then high := mid, otherwise low := mid + 1
return high
Let us see the following implementation to get better understanding −
 Live Demo
#include <bits/stdc++.h>
using namespace std;
class Solution {
   public:
   bool ok(int x, vector <int> &nums, int th){
      int sum = 0;
      for(int i = 0; i < nums.size(); i++){
         sum += ceil((double)nums[i]/(double)x);
      }
      return sum<=th;
   }
   int smallestDivisor(vector<int>& nums, int th) {
      int low = 1;
      int high = 1e7;
      while(low < high){
         int mid = low + (high - low)/2;
         if(ok(mid, nums, th)){
            high = mid;
         }else low = mid + 1;
      }
      return high;
   }
};
main(){
   vector<int> v = {1,2,5,9};
   Solution ob;
   cout << (ob.smallestDivisor(v, 6));
}
[1,2,5,9]
6
5
Lodash _.last() Method - GeeksforGeeks

22 Jul, 2020
Lodash is a JavaScript library that works on the top of Underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc. The _.last() method is used to get the last element of the array i.e. (n-1)th element.
Syntax:
lodash.last( array )
Parameters: This function accepts single parameter i.e. the array.
Return Value: It returns the last element of the array.
Note: Please install lodash module by npm install lodash before using the below given code.
Example 1:
javascript
// Requiring the lodash libraryconst _ = require("lodash");  // Original arraylet array1 = ["a", "b", "c", "d", "e"]  // Using _.last() methodlet value = _.last(array1);  // Printing original Arrayconsole.log("original Array1: ", array1)  // Printing the valueconsole.log("value: ", value)
Output:
Example 2:
javascript
// Requiring the lodash libraryconst _ = require("lodash");  // Original arraylet array1 = []  // Using _.last() methodlet value = _.last(array1);  // Printing original Arrayconsole.log("original Array1: ", array1)  // Printing the valueconsole.log("value: ", value)
Output: 
JavaScript-Lodash
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between var, let and const keywords in JavaScript
Convert a string to an integer in JavaScript
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
How to Open URL in New Tab using JavaScript ?
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
MySQL select query with multiple WHERE?

To implement multiple WHERE, use the IN() IN MySQL.
Following is the syntax:
select *from yourTableName where yourColumnName IN(yourValue1,yourValue2,...N);
Let us first create a table -
mysql> create table DemoTable
   (
   Id int,
   Name varchar(100)
   );
Query OK, 0 rows affected (0.61 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values(10,'John');
Query OK, 1 row affected (0.18 sec)
mysql> insert into DemoTable values(59,'Carol');
Query OK, 1 row affected (0.14 sec)
mysql> insert into DemoTable values(20,'Sam');
Query OK, 1 row affected (0.15 sec)
mysql> insert into DemoTable values(45,'David');
Query OK, 1 row affected (0.73 sec)
Display all records from the table using select statement -
mysql> select *from DemoTable;
+------+-------+
| Id   | Name  |
+------+-------+
| 10   | John  |
| 59   | Carol |
| 20   | Sam   |
| 45   | David |
+------+-------+
4 rows in set (0.00 sec)
Following is the query to implement multiple WHERE -
mysql> select *from DemoTable where Id IN(59,45);
+------+-------+
| Id   | Name  |
+------+-------+
| 59   | Carol |
| 45   | David |
+------+-------+
2 rows in set (0.14 sec)
How to write PHP script by using MySQL JOINS inside it to join two MySQL tables?

We can use the syntax of MySQL JOIN for joining two tables into the PHP function – mysql_query(). This function is used to execute the SQL command and later another PHP function – mysql_fetch_array() can be used to fetch all the selected data.
To illustrate it we are having the following example −
In this example, we are using two MySQL tables which have the following data −
mysql> SELECT * FROM tcount_tbl;
+-----------------+----------------+
| tutorial_author | tutorial_count |
+-----------------+----------------+
| mahran          |      20        |
| mahnaz          |      NULL      |
| Jen             |      NULL      |
| Gill            |      20        |
| John Poul       |       1        |
| Sanjay          |       1        |
+-----------------+----------------+
6 rows in set (0.01 sec)

mysql> SELECT * from tutorials_tbl;
+-------------+----------------+-----------------+-----------------+
| tutorial_id | tutorial_title | tutorial_author | submission_date |
+-------------+----------------+-----------------+-----------------+
|      1      |   Learn PHP    |   John Poul     |   2007-05-24    |
|      2      | Learn MySQL    |   Abdul S       |   2007-05-24    |
|      3      | JAVA Tutorial  |   Sanjay        |   2007-05-06    |
+-------------+----------------+-----------------+-----------------+
3 rows in set (0.00 sec)
Now, the following is a PHP script that will join the tables to select all the authors from table tutorials_tbl and will pick up the corresponding number of tutorials from the tcount_tbl.
<?php
   $dbhost = 'localhost:3036';
   $dbuser = 'root';
   $dbpass = 'rootpassword';
   $conn = mysql_connect($dbhost, $dbuser, $dbpass);

   if(! $conn ) {
      die('Could not connect: ' . mysql_error());
   }

   $sql = 'SELECT a.tutorial_id, a.tutorial_author, b.tutorial_count
   FROM tutorials_tbl a, tcount_tbl b
   WHERE a.tutorial_author = b.tutorial_author';

   mysql_select_db('TUTORIALS');
   $retval = mysql_query( $sql, $conn );

   if(! $retval ) {
      die('Could not get data: ' . mysql_error());
   }

   while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) {
      echo "Author:{$row['tutorial_author']} <br> ".
         "Count: {$row['tutorial_count']} <br> ".
         "Tutorial ID: {$row['tutorial_id']} <br> ".
         "--------------------------------<br>";
   }
   echo "Fetched data successfully\n";
   mysql_close($conn);
?>
Batch Script - TASKKILL

This batch command ends one or more tasks.
Taskkill /im [taskname]

@echo off 
Taskkill /im mspaint.exe
The above command will send a termination message to any open programs of MS Paint.
 Print
 Add Notes
 Bookmark this page
Ways to print escape characters in C#

The following are the escape characters in C# and the display column suggests how to use and print them in C# −
The following is an example showing how to use some of the escape characters in C# −
 Live Demo
using System;
using System.Collections.Generic;

class Demo {
   static void Main() {

      Console.WriteLine("Warning!" + '\u0007');
      Console.WriteLine("Demo Text \t Demo Text");
      Console.WriteLine("This is it!\nThis is on the next line!");
   }
}
Warning!u0007
Demo Text Demo Text
This is it!
This is on the next line!