code-rag-bench/online-tutorials huggingface dataset:
Electron - Environment Variables

Environment Variables control application configuration and behavior without changing code. Certain Electron behaviors are controlled by environment variables because they are initialized earlier than the command line flags and the app’s code.
There are two kinds of environment variables encoded in electron – Production variables and Development variables.
The following environment variables are intended for use at runtime in packaged Electron applications.
GOOGLE_API_KEY
Electron includes a hardcoded API key for making requests to Google’s geocoding webservice. Because this API key is included in every version of Electron, it often exceeds its usage quota.
To work around this, you can supply your own Google API key in the environment. Place the following code in your main process file, before opening any browser windows that will make geocoding requests −
process.env.GOOGLE_API_KEY = 'YOUR_KEY_HERE'

ELECTRON_RUN_AS_NODE
Starts the process as a normal Node.js process.
ELECTRON_FORCE_WINDOW_MENU_BAR (Linux Only)
Do not use the global menu bar on Linux.
The following environment variables are intended primarily for development and debugging purposes.
ELECTRON_ENABLE_LOGGING
Prints Chrome’s internal logging to the console.
ELECTRON_ENABLE_STACK_DUMPING
Prints the stack trace to the console when Electron crashes.
ELECTRON_DEFAULT_ERROR_MODE
Shows the Windows’s crash dialog when Electron crashes.
To set any of these environment variables as true, set it in your console. For example, if you want to enable logging, then use the following commands −
> set ELECTRON_ENABLE_LOGGING=true

$ export ELECTRON_ENABLE_LOGGING=true

Note that you will need to set these environment variables every time you restart your computer. If you want to avoid doing so, add these lines to your .bashrc files.

    251 Lectures 
     35.5 hours 

 Gowthami Swarna

    9 Lectures 
     41 mins

 Ashraf Said

    8 Lectures 
     32 mins

 Ashraf Said

    25 Lectures 
     1 hours 

 Ashraf Said

    17 Lectures 
     1 hours 

 Ashraf Said

    8 Lectures 
     25 mins

 Ashraf Said
 Print
 Add Notes
 Bookmark this page
Optional Named Parameter

Unlike positional parameters, the parameters’ name must be specified while the value is being passed. Curly brace {} can be used to specify optional named parameters.
void function_name(a, {optional_param1, optional_param2}) { } 

function_name(optional_param:value,...); 

void main() { 
   test_param(123); 
   test_param(123,s1:'hello'); 
   test_param(123,s2:'hello',s1:'world'); 
}  
test_param(n1,{s1,s2}) { 
   print(n1); 
   print(s1); 
}  
It should produce the following output−
123 
null 
123 
hello 
123 
world 


    44 Lectures 
     4.5 hours 

 Sriyank Siddhartha

    34 Lectures 
     4 hours 

 Sriyank Siddhartha

    69 Lectures 
     4 hours 

 Frahaan Hussain

    117 Lectures 
     10 hours 

 Frahaan Hussain

    22 Lectures 
     1.5 hours 

 Pranjal Srivastava

    34 Lectures 
     3 hours 

 Pranjal Srivastava
 Print
 Add Notes
 Bookmark this page
Node.js console.debug() Method - GeeksforGeeks

09 Jul, 2020
The console.debug() method is an inbuilt application programming interface of the console module which is used to print messages to stdout in a newline. Similar to console.log() method.
Syntax:
console.debug(data, args);
Parameters: This method has two parameters as mentioned above and described below:
data: This parameter specifies the data to be printed.args: It is optional parameter that specifies parameters to be passed as substitution values in message passed to data. All passed args are sent to util.format().
data: This parameter specifies the data to be printed.
args: It is optional parameter that specifies parameters to be passed as substitution values in message passed to data. All passed args are sent to util.format().
Return Value: This method doesn’t return anything but print the formatted message to stdout in a newline.
Below examples illustrate the use of console.debug() method in Node.js:
Example 1: Filename: app.js
// Accessing console moduleconst console = require('console');  // Calling console.debug() console.debug("This is a sample debug message!");console.debug("Sample debug message with args: %d", 39);
Run the app.js file using the following command:
node app.js
Output:
This is a sample debug message!
Sample debug message with args: 39

Example 2: Filename: app.js
// Accessing console moduleconst console = require('console');  // Calling console.debug()console.debug("This is a %s",     " sample debug message!");console.debug("Sample debug message"    + " with args: %d", 34);console.debug("Debug message: Warning "    + "at function %s: line number %d ",    "ff()",96)  var isDebugMode = true;console.custom_debug = function(message) {   if (isDebugMode) {    console.log(message);  }}  console.custom_debug("Custom debug message");
Run the app.js file using the following command:
node app.js
Output:
This is a  sample debug message!
Sample debug message with args: 34
Debug message: Warning at function ff(): line number 96
Custom debug message

Note: The above program will compile and run by using the node filename.js command.
Reference: https://nodejs.org/api/console.html#console_console_debug_data_args
Node.js-console-module
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to update Node.js and NPM to next version ?
Node.js fs.readFileSync() Method
How to update NPM ?
Node.js fs.writeFile() Method
Difference between promise and async await in Node.js
Top 10 Front End Developer Skills That You Need in 2022
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Difference between var, let and const keywords in JavaScript
Create a Heatmap in R Programming - heatmap() Function - GeeksforGeeks

10 Dec, 2021
heatmap() function in R Language is used to plot a heatmap. Heatmap is defined as a graphical representation of data using colors to visualize the value of the matrix. In this to represent more common values or higher activities brighter colors basically reddish colors are used and to less common or activity values darker colors are preferred. Heatmap is also defined by the name of the shading matrix. 
Syntax: heatmap(data)
Parameters: 
data: It represent matrix data, such as values of rows and columns
Return: This function draws a heatmap. 
r
# Set seed for reproducibilityset.seed(110) # Create example datadata <- matrix(rnorm(100, 0, 5), nrow = 10, ncol = 10) # Column namescolnames(data) <- paste0("col", 1:10)rownames(data) <- paste0("row", 1:10) # Draw a heatmapheatmap(data)       
Output:  
Here, in the above example number of rows and columns are specified to draw heatmap with a given function.
r
# Set seed for reproducibilityset.seed(110) # Create example data       data <- matrix(rnorm(100, 0, 5), nrow = 10, ncol = 10) # Column names   colnames(data) <- paste0("col", 1:10)rownames(data) <- paste0("row", 1:10) # Remove dendogram# Manual color rangemy_colors <- colorRampPalette(c("cyan", "darkgreen")) # Heatmap with manual colorsheatmap(data, col = my_colors(100))                           
Output: 
In the above example heat map is drawn by using colorRampPalette to merge two different colors.
kumar_satyam
R Graphics-Functions
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Change Color of Bars in Barchart using ggplot2 in R
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
Logistic Regression in R Programming
How to change the order of bars in bar chart in R ?
How to filter R dataframe by multiple conditions?
Replace Specific Characters in String in R
Data Visualization in R
How can I convert a Python tuple to an Array?

To convert a tuple to an array(list) you can directly use the list constructor. 
x = (1, 2, 3)
y = list(x)
print(y)
This will give the output −
[1, 2, 3]
If you have a multi-level tuple and want a flat array, you can use the following −
z = ((1, 2, 3), (4, 5))
y = [a for b in z for a in b]
print(y)
This will give the output −
[1, 2, 3, 4, 5]
Find substrings that contain all vowels in Python

Suppose we have a string in lowercase alphabets, we have to find substrings that contain all the vowels at least once and there exist no consonants in that substrings.
So, if the input is like "helloworldaeiouaieuonicestring", then the output will be ['aeiou', 'aeioua', 'aeiouai', 'aeiouaiu', 'eioua', 'eiouai', 'eiouaiu']
To solve this, we will follow these steps −
n := size of s
n := size of s
for i in range 0 to n, domy_map := a new mapfor j in range i to n, doif s[j] not vowel, thencome out from the loopmy_map[s[j]] := 1if size of my_map is same as 5, thendisplay s[from index i to j + 1]
for i in range 0 to n, do
my_map := a new map
my_map := a new map
for j in range i to n, doif s[j] not vowel, thencome out from the loopmy_map[s[j]] := 1if size of my_map is same as 5, thendisplay s[from index i to j + 1]
for j in range i to n, do
if s[j] not vowel, thencome out from the loop
if s[j] not vowel, then
come out from the loop
come out from the loop
my_map[s[j]] := 1
my_map[s[j]] := 1
if size of my_map is same as 5, thendisplay s[from index i to j + 1]
if size of my_map is same as 5, then
display s[from index i to j + 1]
display s[from index i to j + 1]
Let us see the following implementation to get better understanding −
 Live Demo
def isVowel(x):
   if x in ['a','e','i','o','u']:
      return True
   return False
def get_substrings(s):
   n = len(s)
   for i in range(n):
      my_map = dict()
      for j in range(i, n):
         if (isVowel(s[j]) == False):
            break
         my_map[s[j]] = 1
         if (len(my_map) == 5):
            print(s[i:j + 1])
s = "helloworldaeiouaiunicestring"
get_substrings(s)
"helloworldaeiouaiunicestring"
aeiou
aeioua
aeiouai
aeiouaiu
eioua
eiouai
eiouaiu
Locating Modules in Python

When you import a module, the Python interpreter searches for the module in the following sequences −
The current directory.
If the module isn't found, Python then searches each directory in the shell variable PYTHONPATH.
If all else fails, Python checks the default path. On UNIX, this default path is normally /usr/local/lib/python/.
The module search path is stored in the system module sys as the sys.path variable. The sys.path variable contains the current directory, PYTHONPATH, and the installation-dependent default.
The PYTHONPATH is an environment variable, consisting of a list of directories. The syntax of PYTHONPATH is the same as that of the shell variable PATH.
Here is a typical PYTHONPATH from a Windows system −
set PYTHONPATH = c:\python20\lib;
And here is a typical PYTHONPATH from a UNIX system −
set PYTHONPATH = /usr/local/lib/python
Java Program to implement Binary Search on an array

Binary search can be implemented on an array by using the method java.util.Arrays.binarySearch(). This method returns the index of the required element if it is available in the array, otherwise it returns (- (insertion point) - 1) where the insertion point is the position at which the element would be inserted into the array.
A program that demonstrates this is given as follows −
 Live Demo
import java.util.Arrays;
public class Demo {
   public static void main(String[] args) {
      int arr[] = { 3, 9, 1, 6, 4};
      Arrays.sort(arr);
      System.out.print("The sorted array is: ");
      for (int i : arr) {
         System.out.print(i + " ");
      }
      System.out.println();
      int index1 = Arrays.binarySearch(arr, 6);
      System.out.println("The integer 6 is at index " + index1);
      int index2 = Arrays.binarySearch(arr, 7);
      System.out.println("The integer 7 is at index " + index2);
   }
}
The sorted array is: 1 3 4 6 9
The integer 6 is at index 3
The integer 7 is at index -5
Now let us understand the above program.
The int array arr[] is defined and then sorted using Arrays.sort(). Then the sorted array is printed using for loop. A code snippet which demonstrates this is as follows −
int arr[] = { 3, 9, 1, 6, 4};
Arrays.sort(arr);
System.out.print("The sorted array is: ");
for (int i : arr) {
   System.out.print(i + " ");
}
System.out.println();
The method Arrays.binarySearch() is used to find the index of element 6 and 7. Since 6 is in the array, its index is displayed. Also, 7 is not in the array and so the value according to (-(insertion point) - 1) is displayed. A code snippet which demonstrates this is as follows −
int index1 = Arrays.binarySearch(arr, 6);
System.out.println("The integer 6 is at index " + index1);
int index2 = Arrays.binarySearch(arr, 7);
System.out.println("The integer 7 is at index " + index2);
How to update all documents in MongoDB?

You can use updateMany() to update documents. Let us create a collection with a document. The query to create a collection with a document is as follows −
> db.updateManyDocumentsDemo.insertOne({"StudentName":"John","StudentLastName":"Smith"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c948edd4cf1f7a64fa4df48")
}
> db.updateManyDocumentsDemo.insertOne({"StudentName":"John","StudentLastName":"Doe"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c948ee64cf1f7a64fa4df49")
}
> db.updateManyDocumentsDemo.insertOne({"StudentName":"Carol","StudentLastName":"Taylor"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c948ef14cf1f7a64fa4df4a")
}
> db.updateManyDocumentsDemo.insertOne({"StudentName":"David","StudentLastName":"Miller"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c948f044cf1f7a64fa4df4b")
}
Display all documents from a collection with the help of find() method. The query is as follows −
> db.updateManyDocumentsDemo.find().pretty();
The following is the output −
{
   "_id" : ObjectId("5c948edd4cf1f7a64fa4df48"),
   "StudentName" : "John",
   "StudentLastName" : "Smith"
}
{
   "_id" : ObjectId("5c948ee64cf1f7a64fa4df49"),
   "StudentName" : "John",
   "StudentLastName" : "Doe"
}
{
   "_id" : ObjectId("5c948ef14cf1f7a64fa4df4a"),
   "StudentName" : "Carol",
   "StudentLastName" : "Taylor"
}
{
   "_id" : ObjectId("5c948f044cf1f7a64fa4df4b"),
   "StudentName" : "David",
   "StudentLastName" : "Miller"
}
Here is the query to update all documents. The “StudentName” is updated with “StudentFirstName” −
> db.updateManyDocumentsDemo.updateMany({}, {$rename: {'StudentName': "StudentFirstName"}});
The following is the output −
{ "acknowledged" : true, "matchedCount" : 4, "modifiedCount" : 4 }
Check the document has been updated or not. The query is as follows −
> db.updateManyDocumentsDemo.find().pretty();
The following is the output −
{
   "_id" : ObjectId("5c948edd4cf1f7a64fa4df48"),
   "StudentLastName" : "Smith",
   "StudentFirstName" : "John"
}
{
   "_id" : ObjectId("5c948ee64cf1f7a64fa4df49"),
   "StudentLastName" : "Doe",
   "StudentFirstName" : "John"
}
{
   "_id" : ObjectId("5c948ef14cf1f7a64fa4df4a"),
   "StudentLastName" : "Taylor",
   "StudentFirstName" : "Carol"
}
{
   "_id" : ObjectId("5c948f044cf1f7a64fa4df4b"),
   "StudentLastName" : "Miller",
   "StudentFirstName" : "David"
}
setGeometry method - Pyqt5 - GeeksforGeeks

26 Mar, 2020
There are so many options provided by Python to develop GUI application and PyQt5 is one of them. PyQt5 is cross-platform GUI toolkit, a set of python bindings for Qt v5. One can develop an interactive desktop application with so much ease because of the tools and simplicity provided by this library.
setGeometry() method is used to set up the geometry of the PyQt5 window it self.
Syntax : window.setGeometry(x, y, width, height)
Arguments : It takes 4 arguments :1. X co-ordinate2. Y co-ordinate3. Width of the window to be set4. Height of the window to be set
Below is the implementation of this method.
Code :
# importing the required librariesfrom PyQt5.QtGui import * from PyQt5.QtWidgets import * import sys  class Window(QMainWindow):    def __init__(self):        super().__init__()          # set the title        self.setWindowTitle("Geometry")          # setting  the geometry of window        # setGeometry(left, top, width, height)        self.setGeometry(100, 60, 1000, 800)          # creating a label widget        self.widget = QLabel('Hello', self)              # show all the widgets        self.show()      # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()# start the appsys.exit(App.exec())
Output :
Python-gui
Python-PyQt
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
How to Change Default MySQL/MariaDB Port in Linux? - GeeksforGeeks

16 Feb, 2021
The default port that the MySQL database server runs under Linux is 3306/TCP.  Use the commands below to change the default MySQL/MariaDB Database port in Linux.
vi /etc/mysql/mariadb.conf.d/50-server.cnf
Search for the line MYSQL, find port under this line, and replace port values accordingly.
[mysqld]  
port = 12345
After adding the port save the file and then replace the MySQL port variable to match your own port number.
To verify the port configuration for MySql DB use the ss command.
# ss -tlpn | grep mysql
# netstat -tlpn | grep mysql
You can also display the MySQL port by logging in to the MySQL database, use the -p flag to make remote connections to the MySQL database.
# mysql -h localhost -u root -p -P 12345
To make a remote connection with the MySQL database, then you have to explicitly configure it to allow the connection.
Remotely login to MySQL server via the below command
# mysql -h 192.168.1.1 -P 12345 -u root -p  
Now once you have changed the MySQL server database, you have to now update your distribution firewall protocols to allow new connections from the TCP port so that clients can remotely connect to the database.
Picked
How To
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install FFmpeg on Windows?
How to Add External JAR File to an IntelliJ IDEA Project?
How to Set Git Username and Password in GitBash?
How to Install Jupyter Notebook on MacOS?
How to create a nested RecyclerView in Android
Sed Command in Linux/Unix with examples
AWK command in Unix/Linux with examples
grep command in Unix/Linux
cut command in Linux with examples
cp command in Linux with examples
GCD of elements in a given range - GeeksforGeeks

21 May, 2021
Given two numbers n and m. Find the biggest integer a(gcd), such that all integers n, n + 1, n + 2, ..., m are divisible by a.Examples:  
Input : n = 1, m = 2
Output: 1
Explanation:
Here, series become 1, 2. So, the 
greatest no which divides both of 
them is 1.

Input : n = 475, m = 475
Output : 475
Explanation:
Here, series has only one term 475.
So, greatest no which divides 475 is 475.
 
Here, We have to examine only two cases:  
if a = b : the segment consists of a single number, hence the answer is a.if a < b : we have gcd(n, n + 1, n?+ 2, ..., m) = gcd(gcd(n, n + 1), n + 2, ..., m) = gcd(1, n + 2, ..., n) = 1.
if a = b : the segment consists of a single number, hence the answer is a.
if a < b : we have gcd(n, n + 1, n?+ 2, ..., m) = gcd(gcd(n, n + 1), n + 2, ..., m) = gcd(1, n + 2, ..., n) = 1.
C++
Java
Python3
C#
PHP
Javascript
// GCD of given range#include <bits/stdc++.h>using namespace std;   int rangeGCD(int n, int m){    return (n == m)? n : 1;}   int main(){    int n = 475;    int m = 475;    cout << rangeGCD(n, m);    return 0;}
// GCD of given range   import java.io.*;   class GFG {       static int rangeGCD(int n, int m)    {        return (n == m) ? n : 1;    }       public static void main(String[] args)    {        int n = 475;        int m = 475;                   System.out.println(rangeGCD(n, m));    }}   // This code is contributed by Ajit.
# GCD of given range   def rangeGCD(n, m):    return n if(n == m) else 1       # Driver coden, m = 475, 475print(rangeGCD(n, m))   # This code is contributed by Anant Agarwal.
// GCD of given rangeusing System;    class GFG {        static int rangeGCD(int n, int m)    {        return (n == m) ? n : 1;    }        public static void Main()    {        int n = 475;        int m = 475;                    Console.WriteLine(rangeGCD(n, m));    }}    // This code is contributed by Anant Agarwal.
<?php// PHP program for// GCD of given range   // function returns the GCDfunction rangeGCD($n, $m){    return ($n == $m)? $n : 1;}       // Driver Code    $n = 475;    $m = 475;    echo rangeGCD($n, $m);       // This code is contributed by anuj_67.?>
<script> // GCD of given range         function rangeGCD( n,  m)    {        return (n == m) ? n : 1;    }             var n = 475;        var m = 475;                    document.write(rangeGCD(n, m));  </script>
Output:
475
vt_m
bunnyram19
GCD-LCM
Mathematical
Mathematical
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Merge two sorted arrays
Modulo Operator (%) in C/C++ with Examples
Prime Numbers
Program to find GCD or HCF of two numbers
Print all possible combinations of r elements in a given array of size n
Operators in C / C++
The Knight's tour problem | Backtracking-1
Program for factorial of a number
Program for Decimal to Binary Conversion
Find minimum number of coins that make a given value
Python | Union of Value Lists - GeeksforGeeks

06 May, 2019
The functionality of union has been discussed many times. But sometimes, we can have a more complex container, in which we need to check for the union of lists which are in form of keys of dictionary. Let’s discuss certain ways to solve this type of problem.
Method #1 : Using LoopsUsing loops is a naive brute force approach to perform this particular task. In this method, we check for keys present in both list and check for non-repeating values to add to result. We even check for the keys completely not present in other to add its whole list value.
# Python3 code to demonstrate# Union of Value Lists# using loops  # initializing dictstest_dict1 = { "Key1" : [1, 3, 4], "key2" : [4, 5] }test_dict2 = { "Key1" : [1, 7, 8] }  # printing original dictsprint("The original dict 1 : " + str(test_dict1))print("The original dict 2 : " + str(test_dict2))  # using loops# Union of Value Listsfor key in test_dict1:     if key in test_dict2:         for val in test_dict1[key]:            if val not in test_dict2[key]:                  test_dict2[key].append(val)    else:         test_dict2[key] = test_dict1[key][:]  # print resultprint("The dicts after union is : " + str(test_dict2))
The original dict 1 : {'Key1': [1, 3, 4], 'key2': [4, 5]}
The original dict 2 : {'Key1': [1, 7, 8]}
The dicts after union is : {'Key1': [1, 7, 8, 3, 4], 'key2': [4, 5]}

 
Method #2 : Using dictionary comprehension + set operationsThis is the one line approach to solve the similar problem and offers a compact alternative to above method. This solution processes by using the set comprehension to get the necessary elements bound together into lists using dictionary comprehension.
# Python3 code to demonstrate# Union of Value Lists# using dictionary comprehension + set operations  # initializing dictstest_dict1 = { "Key1" : [1, 3, 4], "key2" : [4, 5] }test_dict2 = { "Key1" : [1, 7, 8] }  # printing original dictsprint("The original dict 1 : " + str(test_dict1))print("The original dict 2 : " + str(test_dict2))  # using dictionary comprehension + set operations# Union of Value Listsres = {key : list(set(test_dict1.get(key, []) + test_dict2.get(key, [])))       for key in set(test_dict2) | set(test_dict1)}  # print resultprint("The dicts after union is : " + str(res))
The original dict 1 : {'Key1': [1, 3, 4], 'key2': [4, 5]}
The original dict 2 : {'Key1': [1, 7, 8]}
The dicts after union is : {'Key1': [1, 7, 8, 3, 4], 'key2': [4, 5]}

Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
How to print without newline in Python?
PHP | gethostname() Function - GeeksforGeeks

03 Sep, 2019
The gethostname() function is an inbuilt function in PHP which returns the host or domain name for the local machine. This function is applicable after PHP 5.3.0 before that there was another function called php_uname function.
Syntax:
string gethostname( void )
Parameters: This function doesn’t accept any parameters.
Return Value: This function returns the host or domain name on success and FALSE on failure.
Note: This function is available for PHP 5.3.0 and newer version.
Below program illustrates the gethostname() function in PHP:
Program:
<?php  // Use gethostname() function to// get the host nameecho gethostname();  ?>
Output:
pppContainer

Reference: https://www.php.net/manual/en/function.gethostname.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 execute PHP code using command line ?
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
PHP in_array() Function
How to pop an alert message box using PHP ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Binary Search in C++

Binary Search is a method to find the required element in a sorted array by repeatedly halving the array and searching in the half.
This method is done by starting with the whole array. Then it is halved. If the required data value is greater than the element at the middle of the array, then the upper half of the array is considered. Otherwise, the lower half is considered. This is done continuously until either the required data value is obtained or the remaining array is empty.
A program that demonstrates binary search in C++ is given below.
 Live Demo
#include
using namespace std;
int binarySearch(int arr[], int p, int r, int num) {
   if (p <= r) {
      int mid = (p + r)/2;
      if (arr[mid] == num)
         return mid ;
      if (arr[mid] > num)
         return binarySearch(arr, p, mid-1, num);
      if (arr[mid] < num)
         return binarySearch(arr, mid+1, r, num);
   }
   return -1;
}
int main(void) {
   int arr[] = {1, 3, 7, 15, 18, 20, 25, 33, 36, 40};
   int n = sizeof(arr)/ sizeof(arr[0]);
   int num;
   cout << "Enter the number to search: \n";
   cin >> num;
   int index = binarySearch (arr, 0, n-1, num);
   if(index == -1){
      cout<< num <<" is not present in the array";
   }else{
      cout<< num <<" is present at index "<< index <<" in the array";
   }
   return 0;
}
Enter the numberto search
20
20 is present at index 5 in the array
In the above program, binarySearch() is a recursive function that is used to find the required element in the array using binary search. The function takes the array, its lower bound and upper bound as well as the number to be found as parameters. This is shown below.
int binarySearch(int arr[], int p, int r, int num)
Then the midpoint of the array is calculated. If the value at the midpoint is equal to num, then it is returned. If the value is greater than num, then array calls itself recursively with the lower bound p and upper bound mid-1. If the value is less than num, then array calls itself recursively with the lower bound mid+1 and upper bound r. This can be seen by the following code snippet.
int binarySearch(int arr[], int p, int r, int num) {
   if (p <= r) {
      int mid = (p + r)/2;
      if (arr[mid] == num)
         return mid ;
      if (arr[mid] > num)
         return binarySearch(arr, p, mid-1, num);
      if (arr[mid] < num)
         return binarySearch(arr, mid+1, r, num);
   }
   return -1;
}
In the main() function, the array arr[] is defined. The size of the array is calculated and the number to be found is specified. Then binarySearch() is called to find the index of the number. If the value returned by binarySearch() is -1, then the number is not in the array. Otherwise, the index value is returned. This is given below.
int main(void) {
   int arr[] = {1, 3, 7, 15, 18, 20, 25, 33, 36, 40};
   int n = sizeof(arr)/ sizeof(arr[0]);
   int num = 33;
   int index = binarySearch (arr, 0, n-1, num);
   if(index == -1)
      cout<< num <<" is not present in the array";
   else
      cout<< num <<" is present at index "<< index <<" in the array";
   return 0;
}
How can I download Microsoft WebDriver/Edge Driver to use with Selenium?

We can download Microsoft/Edge Driver to use with Selenium. The Microsoft Edge driver allows communication of the tests developed in Selenium with the Edge browser.
To download the msedgedriver.exe file, we have to first navigate to the following link − https://developer.microsoft.com/en-us/microsoftedge/tools/webdriver/#downloads
Then move to the Downloads section, and click on the link based on the local operating system and browser version we have.
Once the download is completed, a zip file gets saved. It needs to be extracted and stored in a location. After extracting it, the executable file - msedgedriver.exe file is to be kept at a desired location.
We have to configure the path of the msedgedriver.exe file using the System.setProperty method along with creating an object of the EdgeDriver class.
System.setProperty("webdriver.edge.driver", "C:\\Users\\ghs6kor\\Desktop\\Java\\msedgedriver.exe");
WebDriver driver = new EdgeDriver();
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class EdgeBrwserLaunch{
   public static void main(String[] args) {
      //configure path of msedgedriver.exe path
      System.setProperty("webdriver.edge.driver",
         "C:\\Users\\ghs6kor\\Desktop\\Java\\msedgedriver.exe");
      //object of EdgeDriver
      WebDriver driver = new EdgeDriver();
      //URL launch
      driver.get("https://www.yahoo.com/");
      //get browser name
      Capabilities c = ((RemoteWebDriver) driver).getCapabilities();
      System.out.println("Browser: " + c.getBrowserName());
      driver.quit();
   }
}
Python Program for Product of unique prime factors of a number

In this article, we will learn about the solution to the problem statement given below −
Problem statement − Given a number n, we need to find the product of all of its unique prime factors available and return it.
For example,
Input: num = 11
Output: Product is 11
Explanation:
Here, the input number is 11 having only 1 prime factor and it is 11.
And hence their product is 11.
Using a for loop from i = 2 to n+1 check whether i is a factor of n & then check if i is the prime number itself, if yes then store product in product variable and continue this process until I become = n.
 Live Demo
def productPrimeFactors(n):
   product = 1
   for i in range(2, n+1):
      if (n % i == 0):
         isPrime = 1
         for j in range(2, int(i/2 + 1)):
            if (i % j == 0):
               isPrime = 0
               break
         if (isPrime):
            product = product * i
   return product
# main
n = 18
print (productPrimeFactors(n))
6
The scope of all the variables are shown in the image below −
While n is divisible by 2(even), print 2 and divide n by 2.
While n is divisible by 2(even), print 2 and divide n by 2.
After step 1, n must become odd. Now start a for loop from i = 3 till the square root of n. While I divides n, print I and divide n by i. After I fail to divide n, increment I by 2 and continue the process.
After step 1, n must become odd. Now start a for loop from i = 3 till the square root of n. While I divides n, print I and divide n by i. After I fail to divide n, increment I by 2 and continue the process.
If n is a prime number and is greater than 2, then n will not become 1 by above two steps. Hence print n if it is greater than 2.
If n is a prime number and is greater than 2, then n will not become 1 by above two steps. Hence print n if it is greater than 2.
import math
def productPrimeFactors(n):
   product = 1
   # prime factor 2
   if (n % 2 == 0):
      product *= 2
      while (n%2 == 0):
         n = n/2
# n must be odd
for i in range (3, int(math.sqrt(n)), 2):
   # While i divides n, print i and
   # divide n
   if (n % i == 0):
      product = product * i
      while (n%i == 0):
         n = n/i
   # n is a prime number greater than 2
   if (n > 2):
      product = product * n
   return product
# main()
n = 8
print (int(productPrimeFactors(n)))
2
The scopes of the variables are mentioned in the image below −
In this article, we learned about the product of unique prime factors of a given number with a brute force approach and an efficient approach.
How to Filter Rows Without Null in a Column in SQL? - GeeksforGeeks

21 Apr, 2021
Here we will see, how to filter rows without null in a column of an MS SQL Server’s database table with the help of a SQL query using IS NOT NULL operator.
For the purpose of demonstration, we will be creating a demo_orders table in a database called “geeks“.
Use the below SQL statement to create a database called geeks:
CREATE DATABASE geeks;
Use the below SQL statement to switch the database context to geeks:
USE geeks;
We have the following demo table in our geeks database.
CREATE TABLE demo_orders(
 ORDER_ID INT IDENTITY(1,1) PRIMARY KEY, --IDENTITY(1,1) is same as AUTO_INCREMENT in MySQL.
                                              --Starts from 1 and increases by 1 with each inserted row.
 ITEM_NAME VARCHAR(30) NOT NULL,
 ORDER_DATE DATE
);
You can use the below statement to query the description of the created table:
EXEC SP_COLUMNS demo_orders;
Use the below statement to add data to the demo_orders table:
INSERT INTO demo_orders --no need to mention columns explicitly as we
                        --are inserting into all columns and ID gets 
                         --automatically incremented.
VALUES
('Maserati', '2007-10-03'),
('BMW', '2010-07-23'),
('Mercedes Benz', '2012-11-12'),
('Ferrari', '2016-05-09'),
('Lamborghini', '2020-10-20');
To verify the contents of the table use the below statement:
SELECT * FROM demo_orders;
Now let’s insert some rows with no values ( or null values) in order_date column.
INSERT INTO demo_orders(ITEM_NAME)
VALUES
('NullRowOne'),
('NullRowTwo'),
('NullRowThree');
The table after the newly inserted data would be as:
Below is the syntax to filter the rows without a null value in a specified column.
Syntax:
SELECT * FROM <table_name>
WHERE <column_name> IS NOT NULL;
Example:
SELECT * FROM demo_orders
WHERE ORDER_DATE IS NOT NULL;
--Will output the rows consisting of non null order_date values.
Output:
Picked
SQL-Query
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Update Multiple Columns in Single Update Statement in SQL?
What is Temporary Table in SQL?
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL using Python
SQL | Subquery
SQL Query to Convert VARCHAR to INT
How to Write a SQL Query For a Specific Date Range and Date Time?
How to Select Data Between Two Dates and Times in SQL Server?
SQL - SELECT from Multiple Tables with MS SQL Server
SQL Query to Delete Duplicate Rows
Java Examples - Use of Finally

How to use finally block for catching exceptions ?
This example shows how to use finally block to catch runtime exceptions (Illegal Argument Exception) by the use of e.getMessage().
public class ExceptionDemo2 {
   public static void main(String[] argv) {
      new ExceptionDemo2().doTheWork();
   }
   public void doTheWork() {
      Object o = null; 
      for (int i = 0; i < 5; i++) {
         try {
            o = makeObj(i);
         } catch (IllegalArgumentException e) {
            System.err.println("Error: ("+ e.getMessage()+").");
            return;   
         } finally {
            System.err.println("All done");
            if (o == null)
            System.exit(0);
         }
         System.out.println(o); 
      }
   }
   public Object makeObj(int type) throws IllegalArgumentException {
      if (type == 1)throw new IllegalArgumentException("Don't like type " + type);
      return new Object();
   }
}
The above code sample will produce the following result.
All done
java.lang.Object@1b90b39
Error: (Don't like type 1).
All done

The following is an another sample example of finally block in java
public class HelloWorld { 
   public static void main(String []args) { 
      try { 
         int data = 25/5; 
         System.out.println(data);
      } catch(NullPointerException e) { 
         System.out.println(e);
      } finally { 
         System.out.println("finally block is always executed"); 
      } 
      System.out.println("rest of the code...");
   }
}
The above code sample will produce the following result.
5
finally block is always executed
rest of the code...  

 Print
 Add Notes
 Bookmark this page
How to view the pixel values of an image using scikit-learn in Python?

Data pre-processing basically refers to the task of gathering all the data (which is collected from various resources or a single resource) into a common format or into uniform datasets (depending on the type of data).
Since real-world data is never ideal, there is a possibility that the data would have missing cells, errors, outliers, discrepancies in columns, and much more.
Sometimes, images may not be correctly aligned, or may not be clear or may have a very large size. The goal of pre-processing is to remove these discrepancies and errors.
To get the pixels of an image, a built-in function named ‘flatten’ is used. After the image is read, the pixel values are stored in the form of a dataframe. The function ‘flatten’ is used to convert the three dimensions of an RGB image into a single dimension and get the value of pixels into a dataframe.
Instead of printing the entire dataframe, the dimensions of the dataframe are printed. Let us take the example of uploading an image and getting the pixels present in the image as a dataframe using scikit-learn library −
from skimage import io
import pandas as pd
path = "path to puppy.PNG"
img = io.imread(path)
print("Image being read")
io.imshow(img)
print("Image printed on console")
my_df = pd.DataFrame(img.flatten())
print("The image pixels dimensions are ")
print(my_df.shape)
Image being read
Image printed on console
The image pixels dimensions are
(886104, 1)
The required libraries are imported.
The required libraries are imported.
The path where the image is stored is defined.
The path where the image is stored is defined.
The ‘imread’ function is used to visit the path and read the image.
The ‘imread’ function is used to visit the path and read the image.
The ‘imshow’ function is used to display the image on the console.
The ‘imshow’ function is used to display the image on the console.
The function ‘flatten’ is used to convert the three dimensions of an RGB image into a single dimension and get the value of pixels into a dataframe.
The function ‘flatten’ is used to convert the three dimensions of an RGB image into a single dimension and get the value of pixels into a dataframe.
Instead of printing the dataframe which has too many rows, the dimensions of the dataframe are displayed.
Instead of printing the dataframe which has too many rows, the dimensions of the dataframe are displayed.
The dataframe can be viewed using ‘print(my_df)’.
The dataframe can be viewed using ‘print(my_df)’.
The output is a dataframe with image pixel values printed on the console.
The output is a dataframe with image pixel values printed on the console.
DAA instruction in 8085 Microprocessor

Let us consider we want to add two decimal numbers 38 and 45. They will be represented in BCD as 0011 1000 and 0100 0101. The addition results in 0111 1101. But the answer will be incorrect if we want to interpret this result as a BCD number. The result will be not only incorrect but also illegal as 1101, which we obtained as the last nibble in the answer is not a valid BCD number. Here, in such situations, we can use DAA to have the BCD sum as outcome. All that is required to be done is to add the BCD numbers and store the result in A, and then execute the DAA instruction.
Here is the detailing of the calculations −
  38 ---> 0011 1000
+ 45 ---> 0100 0101
----     ---------
  83     0111 1101
         ---- ----
            7    D
The working of DAA instruction depends on the contents of the AL register, Cy, and AC flags. In effect, it adds 00H, 06H, 60H, or 66H to Accumulator so as to get the correct BCD answer in the Accumulator. So here is the illustration of the remedial actions against the previous example −
  38 ---> 0011 1000
+ 45 ---> 0100 0101
----      ---------        1
  83      0111 1101           0111 1101
          ---- ----              + 0110 (06H)
             7    D           ---------
                              1000 0011 ---> 83 (Decimal sum)
As the summary of all related rules are listed below −
If the LS hex digit in A is <= 9 and AC flag is 0, the LS hex digit value will not be altered.
If the LS hex digit in A is <= 9 and AC flag is 0, the LS hex digit value will not be altered.
If the LS hex digit is >9, or if AC flag is set to 1, it adds 6 to the LS hex digit of A. If carry results, then it increments the MS hex digit if this addition resulted in a carry to the MS digit position. In this process, the Cy flag will be set to 1 if the MS hex digit was incremented from F to 0.
If the LS hex digit is >9, or if AC flag is set to 1, it adds 6 to the LS hex digit of A. If carry results, then it increments the MS hex digit if this addition resulted in a carry to the MS digit position. In this process, the Cy flag will be set to 1 if the MS hex digit was incremented from F to 0.
If the MS hex digit is <= 9 and Cy flag is 0, the MS hex digit will not be altered, and Cy flag is reset to 0.
If the MS hex digit is <= 9 and Cy flag is 0, the MS hex digit will not be altered, and Cy flag is reset to 0.
If the MS hex digit is > 9, or if Cy flag is set to 1, it adds 6 to the MS hex digit of A and sets Cy flag to 1.
If the MS hex digit is > 9, or if Cy flag is set to 1, it adds 6 to the MS hex digit of A and sets Cy flag to 1.
Note that for decimal subtraction DAA instruction cannot be used. Due to unavailability of decimal subtraction in Intel 8085 instruction set, a series of instructions are to be executed to perform decimal subtraction.
Let us consider some examples −
The timing diagram against this instruction DAA execution is as follows −
Summary − So this instruction DAA requires 1-Byte, 1-Machine Cycle (Opcode Fetch) and 4 T-States for execution as shown in the timing diagram.
How does in operator work on list in Python?

Python's in operator lets you loop through all the members of a collection(such as a list or a tuple) and check if there's a member in the list that's equal to the given item. 
my_list = [5, 1, 8, 3, 7]
print(8 in my_list)
print(0 in my_list)
This will give the output −
True
False
Note that in operator against dictionary checks for the presence of key. 
my_dict = {'name': 'TutorialsPoint', 'time': '15 years', 'location': 'India'}
print('name' in my_dict)
This will give the output −
True
It can also be used to check the presence of a sequence or substring against string. 
my_str = "This is a sample string"
print("sample" in string)
This will give the output −
True
in can be used in many other places and how it works in those scenarios varies a lot. This is how in works in lists. It starts comparing references of objects from the first one till it either finds that object in the list or reaches the end of the list.
How to export output to excel in PowerShell?

As of now, there is no built-in command like CSV (Export-CSV) to export output to the excel file but we can use the Out-File command to export data to excel or any other file format.
Let’s use Out-File to export the output of the Get-Processes command to an excel file.
Get-Process | Out-File C:\Temp\processes.xls
The above command will get all the running processes on the local system to the excel file. Let’s check the output of the excel file. You can see that the output is not in the proper excel format.
One other way is to install the ImportExcel module for excel. It is a very popular module to work with excel files.
To install the ImportExcel module, you need to run the below command to get it installed from the PowerShell gallery.
Install-Module ImportExcel -AllowClobber -Force
Once you install it, you need to import the module in the current PowerShell session if not imported.
Get-Module ImportExcel -ListAvailable | Import-Module -Force -Verbose
Once you have this module loaded in PowerShell, you can run the below command to export output into the excel format.
Get-Process | Export-Excel -Path C:\Temp\Processes.xlsx
Tryit Editor v3.7

Tryit: Image: original size, or smaller
How we can group data in HTML forms?

To group related data in HTML forms use the <fieldset> tag. This tag creates a box around the related elements. The <legend> tag is used inside the <fieldset> tag to give a caption to the group.
You can try to run the following code to group data in HTML forms −
Live Demo
<!DOCTYPE html>
<html>
   <body>
      <form>
         <fieldset>
            <legend>Student Information:</legend>
            Student Name:<br>
            <input type="text" name="sname">
            <br>
            Student Subject:<br>
            <input type="text" name="ssubject">
            <br>
         </fieldset>
      </form>
   </body>
</html>
Animate a rotating 3D graph in Matplotlib

To make a rotating 3D graph in matplotlib, we can use Animation class for calling a function repeatedly.
Initialize variables for number of mesh grids, frequency per second to call a function, frame numbers.
Initialize variables for number of mesh grids, frequency per second to call a function, frame numbers.
Create x, y, and z array for a curve.
Create x, y, and z array for a curve.
Make a function to make z array using lambda function.
Make a function to make z array using lambda function.
To pass a function into the animation class, make a user-defined function to remove the previous plot and plot a surface using x, y, and zarray.
To pass a function into the animation class, make a user-defined function to remove the previous plot and plot a surface using x, y, and zarray.
Create a new figure or activate an existing figure.
Create a new figure or activate an existing figure.
Add a subplot arrangement using subplots() method.
Add a subplot arrangement using subplots() method.
Set the Z-axis limit using set_zlim() method.
Set the Z-axis limit using set_zlim() method.
Call the animation class to animate the surface plot.
Call the animation class to animate the surface plot.
To display the animated plot, use show() method.
To display the animated plot, use show() method.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation

plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
N = 50
fps = 250
frn = 75

x = np.linspace(-4, 4, N + 1)
x, y = np.meshgrid(x, x)
zarray = np.zeros((N + 1, N + 1, frn))

f = lambda x, y, sig: 1 / np.sqrt(sig) * np.exp(-(x ** 2 + y ** 2) / sig ** 2)

for i in range(frn):
   zarray[:, :, i] = f(x, y, 1.5 + np.sin(i * 2 * np.pi / frn))

def change_plot(frame_number, zarray, plot):
   plot[0].remove()
   plot[0] = ax.plot_surface(x, y, zarray[:, :, frame_number], cmap="afmhot_r")

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

plot = [ax.plot_surface(x, y, zarray[:, :, 0], color='0.75', rstride=1,
cstride=1)]
ax.set_zlim(0, 1.1)
ani = animation.FuncAnimation(fig, change_plot, frn, fargs=(zarray, plot),
interval=1000 / fps)
ani.save('526.gif')

plt.show()