code-rag-bench/online-tutorials huggingface dataset:
Python Program to Implement Binary Search with Recursion

When it is required to implement binary search using recursion, a method can be defined, that checks if the index 'high' is greater than index 'low. Based on value present at 'mid' variable, the function is called again to search for the element.
A list can be used to store heterogeneous values (i.e data of any data type like integer, floating point, strings, and so on).
Below is a demonstration for the same −
Live Demo
def binary_search(my_list, low, high, elem):
   if high >= low:
      mid = (high + low) // 2
      if my_list[mid] == elem:
         return mid
      elif my_list[mid] > elem:
         return binary_search(my_list, low, mid - 1, elem)
      else:
         return binary_search(my_list, mid + 1, high, elem)
   else:
      return -1
     
my_list = [ 1, 9, 11, 21, 34, 54, 67, 90 ]
elem_to_search = 1
print("The list is")
print(my_list)

my_result = binary_search(my_list,0,len(my_list)-1,elem_to_search)

if my_result != -1:
   print("Element found at index ", str(my_result))
else:
   print("Element not found!")
The list is
[1, 9, 11, 21, 34, 54, 67, 90]
Element found at index 0
A function named 'binary_search' is defined.
It takes the list, the 'low' variable, 'high' variable and the element to be searched as parameter.
Then, the variable 'mid' is assigned the average of 'high' and 'low' variables.
If the element at 'mid' is same as the element that needs to be searched for, it is returned.
Else, if the element at 'mid' position is greater than the element to be searched, the function is called again by passing different set of parameters.
Else if the element at 'mid' position is less than the element to be searched, the function is called again by passing a different set of parameters.
Now the list is defined, and the function is called by passing this list as parameter.
This operation's data is stored in a variable.
This variable is the output that is displayed on the console.
Python String center() Method - GeeksforGeeks

05 Aug, 2021
Python String center() method creates and returns a new string that is padded with the specified character. 
Syntax: 
string.center(length[, fillchar])
Parameters:
length: length of the string after padding with the characters.
fillchar: (optional) characters which need to be padded. If it’s not provided, space is taken as the default argument.
Returns:
Returns a string padded with specified fillchar and it doesn’t modify the original string.
Python
# Python program to illustrate# string center() in pythonstring = "geeks for geeks"  new_string = string.center(24)  # here filchar not provided so takes space by default.print "After padding String is: ", new_string
Output: 
After padding String is:      geeks for geeks
Python
# Python program to illustrate# string center() in pythonstring = "geeks for geeks"  new_string = string.center(24, '#')  # here fillchar is providedprint "After padding String is:", new_string
Output: 
After padding String is: ####geeks for geeks#####
AmiyaRanjanRout
python-string
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Read JSON file using Python
Adding new column to existing DataFrame in Pandas
Python map() function
How to get column names in Pandas dataframe
Python Dictionary
Taking input in Python
How to Install PIP on Windows ?
Read a file line by line in Python
Enumerate() in Python
Iterate over a list in Python
Java program to find the cube root of a given number

Following is an example to find the cube root of a given number.
import java.util.Scanner;
public class FindingCubeRoot {
   public static void main(String args[]){
      double i, precision = 0.000001;
      System.out.println("Enter a number ::");
      Scanner sc = new Scanner(System.in);
      int num = sc.nextInt();

      for(i = 1; (i*i*i) <= num; ++i);
      for(--i; (i*i*i) < num; i += precision);
      System.out.println("Cube root of the given number is "+i);
   }
}
Enter a number ::
125
Cube root of the given number is 5.0
How to add multi-language content in HTML?

The lang attribute in HTML allows you to set content for languages other than English. You can try to run the following code to implement lang attribute.
Here, we have added content in French and Spanish as well.
<!DOCTYPE html>
<html>
   <body>
      <h2>English</h2>
      <p lang="en">This is demo text</p>
     
      <h2>French</h2>
      <p lang="fr">Ceci est un texte de démonstration</p>
     
      <h2>Spanish</h2>
      <p lang="es">Este es un texto de demostración</p>
   </body>
</html>
How to use action up event in android?

This example demonstrate about How use action up event in android.
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
Step 2 − Add the following code to res/layout/activity_main.xml.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:gravity="center"
   android:layout_height="match_parent"
   tools:context=".MainActivity"
   android:orientation="vertical">
   <TextView
      android:id="@+id/actionEvent"
      android:textSize="40sp"
      android:layout_marginTop="30dp"
      android:layout_width="wrap_content"
      android:layout_height="match_parent" />
</LinearLayout>
In the above code, we have taken a text view to perform action up event.
Step 3 − Add the following code to src/MainActivity.java
package com.example.myapplication;

import android.annotation.SuppressLint;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.v4.view.MotionEventCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
   TextView textView;
   @SuppressLint({"RestrictedApi", "ClickableViewAccessibility"})
   @RequiresApi(api = Build.VERSION_CODES.N)
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      TextView actionEvent = findViewById(R.id.actionEvent);
      actionEvent.setText("Action UP");
      actionEvent.setOnTouchListener(new View.OnTouchListener() {
         @Override
         public boolean onTouch(View v, MotionEvent event) {
            int action = MotionEventCompat.getActionMasked(event);
            if (action == MotionEvent.ACTION_UP) {
               Toast.makeText(MainActivity.this, "Clicked on textview", Toast.LENGTH_LONG).show();
               return true;
            }
            return false;
         }
      });
   }
}
Let's try to run your application. I assume you have connected your actual Android Mobile device with your computer. To run the app from android studio, open one of your project's activity files and click Run  icon from the toolbar. Select your mobile device as an option and then check your mobile device which will display your default screen –
Click here to download the project code
What are checked exceptions in Java?

A checked exception is an exception that occurs at the time of compilation, these are also called as compile time exceptions. These exceptions cannot simply be ignored at the time of compilation; the programmer should take care of (handle) these exceptions.
if you use FileReader class in your program to read data from a file, if the file specified in its constructor doesn't exist, then a FileNotFoundException occurs, and the compiler prompts the programmer to handle the exception.
import java.io.File;
import java.io.FileReader;

public class FilenotFound_Demo {
   public static void main(String args[]) {
      File file = new File("E://file.txt");
      FileReader fr = new FileReader(file);
   }
}
If you try to compile the above program, you will get the following exceptions.
C:\>javac FilenotFound_Demo.java
FilenotFound_Demo.java:8: error: unreported exception
FileNotFoundException; must be caught or declared to be thrown
   FileReader fr = new FileReader(file);
                   ^
1 error
Zend Framework - Installation

To install the Zend Framework, we must first install the Composer and the latest version of PHP as shown in the following steps.
Install Composer − Zend uses Composer for managing its dependencies, so make sure you have the Composer installed on your machine. If the Composer is not installed, then visit the official website of Composer and install it.
Install Composer − Zend uses Composer for managing its dependencies, so make sure you have the Composer installed on your machine. If the Composer is not installed, then visit the official website of Composer and install it.
Install the latest version of PHP − To get the maximum benefit of Zend Framework, install the latest version of PHP. The minimum required version for the Zend Framework 3 is PHP 5.6 or later.
Install the latest version of PHP − To get the maximum benefit of Zend Framework, install the latest version of PHP. The minimum required version for the Zend Framework 3 is PHP 5.6 or later.
Zend Framework can be installed in two ways. They are as follows −
Manual installation
Composer based installation
Let us discuss both these installations in detail.
Download the latest version of Zend Framework by visiting the following link – https://framework.zend.com/downloads/archives
Extract the content of the downloaded archive file to the folder you would like to keep it. Once you have a copy of Zend Framework available in your local machine, your Zend Framework based web application can access the framework classes. Though there are several ways to achieve this, your PHP include_path needs to contain the path to the Zend Framework classes under the /library directory in the distribution. This method applies to Zend Framework version 2.4 and earlier only.
To easily install the Zend Framework, use the Composer tool. This is the preferred method to install the latest version of Zend Framework. To install all the components of the Zend Framework, use the following Composer command −
$ composer require zendframework/zendframework

Each Zend Framework module / component can be installed individually as well. For example, to install the MVC component of the Zend Framework, use the following composer command −
$ composer require zendframework/zend-mvc

 Print
 Add Notes
 Bookmark this page
What is event Bubbling and capturing in JavaScript?

Event bubbling is the order in which event handlers are called when one element is nested inside a second element, and both elements have registered a listener for the same event (a click, for example). With bubbling, the event is first captured and handled by the innermost element and then propagated to outer elements.
With capturing, the event is first captured by the outermost element and propagated to the inner elements.
Let's look at examples of both.
For both of the following examples, create the following HTML −
 Live  Demo
<div id='outer' style='background-color:red;display:inline-block;padding:50px;'>
   Outer Div
<div id='inner' style='background-color:yellow;display:inline-block;padding:50px;'>
   Inner Div
</div>
</div>
1. Event Bubbling
document.querySelector('#outer').addEventListener('click', e => {
   console.log('Outer div is clicked');
}, false);
document.querySelector('#inner').addEventListener('click', e => {
   console.log('Inner div is clicked');
}, false);
If you run the above code and click in the inner div, you'll get the log −
Inner div is clicked

Outer div is clicked
2. Event Capturing
document.querySelector('#outer').addEventListener('click', e => {
   console.log('Outer div is clicked');
}, true);
document.querySelector('#inner').addEventListener('click', e => {
   console.log('Inner div is clicked');
}, true);
If you run the above code and click in the inner div, you'll get the log −
Outer div is clicked

Inner div is clicked
HTML - <nobr> Tag

The HTML <nobr> tag is used to instruct the browser not to break the specified text (such as the usual line wrap that occurs at the right edge of the browser window).
This is used with the <wbr> tag, <wbr> advises the extended browser when it may insert a line break in an otherwise nonbreakable sequence of text. Unlike the <br> tag, which always causes a line break, even within a <nobr>- tagged segment, the <wbr> tag works only when placed inside a <nobr>- tagged content segment and causes a line break only if the current line has already extended beyond the browser's display window margins.
<!DOCTYPE html>
<html>

   <head>
      <title>HTML nobr Tag</title>
   </head>

   <body>
      <nobr>This is a very long sequence of text that is forced to be 
      on a single line, even if doing so causes <wbr />
      
      the browser to extend the document window beyond the size of the 
      viewing pane and the poor user must scroll right <wbr />
      
      to read the entire line.
      </nobr>
   </body>

</html>
This tag supports all the global attributes described in HTML Attribute Reference
This tag is available in Netscape 4 and higher version only.

    19 Lectures 
     2 hours 

 Anadi Sharma

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    18 Lectures 
     1.5 hours 

 Frahaan Hussain

    57 Lectures 
     5.5 hours 

 DigiFisk (Programming Is Fun)

    54 Lectures 
     6 hours 

 DigiFisk (Programming Is Fun)

    45 Lectures 
     5.5 hours 

 DigiFisk (Programming Is Fun)
 Print
 Add Notes
 Bookmark this page
Java Bitwise Operators

Java defines several bitwise operators, which can be applied to the integer types, long, int, short, char, and byte.
Bitwise operator works on bits and performs the bit-by-bit operation. Assume if a = 60 and b = 13; now in binary format they will be as follows − 
a = 0011 1100
b = 0000 1101
-----------------
a&b = 0000 1100

a|b = 0011 1101

a^b = 0011 0001

~a = 1100 0011
The following table lists the bitwise operators −
Assume integer variable A holds 60 and variable B holds 13 then −
SAS - Standard Deviation

Standard deviation (SD) is a measure of how varied is the data in a data set. Mathematically it measures how distant or close are each value to the mean value of a data set. A standard deviation value close to 0 indicates that the data points tend to be very close to the mean of the data set and a high standard deviation indicates that the data points are spread out over a wider range of values
In SAS the SD values is measured using PROC MEAN as well as PROC SURVEYMEANS.
To measure the SD using proc means we choose the STD option in the PROC step. It brings out the SD values for each numeric variable present in the data set.
The basic syntax for calculating standard deviation in SAS is −
PROC means DATA = dataset STD;

Following is the description of the parameters used −
Dataset − is the name of the dataset.
Dataset − is the name of the dataset.
In the below example we create the data set CARS1 form the CARS data set in the SASHELP library. We choose the STD option with the PROC means step.
PROC SQL;
create table CARS1 as
SELECT make, type, invoice, horsepower, length, weight
   FROM 
   SASHELP.CARS
   WHERE make in ('Audi','BMW')
;
RUN;

proc means data = CARS1 STD;
run;

When we execute the above code it gives the following output −
This procedure is also used for measurement of SD along with some advance features like measuring SD for categorical variables as well as provide estimates in variance.
The syntax for using PROC SURVEYMEANS is −
PROC SURVEYMEANS options statistic-keywords ;
BY variables ;
CLASS variables ;
VAR variables ;

Following is the description of the parameters used −
BY − indicates the variables used to create groups of observations.
BY − indicates the variables used to create groups of observations.
CLASS − indicates the variables used for categorical variables.
CLASS − indicates the variables used for categorical variables.
VAR − indicates the variables for which SD will be calculated.
VAR − indicates the variables for which SD will be calculated.
The below example describes the use of class option which creates the statistics for each of the values in the class variable.
proc surveymeans data = CARS1 STD;
class type;
var type horsepower;
ods output statistics = rectangle;
run;
proc print data = rectangle;
run;

When we execute the above code it gives the following output −
The below code gives example of BY option. In it the result is grouped for each value in the BY option.
proc surveymeans data = CARS1 STD;
var horsepower;
BY make;
ods output statistics = rectangle;
run;
proc print data = rectangle;
run;

When we execute the above code it gives the following output −

    50 Lectures 
     5.5 hours 

 Code And Create

    124 Lectures 
     30 hours 

 Juan Galvan

    162 Lectures 
     31.5 hours 

 Yossef Ayman Zedan

    35 Lectures 
     2.5 hours 

 Ermin Dedic

    167 Lectures 
     45.5 hours 

 Muslim Helalee
 Print
 Add Notes
 Bookmark this page
How to minus one column from another in an R matrix?

To minus one column from another in an R matrix, we first need to read the matrix as a data frame using as.data.frame then find minus the columns using minus sign and accessing the column of the data frame. To understand how it can be done look at the steps in below examples.
Consider the below data frame −
 Live Demo
M1<-matrix(rpois(40,8),ncol=2)
M1
      [,1] [,2]
[1,]  10    5
[2,]  10   16
[3,]   7    7
[4,]  10    5
[5,]   9    9
[6,]   9    5
[7,]   8   11
[8,]   8    3
[9,]  10   11
[10,] 8     8
[11,] 5    11
[12,] 8     6
[13,] 7     9
[14,] 8     6
[15,] 10   10
[16,] 5    10
[17,] 6     9
[18,] 8     8
[19,] 7    13
[20,] 6     8
Reading the matrix M1 as data frame −
M1<-as.data.frame(M1)
M1
    V1  V2
1  10   5
2  10  16
3   7   7
4  10   5
5   9   9
6   9   5
7   8  11
8   8   3
9  10  11
10  8   8
11  5  11
12  8   6
13  7   9
14  8   6
15 10  10
16  5  10
17  6   9
18  8   8
19  7  13
20  6   8
Finding the difference in columns V1 and V2 of M1 −
M1$Difference<-(M1$V1-M1$V2)
M1
    V1  V2 Difference
1  10   5    5
2  10  16   -6
3   7   7    0
4  10   5    5
5   9   9    0
6   9   5    4
7   8  11   -3
8   8   3    5
9  10  11   -1
10  8   8    0
11  5  11   -6
12  8   6    2
13  7   9   -2
14  8   6    2
15 10  10    0
16  5  10   -5
17  6   9   -3
18  8   8    0
19  7  13   -6
20  6   8   -2
 Live Demo
M2<-matrix(rpois(40,5),ncol=2)
M2
     [,1] [,2]
[1,]  8    7
[2,]  4    5
[3,]  3    6
[4,]  8    3
[5,]  3    4
[6,]  5    7
[7,]  4    4
[8,]  6    5
[9,]  4    6
[10,] 8    5
[11,] 5    5
[12,] 3    9
[13,] 3    3
[14,] 3    4
[15,] 8    6
[16,] 5    5
[17,] 7    8
[18,] 8    8
[19,] 0    6
[20,] 3    4
Finding the difference in columns V1 and V2 of M2 −
M2<-as.data.frame(M2)
M2
   V1 V2
1  8  7
2  4  5
3  3  6
4  8  3
5  3  4
6  5  7
7  4  4
8  6  5
9  4  6
10 8  5
11 5  5
12 3  9
13 3  3
14 3  4
15 8  6
16 5  5
17 7  8
18 8  8
19 0  6
20 3  4
Finding the difference in columns V1 and V2 of M2 −
M2$Difference<-(M2$V1-M2$V2)
M2
   V1 V2 Difference
1  8  7    1
2  4  5   -1
3  3  6   -3
4  8  3    5
5  3  4   -1
6  5  7   -2
7  4  4    0
8  6  5    1
9  4  6   -2
10 8  5    3
11 5  5    0
12 3  9   -6
13 3  3    0
14 3  4   -1
15 8  6    2
16 5  5    0
17 7  8   -1
18 8  8    0
19 0  6   -6
20 3  4   -1
Software Testing | Stability Testing - GeeksforGeeks

16 May, 2019
Stability Testing is a type of Software Testing to check the quality and behavior of the software in different environmental parameters. It is defined as the ability of the product to continue to function over time without failure.
It is a Non-functional Testing technique that focuses to stress the software component to the maximum. Stability testing is done to check the efficiency of a developed product beyond normal operational capacity that is known as break point. It has higher significance in error handling, software reliability, robustness and scalability of a product under heavy load rather than checking the system behavior under normal circumstances.
Stability testing assesses stability problems. This testing is majorly intended to check whether the application will crash at any point in time or not.
Objective of the Stability Testing:The objective of the stability testing is:
To yield confidence in the stability of the system or software application under test.
To ensure the system handling big programs.
To operate the effectiveness of the system or software application.
To check the stability of the system under stress.
Stability Testing Process:
Effects of not performing Stability Testing:
If stability testing is not carried out, system slows down with large amount of data.Without stability testing, system crashes suddenly.In absence of stability testing, System’s behavior is abnormal when it goes to different environment.In absence of stability testing, system’s performance decreases which in turn can have bad effects on the business.
If stability testing is not carried out, system slows down with large amount of data.
Without stability testing, system crashes suddenly.
In absence of stability testing, System’s behavior is abnormal when it goes to different environment.
In absence of stability testing, system’s performance decreases which in turn can have bad effects on the business.
Testing Tools used in Stability Testing:
1. Apache JMeter
2. NeoLoad
3. WebLOAD
4. LoadRunner 
Advantages of Stability Testing:
It gives the limit of the data that a system can handle practically.It provides the confidence on the performance of the system.It determines the stability and robustness of the system under load.Stability testing leads to a better end user experience.
It gives the limit of the data that a system can handle practically.
It provides the confidence on the performance of the system.
It determines the stability and robustness of the system under load.
Stability testing leads to a better end user experience.
Software Testing
Software Engineering
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Software Engineering | Integration Testing
System Testing
Software Engineering | Software Quality Assurance
Software Engineering | Black box testing
What is DFD(Data Flow Diagram)?
Difference between IAAS, PAAS and SAAS
Use Case Diagram for Library Management System
Difference between Unit Testing and Integration Testing
Object Oriented Analysis and Design
Software Engineering | Software Design Process
Python | Pandas DatetimeIndex.normalize() - GeeksforGeeks

24 Dec, 2018
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
Pandas DatetimeIndex.normalize() function convert times to midnight. The time component of the date-timeise converted to midnight i.e. 00:00:00. This is useful in cases, when the time does not matter. Length is unaltered. The timezones are unaffected.
Syntax: DatetimeIndex.normalize()
Return: DatetimeIndex or Series
Example #1: Use DatetimeIndex.normalize() function to normalize time.
# importing pandas as pdimport pandas as pd  # Create the DatetimeIndex# Here 'H' represents hourly frequency idx = pd.DatetimeIndex(start ='2018-08-10 08:00', freq ='H',                            periods = 5, tz ='Asia/Calcutta')  # Print the DatetimeIndexprint(didx)
Output :Now we want all the time values present in the DatetimeIndex object to be normalized i.e., it gets converted to midnight time.
# normalize the time.idx.normalize()
Output :As we can see in the output, the function has converted all the time values in the object to midnight time. Example #2: Use DatetimeIndex.normalize() function to normalize time.
# importing pandas as pdimport pandas as pd  # Create the DatetimeIndex# Here 'Q' represents quarter end frequency idx = pd.DatetimeIndex(start ='2000-01-15 08:00', freq ='Q',                            periods = 4, tz ='Asia/Calcutta')  # Print the DatetimeIndexprint(didx)
Output :
Now we want all the time values present in the DatetimeIndex object to be normalized i.e., it gets converted to midnight time.
# normalize the time.idx.normalize()
Output :As we can see in the output, the function has converted all the time values in the object to midnight time.
Python pandas-datetimeIndex
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
How to Install PIP on Windows ?
Read a file line by line in Python
Enumerate() in Python
Iterate over a list in Python
Reading and Writing to text files in Python
*args and **kwargs in Python
Convert integer to string in Python
Check if element exists in list in Python
Create a Pandas DataFrame from Lists
How to remove an array element in a foreach loop? - GeeksforGeeks

21 Feb, 2019
Use unset() function to remove array elements in a foreach loop. The unset() function is an inbuilt function in PHP which is used to unset a specified variable. The behavior of this function depends on different things. If the function is called from inside of any user defined function then it unsets the value associated with the variables inside it, leaving the value which is initialized outside it.
Syntax:
unset( $variable )
Return Value: This function does not returns any value.
Below examples use unset() function to remove an array element in foreach loop.
Example 1:
<?php  // Declare an array and initialize it$Array = array(    "GeeksForGeeks_1",     "GeeksForGeeks_2",     "GeeksForGeeks_3");  // Display the array elementsprint_r($Array);  // Use foreach loop to remove array elementforeach($Array as $k => $val) {    if($val == "GeeksForGeeks_3") {        unset($Array[$k]);    }}  // Display the array elementsprint_r($Array);  ?>
Array
(
    [0] => GeeksForGeeks_1
    [1] => GeeksForGeeks_2
    [2] => GeeksForGeeks_3
)
Array
(
    [0] => GeeksForGeeks_1
    [1] => GeeksForGeeks_2
)

Example 2:
<?php  // Declare an array and initialize it$Array = array(    array(0 => 1),    array(4 => 10),    array(6 => 100));  // Display the array elementsprint_r($Array);  // Use foreach loop to remove // array elementforeach($Array as $k => $val) {    if(key($val) > 5) {        unset($Array[$k]);    }}  // Display the array elementsprint_r($Array);  ?>
Array
(
    [0] => Array
        (
            [0] => 1
        )

    [1] => Array
        (
            [4] => 10
        )

    [2] => Array
        (
            [6] => 100
        )

)
Array
(
    [0] => Array
        (
            [0] => 1
        )

    [1] => Array
        (
            [4] => 10
        )

)

Picked
PHP
PHP Programs
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to convert array to string in PHP ?
PHP | Converting string to Date and DateTime
How to pass JavaScript variables to PHP ?
Split a comma delimited string into an array in PHP
Download file from URL using PHP
How to convert array to string in PHP ?
How to call PHP function on the click of a Button ?
How to pass JavaScript variables to PHP ?
Split a comma delimited string into an array in PHP
How to get parameters from a URL string in PHP?
PyQt5 – Add image icon on a Push button - GeeksforGeeks

22 Apr, 2020
In this article we will see how to add icon to a push button. Here, setting icon not like setting an background image, it is similar to the icon of main window. Icon of button appear at the left side and text is on right size.
Below is the representation of pus button without and with icon. 
In order to do this we will use setIcon method.
Syntax : button.setIcon(QIcon(‘logo.png’))
Argument : It takes file name if in same folder else file path
Action performed : It sets icon to the button.
Code :
# importing librariesfrom PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * import sys    class Window(QMainWindow):    def __init__(self):        super().__init__()          # setting title        self.setWindowTitle("Python ")          # setting geometry        self.setGeometry(100, 100, 600, 400)          # calling method        self.UiComponents()          # showing all the widgets        self.show()      # method for widgets    def UiComponents(self):          # creating a push button        button = QPushButton("CLICK", self)          # setting geometry of button        button.setGeometry(200, 150, 100, 30)          # adding action to a button        button.clicked.connect(self.clickme)          # setting icon to the button        button.setIcon(QIcon('logo.png'))          # action method    def clickme(self):          # printing pressed        print("pressed")  # 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.
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
Reading and Writing to text files in Python
*args and **kwargs in Python
Convert integer to string in Python
Create a Pandas DataFrame from Lists
Batch Script - IPCONFIG

This batch command displays Windows IP Configuration. Shows configuration by connection and the name of that connection.
ipconfig

@echo off 
ipconfig
The above command will display the Windows IP configuration on the current machine. Following is an example of the output.
Windows IP Configuration

Wireless LAN adapter Local Area Connection* 11:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix . :
	
Ethernet adapter Ethernet:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix . :
	
Wireless LAN adapter Wi-Fi:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix . :
 
Tunnel adapter Teredo Tunneling Pseudo-Interface:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix . :

 Print
 Add Notes
 Bookmark this page
How to add date and time picker using only one tag in HTML ? - GeeksforGeeks

07 Jan, 2022
In this article, we will discuss the overview of the datetime tag in HTML and mainly will focus on the example of datetime picker tag. We can add date and time picker in only one tag without using the two different tags. Let’s discuss it one by one. 
Syntax:
For selecting a date we use the date tag in HTML.
Date of Birth: <input type="date">
And for selecting a time we use the time tag in HTML. 
Enter Time: <input type="time">
But if we want to take the date and time at the same time then these two separate lines of code will take more time than the datetime-local tag. So to reduce the time required for coding we can use only one line of code. Let’s see the syntax and example for it:
Date with Time: <input type="datetime-local">
When we click on the input box of date and time it will show a calendar and time, and it will show the current date, month, and time by default, then we have to select the date and time or we can also type it in the input box.
Example:
HTML
<!DOCTYPE html><html>  <head>    <title>Page Title</title></head>  <body>    <h2>Welcome To GFG</h2>    Select date and time:           <input type="datetime-local" /></body>  </html>
Output:
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
HTML-Questions
HTML-Tags
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
REST API (Introduction)
Design a web page using HTML and CSS
Form validation using jQuery
How to place text on image using HTML and CSS?
How to auto-resize an image to fit a div container using CSS?
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
Convert a string to an integer in JavaScript
How to get only hidden files and folders in PowerShell?

To display only hidden files and folders –hidden parameter is used while using Get-ChildItem.
Get-ChildItem D:\Temp\ -Hidden
PS C:\WINDOWS\system32> Get-ChildItem D:\Temp\ -Hidden
    Directory: D:\Temp
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a-h--       13-12-2019     09:52           6182 Hiddenfile1.xlsx
Similarly, you can use this –Hidden with –Recurse or
–Depth
Get-ChildItem D:\Temp\ -Recurse -Hidden
PS C:\WINDOWS\system32> Get-ChildItem D:\Temp\ -Recurse -Hidden
    Directory: D:\Temp
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a-h--       13-12-2019     09:52           6182 Hiddenfile1.xlsx
    Directory: D:\Temp\GPO_backup
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a-h--       13-12-2019     09:52              0 HiddenFile2.txt
Java Program to change JLabel text after creation

At first, set a text for JLabel −
JLabel label;
label = new JLabel("First Label");
Now change the above JLabel text using setText() −
// changing text
label.setText("Updated text");
import java.awt.Font;
import javax.swing.*;
public class SwingDemo {
   public static void main(String args[]) {
      JFrame frame = new JFrame("Label Example");
      JLabel label;
      label = new JLabel("First Label");
      label.setBounds(50, 50, 100, 30);
      label.setFont(new Font("Verdana", Font.PLAIN, 13));
      // changing text
      label.setText("Updated text");
      frame.add(label);
      frame.setSize(500,300);
      frame.setLayout(null);
      frame.setVisible(true);
   }
}
HTML <output> Tag - GeeksforGeeks

17 Mar, 2022
The <output> tag in HTML is used to represent the result of a calculation performed by the client-side script such as JavaScript. The <output> tag is a new tag in HTML 5, and it requires a starting and ends tag. 
Syntax: 
<output> Results... </output>
Attributes: The output tag accepts three attributes which are listed below: 
for: This attribute contains an attribute value element_id which is used to specify the relation between result and calculations.
form: This attribute contains an attribute value form_id which is used to specify one or more forms of output elements.
name: This attribute contains an attribute value name that is used to specify the name of the output element.
Example 1: 
html
<!DOCTYPE html><html>  <body>    <h1>GeeksforGeeks</h1>    <h2>HTML output Tag</h2>    <form oninput="sumresult.value = parseInt(A.value)                 + parseInt(B.value) + parseInt(C.value)">        <input type="number" name="A" value="50" /> +        <input type="range" name="B" value="0" /> +        <input type="number" name="C" value="30" />        <br>        <!-- output tag -->        Result: <output name="sumresult"></output>    </form></body>  </html>
Output:  
Example 2: In this example, <output> tag is used with for and form attribute. 
html
<!DOCTYPE html><html>  <body>    <h1>GeeksforGeeks</h1>    <h2>HTML output Tag</h2>    <form oninput="sumresult.value = parseInt(A.value)                 + parseInt(B.value) + parseInt(C.value)">        <input type="number" name="A" value="50" /> +        <input type="range" name="B" value="0" /> +        <input type="number" name="C" value="50" />        <br /> Submit Result:        <!-- output tag -->        <output name="sumresult" for="A B C"></output>        <br>        <input type="submit">    </form></body>  </html>
Output:  
Supported Browsers: 
Google Chrome 10.0
Internet Explorer 13.0
Firefox 4.0
Opera 11.0
Apple Safari 5.1
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
ghoshsuman0129
HTML-Tags
HTML
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to set the default value for an HTML <select> element ?
How to update Node.js and NPM to next version ?
How to set input type date in dd-mm-yyyy format using HTML ?
Types of CSS (Cascading Style Sheet)
Hide or show elements in HTML using display property
How to Insert Form Data into Database using PHP ?
CSS to put icon inside an input element in a form
REST API (Introduction)
Java do-while loop example

A do...while loop is similar to a while loop, except that a do...while loop is guaranteed to execute at least one time.
Following is the syntax of a do...while loop −
do {
   // Statements
}while(Boolean_expression);
Notice that the Boolean expression appears at the end of the loop, so the statements in the loop execute once before the Boolean is tested.
If the Boolean expression is true, the control jumps back up to do statement, and the statements in the loop execute again. This process repeats until the Boolean expression is false.
Live Demo
public class Test {

   public static void main(String args[]) {
      int x = 10;
      do {
         System.out.print("value of x : " + x );
         x++;
         System.out.print("\n");
      }while( x < 20 );
   }
}
value of x : 10
value of x : 11
value of x : 12
value of x : 13
value of x : 14
value of x : 15
value of x : 16
value of x : 17
value of x : 18
value of x : 19
DAX Filter - VALUES function

Returns a one-column table that contains the distinct values from the specified table or column. In other words, duplicate values are removed and only unique values are returned.
VALUES (<TableNameOrColumnName>) 

TableNameOrColumnName
The table or column from which unique values are to be returned.
A column of unique values.
You can use DAX VALUES function as an intermediate function, nested in a formula, to get a list of distinct values that can be counted, or used to filter or sum other values.
When you use the DAX VALUES function in a context that has been filtered, such as in a PivotTable, the unique values returned by VALUES are affected by the filter.
= COUNTROWS (VALUES (Sales[Salesperson ID])) 
Returns the number of rows that have unique Salesperson IDs.

    53 Lectures 
     5.5 hours 

 Abhay Gadiya

    24 Lectures 
     2 hours 

 Randy Minder

    26 Lectures 
     4.5 hours 

 Randy Minder
 Print
 Add Notes
 Bookmark this page
Gii - Generating Module

Let us see how to generate a Module.
Step 1 − To generate a module, open the module generation interface and fill in the form.
Step 2 − Then, click the “Preview” button and “Generate”.
Step 3 − We need to activate the module. Modify the modules application component in the config/web.php file.
'modules' => [
   'admin' => [
      'class' => 'app\modules\admin\Module',
   ],
],
Step 4 − To check whether our newly generated module works, type the UR http://localhost:8080/index.php?r=admin/default/index in the web browser.
 Print
 Add Notes
 Bookmark this page
Tryit Editor v3.7

Tryit: HTML small text
Reverse an array in C++

The article showcase an array to be reversed in descending order using the C++ coding wherein the highest index is swapped to lowest index consequently by traversing the array in the loop.
 Live Demo
#include <iostream>
#include <algorithm>
using namespace std;
void reverseArray(int arr[], int n){
   for (int low = 0, high = n - 1; low < high; low++, high--){
      swap(arr[low], arr[high]);
   }
   for (int i = 0; i < n; i++){
      cout << arr[i] << " ";
   }
}
int main(){
   int arrInput[] = { 11, 12, 13, 14, 15 };
   cout<<endl<<"Array::";
   for (int i = 0; i < 5; i++){
      cout << arrInput[i] << " ";
   }
   int n = sizeof(arrInput)/sizeof(arrInput[0]);
   cout<<endl<<"Reversed::";
   reverseArray(arrInput, n);
   return 0;
}
As the integer type of array supplied in a bid to be reversed in descending order, the following yields as ;
Array::11 12 13 14 15
Reversed::15 14 13 12 11
What is strncat() Function in C language?

The C library function char *strncat(char *dest, const char *src, size_t n) appends the string pointed to by src to the end of the string pointed to by dest up to n characters long.
An array of characters is called a string.
Following is the declaration for an array −
char stringname [size];
For example: char string[50]; string of length 50 characters
Using single character constant −
char string[10] = { ‘H’, ‘e’, ‘l’, ‘l’, ‘o’ ,‘\0’}
Using string constants −
char string[10] = "Hello":;
Accessing − There is a control string "%s" used for accessing the string till it encounters ‘\0’.
This is used for combining or concatenating n characters of one string into another.
This is used for combining or concatenating n characters of one string into another.
The length of the destination string is greater than the source string.
The length of the destination string is greater than the source string.
The result concatenated string will be in the source string.
The result concatenated string will be in the source string.
The syntax is given below −
strncat (Destination String, Source string,n);
The following program shows the usage of strncat() function −
 Live Demo
#include <string.h>
main ( ){
   char a [30] = "Hello \n";
   char b [20] = "Good Morning \n";
   strncat (a,b,4);
   a [9] = "\0";
   printf("concatenated string = %s", a);
}
When the above program is executed, it produces the following result −
Concatenated string = Hello Good.
Let’s see another example −
Given below is the C program to concatenate n characters from source string to destination string using strncat library function −
 Live Demo
#include<stdio.h>
#include<string.h>
void main(){
   //Declaring source and destination strings//
   char source[45],destination[50];
   //Reading source string and destination string from user//
   printf("Enter the source string :");
   gets(source);
   printf("Enter the destination string before :");
   gets(destination);
   //Concatenate all the above results//
   destination[2]='\0';
   strncat(destination,source,2);
   strncat(destination,&source[4],1);
   //Printing destination string//
   printf("The modified destination string :");
   puts(destination);
}
When the above program is executed, it produces the following result −
Enter the source string :Tutorials Point
Enter the destination string before :Tutorials Point C Programming
The modified destination string :TuTur
Python | os.path.lexists() method - GeeksforGeeks

12 Jun, 2019
OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality. os.path module is sub module of OS module in python used for common path name manipulation.
os.path.lexists() method in Python is used to check whether the given path exists or not. Unlike os.path.exists() method, it returns True for broken symbolic link.
This method behaves similar to os.path.exists() on the platform where os.path.lstat() method is not available.
Syntax: os.path.lexists(path)
Parameter:path: A path-like object representing a file system path. A path-like object is either a string or bytes object representing a path.
Return Type: This method returns a Boolean value of class bool. This method returns True if path exists otherwise returns False. It will return True for broken symbolic links.
# Python program to explain os.path.lexists() method     # importing os.path module import os.path  # Pathpath = '/home/User/Desktop'  # Check whether the Given# path exists or notpathExists = os.path.lexists(path)print(pathExists)  # Pathpath = '/home/User/Downloads/file.txt'  # Check whether the specified# path exists or notpathExists = os.path.lexists(path)print(pathExists)    # os.path.lexists() method# will also return True if# the given path is# broken symbolic link
True
False

Reference: https://docs.python.org/3/library/os.path.html
Python OS-path-module
python-os-module
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Box Plot in Python using Matplotlib
Bar Plot in Matplotlib
Python | Get dictionary keys as a list
Python | Convert set into a list
Ways to filter Pandas DataFrame by column values
Python - Call function from another file
loops in python
Multithreading in Python | Set 2 (Synchronization)
Python Dictionary keys() method
Python Lambda Functions
How to add an image to a button (action) in JavaFX?

A button controls in user interface applications, in general, on clicking the button it performs the respective action. You can create a Button by instantiating the javafx.scene.control.Button class.
You can add a graphic object (node) to a button using the setGraphic() method of the Button class (inherited from javafx.scene.control.Labeled class). This method accepts an object of the Node class representing a graphic (icon).
To add an image to a button −
Create an Image object bypassing the path for the required graphic.
Create an Image object bypassing the path for the required graphic.
Create an ImageView object using the image object.
Create an ImageView object using the image object.
Create a button by instantiating the Button class.
Create a button by instantiating the Button class.
Finally, invoke the setGraphic() method on the button by passing the ImageView object as a parameter.
Finally, invoke the setGraphic() method on the button by passing the ImageView object as a parameter.
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class ButtonGraphis extends Application {
   public void start(Stage stage) {
      //Creating a graphic (image)
      Image img = new Image("UIControls/logo.png");
      ImageView view = new ImageView(img);
      view.setFitHeight(80);
      view.setPreserveRatio(true);
      //Creating a Button
      Button button = new Button();
      //Setting the location of the button
      button.setTranslateX(200);
      button.setTranslateY(25);
      //Setting the size of the button
      button.setPrefSize(80, 80);
      //Setting a graphic to the button
      button.setGraphic(view);
      //Setting the stage
      Group root = new Group(button);
      Scene scene = new Scene(root, 595, 170, Color.BEIGE);
      stage.setTitle("Button Graphics");
      stage.setScene(scene);
      stage.show();
   }
   public static void main(String args[]){
      launch(args);
   }
}