code-rag-bench/online-tutorials huggingface dataset:
Cube - CUBEMEMBERPROPERTY Function

The CUBEMEMBERPROPERTY function returns the value of a member property from the cube. Use this Function to validate that a member name exists within the cube and to return the specified property for this member.
CUBEMEMBERPROPERTY (connection, member_expression, property)

When the CUBEMEMBERPROPERTY function evaluates, it temporarily displays a "#GETTING_DATA..." message in the cell before all of the data is retrieved.
When the CUBEMEMBERPROPERTY function evaluates, it temporarily displays a "#GETTING_DATA..." message in the cell before all of the data is retrieved.
If the connection name is not a valid workbook connection stored in the workbook, CUBEMEMBERPROPERTY returns a #NAME? Error value. If the Online Analytical Processing (OLAP) server is not running, not available, or returns an error message, CUBEMEMBERPROPERTY returns a #NAME? Error value.
If the connection name is not a valid workbook connection stored in the workbook, CUBEMEMBERPROPERTY returns a #NAME? Error value. If the Online Analytical Processing (OLAP) server is not running, not available, or returns an error message, CUBEMEMBERPROPERTY returns a #NAME? Error value.
If the member_expression syntax is incorrect or if the member specified by member_expression does not exist in the cube, CUBEMEMBERPROPERTY returns a #N/A error value.
If the member_expression syntax is incorrect or if the member specified by member_expression does not exist in the cube, CUBEMEMBERPROPERTY returns a #N/A error value.
CUBEMEMBERPROPERTY may return a #N/A error value if you reference a session-based object, such as a calculated member or named set, in a PivotTable when sharing a connection. The PivotTable is deleted or you can convert the PivotTable to formulas. (On the Options tab, in the Tools group, click OLAP Tools, and then click Convert to Formulas.)
CUBEMEMBERPROPERTY may return a #N/A error value if you reference a session-based object, such as a calculated member or named set, in a PivotTable when sharing a connection. The PivotTable is deleted or you can convert the PivotTable to formulas. (On the Options tab, in the Tools group, click OLAP Tools, and then click Convert to Formulas.)
Excel 2007, Excel 2010, Excel 2013, Excel 2016
=CUBEMEMBERPROPERTY ("Sales","[Time].[Fiscal].[2004]",$A$3)
=CUBEMEMBERPROPERTY("Sales","[Store].[MyFavoriteStore]","[Store].[Store Name].[Store Sqft]")


    296 Lectures 
     146 hours 

 Arun Motoori

    56 Lectures 
     5.5 hours 

 Pavan Lalwani

    120 Lectures 
     6.5 hours 

 Inf Sid

    134 Lectures 
     8.5 hours 

 Yoda Learning

    46 Lectures 
     7.5 hours 

 William Fiset

    25 Lectures 
     1.5 hours 

 Sasha Miller
 Print
 Add Notes
 Bookmark this page
Exercise v1.3

Write an if/else statement with the following condition:
If the variable age is greater than 18, output "Old enough", otherwise output "Too young".
if (condition) {
    block of code to be executed if the condition is true
} else { 
    block of code to be executed if the condition is false
}
<!DOCTYPE html>
<html>
<body>
​
<p id="demo">Display the result here.</p>
​
<script>
var age = 25;
​
// Add the if/else statement here
</script>
​
</body>
</html>
​
xxxxxxxxxx
<!DOCTYPE html>
<html>
<body>
​
<p id="demo">Display the result here.</p>
​
<script>
var age = 25;
​
if (age > 18) {
    document.getElementById("demo").innerHTML = "Old enough";
} else {
    document.getElementById("demo").innerHTML = "Too young";
Differentiate between the prefix and postfix forms of the ++ operator in java?

Java provides two operators namely ++ and --, to increment and decrement values by 1 respectively.
There are two variants of these operators −
Pre-increment/decrement − This form, increments/decrements the value first, and then performs the specified operation.
In the following example, the initial value of the variable i is 5. We are printing the incremented value of it using the pre increment operator.
Since we are using the pre increment operator, the value of i is incremented then printed.
 Live Demo
public class ForLoopExample {
   public static void main(String args[]) {
      int i = 5;
      System.out.println(++i);
      System.out.println(i);
   }
}
6
Post-increment/decrement − This form, performs the specified operation first, and then increments/decrements the value.
In the following example, the initial value of the variable i is 5. We are printing the incremented value of it using the post increment operator and, we are printing the i value again.
Since we are using the post increment operator, the value of i is printed and then incremented.
 Live Demo
public class ForLoopExample {
   public static void main(String args[]) {
      int i = 5;
      System.out.println(i++);
      System.out.println(i);
   }
}
5
6
 Live Demo
public class ForLoopExample {
   public static void main(String args[]) {
      int i = 5;
      System.out.println(i--);
      System.out.println(i);
      int j =5;
      System.out.println(--j);
   }
}
5
4
4
Golang | Extracting a Regular Expression from the String - GeeksforGeeks

05 Sep, 2019
A regular expression is a sequence of characters which define a search pattern. Go language support regular expressions. A regular expression is used for parsing, filtering, validating, and extracting meaningful information from large text, like logs, the output generated from other programs, etc.In Go regexp, you are allowed to extract a regular expression from the given string with the help of the FindString() method. This method returns a string which holds the text of the leftmost match in a given string of the regular expression. If there is no match found, then this method returns an empty string, but it will also return an empty string if the regular expression successfully matches an empty string. This method is defined under the regexp package, so for accessing this method you need to import the regexp package in your program.
Syntax:
func (re *Regexp) FindString(str string) string
Example 1:
// Go program to illustrate how to find// the regexp from the given string  package main  import (    "fmt"    "regexp")  // Main functionfunc main() {      // Finding regexp from the given string    // Using FindString() method    m := regexp.MustCompile(`geek`)      fmt.Println(m.FindString("GeeksgeeksGeeks, geeks"))    fmt.Println(m.FindString("Hello! geeksForGEEKs"))    fmt.Println(m.FindString("I like Go language"))    fmt.Println(m.FindString("Hello, Welcome"))  }
Output:
geek
geek

Example 2:
// Go program to illustrate how to find// the regexp from the given stringpackage main  import (    "fmt"    "regexp")  // Main functionfunc main() {      // Finding the regexp from the given string    // Using Find() method    m := regexp.MustCompile(`like.?`)    res := m.FindString("I45, like345, Go-234 langu34age")      // Finding the index value of     // regexp in the given string    // UsingFindStringIndex() method    r := m.FindStringIndex("I45, like345, Go-234 langu34age")          fmt.Printf("Found: %s with index value: %d", res, r)}
Output:
Found: like3 with index value: [5 10]
Golang
Golang-String
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
strings.Replace() Function in Golang With Examples
How to Split a String in Golang?
Arrays in Go
Golang Maps
Slices in Golang
How to compare times in Golang?
How to Trim a String in Golang?
Inheritance in GoLang
Different Ways to Find the Type of Variable in Golang
How to Parse JSON in Golang?
How to Add an Element at Particular Index in Java ArrayList? - GeeksforGeeks

12 Jul, 2021
ArrayList.add() method is used to add an element at particular index in Java ArrayList.
Syntax:
public void add(int index, Object element) ;
Parameters: 
index  -position at which the element has to be inserted. The index is zero-based.
element – the element to be inserted at the specified position.
Exception: throws IndexOutOfBoundsException which occurs when the index is trying to be accessed which isn’t there in the allocated memory block. In java, this exception is thrown when a negative index is accessed or an index of memory space. Here particularly when an index greater than the size of ArrayList is trying to be fetched or the insertion of an element at an index greater than size() of ArrayList is fetched. 
Example:
For a list of string
list=[A,B,C]
list.add(1,”D”);
list.add(2,”E”);
list=[A,D,E,B,C]
For a list of integers
LIST=[1,2,3]
list.add(2,4);
list=[1,2,4,3]
Implementation:
Java
// Adding an Element at Particular// Index in Java ArrayListimport java.io.*;import java.util.ArrayList; class GFG {     // Main driver method    public static void main(String[] args)    {        // Creating an ArrayList        ArrayList<String> list = new ArrayList<>();         // Adding elements to ArrayList        // using add method for String ArrayList        list.add("A");        list.add("B");        list.add("C");         /* Index is zero based */         // 3 gets added to the 1st position        list.add(1, "D");         // 4 gets added to the 2nd(position)        list.add(2, "E");         // Displaying elements in ArrayList        System.out.println(list);    }}
  
[A, D, E, B, C]
 
anikaseth98
Java-ArrayList
Picked
Java
Java Programs
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Different ways of Reading a text file in Java
Stream In Java
Constructors in Java
Generics in Java
Exceptions in Java
Convert a String to Character array in Java
Java Programming Examples
Convert Double to Integer in Java
Implementing a Linked List in Java using Class
How to Iterate HashMap in Java?
How to know current working directory in Python?

To know the current working directory or pwd use the os module.
>>> import os
>>> print(os.getcwd())
/home/ayush/qna
How to create an empty data frame with fixed number of rows and without columns in R?

To create an empty data frame with fixed number of rows but no columns, we can use data.frame function along with the matrix function. That means we need to create a matrix without any column using matrix and save it in a data frame using data.frame function as shown in the below examples.
Live Demo
> df1<-data.frame(matrix(,nrow=10,ncol=0))
> df1
data frame with 0 columns and 10 rows

Live Demo
> df2<-data.frame(matrix(,nrow=100,ncol=0))
> df2
data frame with 0 columns and 100 rows

Live Demo
> df3<-data.frame(matrix(,nrow=39,ncol=0))
> df3
data frame with 0 columns and 39 rows

Live Demo
> df4<-data.frame(matrix(,nrow=20,ncol=0))
> df4
data frame with 0 columns and 20 rows

Live Demo
> df5<-data.frame(matrix(,nrow=200,ncol=0))
> df5
data frame with 0 columns and 200 rows

Live Demo
> df6<-data.frame(matrix(,nrow=150,ncol=0))
> df6
data frame with 0 columns and 150 rows

Live Demo
> df7<-data.frame(matrix(,nrow=1000,ncol=0))
> df7
data frame with 0 columns and 1000 rows

Live Demo
> df8<-data.frame(matrix(,nrow=500,ncol=0))
> df8
data frame with 0 columns and 500 rows

Live Demo
> df9<-data.frame(matrix(,nrow=50000,ncol=0))
> df9
data frame with 0 columns and 50000 rows

> df10<-data.frame(matrix(,nrow=10000000,ncol=0))
> df10
data frame with 0 columns and 10000000 rows
MySQL - ALTER PROCEDURE Statement

Stored procedures are sub routines, segment of SQL statements which are stored in SQL catalog. All the applications that can access Relational databases (Java, Python, PHP etc.), can access stored procedures.
Stored procedures contain IN and OUT parameters or both. They may return result sets in case you use SELECT statements. Stored procedures can return multiple result sets.
You can alter the characteristics of a procedure using the ALTER PROCEDURE statement.
Following is the syntax of the ALTER PROCEDURE statement −
ALTER PROCEDURE procedure_name COMMENT 'string', LANGUAGE SQL;

Where, procedure_name is the name of the procedure you need to alter.
Suppose we have created a table named Employee in the database using the CREATE statement and inserted three records in it as shown below −
mysql> CREATE TABLE Employee(Name VARCHAR(255), Salary INT, Location VARCHAR(255));
mysql> INSERT INTO Employee VALUES ('Amit', 6554, 'Hyderabad');
mysql> INSERT INTO Employee VALUES ('Sumith', 5981, 'Vishakhapatnam');
mysql> INSERT INTO Employee VALUES ('Sudha', 7887, 'Vijayawada');
Let us create a stored procedure named myProcedure. Here we are inserting a column in to the Employee table taking values from user. (through input parameters)
mysql> DELIMITER //
mysql> Create procedure myProcedure (
   IN name VARCHAR(30),
   IN sal INT,
   IN loc VARCHAR(45))
      BEGIN
      INSERT INTO Employee(Name, Salary, Location) VALUES (name, sal, loc);
      END //
Query OK, 0 rows affected (0.20 sec)
mysql> DELIMITER ;
Following query alters the procedure myProcedure, it changes/adds comment to the above created function −
ALTER PROCEDURE myProcedure COMMENT 'This is a sample comment';

You can verify the altered procedure using the Show Create Procedure statement as shown below −
mysql> SHOW CREATE PROCEDURE myProcedure\G
*************************** 1. row ***************************
      Procedure: myProcedure
      sql_mode: STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
   Create Procedure: CREATE DEFINER=`root`@`localhost` PROCEDURE `myProcedure`(
   IN name VARCHAR(30),
   IN sal INT,
   IN loc VARCHAR(45))
   COMMENT 'This is a sample comment'
BEGIN
      INSERT INTO Employee(Name, Salary, Location) VALUES (name, sal, loc);
END
character_set_client: cp850
collation_connection: cp850_general_ci
   Database Collation: utf8mb4_0900_ai_ci
1 row in set (0.07 sec)

    31 Lectures 
     6 hours 

 Eduonix Learning Solutions

    84 Lectures 
     5.5 hours 

 Frahaan Hussain

    6 Lectures 
     3.5 hours 

 DATAhill Solutions Srinivas Reddy

    60 Lectures 
     10 hours 

 Vijay Kumar Parvatha Reddy

    10 Lectures 
     1 hours 

 Harshit Srivastava

    25 Lectures 
     4 hours 

 Trevoir Williams
 Print
 Add Notes
 Bookmark this page
Erlang - nth

Returns the Nth element of List.
nth(N,List)

N − The nth value to return from the list.
N − The nth value to return from the list.
Lst − The list of elements.
Lst − The list of elements.
Returns the Nth element of List.
-module(helloworld). 
-import(lists,[nth/2]). 
-export([start/0]). 

start() -> 
   Lst1 = [1,2,3], 
   io:fwrite("~p~n",[nth(2,Lst1)]).
When we run the above program, we will get the following result.
2

 Print
 Add Notes
 Bookmark this page
How to declare a static String array in Java

Following program shows how to declare a static string array.
public class Tester {
   private static String[] array;
   static {
      array = new String[2];
      array[0] = "Hello";
      array[1] = "World";
   }
   public static void main(String[] args) {
      System.out.println("Array: ");
      for(int i = 0; i < array.length; i++){
      System.out.print(array[i] + " ");
      }
   }
}
Array:
Hello World
Returning multiple values from a C++ function

In C or C++, we cannot return multiple values from a function directly. In this section we will see how to use some trick to return more than one value from
a function.
We can return more than one values from a function by using the method called “call by address”, or “call by reference”. In the invoker function we will use two variables to store the results, and the function will take pointer type data. So we have to pass the address of the data.
In this example we will see how to define a function that can return quotient and remainder after dividing two numbers from one single function.
#include<iostream>
using namespace std;
void div(int a, int b, int *quotient, int *remainder) {
   *quotient = a / b;
   *remainder = a % b;
}
main() {
   int a = 76, b = 10;
   int q, r;
   div(a, b, &q, &r);
   cout << "Quotient is: "<< q <<"\nRemainder is: "<< r <<"\n";
}
Quotient is: 7
Remainder is: 6
#include<iostream>
using namespace std;
void div(int a, int b, int "ient, int &remainder) {
   quotient = a / b;
   remainder = a % b;
}
main() {
   int a = 76, b = 10;
   int q, r;
   div(a, b, q, r);
   cout << "Quotient is: "<< q <<"\nRemainder is: "<< r <<"\n";
}
Quotient is: 7
Remainder is: 6
C# Operators

Operators are used to perform operations on variables and values.
In the example below, we use the
+ operator to add together two values:
int x = 100 + 50;


Try it Yourself »

Although the + operator is often used to add together two values, like in the example above, it can also be used to add together a variable and a value, or a variable and another variable:
int sum1 = 100 + 50;        // 150 (100 + 50)
int sum2 = sum1 + 250;      // 400 (150 + 250)
int sum3 = sum2 + sum2;     // 800 (400 + 400)


Try it Yourself »

Arithmetic operators are used to perform common mathematical operations:
Assignment operators are used to assign values to variables.
In the example below, we use the assignment operator (=) 
to assign the value 10 to a variable called x:
int x = 10;


Try it Yourself »

The addition assignment operator (+=) adds a value to a variable:
int x = 10;
x += 5;


Try it Yourself »

A list of all assignment operators:
Comparison operators are used to compare two values:
Logical operators are used to determine the logic between variables or 
values:
You will learn more about comparison and logical operators in the Booleans and If...Else chapters.
Multiply 10 with 5, and print the result.
Console.WriteLine(10  5);

Start the Exercise
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
gcvt() | Convert float value to string in C - GeeksforGeeks

22 Dec, 2017
Here, we shall see how a float number (floating point value) can be converted to the string in C language. It is a library function defined in stdio.h header file. This function is used to convert a floating point number to string.Syntax :
gcvt (float value, int ndigits, char * buf);

float value : It is the float or double value.
int ndigits : It is number of digits.
char * buf : It is character pointer, in this 
variable string converted value will be copied.
Examples :
Input : 123.4567
Output :123.457

Input : 12345.6789
Output : 12345.7

// C program to convert float// value in string using gcvt()#include <stdio.h>#define MAX 100  int main(){    float x = 123.4567;    char buf[MAX];      gcvt(x, 6, buf);      printf("buffer is: %s\n", buf);      return 0;}
Output:
buffer is: 123.457
Application: Following Program showing difference in output when division result are stored infloat type(result has precision upto six decimal places) in comparison to when stored directly in string type.
// C program to illustrate// application of gcvt()#include <stdio.h>// called functionvoid divide(float x, float y){    char buffer[20];    float z;    z = x / y;    // printing normal division result      printf("%f", z);    gcvt(x / y, 10, buffer);      // printing division result as stored directly in string    printf("\n%s\n", buffer);}int main(){    // taking input    float x = 2.0f, y = 3.0f;      // calling function for division    divide(x, y);      return 0;}
Output:
0.666667
0.6666666865

C-Library
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Multidimensional Arrays in C / C++
rand() and srand() in C/C++
Left Shift and Right Shift Operators in C/C++
Core Dump (Segmentation fault) in C/C++
fork() in C
Command line arguments in C/C++
Function Pointer in C
Substring in C++
Structures in C
Different methods to reverse a string in C/C++
PyQt - BrushStyle Constants

Custom color can be chosen by specifying RGB or CMYK or HSV values.
The following example implements some of these methods.
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *

class Example(QWidget):

   def __init__(self):
      super(Example, self).__init__()
      self.initUI()
		
   def initUI(self):
      self.text = "hello world"
      self.setGeometry(100,100, 400,300)
      self.setWindowTitle('Draw Demo')
      self.show()
		
   def paintEvent(self, event):
      qp = QPainter()
      qp.begin(self)
      qp.setPen(QColor(Qt.red))
      qp.setFont(QFont('Arial', 20))
		
      qp.drawText(10,50, "hello Pyth
		on")
      qp.setPen(QColor(Qt.blue))
      qp.drawLine(10,100,100,100)
      qp.drawRect(10,150,150,100)
		
      qp.setPen(QColor(Qt.yellow))
      qp.drawEllipse(100,50,100,50)
      qp.drawPixmap(220,10,QPixmap("python.jpg"))
      qp.fillRect(200,175,150,100,QBrush(Qt.SolidPattern))
      qp.end()
		
def main():
   app = QApplication(sys.argv)
   ex = Example()
   sys.exit(app.exec_())
	
if __name__ == '__main__':
   main()
The above code produces the following output −

    146 Lectures 
     22.5 hours 

 ALAA EID
 Print
 Add Notes
 Bookmark this page
Getting console.log output from Firefox with Selenium.

We can get console.log output from Firefox with Selenium. This is done with the setProperty method.FirefoxDriver.SystemProperty.BROWSER_LOGFILE and the path of the file in which the logs are to be captured are passed as parameters to that method.
System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "FFLogs.txt");
After refreshing the project folder, we shall get the FFLogs.txt file where the logs shall be captured.
Code Implementation.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.logging.LogType;
public class FirefoxLogs{
   public static void main(String[] args) {
      System.setProperty("webdriver.gecko.driver", "C:\\Users\\ghs6kor\\Desktop\\Java\\geckodriver.exe");
      // set the System Property to BROWSER_LOGFILE and path of log file
      System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "FFLogs.txt");
      WebDriver driver = new FirefoxDriver();
      driver.get("https://www.tutorialspoint.com/tutor_connect/index.php");
      driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
      // identify element
      driver.findElement(By.id("txtSearchText")).sendKeys("Selenium");
      driver.quit();
   }
}
A log file with the name FFLogs.txt gets created within the project folder.
How to disable an Entry widget in Tkinter?

Tkinter Entry widget accepts single line user-input in an entry field. You can customize the width, background color and size of the entry widget based on the need of your application.
Let us assume that in a particular application, we want to disable an Entry widget. To disable the Entry widget, use state='disabled' property in the constructor. Disabling the Entry widget will not allow users to edit and add values to it.
Let us understand this with an example. In this example, we will create an Entry widget using the constructor Entry(master, **options) and a Button to disable it. The function disable_entry() will disable (grey out) the Entry widget.
# Import the required libraries
from tkinter import *

# Create an instance of tkinter frame
win = Tk()

# Set the size of the tkinter window
win.geometry("700x350")

def disable_entry():
   entry.config(state= "disabled")

# Create an entry widget
entry=Entry(win, width= 40, font= ('Helvetica 16'))
entry.pack(pady=20)

# Create a button
button=Button(win, text="Disable Entry", font=('Arial', 12), command=disable_entry)
button.pack()

win.mainloop()
If you run the above code, it will display a window with an Entry widget and a button to disable this Entry widget.
Now, click the button "Disable Entry" to disable the Entry widget.
How to put variable in regular expression match with JavaScript?

You can use match() with passing the variable name. The syntax is as follows −
console.log(yourVariableName.match(yourMatchingVariableName));
var senetence = 'My Name is John';
console.log("The actual value=");
console.log(senetence);
var matchWord = 'John';
console.log("The matching value=");
console.log(matchWord);
var matchRegularExpression = new RegExp(matchWord, 'g' );
console.log(senetence.match(matchWord));
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo107.js.
This will produce the following output −
PS C:\Users\Amit\JavaScript-code> node demo107.js
The actual value=
My Name is John
The matching value=
John
Python program to Convert a elements in a list of Tuples to Float - GeeksforGeeks

24 Oct, 2020
Given a Tuple list, convert all possible convertible elements to float.
Input : test_list = [(“3”, “Gfg”), (“1”, “26.45”)] Output : [(3.0, ‘Gfg’), (1.0, 26.45)] Explanation : Numerical strings converted to floats.
Input : test_list = [(“3”, “Gfg”)] Output : [(3.0, ‘Gfg’)] Explanation : Numerical strings converted to floats. 
Method #1 : Using loop + isalpha() + float()
In this, we use a loop to iterate for all the tuples, check for alphabets using isalpha(), which cannot be converted to float, and for the rest of the elements float() is used to convert. 
Python3
# Python3 code to demonstrate working of # Convert Tuple List elements to Float# Using loop + isalpha() + float  # initializing listtest_list = [("3", "Gfg"), ("1", "26.45"), ("7.32", "8"), ("Gfg", "8")]  # printing original listprint("The original list is : " + str(test_list))  res = []for tup in test_list:    temp = []    for ele in tup:                  # check for string        if ele.isalpha():            temp.append(ele)        else:                          # convert to float            temp.append(float(ele))    res.append((temp[0],temp[1]))  # printing result print("The converted list : " + str(res))
Output:
The original list is : [(‘3’, ‘Gfg’), (‘1’, ‘26.45’), (‘7.32’, ‘8’), (‘Gfg’, ‘8’)]The converted list : [(3.0, ‘Gfg’), (1.0, 26.45), (7.32, 8.0), (‘Gfg’, 8.0)]
Method #2 : Using loop + isalpha() + float() + list comprehension
In this, we perform the task of iterating through inner tuples using list comprehension.
Python3
# Python3 code to demonstrate working of # Convert Tuple List elements to Float# Using loop + isalpha() + float  # initializing listtest_list = [("3", "Gfg"), ("1", "26.45"), ("7.32", "8"), ("Gfg", "8")]  # printing original listprint("The original list is : " + str(test_list))  res = []for tup in test_list:            # list comprehension to check for each case    temp = [ele if ele.isalpha() else float(ele) for ele in tup]    res.append((temp[0],temp[1]))  # printing result print("The converted list : " + str(res))
Output:
The original list is : [(‘3’, ‘Gfg’), (‘1’, ‘26.45’), (‘7.32’, ‘8’), (‘Gfg’, ‘8’)]The converted list : [(3.0, ‘Gfg’), (1.0, 26.45), (7.32, 8.0), (‘Gfg’, 8.0)]
Python list-programs
Python tuple-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python OOPs Concepts
How to Install PIP on Windows ?
Bar Plot in Matplotlib
Defaultdict in Python
Python Classes and Objects
Defaultdict in Python
Python | Split string into list of characters
Python program to check whether a number is Prime or not
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
How to add and remove values to the Hash Table in PowerShell?

You can add values to the hash table and remove values from the hash tables. To add the values to the hash table, you need to use the below format.
$hash["<key>"] = "<value>"
We have hash table already created here,
$htable = [Ordered]@{EmpName="Charlie";City="New York";EmpID="001"}
PS C:\WINDOWS\system32> $htable
Name       Value
----       -----
EmpName    Charlie
City       New York
EmpID      001
We need to add additional key “Dept” in the above hash table with the value “Technical”.
$htable['Dept']="Technical"
When you check the output of the above Hashtable, you can see the key-value is appended to the table.
PS C:\WINDOWS\system32> $htable
Name       Value
----       -----
EmpName    Charlie
City       New York
EmpID      001
Dept       Technical
You can also use the Hashtable method called Add() to add the value. The format is as below.
Add(Key, Value)
To add the same above mentioned Key-Value to the hashtable with the Add() method,
$htable.Add('Dept','Technical')
To remove the Key-value from the Hashtable, you need to use the Remove(Key) method.
For example, to remove the Key “Dept” from the hashtable,
$htable.Remove('Dept')
PS C:\WINDOWS\system32> $htable
Name       Value
----       -----
EmpName    Charlie
City       New York
EmpID      001
You cannot remove the hashtable entry with the values. You must use the key inside the Remove() method.
Sorted difference between two columns in MySQL?

Use ORDER BY clause for this. Let us first create a table −
mysql> create table DemoTable
   (
   Value1 int,
   Value2 int
   );
Query OK, 0 rows affected (0.54 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values(10,40);
Query OK, 1 row affected (0.20 sec)
mysql> insert into DemoTable values(50,5);
Query OK, 1 row affected (0.13 sec)
mysql> insert into DemoTable values(51,56);
Query OK, 1 row affected (0.18 sec)
mysql> insert into DemoTable values(52,78);
Query OK, 1 row affected (0.16 sec)
mysql> insert into DemoTable values(90,7);
Query OK, 1 row affected (0.21 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
+--------+--------+
| Value1 | Value2 |
+--------+--------+
| 10     | 40     |
| 50     | 5      |
| 51     | 56     |
| 52     | 78     |
| 90     | 7      |
+--------+--------+
5 rows in set (0.00 sec)
Following is the query to get sorted difference between two columns −
mysql> select (Value1-Value2) as Sub from DemoTable order by Sub DESC;
+------+
| Sub  |
+------+
| 83   |
| 45   |
| -5   |
| -26  |
| -30  |
+------+
5 rows in set (0.00 sec)
MySQL Tryit Editor v1.0

SELECT COUNT(DISTINCT Country) FROM Customers;
​
        
Edit the SQL Statement, and click "Run SQL" to see the result.
This SQL-Statement is not supported in the WebSQL Database.
The example still works, because it uses a modified version of SQL.
Your browser does not support WebSQL.
Your are now using a light-version of the Try-SQL Editor, with a read-only Database.
If you switch to a browser with WebSQL support, you can try any SQL statement, and play with the Database as much as you like. The Database can also be restored at any time.
Our Try-SQL Editor uses WebSQL to demonstrate SQL.
A Database-object is created in your browser, for testing purposes.
You can try any SQL statement, and play with the Database as much as you like. The Database can be restored at any time, simply by clicking the "Restore Database" button.
WebSQL stores a Database locally, on the user's computer. Each user gets their own Database object.
WebSQL is supported in Chrome, Safari, and Opera.
If you use another browser you will still be able to use our Try SQL Editor, but a different version, using a server-based ASP application, with a read-only Access Database, where users are not allowed to make any changes to the data.
strrev() function in C

04 Oct, 2018
Syntax:
char *strrev(char *str);

Parameter:
str: The given string which is needed to be reversed.
Returns: This function returns the string after reversing the given string.
Note: This is a non-standard function that works only with older versions of Microsoft C.
Below programs illustrate the strrev() function in C:
Example 1:-
// C program to demonstrate// example of strrev() function  #include<stdio.h>#include<string.h>  int main(){   char str[50] = "geeksforgeeks";     printf("The given string is =%s\n",str);     printf("After reversing string is =%s",strrev(str));     return 0;}
Output:
The given string is =geeksforgeeks
After reversing string is =skeegrofskeeg

Example 2:-
// C program to demonstrate// example of strrev() function  #include<stdio.h>#include<string.h>  int main(){   char str[50] = "123456789";     printf("The given string is =%s\n",str);     printf("After reversing string is =%s",strrev(str));     return 0;}
Output:
The given string is = 123456789
After reversing string is = 987654321

C-Functions
C-Library
Reverse
C Language
Reverse
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Substring in C++
Function Pointer in C
Left Shift and Right Shift Operators in C/C++
std::string class in C++
Unordered Sets in C++ Standard Template Library
rand() and srand() in C/C++
What is the purpose of a function prototype?
Enumeration (or enum) in C
C Language Introduction
Operators in C / C++
Java Program for Merge Sort

09 Jun, 2022
Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. The merge() function is used for merging two halves. The merge(arr, l, m, r) is key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one. 
Java
/* Java program for Merge Sort */class MergeSort{    // Merges two subarrays of arr[].    // First subarray is arr[l..m]    // Second subarray is arr[m+1..r]    void merge(int arr[], int l, int m, int r)    {        // Find sizes of two subarrays to be merged        int n1 = m - l + 1;        int n2 = r - m;         /* Create temp arrays */        int L[] = new int [n1];        int R[] = new int [n2];         /*Copy data to temp arrays*/        for (int i=0; i<n1; ++i)            L[i] = arr[l + i];        for (int j=0; j<n2; ++j)            R[j] = arr[m + 1+ j];          /* Merge the temp arrays */         // Initial indexes of first and second subarrays        int i = 0, j = 0;         // Initial index of merged subarray array        int k = l;        while (i < n1 && j < n2)        {            if (L[i] <= R[j])            {                arr[k] = L[i];                i++;            }            else            {                arr[k] = R[j];                j++;            }            k++;        }         /* Copy remaining elements of L[] if any */        while (i < n1)        {            arr[k] = L[i];            i++;            k++;        }         /* Copy remaining elements of R[] if any */        while (j < n2)        {            arr[k] = R[j];            j++;            k++;        }    }     // Main function that sorts arr[l..r] using    // merge()    void sort(int arr[], int l, int r)    {        if (l < r)        {            // Find the middle point            int m = (l+r)/2;             // Sort first and second halves            sort(arr, l, m);            sort(arr , m+1, r);             // Merge the sorted halves            merge(arr, l, m, r);        }    }     /* A utility function to print array of size n */    static void printArray(int arr[])    {        int n = arr.length;        for (int i=0; i<n; ++i)            System.out.print(arr[i] + " ");        System.out.println();    }     // Driver method    public static void main(String args[])    {        int arr[] = {12, 11, 13, 5, 6, 7};         System.out.println("Given Array");        printArray(arr);         MergeSort ob = new MergeSort();        ob.sort(arr, 0, arr.length-1);         System.out.println("\nSorted array");        printArray(arr);    }}/* This code is contributed by Rajat Mishra */
Given Array
12 11 13 5 6 7 

Sorted array
5 6 7 11 12 13 

Time Complexity: O(n logn),
Auxiliary Space: O(n)
Please refer complete article on Merge Sort for more details!
akshaysingh98088
chandramauliguptach
Merge Sort
Java Programs
Merge Sort
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Set image for bullet style with CSS

The list-style-image allows you to specify an image so that you can use your own bullet style.
You can try to run the following code to set an image for bullet with CSS
<html>
   <head>
   </head>
   <body>
      <ul style = "list-style-image: url(/images/bullet.gif);">
         <li>Football</li>
         <li>Cricket</li>
      </ul>
   </body>
</html>
Insert an element at second position in a C# List

Here is our list −
List<string> val = new List<string> ();

// list of strings
val.Add("water");
val.Add("food");
val.Add("air");
Use the Insert() method to insert an element in the list. With that, also set where you want to add it. We have set the new text at position 1st −
val.Insert(1, "shelter");
The following is the complete code −
Example
 Live Demo
using System;
using System.Collections.Generic;
public class Demo {
   public static void Main() {
      List<string> val = new List<string> ();
      // list of strings
      val.Add("water");
      val.Add("food");
      val.Add("air");
      Console.WriteLine("Initial list:");
      // Initial List
      foreach (string res in val) {
         Console.WriteLine(res);
      }
      // inserting an element at second position
      val.Insert(1, "shelter");
      Console.WriteLine("New list after inserting an element:");
      foreach (string res in val) {
         Console.WriteLine(res);
      }
   }
}
Initial list:
water
food
air
New list after inserting an element:
water
shelter
food
air
How to Create a Timeline or Milestone Chart in Excel? - GeeksforGeeks

31 May, 2021
A timeline is a type of chart that visually shows a series of events in chronological order over a linear timescale. The power of a timeline is that it is graphical, which makes it easy to understand critical milestones, such as the progress of a project schedule.
Benefits of using Timeline / Milestone Chart:
It’s easy to check the progress of the project with a milestone chart.Easy for the user to understand the project schedule.You have all the important information in a single chart.
It’s easy to check the progress of the project with a milestone chart.
Easy for the user to understand the project schedule.
You have all the important information in a single chart.
Follow the below steps to create a Timeline or Milestone chart:
Step 1: Prepare your Data.
Data
 In the above table:
The first column is for completion dates of the project stages.
The second column is for the activity name.
The third column is just for the placement of the activities into the timeline (up and down).
Step 2: Select “Date” and “Placement” column and then from: 
insert-> chart-> select 2d chart
The following chart will appear:
Step 3: From the chart element select data labels then select more options.
chart elements->data labels->more options
Step 4: Now in Format data labels deselect the “value” option and select the “value from cells” option.
   
Step 5: Then select the “activity” column and then click on ok.
Step 6: Now select bars and on the format tab on the chart tools select no fill-in shape fills.
No fill bars
Step 7: Now for the Error bars, from the chart element select error bars then select more options.
Step 8: Now in “Format Error Bars”  change everything as per the image shown below:
Step 9: Now remove the vertical axis by unchecking the primary vertical option from
 chart element->axes
 And also deselect gridlines option.
Vertical axis Removed
Step 10: To customize the bars, select Horizontal axis and then in format select shape outline color weight and arrow design.
Step 11: Now select the arrow bars and change their color too. 
Both Horizontal axis and arrow bars in the same color
Step 12: The final step is to change the Chat Title. The following would be the result:
Final Chart
Picked
Excel
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Calculate Relative Standard Deviation in Excel?
How to Create a Macro in Excel?
How to Easily Calculate the Dot Product in Excel?
VLOOKUP Function in Excel With Examples
How to Delete a Module in Excel VBA?
How to Extract Text Only from Alphanumeric String in Excel?
How to Check if the Number is Prime Number in Excel?
How to Use Solver in Excel?
Pivot Tables in Excel
How to Calculate Frequency Distribution in Excel?
How to convert an integer to a octal string in Python?

We have use oct() function from Python’s library to convert any integer to its octal equivalent number. We get a string having octal representation
>>> oct(100)
'0o144'
>>> oct(0x10)
'0o20'
>>> oct(10)
'0o12'
RxJava - AsyncSubject

AsyncSubject emits the only last value followed by a completion event or the received error to Observers.
Following is the declaration for io.reactivex.subjects.AsyncSubject<T> class −
public final class  AsyncSubject<T>
extends Subject<T>

Create the following Java program using any editor of your choice in, say, C:\> RxJava.
import io.reactivex.subjects. AsyncSubject;
public class ObservableTester  {
   public static void main(String[] args) {   
      final StringBuilder result1 = new StringBuilder();
      final StringBuilder result2 = new StringBuilder();         

      AsyncSubject<String> subject =  AsyncSubject.create(); 
      subject.subscribe(value -> result1.append(value) ); 
      subject.onNext("a"); 
      subject.onNext("b"); 
      subject.onNext("c"); 
      subject.subscribe(value -> result2.append(value)); 
      subject.onNext("d"); 
      subject.onComplete();

      //Output will be d being the last item emitted
      System.out.println(result1);
      //Output will be d being the last item emitted     
      System.out.println(result2);
   }
}
Compile the class using javac compiler as follows −
C:\RxJava>javac ObservableTester.java

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

It should produce the following output −
d
d

 Print
 Add Notes
 Bookmark this page
C# Program to rename a file

Use the Move method to rename a file.
Let’s say the file name is −
D:\tom.txt
Now, to update it to the following, use the Move() method.
D:\tim.txt
Let us see the complete code.
using System;
using System.IO;
public class Demo {
   public static void Main() {
      File.Move(@"D:\tom.txt", @"D:\tim.txt");
      Console.WriteLine("File moved successfully!");
   }
}
Usage of Bootstrap class panel-success

The panel-success class in Bootstrap is a contextual state class to form a panel more meaningful to a particular context. It indicates success.
You can try to run the following code to implement the panel-success class −
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class = "panel panel-success">
         <div class = "panel-heading">
            <h3 class = "panel-title">Panel Title</h3>
         </div>
         <div class = "panel-body">
            This is a demo panel!
         </div>
      </div>
   </body>
</html>
Java boolean Keyword

❮ Java Keywords

A boolean data type with true or false values:
boolean isJavaFun = true;
boolean isFishTasty = false;
System.out.println(isJavaFun);     // Outputs true
System.out.println(isFishTasty);   // Outputs false


Try it Yourself »

The boolean keyword is a data type that can only take the values true or false.
Boolean values are mostly used for conditional testing (read the Java Booleans Tutorial for more information).
Read more about data types in our Java Data Types Tutorial.
Read more about booleans in our Java Booleans Tutorial.

❮ Java Keywords

We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
How to compare time in different time zones in Python?

When you have 2 different time objects with different timezones and you need to compare them, you first need to understand the difference between aware and naive objects. An aware datetime object is an object that holds the information about the timezone while naive object doesn't hold any timezone information.
The easiest way to compare 2 aware objects to check whether they tell the same time or not is to directly compare them.
import datetime, pytz
local_tz = pytz.timezone('CET')
# Get the time in UTC
utc = datetime.datetime.now(pytz.utc)
# Convert the time to local timezone
local = utc.astimezone(local_tz)
print("UTC: ", utc)
print("Local: ", local)
print(utc == local)
This will give the output −
UTC:  2018-01-03 17:02:43.632805+00:00
Local:  2018-01-03 18:02:43.632805+01:00
True
Internal Working of the len() Function in Python - GeeksforGeeks

02 Jul, 2020
The len() function in Python has a very peculiar characteristic that one had often wondered about. It takes absolutely no time, and equal time, in calculating the lengths of iterable data structures(string, array, tuple, etc.), irrespective of the size or type of data. This obviously implies O(1) time complexity. But have you wondered How?
Python follows the idea that keeping the length as an attribute is cheap and easy to maintain. len() is actually a function that calls the method ‘__len__()’. This method is defined in the predefined classes of iterable data structures. This method actually acts as a counter, that is automatically incremented as the data is defined and stored. Thus when you call the len() function, you do not give the interpreter the command to find the length by traversing, but rather you ask the interpreter to print a value that is already stored. Hence, len() function in Python runs in O(1) complexity.
Thus it can also be defined as:
def length(ar):       # calling the internally     # defined __len__() method    return ar.__len__()   # Driver codea = [1, 2, 3, 4]print(length(a))
Output:
4

Note: This might seem very beneficial, but remember that it puts a remarkable burden on the interpreter during the data definition phase. This is one of the many reasons why Python is slower during competitive programming, especially with big inputs.
Akanksha_Rai
Python-Functions
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Different ways to create Pandas Dataframe
Python String | replace()
Reading and Writing to text files in Python
sum() function in Python
Create a Pandas DataFrame from Lists
How to drop one or multiple columns in Pandas Dataframe
*args and **kwargs in Python
How can Detached DOM elements cause memory leak in JavaScript?

Detached DOM elements are the elements which have been removed from the DOM but their memory is still retained because of JavaScript. This means that as long the element have a reference to any variable or an object anywhere, it does not garbage collected even after destroyed from the DOM.
DOM is like an double-linked tree which means a reference to a node in the tree will halt the entire tree from garbage collection.
Let's take an example of creating a DOM element in javascript. After creating the element destroy it but forget to delete the variable holding it. This scenario leads to a Detached DOM which has a reference not only to the particular DOM element but also to the entire tree.
In the following example, even after removed from the DOM, 'someText' will still have a reference in the global 'value' object.This is why it can't eliminated from garbage collector and continue to consume memory.This causes memory leak.
<html>
<body>
<script>
   var example = document.createElement("p");
   example.id = "someText";
   document.body.appendChild(example);
   var value = {
    text: document.getElementById('someText')
   };
   function createFun() {
      value.text.innerHTML = "Javascript is not Java";
   }
   createFun();
   function deleteFun() {
      document.body.removeChild(document.getElementById('someText'));
   }
   deleteFun();
</script>
</body>
</html>
To avoid memory leak, the best practice is to put var example inside listener, which makes it a local variable. When var example is deleted the path for the object will cutoff,allowing the garbage collector to release memory.