code-rag-bench/online-tutorials huggingface dataset:
How to create a pagination using JavaFX?

Pagination divides content up between pages and allows users to skip between pages or go in order through the content. You can create pagination by instantiating the javafx.scene.control.Pagination class.
The following Example demonstrates the creation of a Pagination.
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Pagination;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class PaginationExample extends Application {
   public void start(Stage stage) {
      //Creating a pagination
      Pagination pagination = new Pagination();
      //Setting number of pages
      pagination.setPageCount(10);
      //Creating a vbox to hold the pagination
      VBox vbox = new VBox();
      vbox.setSpacing(5);
      vbox.setPadding(new Insets(50, 50, 50, 60));
      vbox.getChildren().addAll(pagination);
      //Setting the stage
      Group root = new Group(vbox);
      Scene scene = new Scene(root, 595, 200, Color.BEIGE);
      stage.setTitle("Pagination");
      stage.setScene(scene);
      stage.show();
   }
   public static void main(String args[]){
      launch(args);
   }
}
Program to convert IntStream to String in Java - GeeksforGeeks

11 Dec, 2018
Given a Instream containing ASCII values, the task is to convert this Instream into a String containing the characters corresponding to the ASCII values.
Examples:
Input: IntStream = 71, 101, 101, 107, 115
Output: Geeks

Input: IntStream = 71, 101, 101, 107, 115, 70, 111, 114, 71, 101, 101, 107, 115
Output: GeeksForGeeks

Algorithm:
Get the Instream to be converted.Convert the IntStream into String with the help of StringBuilderCollect the formed StringBuilderConvert the StringBuilder into String using toString() methods.Print the formed String.
Get the Instream to be converted.
Convert the IntStream into String with the help of StringBuilder
Collect the formed StringBuilder
Convert the StringBuilder into String using toString() methods.
Print the formed String.
Below is the implementation of the above approach:
// Java program to convert// String to IntStream  import java.util.stream.IntStream;  class GFG {    public static void main(String[] args)    {          // Get the String to be converted        IntStream intStream = "Geeks".chars();          // Convert IntStream to String        String string = intStream                            .collect(StringBuilder::new,                                     StringBuilder::appendCodePoint,                                     StringBuilder::append)                            .toString();          // Print the String        System.out.println("String: " + string);    }}
Output:
String: Geeks

Java - util package
java-intstream
Java-Stream-programs
Java-String-Programs
Java
Java Programs
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Initialize an ArrayList in Java
Interfaces in Java
ArrayList in Java
Multidimensional Arrays in Java
Stack Class in Java
Convert a String to Character array in Java
Initializing a List in Java
Java Programming Examples
Convert Double to Integer in Java
Implementing a Linked List in Java using Class
Flattening a JSON object in JavaScript

Suppose, we have the following JSON object that may contain nesting upto any level −
const obj = {
   "one": 1,
   "two": {
      "three": 3
   },
   "four": {
      "five": 5,
      "six": {
         "seven": 7
      },
      "eight": 8
   },
   "nine": 9
};
We are required to write a JavaScript function that takes in one such nested JSON object and returns a new object that contains no nesting and maps the corresponding values to the keys using the dot notation.
Therefore, in case of the object above, the output should look something like this −
const output = {
   'one': 1,
   'two.three': 3,
   'four.five': 5,
   'four.six.seven': 7,
   'four.eight': 8,
   'nine': 9
};
The code for this will be −
 Live Demo
const obj = {
   "one": 1,
   "two": {
      "three": 3
   },
   "four": {
      "five": 5,
      "six": {
         "seven": 7
      },
      "eight": 8
   },
   "nine": 9
};
const flattenJSON = (obj = {}, res = {}, extraKey = '') => {
   for(key in obj){
      if(typeof obj[key] !== 'object'){
         res[extraKey + key] = obj[key];
      }else{
         flattenJSON(obj[key], res, `${extraKey}${key}.`);
      };
   };
   return res;
};
console.log(flattenJSON(obj));
And the output in the console will be −
{
   one: 1,
   'two.three': 3,
   'four.five': 5,
   'four.six.seven': 7,
   'four.eight': 8,
   nine: 9
}
How to append a list to a Pandas DataFrame using append() in Python?

To append a list to a DataFrame using append(), let us first create a DataFrame. The data is in the form of lists of team rankings for our example −
# data in the form of list of team rankings
Team = [['India', 1, 100],['Australia', 2, 85],['England', 3, 75],['New Zealand', 4 , 65],['South Africa', 5, 50]]

# Creating a DataFrame and adding columns
dataFrame = pd.DataFrame(Team, columns=['Country', 'Rank', 'Points'])
Let’s say the following is the row to be append −
myList = [["Sri Lanka", 6, 40]]

Append the above row in the form of list using append() −
dataFrame = dataFrame.append(pd.DataFrame(myList, columns=['Country', 'Rank', 'Points']), ignore_index=True)
Following is the code −
import pandas as pd

# data in the form of list of team rankings
Team = [['India', 1, 100],['Australia', 2, 85],['England', 3, 75],['New Zealand', 4 , 65],['South Africa', 5, 50]]

# Creating a DataFrame and adding columns
dataFrame = pd.DataFrame(Team, columns=['Country', 'Rank', 'Points'])

print"DataFrame...\n",dataFrame

# row to be appended
myList = [["Sri Lanka", 6, 40]]

# append the above row in the form of list
dataFrame = dataFrame.append(pd.DataFrame(myList, columns=['Country', 'Rank', 'Points']), ignore_index=True)

# display the update dataframe
print"\nUpdated DataFrame after appending a row...\n",dataFrame
This will produce the following output −
DataFrame...
        Country   Rank   Points
0         India      1      100
1     Australia      2       85
2       England      3       75
3   New Zealand      4       65
4  South Africa      5       50

Updated DataFrame after appending a row...
        Country   Rank   Points
0         India      1      100
1     Australia      2       85
2       England      3       75
3   New Zealand      4       65
4  South Africa      5       50
5     Sri Lanka      6       40
Pass array to MySQL stored routine?

We need to create a stored procedure to display how to pass array to MySQL stored routine. Let us first create a table for our example.
Creating a table
mysql> create table FindDemo
   -> (
   -> name varchar(100)
   -> );
Query OK, 0 rows affected (0.46 sec)
Inserting some records into the table.
mysql> insert into FindDemo values('John'),('Smith');
Query OK, 2 rows affected (0.13 sec)
Records: 2  Duplicates: 0  Warnings: 0
To display all records.
mysql> select *from FindDemo;
The following is the output.
+-------+
| name  |
+-------+
| John  |
| Smith |
+-------+
2 rows in set (0.00 sec)

To create a stored routine that accepts an array as a parameter.
mysql> delimiter //
mysql>CREATE  PROCEDURE SearchingStoredProcedure(IN ArrayDemo VARCHAR(100))
   -> BEGIN
   ->     SELECT * FROM FindDemo
   ->     WHERE FIND_IN_SET(name, ArrayDemo);
   ->
   -> END//
Query OK, 0 rows affected (0.14 sec)
Passing array as a parameter.
mysql> delimiter ;
mysql> call SearchingStoredProcedure('David,Bob,John');
Here is the output.
+------+
| name |
+------+
| John |
+------+
1 row in set (0.00 sec)

Query OK, 0 rows affected (0.01 sec)
Rexx - RANDOM

This method returns a random generated number.
RANDOM() 

None
None
This method returns a random generated number.
/* Main program */ 
say RANDOM() 
When we run the above program, we will get the following result.
971

 Print
 Add Notes
 Bookmark this page
How to find and display the Multiplication Table in C#?

To display multiplication table, you need to set the numbers and format the output property. Let’s say you want to find the table of 4 from 1 to 10. For that, set a while loop first till 10.
while (a <= 10) {
}
Now format the output to get the result as shown below. Here, n is 4 i.e. table of 4.
Console.WriteLine(" {0} x {1} = {2} \n ", n, a, n * a);
The above will give a formatted output −
4 x 1 = 4
4 x 2 = 8
4 x 3 = 12
.
.
.
The following is the complete example −
using System;
public class Demo {

   public static void Main() {
      int n = 4, a = 1;

      while (a <= 10) {
         Console.WriteLine(" {0} x {1} = {2} \n ", n, a, n * a);
         a++;
      }
   }
}
IPython - Installation

IPython is included by default in Anaconda distribution of Python. It can be downloaded from Anaconda’s download page www.anaconda.com/download/ Binaries for all major OS (Windows, MacOS and Linux) and architecture (32 bit and 64 bit) are available on this link.
To install IPython separately in standard Python installation, you can use pip command as shown below −
pip3 install ipython

IPython internally uses following packages −
colorama
Cross-platform API for printing colored terminal text from Python
jedi
An autocompletion tool for Python
pickleshare
Small ‘shelve’ like datastore with concurrency support
prompt_toolkit
Library for building powerful interactive command lines in Python
pygments
Syntax highlighting package written in Python
simplegeneric
Simple generic functions
traitlets
Configuration system for Python applications.
In general, all dependencies get installed automatically. Else, you can install them individually using pip.

    22 Lectures 
     49 mins

 Bigdata Engineer
 Print
 Add Notes
 Bookmark this page
C++ String Library - find_last_not_of

It searches the string for the first character that does not match any of the characters specified in its arguments.
Following is the declaration for std::string::find_last_not_of.
size_t find_last_not_of (const string& str, size_t pos = npos) const;
size_t find_last_not_of (const string& str, size_t pos = npos) const noexcept;
size_t find_last_not_of (const string& str, size_t pos = npos) const noexcept;
str − It is a string object.
str − It is a string object.
len − It is used to copy the characters.
len − It is used to copy the characters.
pos − Position of the first character to be copied.
pos − Position of the first character to be copied.
none
if an exception is thrown, there are no changes in the string.
In below example for std::string::find_last_not_of.
#include <iostream>
#include <string>
#include <cstddef>

int main () {
   std::string str ("It erases trailing white-spaces   \n");
   std::string whitespaces (" \t\f\v\n\r");

   std::size_t found = str.find_last_not_of(whitespaces);
   if (found!=std::string::npos)
      str.erase(found+1);
   else
      str.clear();

   std::cout << '[' << str << "]\n";

   return 0;
}
The sample output should be like this −
[It erases trailing white-spaces]

 Print
 Add Notes
 Bookmark this page
Splitter splitToList() method | Guava | Java - GeeksforGeeks

31 Jan, 2019
The method splitToList(CharSequence sequence) splits sequence into string components and returns them as an immutable list.
Syntax:
public List<String> 
    splitToList(CharSequence sequence)

Parameters: This method takes sequence as parameter which is the sequence of characters to split.
Return Value: This method returns an immutable list of the segments split from the parameter.
Below examples illustrate the working of splitToList() method:
Example 1:
// Java code to show implementation of// splitToList method// of Guava's Splitter Class  import com.google.common.base.Splitter;import java.util.List;  class GFG {      // Driver's code    public static void main(String[] args)    {          // Creating a string variable        String str = "Hello, geeks, for, geeks, noida";          // SplitToList returns a List of the strings.        // This can be transformed to an ArrayList        // or used directly in a loop.        List<String> myList = Splitter.on(',').splitToList(str);          for (String temp : myList) {            System.out.println(temp);        }    }}
Hello
 geeks
 for
 geeks
 noida

Example 2:
// Java code to show implementation of// splitToList method // of Guava's Splitter Class  import com.google.common.base.Splitter;import java.util.List;  class GFG {      // Driver's code    public static void main(String[] args)    {          // Creating a string variable        String str = "Everyone. should. Learn, Data. Structures";          // SplitToList returns a List of the strings.        // This can be transformed to an ArrayList        // or used directly in a loop.        List<String> myList = Splitter.on('.').splitToList(str);          for (String temp : myList) {            System.out.println(temp);        }    }}
Everyone
 should
 Learn, Data
 Structures

Guava-Functions
Guava-Splitter
java-guava
java-list
Java-Strings
Java
Java-Strings
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Initialize an ArrayList in Java
Object Oriented Programming (OOPs) Concept in Java
HashMap in Java with Examples
Interfaces in Java
ArrayList in Java
How to iterate any Map in Java
Multidimensional Arrays in Java
Stack Class in Java
Stream In Java
Singleton Class in Java
How can I check if a string is all uppercase in JavaScript?

You can compare the string against itself in upper case to check if it is
in the upper case.
function isUpperCase(str) {
   return str === str.toUpperCase();
}
console.log(isUpperCase('a'))
console.log(isUpperCase('A'))
console.log(isUpperCase('ASDF 123 asd'))
console.log(isUpperCase('TEST 123 TEST'))
This will give the output −
false
true
false
true
Divide large number represented as string in C++ Program

In this tutorial, we are going to learn how to divide a large number that is represented as a string.
We have given a large number in string format and a divisor. Our program should find a reminder.
First, we will find a part of the given number that is greater than the dividend. And then we will add the remaining digits one by one to the divisor.
Let's see the steps to solve the problem.
Initialize the large number along with a divisor.
Initialize the large number along with a divisor.
Iterate over the given number until we extract the part that is greater than the divisor.
Iterate over the given number until we extract the part that is greater than the divisor.
Now, iterate from where we left in the previous step until the end of the number.Divide the extracted part with a divisor and add it to the result.Update the number with the next digit.
Now, iterate from where we left in the previous step until the end of the number.
Divide the extracted part with a divisor and add it to the result.
Divide the extracted part with a divisor and add it to the result.
Update the number with the next digit.
Update the number with the next digit.
Check whether the result is zero or not.
Check whether the result is zero or not.
And print the result.
And print the result.
Let's see the code.
 Live Demo
#include <bits/stdc++.h>
using namespace std;
string divideLargeNumber(string number, int divisor) {
   // to store the result
   string result;
   int index = 0;
   // extracting the part that is greater than the given divisor
   int dividend = number[index] - '0';
   while (dividend < divisor) {
      dividend = dividend * 10 + (number[++index] - '0');
   }
   // iterating until all digits participate in the division
   while (number.size() > index) {
      result += (dividend / divisor) + '0';
      // adding the next digit to the dividend
      dividend = (dividend % divisor) * 10 + number[++index] - '0';
   }
   if (result.length() == 0) {
      return "0";
   }
   return result;
}
int main() {
   string large_number = "12345678901234567890";
   int divisor = 75;
   cout << divideLargeNumber(large_number, divisor) << endl;
   return 0;
}
If you execute the above program, then you will get the following result.
164609052016460905
If you have any queries in the tutorial, mention them in the comment section.
Explain Encapsulation in PHP.

Object Oriented Programming is a software approach added to PHP5, which helps in building the composite application in an easy way. Some of the OOP concepts added into the PHP5 are an abstraction, interface, static method, and static class, etc...
In this article, we will learn Encapsulation and it's implementation through a few examples.
The wrapping up of data and methods into a single unit (called class) is known as encapsulation. Encapsulation is a protection mechanism for the data members and methods present inside the class. In the encapsulation technique, we are restricting the data members from access to outside world end-user.
In PHP, encapsulation utilized to make the code more secure and robust. Using encapsulation, we are hiding the real implementation of data from the user and also does not allow anyone to manipulate data members except by calling the desired operation.
Let' understand this through an example.
<?php
   class ATM {
      private $custid;
      private $atmpin;
      public function PinChange($custid,$atmpin) {
               ---------perform tasks-----
               }
      public function CheckBalance($custid,$atmpin){
               ---------perform tasks-----
               }
      public function miniStatement($custid) {
               ---------perform tasks-----
               }
      }
   $obj = new ATM();
   $obj ->CheckBalance(10005285637,1**3);
?>
In this example, all the ATM class data members (variable) are marked with the private modifier. It implies that we can not directly access ATM class data members (property). So, we can't change the class property directly. The only approach to change the class property (data members) is calling a method (function). That’s the reason we have stated all the ATM class methods with a public access modifier. The user can pass the expected arguments to a class method to perform a particular task. 
Suppose anyone wants to check balance then he needs to access the CheckBalance() method with the required arguments custid="10005285637"andatmpin="1**3". This is called Data hiding through Encapsulation.
We can achieve Encapsulation in PHP through by implementing Access specifiers.
PHP | floatval() Function

25 Jun, 2018
The floatval() function is an inbuilt function in PHP which returns the float value of a variable.
Syntax:
float floatval ( $var )

Parameters: This function accepts one parameter which is mandatory and described below:
$var: The variable whose corresponding float value will be returned. This variable should not be an object.
Return Value: It returns float value of given variable. Empty array returns 0 and non-empty array returns 1.
Note: If an object is passed to the function, it produce an E_NOTICE level error and return 1.
Examples:
Input : $var = '41.68127E3'
Output : 41681.27

Input : $var = '47.129mln'
Output : 47.129

Below programs illustrate the use of floatval() function in PHP:Program 1:
<?php$var = '41.68127E3';$float_value = floatval($var);echo $float_value;?>
41681.27

Program 2:
<?php$var = '47.129mln';$float_value = floatval($var);echo $float_value;?>
47.129

Reference: http://php.net/manual/en/function.floatval.php
PHP-function
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
How to Upload Image into Database and Display it using PHP ?
How to check whether an array is empty using PHP?
PHP | Converting string to Date and DateTime
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
Python | numpy.fill_diagonal() method

27 Sep, 2019
With the help of numpy.fill_diagonal() method, we can get filled the diagonals of numpy array with the value passed as the parameter in numpy.fill_diagonal() method.
Syntax : numpy.fill_diagonal(array, value)Return : Return the filled value in the diagonal of an array.
Example #1 :In this example we can see that by using numpy.fill_diagonal() method, we are able to get the diagonals filled with the values passed as parameter.
# import numpyimport numpy as np  # using numpy.fill_diagonal() methodarray = np.array([[1, 2], [2, 1]])np.fill_diagonal(array, 5)  print(array)
Output :
[[5 2][2 5]]
Example #2 :
# import numpyimport numpy as np  # using numpy.fill_diagonal() methodarray = np.zeros((3, 3), int)np.fill_diagonal(array, 1)  print(array)
Output :
[[1 0 0][0 1 0][0 0 1]]
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
Introduction To PYTHON
Python | os.path.join() method
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 | Get unique values from a list
Python | datetime.timedelta() function
Extract and print words separately from a given Camel Case string

26 Jun, 2020
Given a string in Camel Case format, we need to extract all the words which are present in the string.
CamelCase is the sequence of one or more than one words having the following properties:
It is a concatenation of one or more words consisting of English letters.All letters in the first word are lowercase.For each of the subsequent words, the first letter is uppercase and the rest of the letters are lowercase.
It is a concatenation of one or more words consisting of English letters.
All letters in the first word are lowercase.
For each of the subsequent words, the first letter is uppercase and the rest of the letters are lowercase.
Example:
Input: str = “GeeksForGeeks”Output:GeeksForGeeks
Input: str = “AComputerSciencePortalForGeeks”Output:AComputerSciencePortalForGeeks
Approach:A simple approach is to traverse the array and extract every word by looking at its first character, as it will always be in upper-case. Store all extracted words in a new array and print them.
C++
// C++ program to print words// from CamelCase String  #include <cstring>#include <iostream>using namespace std;  // Function to extract a wordchar* mystrtok(char* str){    static char* input = NULL;    if (str != NULL) {        input = str;    }      // Base case    if (input == NULL)        return NULL;      // Array for storing tokens    // +1 is for '\0'    char* output = new char[strlen(input + 1)];      int i = 0;      // Storing the upper case character    output[i] = input[i];      i++;      // Generating Tokens    for (; input[i] != '\0'; i++) {        if (!isupper(input[i]))            output[i] = input[i];        else {            output[i] = '\0';            input = input + i;            return output;        }    }      output[i] = '\0';    input = NULL;    return output;}  // Function to extract wordsvoid extractWords(char* s){      // Extract 1st word and print it    char* ptr = mystrtok(s);    cout << ptr << endl;      // Extract the remaining words    while (ptr != NULL) {        ptr = mystrtok(NULL);        cout << ptr << endl;    }}  // Driver codeint main(){      char s[] = "GeeksForGeeks";    extractWords(s);      return 0;}
Geeks
For
Geeks

Time Complexity: O(N)Space Complexity: O(N), as we needed a new array to store output.
Strings
Strings
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Top 50 String Coding Problems for Interviews
What is Data Structure: Types, Classifications and Applications
Print all the duplicates in the input string
Print all subsequences of a string
A Program to check if strings are rotations of each other or not
String class in Java | Set 1
Find if a string is interleaved of two other strings | DP-33
Remove first and last character of a string in Java
Check if an URL is valid or not using Regular Expression
Find the smallest window in a string containing all characters of another string
How to create proxy server on Heroku in Node.js ?

11 May, 2022
The following approach covers how to create a proxy server on Heroku using NodeJS. Heroku is a cloud application platform that is used as PaaS (Platform as a service) to build, operate and run applications on their cloud.
Prerequisites: To create a proxy server, you will need the following to be installed on your computer:
Install Heroku CLI.
Install node.js.
Install git.
Git version control skills.
Follow these simple steps to create a proxy server on Heroku:
Step 1: Setting up a local repository. Clone your remote repository to the local directory.
Now cd into your cloned repository and run the command npm install to install all node dependencies into your project.
Step 2: Setting up the Heroku environment using the following approach:
Login into Heroku from the terminal by using the command Heroku login.
After the login command from the terminal follow the prompts in the open browser to log in.
After successful execution following will be displayed on your terminal screen.
The next step is to create an app on Heroku using the command Heroku create.
After the above step, Heroku will display a generic message with deployed URL which can be exchanged for a universal URL anywhere.
Step 3: Pushing our proxy server into the Heroku server. The final step is to push our proxy server to Heroku which can be done by using the following command.
git push heroku (branch-name)
Now your proxy server is successfully created and deployed on Heroku.
Heroku Cloud
Node.js-Methods
NodeJS-Questions
Picked
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Use for Each Loop in Excel VBA?

29 Jul, 2021
A For Each loop is used to execute a statement or a set of statements for each element in an array or collection.
Syntax:
For Each element In group
[ statements ]
[ Exit For ]
[ statements ]
Next [ element ]
The For...Each...Next statement syntax has the following three parts:
There are 4 basic steps to writing a For Each Next Loop in VBA:
Declare a variable.
Write the For Each Line with the variable and collection references.
Add line(s) of code to repeat for each item in the collection.
Write the Next line to terminate the loop.
The For...Each block is entered if there is at least one element in the group. Upon entering the loop, all the statements in the loop are executed for each element. When there are no more elements in the group, the loop is exited and execution continues with the statement following the Next statement. The next statement line terminates the loop.
Any number of Exit For statements may be placed anywhere in the loop as an alternative way to exit. Exit For is often used after evaluating some condition, for example, If...Then, and transfers control to the statement immediately following Next.
You can also nest For...Each...Next loops by placing one For...Each...Next loop within another. However, each loop element must be unique in its way.
NOTE
Execution continues as if element is included, if you omit element in a Next statement.
An error occurs, If a Next statement is encountered before its corresponding For statement,
You can’t use the For...Each...Next statement with an array of user-defined types because a Variant can’t contain a user-defined type.
Example 1
  Private Sub Demo_Loop()
        students is an array
       students = Array(“Akshit”, “Nikita”, “Ritesh”)  //Initialising Array-> students
      Dim studentnames As Variant  // Variable is assigned
     ‘iterating using For each loop.
      For Each Item In students
     studentnames =studentnames & Item & Chr(10)
    Next
       MsgBox studentnames
End Sub
It would look somewhat like below:
When the above code is executed, it prints all the student names with one item in each line.
akshitsaxenaa09
Excel-VBA
Picked
Excel
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Delete Blank Columns in Excel?
How to Get Length of Array in Excel VBA?
How to Normalize Data in Excel?
How to Find the Last Used Row and Column in Excel VBA?
How to Use Solver in Excel?
Introduction to Excel Spreadsheet
How to make a 3 Axis Graph using Excel?
Macros in Excel
How to Show Percentages in Stacked Column Chart in Excel?
How to Extract the Last Word From a Cell in Excel?
Swift – Convert String to Int Swift

07 Jan, 2022
Swift provides a number of ways to convert a string value into an integer value. Though, we can convert a numeric string only into an integer value. In this article, we will see the two most common methods used to convert a string to an integer value. A string is a collection of characters. Swift provides String data type with the help of which we can store a string. For example, “GeeksforGeeks”, “GFG”, etc. A variable can be declared as String type by following the below syntax,
Syntax:
let myVariable: String 
For example: myVariable = “GeeksforGeeks”
Swift provides the function of integer initializers using which we can convert a string into an Int type. To handle non-numeric strings, we can use nil coalescing using which the integer initializer returns an optional integer. 
let myStringVariable = “25”
let myIntegerVariable = Int(myStringVariable) ?? 0                       
It means that if the string is non-numeric then assign the variable with 0 otherwise convert the numeric string to an integer. Below is the implementation to convert a String into Int:
Example:
Swift
// Swift program to convert String to Int  // Here we are converting a numeric string.  // Initializing a constant variable of string typelet myStringVariable = "25"  // Converting the string into integer typelet myIntegerVariable = Int(myStringVariable) ?? 0  // Print the value represented by myIntegerVariableprint("Integer Value:", myIntegerVariable)  // Here, we are converting a non-numeric string.// Initializing a constant variable of string typelet myStringvariable = "GeeksforGeeks"  // Trying to convert "GeeksforGeeks" // to the integer equivalent but since // it's non-numeric string hence the// optional value would be assigned // to the integer variable which is// equal to 0 in this caselet myIntegervariable = Int(myStringvariable) ?? 0  // Print the value represented by myIntegervariableprint("Integer Value:", myIntegervariable)
Output:
Integer Value: 25
Integer Value: 0
NSString in Swift is a class that is used to create objects that lie in heap and they are passed by reference. It provides different types of methods for comparing, searching, and modifying strings. We can convert a numeric string into an integer value indirectly. Firstly, we can convert a string into an NSString then we can use “integerValue” property used with NSStrings to convert an NSString into an integer value. 
Example: 
In the below program we have converted the numeric string into NSString then we have applied “integerValue” property to convert a string into an integer value.
Swift
// Swift program to convert String to Int  import Foundationimport Glibc  let myString = "25"  // Firstly we are converting a string into NSString then// using integerValue property we get integer valuelet myIntegerVariable = (myString as NSString) .integerValue  print("Integer Value:", myString)
Output:
Integer Value: 25
arorakashish0911
Picked
Swift
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | GATE CS Mock 2018 | Question 59

10 Jan, 2018
Consider a database with the following schema:
Person ( name, age, gender )
name is a key
Frequents ( name, pizzeria )
(name, pizzeria) is a key
Eats ( name, pizza )
(name, pizza) is a key
Serves ( pizzeria, pizza, price )
(pizzeria, pizza) is a key

Relational algebra expression for query “Names of all people who frequent only pizzeria’s serving at least one pizza they eat” is
(A) 
(B) (C) (D) None of the aboveAnswer: (B)Explanation: Find names of all people who frequent only pizzerias serving at least one pizza they eat :
Option (B) is correct.Quiz of this Question
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to define multiline String Literal in C#?

Let’s say the string is −
Welcome User, Kindly wait for the image to load
For multiline String Literal, firstly set it like the following statement using@ prefix −
string str = @"Welcome User,
Kindly wait for the image to
load";
Now let us display the result. The string is a multi-line string now −
 Live Demo
using System;

namespace Demo {

   class Program {

      static void Main(string[] args) {
         string str = @"Welcome User,
         Kindly wait for the image to
         load";

         Console.WriteLine(str);
      }
   }
}
Welcome User,
Kindly wait for the image to
load
Materialize -  DatePicker

The following example demonstrates Materialize DatePicker control.
materialize_datepicker.htm
<html>
   <head>
      <title>The Materialize Range Example</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">      
      <link rel = "stylesheet"
         href = "https://fonts.googleapis.com/icon?family=Material+Icons">
      <link rel = "stylesheet"
         href = "https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
      <script type = "text/javascript"
         src = "https://code.jquery.com/jquery-2.1.1.min.js">></script>           
      <script src = "https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js">
      </script> 
   </head>
   <body class = "container">   
      <div class = "row">
         <form class = "col s12">
            <div class = "row">            <label>Materialize DatePicker</label>              
               <input type = "date" class = "datepicker" />    
            </div>            
         </form>       
      </div>
   </body>   
</html>
Verify the result.
 Print
 Add Notes
 Bookmark this page
Java program to check palindrome

Palindrome number is a number which remains the same when reversed, for example, 121, 313, 525, etc.
Let us now see an example to check palindrome −
public class Palindrome {
   public static void main(String[] args) {
      int a = 525, revVal = 0, remainder, val;
      val = a;
      System.out.println("Number to be checked = "+a);
      while( a != 0 ) {
         remainder = a % 10;
         revVal = revVal * 10 + remainder;
         a /= 10;
      }
      if (val == revVal)
         System.out.println("Palindrome!");
      else
         System.out.println("Not a palindrome!");
   }
}
Number to be checked = 525
Palindrome!
Let us now check for palindrome string such as “aba”, “wow”, etc −
public class Demo {
   public static void main (String[] args) {
      String str = "ABA";
      String strRev = new StringBuffer(str).reverse().toString();
      if (str.equals(strRev))
         System.out.println("Palindrome!");
      else
         System.out.println("Not a Palindrome!");
   }
}
Palindrome!
How to create Message Pop-Ups with Java?

To create Message Pop-ups, use the following JOptionPane −
JOptionPane.showMessageDialog
We are displaying a tree inside the message pop-ups. The following is an example to create Message Pop-Ups with Java −
package my;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
public class SwingDemo {
   public static void main(String[] args) throws Exception {
      JFrame frame = new JFrame("Demo");
      DefaultMutableTreeNode node = new DefaultMutableTreeNode("Project");
      DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("App");
      DefaultMutableTreeNode node2 = new DefaultMutableTreeNode("Website");
      DefaultMutableTreeNode node3 = new DefaultMutableTreeNode("WebApp");
      node.add(node1);
      node.add(node2);
      node.add(node3);
      DefaultMutableTreeNode one = new DefaultMutableTreeNode("Learning website");
      DefaultMutableTreeNode two = new DefaultMutableTreeNode("Business website");
      DefaultMutableTreeNode three = new DefaultMutableTreeNode("News publishing website");
      DefaultMutableTreeNode four = new DefaultMutableTreeNode("Android app");
      DefaultMutableTreeNode five = new DefaultMutableTreeNode("iOS app");
      DefaultMutableTreeNode six = new DefaultMutableTreeNode("Editor WebApp");
      node1.add(one);
      node1.add(two);
      node1.add(three);
      node2.add(four);
      node2.add(five);
      node3.add(six);
      JTree tree = new JTree(node);
      frame.add(tree);
      tree.setVisibleRowCount(8);
      JOptionPane.showMessageDialog(null, new JScrollPane(tree));
   }
}
How to open an Excel file with PHPExcel for both reading and writing?

There is no concept of opening a file for read and write in PHPExcel since it is not aware of the source of the PHPExcel object. Irrespective of the source from where the file was loaded or the type of file, the file can be read based on its named and saved with the same name. This way, the file will be overwritten, and new changes will be reflected in the file.
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
set_include_path(get_include_path() . PATH_SEPARATOR . './Classes/');
include 'PHPExcel/IOFactory.php';
$fileType = 'Excel5';
$fileName = name_of_file.xls';
// Read the file
$objReader = PHPExcel_IOFactory::createReader($fileType);
$objPHPExcel = $objReader->load($fileName);
// Change the file
$objPHPExcel->setActiveSheetIndex(0)
   ->setCellValue('A1', 'Hello')
   ->setCellValue('B1', 'World!');
// Write the file
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $fileType);
$objWriter->save($fileName);
This will produce the following output −
Changes to cell A1, B1 are reflected in the name_of_file.xls file.
The time limit is set to 0 and the timezone is set to Europe/London. The filetype is known to be Excel and filename is assigned to the variable ‘fileName’. The ‘PHPExcel_IOFactory’ class ‘createReader’ is used to create the object and it is loaded using the ‘load’ function. Two cell values of the ‘xls’ sheet are changed and it is saved with the same named.
Missing SAP Java Connector libraries JCo- librfc32.dll, com.sap.utils and com.sap.mw

Please note that all these library files - librfc32.dll, com.sap.utils and com.sap.mw come under JCo 2.1. With release of JCo 3.0, it’s classes were also relocated from packages com.sap.mw.jco.* to com.sap.conn.jco.*
For running with SAP JCo 3.0, you need these files at runtime - sapjco3.jar and sapjco3.dll (on Windows). You can follow below procedure for installation of JCo files:
In Windows OS, you have to copy sapjco3.jar file into ITDI_HOME/jars/3rdparty/others.
Copy the sapjco3.dll file into ITDI_HOME/libs. On Windows, JCo 3 requires additional Microsoft Visual C++ 2005 libraries to be installed. Installation details for the package that contains these libraries are specified in Microsoft Knowledge Base article 973544.
Restart the adapter service.
Create a symbolic link to the sapjco3.jar file in ITDI_HOME/jars/3rdparty/others:
ln -s <sapjco_install_dir>/sapjco3.jar
ITDI_HOME/jars/3rdparty/others/sapjco3.jar
Next is to add SAP JCo installation directory to the dynamic library path by following below steps:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<sapjco_install_dir>
export LIBPATH=$LIBPATH:<sapjco_install_dir>
Restart the Dispatcher.
Send keys without specifying element in Python Selenium webdriver

We can send keys without specifying elements in Python with Selenium webdriver. The tagname input is used for all the edit boxes. We shall use the find_element_by_tag_name method and pass input as a parameter to that method.
Thus we need not mention element attributes explicitly. Let us investigate the html code of an element which can be identified with tagname input.
from selenium import webdriver
#set geckodriver.exe path
driver = webdriver.Firefox(executable_path="C:\\geckodriver.exe")
driver.implicitly_wait(0.5)
driver.get("https://www.tutorialspoint.com/index.htm")
#identify element with tagname
l = driver.find_element_by_tag_name("input")
l.send_keys("Selenium")
#obtain value obtained
print("Value entered: ")
print(l.get_attribute('value'))
driver.quit()
Program to loop on every character in string in C++

Here in this program we will see how to iterate through each characters of a string in C++. To loop on each character, we can use loops starting from 0 to (string length – 1). For accessing the character we can either use subscript operator "[ ]" or at() function of string object.
Input: A string “Hello World”
Output: “Hello World”
Step 1: Get the string
Step 2: Use R before string to make it raw string
Step 3: End
 Live Demo
#include<iostream>
using namespace std;
main() {
   string my_str = "Hello World";
   for(int i = 0; i<my_str.length(); i++) {
      cout << my_str.at(i) << endl; //get character at position i
   }
}
H
e
l
l
o

W
o
r
l
d
jQuery - serialize( ) Method

The serialize( ) method serializes a set of input elements into a string of data.
Here is the simple syntax to use this method −
$.serialize( )

Here is the description of all the parameters used by this method −
NA
NA
Assuming we have following PHP content in serialize.php file −
<?php
if( $_REQUEST["name"] ) {

   $name = $_REQUEST['name'];
   echo "Welcome ". $name;
   $age = $_REQUEST['age'];
   echo "<br />Your age : ". $age;
   $sex = $_REQUEST['sex'];
   echo "<br />Your gender : ". $sex;
}
?>
Following is a simple example a simple showing the usage of this method −
<html>
   <head>
      <title>The jQuery Example</title>
      <script type = "text/javascript" 
         src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
		
      <script type = "text/javascript" language = "javascript">
         $(document).ready(function() {
			
            $("#driver").click(function(event){
				
               $.post( 
                  "/jquery/serialize.php",
                  $("#testform").serialize(),
						
                  function(data) {
                     $('#stage1').html(data);
                  }
						
               );
					
               var str = $("#testform").serialize();
               $("#stage2").text(str);
            });
				
         });
      </script>
   </head>
	
   <body>
      <p>Click on the button to load result.html file:</p>
		
      <div id = "stage1" style = "background-color:blue;">
         STAGE - 1
      </div>
      <br />
		
      <div id = "stage2" style = "background-color:blue;">
         STAGE - 2
      </div>
		
      <form id = "testform">
         <table>
            <tr>
               <td><p>Name:</p></td>
               <td><input type = "text" name = "name" size = "40" /></td>
            </tr>
				
            <tr>
               <td><p>Age:</p></td>
               <td><input type = "text" name = "age" size = "40" /></td>
            </tr>
				
            <tr>
               <td><p>Sex:</p></td>
               <td> <select name = "sex">
                  <option value = "Male" selected>Male</option>
                  <option value = "Female" selected>Female</option>
               </select></td>
            </tr>
				
            <tr>
               <td colspan = "2">
                  <input type = "button" id = "driver" value = "Load Data" />
               </td>
            </tr>
         </table>
      </form>
   </body>
</html>
This will produce following result −
Click on the button to load result.html file −
Name −
Age −
Sex −

    27 Lectures 
     1 hours 

 Mahesh Kumar

    27 Lectures 
     1.5 hours 

 Pratik Singh

    72 Lectures 
     4.5 hours 

 Frahaan Hussain

    60 Lectures 
     9 hours 

 Eduonix Learning Solutions

    17 Lectures 
     2 hours 

 Sandip Bhattacharya

    12 Lectures 
     53 mins

 Laurence Svekis
 Print
 Add Notes
 Bookmark this page
ERROR 1396 (HY000): Operation CREATE USER failed for 'root'@'localhost'?

In the system, the root is defined by another name as well as password. Then the user is
created as a root with the help of the create command. This will result in the ERROR 1396.
The query for this is given as follows −
mysql> create user 'root'@'localhost' identified by 'root123';

After executing the above query, the following error is obtained −
ERROR 1396 (HY000): Operation CREATE USER failed for 'root'@'localhost'

The user can be created with another name and password successfully. This is given as
follows −
mysql> create user 'John'@'localhost' identified by 'john123';
Query OK, 0 rows affected (0.14 sec)

Now, the user John has been created successfully with the given password.
Mirror Reflection in C++

Suppose there is a special square room with mirrors on each of the four walls. In each corner except the southwest corner, there are receptors. These are numbered as 0, 1, and 2. Now the square room has walls of length p, and a laser ray from the southwest corner first meets the east wall at a distance q from the 0th receptor. We have to find the number of the receptor that the ray meets first.
So if p = 2, and q = 1, then the case will be like −
So the output will be 2, as the ray meets receptor 2 the first time it gets reflected back to the left wall.
To solve this, we will follow these steps −
while p and q both are even,p := p/2q := q / 2
p := p/2
q := q / 2
if p is even, then return 2
if q is even, then return 0
return 1.
Let us see the following implementation to get better understanding −
 Live Demo
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
   int mirrorReflection(int p, int q) {
      while(p % 2 == 0 && q % 2 == 0){
         p >>= 1;
         q >>= 1;
      }
      if(p % 2 == 0) return 2;
      if(q % 2 == 0) return 0;
      return 1;
   }
};
main(){
   Solution ob;
   cout << (ob.mirrorReflection(2, 1));
}
2
1
2
SVG Element.innerHTML Property

30 Mar, 2022
The SVG Element.innerHTML property returns innerHTML of the given element.
Syntax:
const content = element.innerHTML
Return value: This property returns innerHTML of the element.
Example 1: 
<!DOCTYPE html><html>  <body>    <svg width="350" height="100"         xmlns="http://www.w3.org/2000/svg">                  <a href="https://www.geeksforgeeks.org" id="gfg">                          <text x='100' y='50' font-size="50px">                GfG            </text>        </a>                  <script>            var g = document.getElementById('gfg');            console.log(g.innerHTML);        </script>    </svg></body>  </html>
Output:
Example 2: 
<!DOCTYPE html><html>  <body>    <svg width="350" height="100"         xmlns="http://www.w3.org/2000/svg">                  <a href="https://www.geeksforgeeks.org" id="gfg">            <circle cx='100' cy='50' r="50"> </circle>        </a>                  <script>            var g = document.getElementById('gfg');            console.log(g.innerHTML);        </script>    </svg></body>  </html>
Output:
HTML-SVG
SVG-Property
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
REST API (Introduction)
Design a Tribute Page using HTML & CSS
Build a Survey Form using HTML and CSS
Angular File Upload
Form validation using jQuery
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array