code-rag-bench/online-tutorials huggingface dataset:
Create array from JSON object JavaScript

Suppose, we have the following JSON object −
const obj = {
   "test1": [{
      "1": {
      "rssi": -25,
   }
   }, {
      "2": {
         "rssi": -25,
      }
   }],
   "test2": [{
      "15": {
         "rssi": -10,
      } }, {
         "19": {
         "rssi": -21,
      }
   }]
};
We are required to write a JavaScript function that takes in an object like this −
The function should then map the "rssi" property of all the nested objects to a corresponding nested array of arrays.
Therefore, for the above array, the output should look like this −
const output = [[-25, -25], [-10, -21]];
const obj = {
   "test1": [{
      "1": {
         "rssi": -25,
      }
   }, {
      "2": {
      "rssi": -25,
   }
}],
"test2": [
   {
      "15":
      { "rssi": -10,
      }
      }, {
         "19": {
         "rssi": -21,
      }
   }]
};
const mapToValues = (object = {}) => {
   const res = [];
   for (let key in object) {
      let obj = object[key];
      let aux = [];
      for (let i = 0; i < obj.length; i++) {
         for (x in obj[i]) {
            aux.push(obj[i][x].rssi);
         }
      }
      res.push(aux);
   }
   return res;
};
console.log(mapToValues(obj));
And the output in the console will be −
[ [ -25, -25 ], [ -10, -21 ] ]
Convert Docx to Pdf using docx2pdf Module in Python - GeeksforGeeks

03 Aug, 2021
Tired of having to use online docx to PDF converters with crappy interfaces and conversion limits? Then, look no further than your friendly neighborhood language python’s docx2pdf module. This module is a hidden gem among the many modules for the python language.
This module can be used to convert files singly or in bulk using the command line or a python program.
This module does not come built-in with Python. To install this module type the below command in the terminal.
pip install docx2pdf
The basic structure of the docx2pdf command line usage is:
docx2pdf [input] [output]
If only the input file is specified, it generates a pdf from the docx and stores it in the same folder.
Example:
docx2pdf usage using the command line
GeeksforGeeks folder containing both the original GFG.docx and the converted GFG.pdf
Original GFG.docx on the left and GFG.pdf on the right
For the bulk conversion, you can specify the folder containing all the Docx files. The converted pdfs will get stored in the same folder.
docx2pdf GeeksForGeeks_Folder/
You can also explicitly specify the input and output file or folder by specifying the path.
An endless number of useful applications can be made using this module.
Python3
# Python3 program to convert docx to pdf# using docx2pdf module # Import the convert method from the# docx2pdf modulefrom docx2pdf import convert # Converting docx present in the same folder# as the python fileconvert("GFG.docx") # Converting docx specifying both the input# and output pathsconvert("GeeksForGeeks\GFG_1.docx", "Other_Folder\Mine.pdf") # Notice that the output filename need not be# the same as the docx # Bulk Conversionconvert("GeeksForGeeks\")
Output:
simranarora5sos
python-modules
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Check if element exists in list in Python
Python | os.path.join() method
Selecting rows in pandas DataFrame based on conditions
Defaultdict in Python
Python | Get unique values from a list
Create a directory in Python
Python | Pandas dataframe.groupby()
Java Program for GCD of more than two (or array) numbers

Following is the Java program for GCD of more than two numbers −
 Live Demo
public class Demo{
   static int gcd_of_nums(int val_1, int val_2){
      if (val_1 == 0)
      return val_2;
      return gcd_of_nums(val_2 % val_1, val_1);
   }
   static int find_gcd(int arr[], int no){
      int result = arr[0];
      for (int i = 1; i < no; i++){
         result = gcd_of_nums(arr[i], result);
         if(result == 1){
            return 1;
         }
      }
      return result;
   }
   public static void main(String[] args){
      int my_arr[] = { 7, 49, 177, 105, 119, 42};
      int no = my_arr.length;
      System.out.println("The GCD of the elements in the array is ");
      System.out.println(find_gcd(my_arr, no));
   }
}
The GCD of the elements in the array is
1
A class named Demo contains a main function that takes in two values. If the first value is 0, the second value is returned as output. Otherwise, a recursive function is written that computes the greatest common divisor of the two elements.
Next, another static function is defined that takes an array and another integer value as parameter. The first element of the array is assigned to a variable named ‘result’ and a ‘for’ loop iterates over elements from 1 to the integer value that was passed as a parameter to the function. The greatest common divisor function is called on this array elements and a result. This output is assigned to ‘result’ variable itself. If the value of ‘result’ is 1, then the output is 1, otherwise the value of ‘result’ is returned.
In the main function, an array integer is defined and the length of the array is assigned to a specific value. The greatest common divisor function is called on the array elements and length. Relevant data is displayed on the console.
Kotlin Output (Print Text)

The println() function is used to output values/print text:
fun main() {
  println("Hello World")
}
You can add as many println() functions as you want. Note that it will add a new line for each function:
fun main() {
  println("Hello World!")
  println("I am learning Kotlin.")
  println("It is awesome!")
}
You can also print numbers, and perform mathematical calculations:
fun main() {
  println(3 + 3)
}
There is also a print() function, which is similar to println(). The only difference is that it does not insert a new line at the end of the output:
fun main() {
  print("Hello World! ")
  print("I am learning Kotlin. ")
  print("It is awesome!")
}
Note that we have added a space character to create a space between the sentences.
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.
MySQL query to select the values having multiple occurrence and display their count

For this, use GROUP BY HAVING clause. Let us first create a table −
mysql> create table DemoTable673(
   Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   Value int
);
Query OK, 0 rows affected (0.59 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable673(Value) values(10);
Query OK, 1 row affected (0.21 sec)
mysql> insert into DemoTable673(Value) values(20);
Query OK, 1 row affected (0.18 sec)
mysql> insert into DemoTable673(Value) values(10);
Query OK, 1 row affected (0.10 sec)
mysql> insert into DemoTable673(Value) values(30);
Query OK, 1 row affected (0.12 sec)
mysql> insert into DemoTable673(Value) values(20);
Query OK, 1 row affected (0.09 sec)
mysql> insert into DemoTable673(Value) values(10);
Query OK, 1 row affected (0.08 sec)
mysql> insert into DemoTable673(Value) values(10);
Query OK, 1 row affected (0.28 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable673;
This will produce the following output −
+----+-------+
| Id | Value |
+----+-------+
|  1 |    10 |
|  2 |    20 |
|  3 |    10 |
|  4 |    30 |
|  5 |    20 |
|  6 |    10 |
|  7 |    10 |
+----+-------+
7 rows in set (0.00 sec)
Following is the query to display only the values having multiple occurrences −
mysql> select Id,count(*) as myValue from DemoTable673 group by Value having count(*) > 1;
This will produce the following output −
+----+---------+
| Id | myValue |
+----+---------+
|  1 |       4 |
|  2 |       2 |
+----+---------+
2 rows in set (0.00 sec)
Python – Ways to find Geometric Mean in List

30 Jan, 2020
While working with Python, we can have a problem in which we need to find geometric mean of a list cumulative. This problem is common in Data Science domain. Let’s discuss certain ways in which this problem can be solved.
Method #1 : Using loop + formulaThe simpler manner to approach this problem is to employ the formula for finding geometric mean and perform using loop shorthands. This is the most basic approach to solve this problem.
# Python3 code to demonstrate working of # Geometric Mean of List # using loop + formula import math  # initialize list test_list = [6, 7, 3, 9, 10, 15]   # printing original list print("The original list is : " + str(test_list))   # Geometric Mean of List # using loop + formula temp = 1for i in range(0, len(test_list)) :     temp = temp * test_list[i] temp2 = (float)(math.pow(temp, (1 / len(test_list)))) res = (float)(temp2)   # printing result print("The geometric mean of list is : " + str(res)) 
The original list is : [6, 7, 3, 9, 10, 15]
The geometric mean of list is : 7.443617568993922

 
Method #2 : Using statistics.geometric_mean()This task can also be performed using inbuilt function of geometric_mean(). This is new in Python versions >= 3.8.
# Python3 code to demonstrate working of # Geometric Mean of List # using statistics.geometric_mean()import statistics   # initialize list test_list = [6, 7, 3, 9, 10, 15]   # printing original list print("The original list is : " + str(test_list))   # Geometric Mean of List # using statistics.geometric_mean() res = statistics.geometric_mean(test_list, 1)   # printing result print("The geometric mean of list is : " + str(res))
The original list is : [6, 7, 3, 9, 10, 15]
The geometric mean of list is : 7.443617568993922

Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Create Dataframe of Unequal Length in R

16 May, 2021
In this article, we will be looking at the approach to create a data frame of unequal length using different functions in R Programming language.
To create a data frame of unequal length, we add the NA value at the end of the columns which are smaller in the lengths and makes them equal to the column which has the maximum length among all and with this process all the length becomes equal and the user is able to process operations on that data frame in R language. 
rep() function is used to replicate the values in x. Here, this will be used to replicate NA value of the end of the columns of the data frames.
Syntax: rep(x, ...)
Parameters:
x:-a vector or a factor or a POSIXct or POSIXlt or Date object.
...:-further arguments to be passed to or from other methods
Example 1:
R
# Creating variablex=c(1,2,3,4,5)y=c(1,2,3)  # Finding maximum lengthmax_ln <- max(c(length(x), length(y)))gfg_data<- data.frame(col1 = c(x,rep(NA, max_ln - length(x))),                      col2 = c(y,rep(NA, max_ln - length(y))))gfg_datais.data.frame((gfg_data))
Output:
Example 2:
R
# Creating variablea=c('a','b','c','d')b=c('g','e','e','k','s')c=c('f','o','r')d=c('g','e','e','k','s')  # Finding maximum lengthmax_ln1 <- max(c(length(a), length(b)))max_ln2 <- max(c(length(c), length(d)))max_ln<-max(max_ln2,max_ln1)gfg_data<- data.frame(col1 = c(a,rep(NA, max_ln - length(a))),                      col2 = c(b,rep(NA, max_ln - length(b))),                      col3 = c(c,rep(NA, max_ln - length(c))),                      col4 = c(d,rep(NA, max_ln - length(d))))  gfg_datais.data.frame((gfg_data))
Output:
Picked
R DataFrame-Programs
R-DataFrame
R Language
R Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
How to Split Column Into Multiple Columns in R DataFrame?
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to filter R DataFrame by values in a column?
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
Replace Specific Characters in String in R
Merge DataFrames by Column Names in R
How to Sort a DataFrame in R ?
How to replace missing values recorded with blank spaces in R with NA or any other value?

Sometimes when we read data in R, the missing values are recorded as blank spaces and it is difficult to replace them with any value. The reason behind this is we need to know how many spaces we have used in place of missing values. If we know that then assigning any value becomes easy.
Consider the below data frame of vectors x and y.
> x<-c("", 3,2,1,2,3,2,1," ", 43, "")
> y<-c(1,2,"", 43,2," ", 3,2,3,"", 7)
> df<-data.frame(x,y)
> df
  x  y
1    1
2 3  2
3 2
4 1 43
5 2  2
6    3
7 2  3
8 1  2
9    3
10  43
11   7
Here, we have missing values recorded as blank spaces as well simply with double inverted commas. Now let’s replace these missing values with NA as shown below −
> df[df==""]<-NA
> df
    x   y
1 <NA>  1
2   3   2
3   2 <NA>
4   1  43
5   2   2
6       3
7   2   3
8   1   2
9       3
10 43 <NA>
11 <NA> 7
Here, the nineth value in x and sixth value in y are not replaced because the number of blank spaces, so we need to specify them. First, read the number of spaces by looking at the vectors as follows −
> x
[1] "" "3" "2" "1" "2" "3" "2" "1" " " "43" ""
> y
[1] "1"  "2"    ""    "43" "2"    " "    "3"    "2"
[9] "3"   ""    "7"
There seems to be one blank space for nineth value in x and five blank spaces in sixth value of y. Now let’s change the df for x as follows −
> df[df==" "]<-NA
> df
     x  y
1  <NA> 1
2   3   2
3   2 <NA>
4   1  43
5   2   2
6       3
7   2   3
8   1   2
9  <NA> 3
10 43 <NA>
11 <NA> 7
Now we will the df for y as shown below −
> df[df==" "]<-NA
> df
     x  y
1  <NA> 1
2   3   2
3   2 <NA>
4   1  43
5   2   2
6   3 <NA>
7   2   3
8   1   2
9 <NA>  3
10 43 <NA>
11 <NA> 7
Now, we have our complete data frame with NA’s and other numbers.
RxJava - Completable Observable

The Completable class represents deferred response. Completable observable can either indicate a successful completion or error.
Following is the declaration for io.reactivex.Completable class −
public abstract class Completable
extends Object
implements CompletableSource

Following is the sequential protocol that Completable Observable operates −
onSubscribe (onError | onComplete)?

Create the following Java program using any editor of your choice in, say, C:\> RxJava.
import java.util.concurrent.TimeUnit;

import io.reactivex.Completable;
import io.reactivex.disposables.Disposable;
import io.reactivex.observers.DisposableCompletableObserver;
import io.reactivex.schedulers.Schedulers;

public class ObservableTester {
   public static void main(String[] args) throws InterruptedException {

      //Create an observer
      Disposable disposable = Completable.complete()
         .delay(2, TimeUnit.SECONDS, Schedulers.io())
         .subscribeWith(new DisposableCompletableObserver() {
         @Override
         public void onError(Throwable e) { 
            e.printStackTrace();
         }
         @Override
         public void onStart() {
            System.out.println("Started!");
         }
         @Override
         public void onComplete() {
            System.out.println("Done!");
         }
      }); 
      Thread.sleep(3000);
      //start observing
      disposable.dispose();
   }
}
Compile the class using javac compiler as follows −
C:\RxJava>javac ObservableTester.java

Now run the ObservableTester as follows −
C:\RxJava>java ObservableTester

It should produce the following output −
PHP | array_sum() Function

09 Mar, 2018
The array_sum() function returns the sum of all the values in an array(one dimensional and associative). It takes an array parameter and returns the sum of all the values in it.
number array_sum ( $array )

ArgumentThe only argument to the function is the array whose sum needs to be calculated.
Return valueThis function returns the sum obtained after adding all the elements together. The returned sum may be integer or float. It also returns 0 if the array is empty.
Examples:
Input : $a = array(12, 24, 36, 48);
        print_r(array_sum($a));
Output :120

Input : $a = array();
        print_r(array_sum($a));
Output :0

In the first example the array calculates the sum of the elements of the array and returns it. In the second example the answer returned is 0 since the array is empty.
Program – 1
<?php//array whose sum is to be calculated$a = array(12, 24, 36, 48);  //calculating sumprint_r(array_sum($a));?>
Output:
120

Program – 2
<?php//array whose sum is to be calculated$a = array();  //calculating sumprint_r(array_sum($a));?>
Output:
0

Program – 3
<?php// array whose sum is to be calculated$b = array("anti" => 1.42, "biotic" => 12.3, "charisma" => 73.4);  // calculating sumprint_r(array_sum($b));?>
Output:
87.12

Thanks to HGaur for providing above examples.
PHP-array
PHP-function
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install Apache JMeter on Linux?

06 Oct, 2021
In this article, we will see how to install Apache JMeter in Linux.  Here we will use Ubuntu which is a Linux distribution based on Debian and composed mostly of free and open-source software. JMeter is developed by Java so it is necessary to have java 8 or higher version on your computer.
Checking Java Version:
Use java –version or javac –version to check if java is already installed on your computer or not.
$ java --version
If you get the same message then skip step 2 i.e. installation of java and move to step 3.
If you get “java not found” in output, so first install Java.
Step 1: Use the following command to install openjdk – 11-jre.
$ sudo apt install openjdk-11-jre-headless
Then enter the sudo password and enter “Y” to confirm the download. 
It will take some time according to your internet speed.
Step 2: Use the following command to install openjdk-11-jdk.
$ sudo apt install openjdk-11-jdk-headless
Step 3: If download completes then check again using java –version command.
First, we will download the latest JMeter version from the official JMeter website. Go to the given link and click on the “apache-jmeter-5.4.1.zip” link to download the binary zip file of JMeter.
After clicking on the zip file a dialog box will appear and check the save file box and click ok. It will start the download.
The file will be placed in the Downloads folder. Open the folder, right-click on the zip file and click on Extract here.
Now we have successfully downloaded the JMeter and extracted it.
Open the terminal and use the following command to go to the directory from where we can run JMeter
$ cd Downloads/apache-jmeter-5.4.1/bin
Cd stands for change directory, a Linux command to move between directories.
Run the following command to start the JMeter.
$ ./jmeter
This will look like this.
how-to-install
Picked
How To
Installation Guide
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Set Git Username and Password in GitBash?
How to Install Jupyter Notebook on MacOS?
How to Install and Use NVM on Windows?
How to Install Python Packages for AWS Lambda Layers?
How to Install Git in VS Code?
Installation of Node.js on Linux
Installation of Node.js on Windows
How to Install Jupyter Notebook on MacOS?
How to Install and Use NVM on Windows?
How to Install Pygame on Windows ?
Dora module in Python

11 Oct, 2020
Dora is a library designed to simplify the exploratory data analysis which is such a painful part. It automates the repetitive tasks that consume most of the time. 
The library has functions that are very convenient for data cleaning, visualization, feature extraction and selection, visualization. Apart from this, it is also used for model validation by partitioning data, and transformations of data.
This library uses scikit-learn, pandas, and matplotlib. The intention of this library is to add additional features to general library mentioned before for exploratory data analysis. 
Installation:
pip install Dora

Usage:
In-order to implement it in datasets use the below syntax:
Python3
from Dora import Dora
It can be used for :
Reading Data & Configuration
Cleaning
Feature Selection & Extraction
Visualization
Model Validation
Data Versioning
Below is the most basic implementation of Dora module on a dataset in Python: 
Python
# Import required modulefrom Dora import Dora  # Create objectdora = Dora()  # Add dataset path as argument dora.configure(output = 'A', data = 'data.csv')   # Display datasetdora.data
Output:
python-modules
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Convert integer to string in Python
Python | os.path.join() method
Create a Pandas DataFrame from Lists
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Python OOPs Concepts
How To Convert Python Dictionary To JSON?
C++ Program to Find Largest Element of an Array

An array contains multiple elements and the largest element in an array is the one that is greater than other elements.
For example.
In the above array, 7 is the largest element and it is at index 2.
A program to find the largest element of an array is given as follows.
 Live Demo
#include <iostream>
using namespace std;
int main() {
   int a[] = {4, 9, 1, 3, 8};
   int largest, i, pos;
   largest = a[0];
   for(i=1; i<5; i++) {
      if(a[i]>largest) {
         largest = a[i];
         pos = i;
      }
   }
   cout<<"The largest element in the array is "<<largest<<" and it is at index "<<pos;
   return 0;
}
The largest element in the array is 9 and it is at index 1
In the above program, a[] is the array that contains 5 elements. The variable largest will store the largest element of the array.
Initially largest stores the first element of the array. Then a for loop is started which runs from the index 1 to n. For each iteration of the loop, the value of largest is compared with a[i]. If a[i] is greater than largest, then that value is stored in largest. And the corresponding value of i is stored in pos.
This is demonstrated by the following code snippet.
for(i=1; i<5; i++) {
   if(a[i]>largest) {
      largest = a[i];
      pos = i;
   }
}
After this, the value of the largest element in the array and its position is printed.
This is shown as follows −
cout<<"The largest element in the array is "<<largest<<" and it is at index "<<pos;
Tcl - File I/O

Tcl supports file handling with the help of the built in commands open, read, puts, gets, and close.
A file represents a sequence of bytes, does not matter if it is a text file or binary file.
Tcl uses the open command to open files in Tcl. The syntax for opening a file is as follows −
open fileName accessMode

Here, filename is string literal, which you will use to name your file and accessMode can have one of the following values −
r
Opens an existing text file for reading purpose and the file must exist. This is the default mode used when no accessMode is specified.
w
Opens a text file for writing, if it does not exist, then a new file is created else existing file is truncated.
a
Opens a text file for writing in appending mode and file must exist. Here, your program will start appending content in the existing file content.
r+
Opens a text file for reading and writing both. File must exist already.
w+
Opens a text file for reading and writing both. It first truncate the file to zero length if it exists otherwise create the file if it does not exist.
a+
Opens a text file for reading and writing both. It creates the file if it does not exist. The reading will start from the beginning, but writing can only be appended.
To close a file, use the close command. The syntax for close is as follows −
close fileName 

Any file that has been opened by a program must be closed when the program finishes using that file. In most cases, the files need not be closed explicitly; they are closed automatically when File objects are terminated automatically.
Puts command is used to write to an open file.
puts $filename "text to write"

A simple example for writing to a file is shown below.
#!/usr/bin/tclsh

set fp [open "input.txt" w+]
puts $fp "test"
close $fp
When the above code is compiled and executed, it creates a new file input.txt in the directory that it has been started under (in the program's working directory).
Following is the simple command to read from a file −
set file_data [read $fp]

A complete example of read and write is shown below −
#!/usr/bin/tclsh

set fp [open "input.txt" w+]
puts $fp "test"
close $fp
set fp [open "input.txt" r]
set file_data [read $fp]
puts $file_data
close $fp
When the above code is compiled and executed, it reads the file created in previous section and produces the following result −
test

Here is another example for reading file till end of file line by line −
#!/usr/bin/tclsh

set fp [open "input.txt" w+]
puts $fp "test\ntest"
close $fp
set fp [open "input.txt" r]

while { [gets $fp data] >= 0 } {
   puts $data
}
close $fp
When the above code is compiled and executed, it reads the file created in previous section and produces the following result −
test
test

 Print
 Add Notes
 Bookmark this page
C library function - asin()

The C library function double asin(double x) returns the arc sine of x in radians.
Following is the declaration for asin() function.
double asin(double x)
x − This is the floating point value in the interval [-1,+1].
x − This is the floating point value in the interval [-1,+1].
This function returns the arc sine of x, in the interval [-pi/2,+pi/2] radians.
The following example shows the usage of asin() function.
#include <stdio.h>
#include <math.h>

#define PI 3.14159265

int main () {
   double x, ret, val;
   x = 0.9;
   val = 180.0 / PI;

   ret = asin(x) * val;
   printf("The arc sine of %lf is %lf degrees", x, ret);
   
   return(0);
}
Let us compile and run the above program that will produce the following result −
The arc sine of 0.900000 is 64.158067 degrees


    12 Lectures 
     2 hours 

 Nishant Malik

    12 Lectures 
     2.5 hours 

 Nishant Malik

    48 Lectures 
     6.5 hours 

 Asif Hussain

    12 Lectures 
     2 hours 

 Richa Maheshwari

    20 Lectures 
     3.5 hours 

 Vandana Annavaram

    44 Lectures 
     1 hours 

 Amit Diwan
 Print
 Add Notes
 Bookmark this page
Accessing Values of Dictionary in Python

To access dictionary elements, you can use the familiar square brackets along with the key to obtain its value.
Following is a simple example −
 Live Demo
#!/usr/bin/python
dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
print "dict['Name']: ", dict['Name']
print "dict['Age']: ", dict['Age']
When the above code is executed, it produces the following result −
dict['Name']: Zara
dict['Age']: 7
If we attempt to access a data item with a key, which is not part of the dictionary, we get an error as follows −
 Live Demo
#!/usr/bin/python
dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
print "dict['Alice']: ", dict['Alice']
When the above code is executed, it produces the following result −
dict['Alice']:
Traceback (most recent call last):
File "test.py", line 4, in <module>
print "dict['Alice']: ", dict['Alice'];
KeyError: 'Alice'
.NET Core - Project Files

In this chapter, we will discuss .NET Core project files and how you can add existing files in your project.
Let us understand a simple example in which we have some files which are already created; we have to add these files in our FirstApp project.
Here is the implementation of the Student.cs file
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Threading.Tasks; 
  
namespace FirstApp { 
   public class Student { 
      public int ID { get; set; } 
      public string LastName { get; set; } 
      public string FirstMidName { get; set; } 
      public DateTime EnrollmentDate { get; set; } 
   } 
}
Here is the implementation of the Course.cs file.
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Threading.Tasks; 
  
namespace FirstApp { 
   public class Course { 
      public int CourseID { get; set; } 
      public string Title { get; set; } 
      public int Credits { get; set; } 
   } 
}
Let us now save these three files in your disk and the source folder of your project.
Now if you are familiar with .NET and this one was a traditional .NET framework console application, it is important to understand how to add these files in your project in Visual Studio.
Now if you are familiar with .NET and this one was a traditional .NET framework console application, it is important to understand how to add these files in your project in Visual Studio.
You first need to drag the files to the solution explorer to copy them in your project folder, because your project needs reference to these files.
You first need to drag the files to the solution explorer to copy them in your project folder, because your project needs reference to these files.
One of the benefits of .NET Core is the approach taken with the project file (project.json); we can just drop files into the root of our project and then these will be automatically included in our project.
One of the benefits of .NET Core is the approach taken with the project file (project.json); we can just drop files into the root of our project and then these will be automatically included in our project.
We don’t have to manually reference files like we did in the past for traditional .NET Framework application in Visual Studio.
We don’t have to manually reference files like we did in the past for traditional .NET Framework application in Visual Studio.
Let us now open the root of your project.
Let us now copy all of the three files into the root of your project.
You can now see all the files copied to the root folder.
Let us now go to Visual Studio; you will receive the following dialog box.
Click Yes to All to reload your project.
You will now that files are automatically included in your project.
 Print
 Add Notes
 Bookmark this page
CSS - Fade In Effect

The image come or cause to come gradually into or out of view, or to merge into another shot.
@keyframes fadeIn {
   0% {opacity: 0;}
   100% {opacity: 1;}
} 
Transform − Transform applies to 2d and 3d transformation to an element.
Transform − Transform applies to 2d and 3d transformation to an element.
Opacity − Opacity applies to an element to make translucence.
Opacity − Opacity applies to an element to make translucence.
<html>
   <head>
      <style>
         .animated {
            background-image: url(/css/images/logo.png);
            background-repeat: no-repeat;
            background-position: left top;
            padding-top:95px;
            margin-bottom:60px;
            -webkit-animation-duration: 10s;
            animation-duration: 10s;
            -webkit-animation-fill-mode: both;
            animation-fill-mode: both;
         }
         
         @-webkit-keyframes fadeIn {
            0% {opacity: 0;}
            100% {opacity: 1;}
         }
         
         @keyframes fadeIn {
            0% {opacity: 0;}
            100% {opacity: 1;}
         }
         
         .fadeIn {
            -webkit-animation-name: fadeIn;
            animation-name: fadeIn;
         }
      </style>
   </head>

   <body>
   
      <div id = "animated-example" class = "animated fadeIn"></div>
      <button onclick = "myFunction()">Reload page</button>
      
      <script>
         function myFunction() {
            location.reload();
         }
      </script>
      
   </body>
</html>
It will produce the following result −


 Academic Tutorials
 Big Data & Analytics 
 Computer Programming 
 Computer Science 
 Databases 
 DevOps 
 Digital Marketing 
 Engineering Tutorials 
 Exams Syllabus 
 Famous Monuments 
 GATE Exams Tutorials
 Latest Technologies 
 Machine Learning 
 Mainframe Development 
 Management Tutorials 
 Mathematics Tutorials
 Microsoft Technologies 
 Misc tutorials 
 Mobile Development 
 Java Technologies 
 Python Technologies 
 SAP Tutorials 
Programming Scripts 
 Selected Reading 
 Software Quality 
 Soft Skills 
 Telecom Tutorials 
 UPSC IAS Exams 
 Web Development 
 Sports Tutorials 
 XML Technologies 
 Multi-Language
 Interview Questions


 Academic Tutorials
 Big Data & Analytics 
 Computer Programming 
 Computer Science 
 Databases 
 DevOps 
 Digital Marketing 
 Engineering Tutorials 
 Exams Syllabus 
 Famous Monuments 
 GATE Exams Tutorials
 Latest Technologies 
 Machine Learning 
 Mainframe Development 
 Management Tutorials 
 Mathematics Tutorials
 Microsoft Technologies 
 Misc tutorials 
 Mobile Development 
 Java Technologies 
 Python Technologies 
 SAP Tutorials 
Programming Scripts 
 Selected Reading 
 Software Quality 
 Soft Skills 
 Telecom Tutorials 
 UPSC IAS Exams 
 Web Development 
 Sports Tutorials 
 XML Technologies 
 Multi-Language
 Interview Questions
Selected Reading
UPSC IAS Exams Notes
Developer's Best Practices
Questions and Answers
Effective Resume Writing
HR Interview Questions
Computer Glossary
Who is Who
 Print
 Add Notes
 Bookmark this page
C++ Program to remove spaces from a string - GeeksforGeeks

17 May, 2018
Given a string, remove all spaces from it. For example “g e e k” should be converted to “geek” and ” g e ” should be converted to “ge”.
The idea is to traverse the string from left to right and ignore spaces while traversing. We need to keep track of two indexes, one for current character being red and other for current index in output.
// C++ program to evaluate a given expression#include <iostream>using namespace std;  char *removeSpaces(char *str){    int i = 0, j = 0;    while (str[i])    {        if (str[i] != ' ')           str[j++] = str[i];        i++;    }    str[j] = '\0';    return str;}  // Driver program to test above functionint main(){    char str1[] = "gee    k   ";    cout << removeSpaces(str1) << endl;      char str2[] = " g e e k ";    cout << removeSpaces(str2);    return 0;}
Output:
geek
geek
Time complexity of above implementation is O(n) where n is number of characters in input string.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Strings
Strings
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Array of Strings in C++ (5 Different Ways to Create)
Convert string to char array in C++
Caesar Cipher in Cryptography
Top 50 String Coding Problems for Interviews
Check whether two strings are anagram of each other
Length of the longest substring without repeating characters
Reverse words in a given string
How to split a string in C/C++, Python and Java?
Remove duplicates from a given string
Reverse string in Python (5 different ways)
Print all paths from a given source to a destination in C++

In this problem we are given a directed graph and we have to print all paths from the source to the destination of the graph.
Directed graph is a graph in with edges that are directed from vertex a to b.
Let’s take an example to understand the problem 
Source = K destination = P
Output:
K -> T -> Y -> A -> P
K -> T -> Y -> P
K -> A -> P
Here, we have found paths from K to P. We have traversed paths and printed all paths from K that direct us to P.
To solve this problem, we will traverse the graph using depth-first search traversal technique. Starting from source, we will traverse each vertex store in our path array and mark it as visited (to avoid multiple visiting of the same vertex). And print this path, when the destination vertex is reached.
Let’s see the program implementing the logic -
 Live Demo
#include<iostream>
#include <list>
using namespace std;
class Graph {
   int V;
   list<int> *adj;
   void findNewPath(int , int , bool [], int [], int &);
   public:
   Graph(int V);
   void addEdge(int u, int v);
   void printPaths(int s, int d);
};
Graph::Graph(int V) {
   this->V = V;
   adj = new list<int>[V];
}
void Graph::addEdge(int u, int v) {
   adj[u].push_back(v);
}
void Graph::printPaths(int s, int d) {
   bool *visited = new bool[V];
   int *path = new int[V];
   int path_index = 0;
   for (int i = 0; i < V; i++)
   visited[i] = false;
   findNewPath(s, d, visited, path, path_index);
}
void Graph::findNewPath(int u, int d, bool visited[],
int path[], int &path_index) {
   visited[u] = true;
   path[path_index] = u;
   path_index++;
   if (u == d) {
      for (int i = 0; i<path_index; i++)
      cout<<path[i]<<" ";
      cout << endl;
   } else {
      list<int>::iterator i;
      for (i = adj[u].begin(); i != adj[u].end(); ++i)
         if (!visited[*i])
            findNewPath(*i, d, visited, path, path_index);
   }
   path_index--;
   visited[u] = false;
}
int main() {
   Graph g(4);
   g.addEdge(0, 1);
   g.addEdge(0, 2);
   g.addEdge(0, 3);
   g.addEdge(2, 0);
   g.addEdge(2, 1);
   g.addEdge(1, 3);
   int s = 2, d = 3;
   cout<<"Following are all different paths from source to destination : \n";
   g.printPaths(s, d);
   return 0;
}
Following are all different paths from source to destination :
2 0 1 3
2 0 3
2 1 3
Nesting Columns in Bootstrap

To nest your content with the default grid, add a new .row and set of .col-md-* columns within an existing .col-md-* column. 
You can try to run the following code to learn how to implement nesting columns in Bootstrap −
 Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class = "box">
         <h1>Heading</h1>
         <div class = "row">
            <div class = "col-md-3" style = "background-color: gray; color: white;
               box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
               <h4>Heading</h4>
               <p>This is demo text.</p>
            </div>
            <div class = "col-md-9" style = "background-color: gray;color: white;
               box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
               <h4>Heading</h4>
               <p>This is demo text.</p>
               <div class = "row">
                  <div class = "col-md-6" style = "background-color: orange;
                     box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
                     <p>This is box 1.</p>
                  </div>
                  <div class = "col-md-6" style = "background-color: orange;
                     box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
                     <p>This is box 2.</p>
                  </div>
               </div>
               <div class = "row">
                  <div class = "col-md-6" style = "background-color: orange;
                     box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
                     <p>This is box 3.</p>
                  </div>
                  <div class = "col-md-6" style = "background-color: orange;
                     box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
                     <p>This is box 4.</p>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </body>
</html>
PHP | str_shuffle() Function - GeeksforGeeks

20 Aug, 2020
The str_shuffle() function is an inbuilt function in PHP and is used to randomly shuffle all the characters of a string passed to the function as a parameter. When a number is passed, it treats the number as the string and shuffles it. This function does not make any change in the original string or the number passed to it as a parameter. Instead, it returns a new string which is one of the possible permutations of the string passed to it in the parameter.
Syntax:
str_shuffle($string) 
Parameter: This function accepts a single parameter $string. The parameter $string specifies the string whose characters are needed to be shuffled. In place of a string, a number can also be passed. If a number is passed instead of a string as a parameter then this function will treat that number as a string.
Return Value: The function returns a string of the same length but with shuffled characters within itself. Every time the program is executed, it displays a different output since shuffling of characters is different every time. The original string or the number can be the return value on some occasions.
Examples:
Input : $string = "raj" 
Output : jar 

Input : $string = "geeks" 
Output : eeksg 

Input : $string = 142 
Output : 412 

Note: The output will be different on every execution. 

Below programs illustrate the str_shuffle() function:
Program 1: Program to demonstrate the str_shuffle() function when a string is passed.
<?php// PHP program to demonstrate the str_shuffle()// function when a string is passed$string = "geeks";   // prints the shuffled string echo str_shuffle($string);?>
Output:
keegs
Program 2: Program to demonstrate the str_shuffle() function when a number is passed.
<?php// PHP program to demonstrate the str_shuffle()// function when a number is passed$string = 142;   // prints the shuffled string echo str_shuffle($string);?>
Output:
124
Reference:http://php.net/manual/en/function.str-shuffle.php
Akanksha_Rai
PHP-string
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to fetch data from localserver database and display on HTML table using PHP ?
How to create admin login page using PHP?
PHP str_replace() Function
How to pass form variables from one page to other page in PHP ?
Create a drop-down list that options fetched from a MySQL database in PHP
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
Python | Pandas dataframe.filter() - GeeksforGeeks

19 Nov, 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 dataframe.filter() function is used to Subset rows or columns of dataframe according to labels in the specified index. Note that this routine does not filter a dataframe on its contents. The filter is applied to the labels of the index.
Syntax: DataFrame.filter(items=None, like=None, regex=None, axis=None)
Parameters:items : List of info axis to restrict to (must not all be present)like : Keep info axis where “arg in col == True”regex : Keep info axis with re.search(regex, col) == Trueaxis : The axis to filter on. By default this is the info axis, ‘index’ for Series, ‘columns’ for DataFrame
Returns : same type as input object
The items, like, and regex parameters are enforced to be mutually exclusive. axis defaults to the info axis that is used when indexing with [].
For the link to CSV file click here
Example #1: Use filter() function to filter out any three columns of the dataframe.
# importing pandas as pdimport pandas as pd  # Creating the dataframe df = pd.read_csv("nba.csv")  # Print the dataframedf
Now filter the “Name”, “College” and “Salary” columns.
# applying filter function df.filter(["Name", "College", "Salary"])
Output :
 Example #2: Use filter() function to subset all columns in a dataframe which has the letter ‘a’ or ‘A’ in its name.
Note : filter() function also takes a regular expression as one of its parameter.
# importing pandas as pdimport pandas as pd  # Creating the dataframe df = pd.read_csv("nba.csv")  # Using regular expression to extract all# columns which has letter 'a' or 'A' in its name.df.filter(regex ='[aA]')
Output :
The regular expression ‘[aA]’ looks for all column names which has an ‘a’ or an ‘A’ in its name.
Python pandas-dataFrame
Python pandas-dataFrame-methods
Python-pandas
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
Create a Pandas DataFrame from Lists
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Convert integer to string in Python
sum() function in Python
reflect.String() Function in Golang with Examples - GeeksforGeeks

05 May, 2020
Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.String() Function in Golang is used to get the string v’s underlying value, as a string. To access this function, one needs to imports the reflect package in the program.
Syntax:
func (v Value) String() string

Parameters: This function does not accept any parameter.
Return Value: This function returns the string v’s underlying value, as a string.
Below examples illustrate the use of the above method in Golang:
Example 1:
// Golang program to illustrate// reflect.String() Function    package main   import (    "fmt"    "reflect")   // Main function func main() {       var k = reflect.TypeOf(0)    var e = reflect.TypeOf("")           //use of String method    fmt.Println(reflect.FuncOf([]reflect.Type{k},               []reflect.Type{e}, false).String())}
Output:
func(int) string

Example 2:
// Golang program to illustrate// reflect.String() Function    package main    import (    "fmt"    "reflect")   type Struct1 struct {    Var1       string    Var2       string    Var3       float64    Var4       float64}   // Main function func main() {    NewMap := make(map[string]*Struct1)    NewMap["abc"] = &Struct1{"abc", "def", 1.0, 2.0}    subvalMetric := "Var1"           for _, Value:= range NewMap {        s := reflect.ValueOf(&Value).Elem()          // use of String() method        println(s.String())        println(s.Elem().String())                   metric := s.Elem().FieldByName(subvalMetric).Interface()        fmt.Println(metric)    }       }
Output:
<*main.Struct1 Value>
<main.Struct1 Value>
abc

Golang-reflect
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
6 Best Books to Learn Go Programming Language
Arrays in Go
fmt.Sprintf() Function in Golang With Examples
Golang Maps
Slices in Golang
Different Ways to Find the Type of Variable in Golang
Inheritance in GoLang
Interfaces in Golang
How to Trim a String in Golang?