code-rag-bench/online-tutorials huggingface dataset:
DAX Logical - OR function

Checks whether one of the arguments is TRUE. Returns TRUE if at least one of the arguments is TRUE and returns FALSE if both the arguments are FALSE.
OR (<logical1>, <logical2>) 

TRUE if any of the two arguments is TRUE.
FALSE if both the arguments are FALSE.
DAX OR function takes only two arguments. If you have more than two arguments, either nest the OR functions or use the logical OR operator ||.
= OR (Results[Medal Count]>150,Results[Count of Sport]>150) 
= OR ([Medal Count]<500, [Count of Sport]>100) 
Both the above DAX formulas return True as [Count of Sport] > 100 is True. 
OR ([Medal Count]<500, [Count of Sport]<100) 
Returns False as both arguments are False. 

    53 Lectures 
     5.5 hours 

 Abhay Gadiya

    24 Lectures 
     2 hours 

 Randy Minder

    26 Lectures 
     4.5 hours 

 Randy Minder
 Print
 Add Notes
 Bookmark this page
Python – Sort Dictionary List by Key’s ith Index value

When it is required to sort the list of dictionary based on the key’s ‘i’th index value, the ‘sorted’ method and the lambda methods are used.
Below is a demonstration of the same −
my_list = [{"Python" : "Best", "to" : "Code"},
   {"Python" : "Good", "to" : "Learn"},
   {"Python" : "object", "to" : "cool"},
   {"Python" : "oriented", "to" : "language"}]

print("The list is : " )
print(my_list)

K = "Python"
print("The value of K is ")
print(K)

i = 2
print("The value of i is :")
print(i)

my_result = sorted(my_list, key = lambda sub: sub[K][i])

print("The resultant list is : ")
print(my_result)
The list is :
[{'Python': 'Best', 'to': 'Code'}, {'Python': 'Good', 'to': 'Learn'}, {'Python': 'object', 'to': 'cool'},
{'Python': 'oriented', 'to': 'language'}]
The value of K is
Python
The value of i is :
2
The resultant list is :
[{'Python': 'oriented', 'to': 'language'}, {'Python': 'object', 'to': 'cool'}, {'Python': 'Good', 'to':
'Learn'}, {'Python': 'Best', 'to': 'Code'}]
A list of dictionaries is created and displayed on the console.
A list of dictionaries is created and displayed on the console.
The value of 'K' is defined and is displayed on the console.
The value of 'K' is defined and is displayed on the console.
The value of 'i' is defined and is displayed on the console.
The value of 'i' is defined and is displayed on the console.
The 'sorted' method is used to sort the list using the lambda function as the key.
The 'sorted' method is used to sort the list using the lambda function as the key.
This is assigned to a variable.
This is assigned to a variable.
This variable is displayed as the output on the console.
This variable is displayed as the output on the console.
Find sum and average of List in Python - GeeksforGeeks

29 Aug, 2020
Given a List. The task is to find the sum and average of the list. Average of the list is defined as the sum of the elements divided by the number of the elements.
Examples:
Input: [4, 5, 1, 2, 9, 7, 10, 8]
Output:
sum =  46
average =  5.75

Input: [15, 9, 55, 41, 35, 20, 62, 49]
Output:
sum =  286
average =  35.75

Method 1: Naive method
In this method, we will iterate over the list of and will add each element to a variable count which stores the sum of the ith element and then dividing the sum with the total number of variables to find the average.
Example:
Python3
# Python program to find the sum# and average of the list  L = [4, 5, 1, 2, 9, 7, 10, 8]    # variable to store the sum of # the listcount = 0  # Finding the sumfor i in L:    count += i      # divide the total elements by# number of elementsavg = count/len(L)  print("sum = ", count)print("average = ", avg)
Output:
sum =  46
average =  5.75

Method 2: Using sum() method
sum() method returns the sum of the list passed as its argument. Then we will divide the sum by the len() method to find the average.
Example:
Python3
# Python program to find the sum# and average of the list  L = [4, 5, 1, 2, 9, 7, 10, 8]    # using sum() methodcount = sum(L)  # finding averageavg = count/len(L)  print("sum = ", count)print("average = ", avg)
Output:
sum =  46
average =  5.75

Python list-programs
python-list
Python
Python Programs
python-list
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Check if element exists in list in Python
Python | os.path.join() method
Defaultdict in Python
Python | Split string into list of characters
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python program to check whether a number is Prime or not
How to find all the different combinations of opening and closing brackets from the given number k using C#?

Create a backtrack function that updates the current string if open brackets are less than n or close bracket are less than open bracket. When the length of current string becomes equal to 2*n, add it to the combination result array. It could be simply tracked by keeping the number of { } placed . We can start an opening bracket if we still have one left to place. And we can start a closing bracket if it would not exceed the number of opening brackets.
 Live Demo
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace ConsoleApplication{
   public class BackTracking{
      public void Brackets(){
         char[] arr = new char[4];
         FindSequence(arr, 0, 2, 0, 0);
      }
      private static void FindSequence(char[] arr, int index, int N, int openBracket, int closeBracket){
         if (closeBracket == N){
            StringBuilder s = new StringBuilder();
            for (int i = 0; i < arr.Length; i++){
               s.Append(arr[i]);
            }
            Console.WriteLine(s);
            s = null;
               return;
         }
         else{
            if (openBracket > closeBracket){
               arr[index] = '}';
               FindSequence(arr, index + 1, N, openBracket, closeBracket + 1);
            }
            if (openBracket < N){
               arr[index] = '{';
               FindSequence(arr, index + 1, N, openBracket + 1, closeBracket);
            }
         }
      }
   }
   class Program{
      static void Main(string[] args){
         BackTracking b = new BackTracking();
         b.Brackets();
      }
   }
}
{}{}
{{}}
How to plot a pcolor colorbar in a different subplot in Matplotlib?

To plot a pcolor colorbar in a different subplot in Matplotlib, we can take the following steps −
Set the figure size and adjust the padding between and around the subplots.
Create a figure and a set of subplots wuth two rows and two columns.
Make a list of colormaps.
Iterate the axes and create a pseudocolor plot with a non-regular rectangular grid.
Make colorbars with the same axes of pcolormesh.
To display the figure, use show() method.
import matplotlib.pyplot as plt
import numpy as np

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

fig, axs = plt.subplots(2, 2)
cm = ['plasma', 'copper']

for col in range(2):
   for row in range(2):
      ax = axs[row, col]
      pcm = ax.pcolormesh(np.random.random((20, 20)) * (col + 1), cmap=cm[col])
      fig.colorbar(pcm, ax=ax)

plt.show()
jQuery Add Elements

With jQuery, it is easy to add new elements/content.
We will look at four jQuery methods that are used to add new content:
append() - Inserts content at the end of the selected elements
prepend() - Inserts content at the beginning of the selected elements
after() - Inserts content after the selected elements
before() - Inserts content before the selected elements
The jQuery append() method inserts content AT THE END of the selected HTML elements.
The jQuery prepend() method inserts content AT THE BEGINNING of the selected HTML elements.
In both examples above, we have only inserted some text/HTML at the 
beginning/end of the selected HTML elements.
However, both the append() and prepend() methods can take an infinite number of new 
elements as parameters. The new elements can be generated with text/HTML (like 
we have done in the examples above), with jQuery, or with 
JavaScript code and DOM elements.
In the following example, we create several new elements. The elements are 
created with text/HTML, jQuery, and JavaScript/DOM. Then we append the new 
elements to the text with the append() method (this would have worked for 
prepend() too) :
The jQuery after() method inserts content AFTER the selected HTML elements.
The jQuery before() method inserts content BEFORE the selected HTML elements.
Also, both the after() and before() methods can take an infinite number of new 
elements as parameters. The new elements can be generated with text/HTML (like 
we have done in the example above), with jQuery, or with 
JavaScript code and DOM elements.
In the following example, we create several new elements. The elements are 
created with text/HTML, jQuery, and JavaScript/DOM. Then we insert the new 
elements to the text with the after() method (this would have worked for 
before() too) :
Use a jQuery method to insert the text "YES!" at the end of a <p> element.
$("p").("YES!");

Start the Exercise
For a complete overview of all jQuery HTML methods, please go to our
jQuery HTML/CSS Reference.
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.
emplace vs insert in C++ STL - GeeksforGeeks

30 Nov, 2021
In C++, all containers (vector, stack, queue, set, map, etc) support both insert and emplace operations.The advantage of emplace is, it does in-place insertion and avoids an unnecessary copy of object. For primitive data types, it does not matter which one we use. But for objects, use of emplace() is preferred for efficiency reasons. 
CPP
// C++ code to demonstrate difference between// emplace and insert#include<bits/stdc++.h>using namespace std;  int main(){    // declaring map    multiset<pair<char, int>> ms;          // using emplace() to insert pair in-place    ms.emplace('a', 24);          // Below line would not compile    // ms.insert('b', 25);             // using insert() to insert pair in-place    ms.insert(make_pair('b', 25));             // printing the multiset    for (auto it = ms.begin(); it != ms.end(); ++it)        cout << " " << (*it).first << " "             << (*it).second << endl;      return 0;}
Output:  
 a 24
 b 25
Please refer Inserting elements in std::map (insert, emplace and operator []) for details. 
Jb_01
cpp-map
STL
C++
STL
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Inheritance in C++
C++ Classes and Objects
Operator Overloading in C++
Bitwise Operators in C/C++
Socket Programming in C/C++
Constructors in C++
Virtual Function in C++
Multidimensional Arrays in C / C++
Templates in C++ with Examples
Copy Constructor in C++
Java Examples - Delete a file

How to delete a file?
This example shows how to delete a file using delete() method of File class.
import java.io.*;

public class Main {
   public static void main(String[] args) { 
      try {
         BufferedWriter out = new BufferedWriter (new FileWriter("filename"));
         out.write("aString1\n");
         out.close();
         boolean success = (new File("filename")).delete();
         
         if (success) {
            System.out.println("The file has been successfully deleted"); 
         }
         BufferedReader in = new BufferedReader(new FileReader("filename"));
         String str;
         
         while ((str = in.readLine()) != null) {
            System.out.println(str);
         }
         in.close();
      }catch (IOException e) {
         System.out.println("exception occoured"+ e);
         System.out.println("
            File does not exist or you are trying to read a file that has been deleted");
      }
   }
}
The above code sample will produce the following result.
The file has been successfully deleted
exception occouredjava.io.FileNotFoundException:
filename (The system cannot find the file specified)
File does not exist or you are trying to read a 
file that has been deleted

The following is another sample example of delete a file in Java
import java.io.File;

public class DeleteFileExample { 
   public static void main(String[] args) { 
      try { 
         File file = new File("C:\\Users\\TutorialsPoint7\\Desktop\\abc.txt");
         if(file.delete()) { 
            System.out.println(file.getName() + " is deleted!");
         } else {
            System.out.println("Delete operation is failed.");
    		}
      } catch(Exception e) {
         e.printStackTrace();
      }
   }
}
The above code sample will produce the following result.
abc.txt is deleted!

 Print
 Add Notes
 Bookmark this page
Variable length arguments for Macros - GeeksforGeeks

21 Jan, 2022
Like functions, we can also pass variable length arguments to macros. For this we will use the following preprocessor identifiers.To support variable length arguments in macro, we must include ellipses (...) in macro definition. There is also “__VA_ARGS__” preprocessing identifier which takes care of variable length argument substitutions which are provided to macro. Concatenation operator ## (aka paste operator) is used to concatenate variable arguments. Let us see with example. Below macro takes variable length argument like “printf()” function. This macro is for error logging. The macro prints filename followed by line number, and finally it prints info/error message. First arguments “prio” determines the priority of message, i.e. whether it is information message or error, “stream” may be “standard output” or “standard error”. It displays INFO messages on stdout and ERROR messages on stderr stream.  
C
#include <stdio.h> #define INFO     1#define ERR    2#define STD_OUT    stdout#define STD_ERR    stderr #define LOG_MESSAGE(prio, stream, msg, ...) do {\                        char *str;\                        if (prio == INFO)\                            str = "INFO";\                        else if (prio == ERR)\                            str = "ERR";\                        fprintf(stream, "[%s] : %s : %d : "msg" \n", \                                str, __FILE__, __LINE__, ##__VA_ARGS__);\                    } while (0) int main(void){    char *s = "Hello";         /* display normal message */    LOG_MESSAGE(ERR, STD_ERR, "Failed to open file");     /* provide string as argument */    LOG_MESSAGE(INFO, STD_OUT, "%s Geeks for Geeks", s);     /* provide integer as arguments */    LOG_MESSAGE(INFO, STD_OUT, "%d + %d = %d", 10, 20, (10 + 20));     return 0;}
Compile and run the above program, it produces below result.  
  [narendra@/media/partition/GFG]$ ./variable_length 
  [ERR] : variable_length.c : 26 : Failed to open file 
  [INFO] : variable_length.c : 27 : Hello Geeks for Geeks 
  [INFO] : variable_length.c : 28 : 10 + 20 = 30 
  [narendra@/media/partition/GFG]$
This article is compiled by Shreyan Biswas. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above 
shreyanbiswas2010
C-Macro & Preprocessor
c-puzzle
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
fork() in C
Function Pointer in C
Substring in C++
std::string class in C++
Enumeration (or enum) in C
Command line arguments in C/C++
TCP Server-Client implementation in C
Structures in C
Different methods to reverse a string in C/C++
Exception Handling in C++
How to get the datatype of a column of a table using JDBC?

You can get the datatype of a column of a table using the getColumnType() method of the ResultSetMetaData class.
//Retrieving the ResultSetMetaData object
ResultSetMetaData rsmd = rs.getMetaData();

//getting the column type
String column_name = rsmd.getColumnTypeName(2);
Assume we have a table named employee_data in the database with the description as shown below:
+----------+--------------+------+-----+---------+-------+
| Field    | Type         | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| id       | int(11)      | YES  |     | NULL    |       |
| Name     | varchar(255) | YES  |     | NULL    |       |
| Dob      | date         | YES  |     | NULL    |       |
| Location | varchar(255) | YES  |     | NULL    |       |
+----------+--------------+------+-----+---------+-------+
Following JDBC program establishes connection with the database, retrieves the ResultSetMetaData object of the employee_data table, and prints the datatype of the third column.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
public class TypeOfColumn {
   public static void main(String args[])throws Exception {
      //Registering the Driver
      DriverManager.registerDriver(new com.mysql.jdbc.Driver());
      //Getting the connection
      String mysqlUrl = "jdbc:mysql://localhost/mydatabase";
      Connection con = DriverManager.getConnection(mysqlUrl, "root", "password");
      System.out.println("Connection established......");
      //Creating a Statement object
      Statement stmt = con.createStatement();
      ResultSet rs = stmt.executeQuery("select * from employee_data");
      //Retrieving the ResultSetMetaData object
      ResultSetMetaData rsmd = rs.getMetaData();
      //getting the column type
      String column_name = rsmd.getColumnTypeName(3);
      System.out.println("Data type of the column with the specified index is: "+column_name);
   }
}
Connection established......
Data type of the column with the specified index is: DATE
SQL Query to Remove Trailing Spaces - GeeksforGeeks

29 Sep, 2021
In this article, we will look at how to remove trailing spaces. Trailing spaces means the space characters from the right side. We need to use the RTRIM() function. The RTRIM function is used for removing all specified characters from the right-hand side of a string. T
Syntax:
RTRIM(string)
Parameter:
string – This is the only required parameter which is a string to remove the trailing spaces.
Applies to:
This function applies to the following databases.
SQL Server (all supporting versions),
Parallel Data Warehouse
Azure SQL Data Warehouse
Azure SQL Database,
Example 1:
Query:
SELECT RTRIM('Geeks for Geeks     ');
Output:
+------------------+
| (No column name) |
+------------------+
| Geeks for Geeks  |
+------------------+
Example 2:
Query:
SELECT RTRIM('   GeeksforGeeks     ');
Output:
+------------------+
| (No column name) |
+------------------+
|   GeeksforGeeks  |
+------------------+
Picked
SQL-Query
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Update Multiple Columns in Single Update Statement in SQL?
How to Create a Table With Multiple Foreign Keys in SQL?
What is Temporary Table in SQL?
SQL Query to Convert VARCHAR to INT
SQL | Subquery
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL using Python
How to Select Data Between Two Dates and Times in SQL Server?
How to Write a SQL Query For a Specific Date Range and Date Time?
SQL Query to Compare Two Dates
HTML | <textarea> wrap Attribute - GeeksforGeeks

15 Dec, 2021
The HTML textarea wrap Attribute is used to specify that in which manner the text is to be wrapped in a text area when a form is submitted.
Syntax:
<textarea wrap="soft|hard"> 
Attribute Values:
soft: It specifies that the Text present in the Textarea would not be wrapped after submitting the form. This is the default value.
Hard: It specifies that the Text in a Textarea is wraps when submitting the form.
Example: This Example that illustrates the use of wrap attribute in the Textarea Element.
<!DOCTYPE html><html>  <head>    <title>        HTML Textarea wrap attribute    </title></head>  <body style="text-align:center">    <h1 style="color: green;">     GeeksforGeeks </h1>    <h2>     HTML Textarea wrap attribute </h2>      <!-- Assigning id to textarea. -->    <textarea id="GFG_ID"              rows="3"              cols="10"               name="Geeks"               wrap="hard">        This text is wrapped in the text area field.    </textarea>    <br>      <button onclick="myGeeks()">        Submit    </button></body>  </html>
Output:
Supported Browsers:
Google Chrome
Firefox
Edge
Opera
Apple Safari
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
chhabradhanvi
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Insert Form Data into Database using PHP ?
Types of CSS (Cascading Style Sheet)
REST API (Introduction)
Form validation using HTML and JavaScript
HTML | <img> align Attribute
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Convert a string to an integer in JavaScript
Top 10 Angular Libraries For Web Developers
A Program to check if strings are rotations of each other or not?

Here we will see one program that can tell whether two strings are rotation of each other or not. The rotation of strings is like −
Suppose two strings are S1 = ‘HELLO’, and S2 = ‘LOHEL’ So they are rotation of each other. By rotating HELLO three position to the left it will be LOHEL.
To solve this problem, we will concatenate the first string with itself, then check whether the second one is present in the concatenated string or not. So for HELLO, it will be HELLOHELLO. Then this concatenated string contains the LOHEL. [HELLOHELLO].
begin
   if lengths of str1, and str2 are not same then return false;
   temp := concatenate str1 with str1 itself
   if temp contains str2, then
      return true
   otherwise return false
end
 Live Demo
#include<iostream>
using namespace std;
bool isRotation(string str1, string str2){
   if(str1.length() != str2.length())
      return false;
   string con_str = str1 + str1;
   if(con_str.find(str2) != string::npos){
      return true;
   } else {
      return false;
   }
}
main() {
   string str1, str2;
   cout << "Enter two strings: ";
   cin >> str1 >> str2;
   if(isRotation(str1, str2)){
      cout << "Two strings are rotation of each other";
   } else {
      cout << "Two strings are not rotation of each other";
   }
}
Enter two strings: STACK CKSTA
Two strings are rotation of each other
C# Program to convert integer array to string array

Use the ConvertAll method to convert integer array to string array.
Set an integer array −
int[] intArray = new int[5];

// Integer array with 5 elements
intArray[0] = 15;
intArray[1] = 30;
intArray[2] = 44;
intArray[3] = 50;
intArray[4] = 66;
Now use Array.ConvertAll() method to convert integer array to string array −
Array.ConvertAll(intArray, ele => ele.ToString());
Let us see the complete code −
 Live Demo
using System;
using System.Text;
public class Demo {
   public static void Main() {
      int[] intArray = new int[5];
      // Integer array with 5 elements
      intArray[0] = 15;
      intArray[1] = 30;
      intArray[2] = 44;
      intArray[3] = 50;
      intArray[4] = 66;
      string[] strArray = Array.ConvertAll(intArray, ele => ele.ToString());
      Console.WriteLine(string.Join("|", strArray));
   }
}
15|30|44|50|66
Can I use SUM() with IF() in MySQL?

Yes, you can use SUM() with IF() in MySQL. Let us first create a demo table:
mysql> create table DemoTable
(
   Value int,
   Value2 int
);
Query OK, 0 rows affected (0.51 sec)
Following is the query to insert some records in the table using insert command:
mysql> insert into DemoTable values(100,400);
Query OK, 1 row affected (0.13 sec)
mysql> insert into DemoTable values(100,400);
Query OK, 1 row affected (0.18 sec)
mysql> insert into DemoTable values(400,100);
Query OK, 1 row affected (0.14 sec)
Following is the query to display records from the table using select command:
mysql> select *from DemoTable;
This will produce the following output
+-------+--------+
| Value | Value2 |
+-------+--------+
|   100 |    400 |
|   100 |    400 |
|   400 |    100 |
+-------+--------+
3 rows in set (0.00 sec)
Following is the query to use SUM() along with IF() that calculates how many 100s and 400s are
in the above table:
mysql> SELECT SUM(IF(Value=100, 1, 0) + IF(Value2=100, 1, 0)) as Hundred,
SUM(IF(Value=400, 1, 0) + IF(Value2=400, 1, 0)) as FourHundred
FROM DemoTable;
This will produce the following output:
+---------+--------------+
| Hundred | FourHundred  |
+---------+--------------+
|       3 |            3 |
+---------+--------------+
1 row in set (0.00 sec)
C++ Program to Check Whether a Number can be Expressed as Sum of Two Prime Numbers

The following is an example to check whether a number can be expressed as sum of two prime numbers.
 Live Demo
#include <iostream>
using namespace std;
int func(int num) {
   int i;
   int flag = 1;
   for(i = 2; i <= num/2; ++i) {
      if(num % i == 0) {
         flag = 0;
         break;
      }
   }
   return flag;
}
int main() {
   int num , i;
   cout << "Enter a number : \n";
   cin >> num;
   for(i = 2; i <= num/2; ++i) {
      if (func(i)) {
         if (func(num - i)) {
            cout << num << " = " << i << " + " << num-i << endl;
         }
      }
   }
   return 0;
}
Enter a number : 18
18 = 5 + 13
18 = 7 + 11
In the above program, the function func() is checking that the number is prime or not.
int func(int num) {
   int i;
   int flag = 1;
   for(i = 2; i <= num/2; ++i) {
      if(num % i == 0) {
         flag = 0;
         break;
      }
   }
   return flag;
}
In the main() function, a number is entered by the user. It is computing the number as sum of two prime numbers.
cout << "Enter a number : \n";
cin >> num;
for(i = 2; i <= num/2; ++i) {
   if (func(i)) {
      if (func(num - i)) {
         cout << num << " = " << i << " + " << num-i << endl;
      }
   }
}
Python VLC - MediaList - GeeksforGeeks

29 Aug, 2020
In this article we will see how we can create a MediaList object in the python vlc module. VLC media player is a free and open-source portable cross-platform media player software and streaming media server developed by the VideoLAN project. MediaList object contains the multiple media, in other words it has list of media which can be used with MediaListPlayer object to play these multiple media object.
In order to do this we will use vlc.MediaList method with the vlc module
Syntax : vlc.MediaList()
Argument : It takes no argument
Return : It returns MediaList object
Below is the implementation
# importing vlc moduleimport vlc  # importing time moduleimport time  # creating a media player objectmedia_player = vlc.MediaListPlayer()  # creating Instance class objectplayer = vlc.Instance()  # creating a media list objectmedia_list = vlc.MediaList()  # creating a new mediamedia = player.media_new("death_note.mkv")  # adding media to media listmedia_list.add_media(media)  # setting media list to the media playermedia_player.set_media_list(media_list)    # start playing videomedia_player.play()  # wait so the video can be played for 5 seconds# irrespective for length of videotime.sleep(5)
Output :
Another example
# importing vlc moduleimport vlc  # importing time moduleimport time  # creating a media player objectmedia_player = vlc.MediaListPlayer()  # creating Instance class objectplayer = vlc.Instance()  # creating a media list objectmedia_list = vlc.MediaList()  # creating a new mediamedia = player.media_new("1.mp4")  # adding media to media listmedia_list.add_media(media)  # setting media list to the media playermedia_player.set_media_list(media_list)    # start playing videomedia_player.play()  # wait so the video can be played for 5 seconds# irrespective for length of videotime.sleep(5)
Output :
Python vlc-mediaList
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
How to drop one or multiple columns in Pandas Dataframe
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | Pandas dataframe.groupby()
Defaultdict in Python
Python | Get unique values from a list
Python Classes and Objects
Python | os.path.join() method
Create a directory in Python
numpy.asscalar() in Python - GeeksforGeeks

28 Nov, 2018
numpy.asscalar() function is used when we want to convert an array of size 1 to its scalar equivalent.
Syntax : numpy.asscalar(arr)
Parameters :arr : [ndarray] Input array of size 1.
Return : Scalar representation of arr. The output data type is the same type returned by the input’s item method.
Code #1 : Working
# Python program explaining# numpy.asscalar() function  import numpy as geek# creating a array of size 1in_arr = geek.array([ 8 ])  print ("Input  array : ", in_arr)       out_scalar = geek.asscalar(in_arr)print ("output scalar from input array : ", out_scalar) 
Output :
Input  array :  [8]
output scalar from input array :  8

 Code #2 :
# Python program explaining# numpy.asscalar() functionimport numpy as geek  in_list = [2 ]  # changing the list to size 1 arrayarr = geek.array(in_list)   print ("Input  array from list : ", arr)  # changing the array to scalar  scalar = geek.asscalar(arr)  print ("output scalar from input list : ", scalar) 
Output :
Input  array from list :  [2]
output scalar from input list :  2

Python numpy-arrayManipulation
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python OOPs Concepts
How to Install PIP on Windows ?
Bar Plot in Matplotlib
Defaultdict in Python
Python Classes and Objects
Deque in Python
Check if element exists in list in Python
How to drop one or multiple columns in Pandas Dataframe
Python - Ways to remove duplicates from list
Class method vs Static method in Python
C++ Program to Implement Counting Sort

Counting sort is a stable sorting technique, which is used to sort objects according the keys that are small numbers. It counts the number of keys whose key values are same. This sorting technique is efficient when difference between different keys are not so big, otherwise it can increase the space complexity.
Time Complexity: O(n+r)
Time Complexity: O(n+r)
Space Complexity: O(n+r)
Space Complexity: O(n+r)
Input − A list of unsorted data: 2 5 6 2 3 10 3 6 7 8
Output − Array after Sorting: 2 2 3 3 5 6 6 7 8 10
Input: An array of data, and the total number in the array
Output: The sorted Array
Begin
   max = get maximum element from array.
   define count array of size [max+1]
   for i := 0 to max do
      count[i] = 0 //set all elements in the count array to 0
   done
   for i := 1 to size do
      increase count of each number which have found in the array
   done
   for i := 1 to max do
      count[i] = count[i] + count[i+1] //find cumulative frequency
   done
   for i := size to 1 decrease by 1 do
      store the number in the output array
      decrease count[i]
   done
   return the output array
End
#include<iostream>
#include<algorithm>
using namespace std;
void display(int *array, int size) {
   for(int i = 1; i<=size; i++)
      cout << array[i] << " ";
   cout << endl;
}
int getMax(int array[], int size) {
   int max = array[1];
   for(int i = 2; i<=size; i++) {
      if(array[i] > max)
         max = array[i];
   }
   return max; //the max element from the array
}
void countSort(int *array, int size) {
   int output[size+1];
   int max = getMax(array, size);
   int count[max+1];     //create count array (max+1 number of elements)
   for(int i = 0; i<=max; i++)
      count[i] = 0;     //initialize count array to all zero
   for(int i = 1; i <=size; i++)
      count[array[i]]++;     //increase number count in count array.
   for(int i = 1; i<=max; i++)
      count[i] += count[i-1];     //find cumulative frequency
   for(int i = size; i>=1; i--) {
      output[count[array[i]]] = array[i];
      count[array[i]] -= 1; //decrease count for same numbers
   }
   for(int i = 1; i<=size; i++) {
      array[i] = output[i]; //store output array to main array
   }
}
int main() {
   int n;
   cout << "Enter the number of elements: ";
   cin >> n;
   int arr[n+1];       //create an array with given number of elements
   cout << "Enter elements:" << endl;
   for(int i = 1; i<=n; i++) {
      cin >> arr[i];
   }
   cout << "Array before Sorting: ";
   display(arr, n);
   countSort(arr, n);
   cout << "Array after Sorting: ";
   display(arr, n);
}
Enter the number of elements: 10
Enter elements:
2 5 6 2 3 10 3 6 7 8
Array before Sorting: 2 5 6 2 3 10 3 6 7 8
Array after Sorting: 2 2 3 3 5 6 6 7 8 10
Sum of two numbers modulo M

23 Apr, 2021
Given three numbers A, B, and M. The task is to print the sum of A and B under modulo M. 
Examples: 
Input: 
a = 10, b = 20, m = 3 
Output: 
0
Explanation:
10+20 = 30 % 3 = 0 

Input: 
a = 100, b = 13, m = 107 
Output: 
6
Approach: 
Add the two given numbers A and B and print their sum under modulo M.
Below is the implementation of the above approach:  
C++
Java
Python
C#
PHP
Javascript
// C++ program for sum of two// numbers modulo M#include <iostream>using namespace std; // Function to return summation mod mint sum(int a, int b, int m){    // add two numbers    int s = a + b;     // do a mod with m    s = s % m;     return s;} // Driver Codeint main(){    int a = 20, b = 10, m = 3;         // Function Call    cout << sum(a, b, m);    return 0;}
// JAVA program for addition of// two numbers modulo m import java.io.*; class GFG {     static int sum(int a, int b, int m)    {        // add two numbers        int s = a + b;         // do mod with m        s = s % m;        return s;    }    // Driver Code    public static void main(String[] args)    {        int a = 10, b = 20, m = 3;         // Function Call        System.out.println("The sum = " + sum(a, b, m));    }}
# Python program for addition of# two numbers modulo m  def summ(a, b, m):     # add two number    s = a + b     # do mod with m    s = s % m    return s  # Driver Codea = 20b = 10m = 3 # Function Callprint summ(a, b, m)
// C# program for addition of// two numbers modulo musing System; class GFG {     static int sum(int a, int b, int m)    {         // add two numbers        int s = a + b;         // do mod with m        s = s % m;        return s;    }     // Driver Code    public static void Main()    {        int a = 10, b = 20, m = 3;         // Function Call        Console.Write("The sum = " + sum(a, b, m));    }} // This code is contributed by// Smitha Dinesh Semwal
<?php// Php program for sum of two// numbers modulo M // Function to return summation mod mfunction sum($a, $b, $m){    // add two numbers    $s = $a + $b;     // do a mod with m    $s = $s % $m;     return $s;} // Driver Code$a = 20;$b = 10;$m = 3; // Function Callecho (sum($a, $b, $m)); // This code is contributed// by Shivi_Aggarwal?>
<script>  // Javascript program for sum of two// numbers modulo M // Function to return summation mod mfunction sum( a,  b,  m){    // add two numbers    let s = a + b;     // do a mod with m    s = s % m;     return s;}     // driver code    let a = 20, b = 10, m = 3;       // Function Call    document.write(sum(a, b, m));         // This code is contributed by Jana_Sayantan.</script>
0
Smitha Dinesh Semwal
Shivi_Aggarwal
mr_happy
jana_sayantan
Modular Arithmetic
school-programming
School Programming
Modular Arithmetic
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Serial I/O Lines in 8085 Microprocessor

24 Jan, 2020
The 8085 Microprocessor has Serial Input/Output lines consisting of two pins as follows:
1. Serial Output Data (SOD)
2. Serial Input Data (SID) 
They both are specially made for Input/Output which is further controlled by software. The transfer of data is controlled with the help of two instructions, i.e, SIM and RIM.
Now, let’s see both the pins one-by-one:
Serial Output Data (SOD):The SIM Instruction should be initiated in order to output data in serial manner. This is done through the SOD Line.Examples:Instructions:MVI A, 80H : Set D7 in the accumulator=1RAR : Set D6 = 1 and bring carry into D7SIM : Output D7In the above set of instructions, the serial output line is enabled by rotating 1 into bit position D6; the instruction SIM outputs the carry bit through bit position D7.It can be represented as:Figure – Interpretation by SIM InstructionSerial Input Data (SID):In SID, the RIM Instruction is initiated to input data in a serial manner. This is done through SID line.It can be represented as:Figure – Interpretation by RIM Instruction
Serial Output Data (SOD):The SIM Instruction should be initiated in order to output data in serial manner. This is done through the SOD Line.Examples:Instructions:MVI A, 80H : Set D7 in the accumulator=1RAR : Set D6 = 1 and bring carry into D7SIM : Output D7In the above set of instructions, the serial output line is enabled by rotating 1 into bit position D6; the instruction SIM outputs the carry bit through bit position D7.It can be represented as:Figure – Interpretation by SIM Instruction
Examples:
Instructions:
MVI A, 80H : Set D7 in the accumulator=1RAR : Set D6 = 1 and bring carry into D7SIM : Output D7
In the above set of instructions, the serial output line is enabled by rotating 1 into bit position D6; the instruction SIM outputs the carry bit through bit position D7.It can be represented as:
Serial Input Data (SID):In SID, the RIM Instruction is initiated to input data in a serial manner. This is done through SID line.It can be represented as:Figure – Interpretation by RIM Instruction
Advantage:In a software controlled Input/Output system, the SID and SOD lines eliminate the need of an input and output port respectively.
microprocessor
system-programming
Technical Scripter 2019
Computer Organization & Architecture
Technical Scripter
microprocessor
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Direct Access Media (DMA) Controller in Computer Architecture
Architecture of 8085 microprocessor
Pin diagram of 8086 microprocessor
Control Characters
I2C Communication Protocol
Pin diagram of 8085 microprocessor
Difference between SRAM and DRAM
Computer Organization | Different Instruction Cycles
Computer Architecture | Flynn's taxonomy
Difference between RISC and CISC processor | Set 2
Features & Components of Private Cloud

10 Sep, 2020
Private clouds are distributed systems that work on private infrastructure and providing the users with dynamic provisioning of computing resources. A private cloud is generally used within an organization. This helps to avoid the complexities and time associated with the purchase and cloud implementation of traditional physical infrastructure. Private cloud implementation also includes the challenges of integrating hardware and software from several vendors.
Features of Private Cloud:
Higher Security And Privacy: Private cloud offers higher security as compared to public cloud services. Due to the limited access, Private Cloud provides more Security services.
Improved Reliability: Private cloud offers virtually created operating environments which indicate that the network is highly flexible to individual failures.
More Control: As the access to the pool of resources is restricted to one organization, the configuration, and management of private cloud can be aligned as per their needs for obtaining a customized network solution.
So it is important to understand the components of the private cloud. The key expectations of private clouds are in demand. To provide some features the building blocks are required for private cloud which are as follows:
Supports for Heterogeneous System: The cloud should support a wide range of products and vendors such as the latest hardware, software, and virtualization, open system, commodity hardware. The cloud manager product you select must support for the original manufacturers.
Virtualization: This is the foundation of any cloud. The hardware resources, including the identity and the number of individual physical servers to form a pool of virtual machines. So the virtual machines must be worked with the elasticity.
Service Catalog: A service catalog is a menu of applications that customers can choose from. The service catalog is a guide for users and customers.
Self Service Portal: Self Service Portal gives a way for interaction between customers and cloud service providers. It is used to consume less amount of time. The offered services and resources should be easy for the end-user to configure and manage.
Resource and workload manager: The cloud must-have a resource manager that allows it to easily meet varying workload, maintain service availability. It is done by moving applications to healthy hardware in the event of failure of servers and network links of other resources.
Metering software and pay per use billing: The cloud must have metering software to track the utilization of software and hardware resources.
Cloud-Computing
Computer Subject
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
numpy.nanstd() function – Python

11 Jun, 2020
numpy.nanstd() function compute the standard deviation along the specified axis, while ignoring NaNs.
Syntax : numpy.nanstd(arr, axis = None, dtype = None, out = None, ddof = 0, keepdims)
Parameters :arr : [array_like] Calculate the standard deviation of the non-NaN values.axis : [{int, tuple of int, None}, optional] Axis along which the standard deviation is computed.dtype : [dtype, optional] Type to use in computing the standard deviation. For arrays of integer type, the default is float64, for arrays of float types it is the same as the array type.out : [ndarray, optional] Alternative output array in which to place the result.ddof : [int, optional] ddof means Delta Degrees of Freedom. The divisor used in calculations is N – ddof, where N represents the number of non-NaN elements. By default, ddof is zero.keepdims : [bool, optional] If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original arr.
Return : [standard_deviation] If out is None, return a new array containing the standard deviation, otherwise return a reference to the output array.
Code #1 :
# Python program explaining# numpy.nanstd() function       # importing numpy as geek import numpy as geek    arr = geek.array([[1, 2], [geek.nan, 4]])   gfg = geek.nanstd(arr)   print (gfg)
Output :
1.247219128924647

 Code #2 :
# Python program explaining# numpy.nanstd() function       # importing numpy as geek import numpy as geek    arr = geek.array([[1, 2], [geek.nan, 4]])   gfg = geek.nanstd(arr, axis = 0)   print (gfg)
Output :
[0. 1.]

Python numpy-Statistics Functions
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Python | os.path.join() method
How to drop one or multiple columns in Pandas Dataframe
Introduction To PYTHON
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | datetime.timedelta() function
Python | Get unique values from a list
How to upload file without form using JavaScript ?

12 Jul, 2021
There are several approaches to upload a file without using the form in JavaScript:
Approach 1: This approach is to use FormData that can upload a file without using any kind of form. The special thing about this is that network methods, such as fetch, can accept a FormData object as a body. It’s encoded and sent out with Content-Type — multipart/form-data.
JavaScript Snippet:
Javascript
var gfg = new FormData(); gfg.append('pictureFile',        pictureInput.files[0]); // upload.php is the file to be uploaded$.ajax({    url: 'upload.php',    type: 'POST',    processData: false,    contentType: false,    dataType: 'json',    data: gfg});
 
 
 
 
Approach 2: This approach is to use XMLHTTPRequest that can directly upload the file as the content inside the body of POST request.
 
JavaScript Snippet:
 
Javascript
// JavaScript Codevar form = document.getElementById('the-form'); form.onsubmit = function () {    var formData = new FormData(form);    formData.append('file', file);    var xhr = new XMLHttpRequest();     // Add any event handlers here...    xhr.open('POST', form.getAttribute('action'), true);    xhr.send(formData);     // To avoid actual submission of the form    return false;}
 
 
 
 
Approach 3: This approach is to use simpleUpload plugin.
 
HTML Code Snippet:
 
HTML
<!DOCTYPE html><html> <body>    <h2>Welcome To GFG</h2>     <input type="file" name="arquivo"        id="simpleUpload" multiple>             <button type="button" id="upload">            Upload        </button></body> </html>
 
 
 
 
JavaScript Snippet:
 
Javascript
$('#simpleUpload').simpleUpload({     // upload.php is the file    // to be uploaded    url: 'upload.php',    trigger: '#upload',    success: function (data) {        alert('Successfully Uploaded');    }});
 
 
 
 
Output:
 
 
sooda367
HTML-Misc
JavaScript-Misc
HTML
JavaScript
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
REST API (Introduction)
CSS to put icon inside an input element in a form
Types of CSS (Cascading Style Sheet)
Design a Tribute Page using HTML & CSS
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
Difference Between PUT and PATCH Request
How to append HTML code to a div using JavaScript ?
Tailwind CSS Word Break

23 Mar, 2022
This class accepts more than one value in tailwind CSS. All the properties are covered in class form. It is the alternative to the CSS word-break property. This class is used to specify how to break the word when the word reached at end of the line. The line breaks in the text can occur in certain spaces, like when there is a space or a hyphen.
Word Break classes:
break-normal
break-words
break-all
break-normal: This class is used for the default line break rules.
Syntax:
<element class="break-normal">...</element>
Example:
HTML
<!DOCTYPE html> <head>     <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"           rel="stylesheet"> </head>   <body class="text-center mx-4 space-y-2">     <h1 class="text-green-600 text-5xl font-bold">        GeeksforGeeks    </h1>     <b>Tailwind CSS Word Break Class</b>     <div class="mx-48 w-48 bg-green-200 rounded-lg">        <p class="p-4 break-normal">            GeeksGeeks: Acomputerscienceportalforgeeks        </p>      </div></body>   </html> 
Output:
break-words: It is used to break the words at arbitrary points to prevent overflow.
Syntax:
<element class="break-words">...</element>
Example:
HTML
<!DOCTYPE html> <head>     <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"           rel="stylesheet"> </head>   <body class="text-center mx-4 space-y-2">     <h1 class="text-green-600 text-5xl font-bold">        GeeksforGeeks    </h1>     <b>Tailwind CSS Word Break Class</b>     <div class="mx-48 w-48 bg-green-200 rounded-lg">        <p class="p-4 break-words">            GeeksGeeks: Acomputerscienceportalforgeeks        </p>      </div></body>   </html> 
Output:
break-all: It is used to break the words at any character to prevent overflow.
Syntax:
<element class="break-all">...</element>
Example:
HTML
<!DOCTYPE html> <head>     <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"           rel="stylesheet"> </head>   <body class="text-center mx-4 space-y-2">     <h1 class="text-green-600 text-5xl font-bold">        GeeksforGeeks    </h1>     <b>Tailwind CSS Word Break Class</b>     <div class="mx-48 w-48 bg-green-200 rounded-lg">        <p class="p-4 break-all">            GeeksGeeks: Acomputerscienceportalforgeeks        </p>      </div></body>   </html> 
Output:
break all class
Tailwind CSS
Tailwind-Typography
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.