code-rag-bench/online-tutorials huggingface dataset:
Int32.GetHashCode Method in C# with Examples - GeeksforGeeks

04 Apr, 2019
Int32.GetHashCode method is used to get the HashCode for the current Int32 instance.
Syntax: public override int GetHashCode ();
Return Value: This method returns a 32-bit signed integer hash code.
Below programs illustrate the use of the above discussed-method:
Example 1:
// C# program to illustrate the// Int32.GetHashCode() Methodusing System;  class GFG {      // Main Method    public static void Main()    {          // Taking Int32 variable        int val = 32523;          // Getting the hash code for Int32        // using GetHashCode() method        int result = val.GetHashCode();          // Display the hashcode        Console.WriteLine("HashCode for Int32 is: {0}",                                               result);    }}
HashCode for Int32 is: 32523

Example 2:
// C# program to illustrate the// Int32.GetHashCode() Methodusing System;  class GFG {      // Main Method    public static void Main()    {        // using result() Method        result(Int32.MinValue);        result(Int32.MaxValue);    }      // result() method    public static void result(int val)    {          // using GetHashCode() method        int code = val.GetHashCode();          // Display the hashcode        Console.WriteLine("HashCode for {0} is {1}",                                         val, code);    }}
HashCode for -2147483648 is -2147483648
HashCode for 2147483647 is 2147483647

Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.int32.gethashcode?view=netframework-4.7.2
CSharp-Int32-Struct
CSharp-method
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Program to calculate Electricity Bill
C# Dictionary with examples
C# | How to insert an element in an Array?
HashSet in C# with Examples
Introduction to .NET Framework
Linked List Implementation in C#
C# | Data Types
C# | Replace() Method
Lambda Expressions in C#
Main Method in C#
Tryit Editor v3.7

CSS Style Images
Tryit: Image hover - Slide in from top
How to print new line in Java?

The java.io.PrintStream.println() method prints an array of characters and then terminate the line. This method behaves as though it invokes print(char[]) and then println().
Using this method you can print the data on the console.
import java.io.*;
public class PrintStreamDemo {
   public static void main(String[] args) {
      char[] c = {'a', 'b', 'c'};
      
      // create print stream object
      PrintStream ps = new PrintStream(System.out);
      
      // print an array and change line
      ps.println(c);
      ps.print("New Line");
      
      // flush the stream
      ps.flush();
   }
}
abc
New Line
MySQL SELECT to sum a column value with previous value

For this, you can use a session variable. Let us first create a table −
mysql> create table DemoTable809(Price int);
Query OK, 0 rows affected (0.53 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable809 values(40);
Query OK, 1 row affected (0.17 sec)
mysql> insert into DemoTable809 values(50);
Query OK, 1 row affected (0.14 sec)
mysql> insert into DemoTable809 values(60);
Query OK, 1 row affected (0.12 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable809;
This will produce the following output −
+-------+
| Price |
+-------+
|    40 |
|    50 |
|    60 |
+-------+
3 rows in set (0.00 sec)
Following is the query to sum a column value with a previous value −
mysql> select @currentSum:=@currentSum+Price from DemoTable809;
This will produce the following output −
+--------------------------------+
| @currentSum:=@currentSum+Price |
+--------------------------------+
|                             40 |
|                             90 |
|                            150 |
+--------------------------------+
3 rows in set (0.00 sec)
UPDATE column to append data into it in MySQL?

To achieve this, the following is the syntax.
UPDATE yourTableName set
yourColumnName=concat(ifnull(yourColumnName,””),’anyValue1,anyValue2,anyValue);
To understand the above syntax, let us first create a table. The query to create a table is as follows -
mysql> create table AppendDataDemo
-> (
-> StudentId int,
-> StudentName varchar(100),
-> StudentAge int
-> );
Query OK, 0 rows affected (1.54 sec)
Insert some records in the table using insert command. The query is as follows.
mysql> insert into AppendDataDemo values(101,'John',23);
Query OK, 1 row affected (0.24 sec)

mysql> insert into AppendDataDemo values(102,null,24);
Query OK, 1 row affected (0.74 sec)

mysql> insert into AppendDataDemo values(103,'Mike',26);
Query OK, 1 row affected (0.12 sec)
Display all records from the table using select statement. The query is as follows.
mysql> select *from AppendDataDemo;
The following is the output.
+-----------+-------------+------------+
| StudentId | StudentName | StudentAge |
+-----------+-------------+------------+
| 101       | John        | 23         |
| 102       | NULL        | 24         |
| 103       | Mike        | 26         |
+-----------+-------------+------------+
3 rows in set (0.00 sec)
The following is the query to update the column StudentName and append “Carol, Sam, Maria” to its data.
mysql> update AppendDataDemo set StudentName=concat(ifnull(StudentName,""), ' Carol,Sam,Maria');
Query OK, 3 rows affected (0.14 sec)
Rows matched: 3 Changed: 3 Warnings: 0
Check the table records from the table using select statement. The query is as follows.
mysql> select *from AppendDataDemo;
The following is the output displaying appened data.
+-----------+----------------------+------------+
| StudentId | StudentName          | StudentAge |
+-----------+----------------------+------------+
| 101       | John Carol,Sam,Maria | 23         |
| 102       | Carol,Sam,Maria      | 24         |
| 103       | Mike Carol,Sam,Maria | 26         |
+-----------+----------------------+------------+
3 rows in set (0.03 sec)
C++ String Library - operator+=

It extends the string by appending additional characters at the end of its current value.
Following is the declaration for std::string::operator+=
string& operator+= (const string& str);
string& operator+= (const string& str);
str − It is a string object.
str − It is a string object.
c − It is a character object.
c − It is a character object.
It returns *this.
if an exception is thrown, there are no changes in the string.
In below example for std::string::operator+=.
#include <iostream>
#include <string>

int main () {
   std::string name ("Sairamkrishna");
   std::string family ("Mammahe");
   name += " Prasad. ";
   name += family;
   name += '\n';

   std::cout << name;
   return 0;
}
Sairamkrishna Prasad. Mammahe

 Print
 Add Notes
 Bookmark this page
Lodash _.isNull() Method - GeeksforGeeks

05 Sep, 2020
Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc.
The _.isNull() method is used to find whether the value of the object is null. If the value is null then returns true otherwise it returns false.
Syntax:
_.isNull(value)
Parameters: This method accepts a single parameter as mentioned above and described below:
value: This parameter holds the value to check.
Return Value: This method returns true if the value is null, else false.
Example 1: Here, const _ = require(‘lodash’) is used to import the lodash library into the file.
Javascript
// Requiring the lodash library  const _ = require("lodash");       // Use of _.isNull()  // method let gfg = _.isNull(null);         // Printing the output  console.log(gfg);
Output:
true
Example 2:  
Javascript
// Requiring the lodash library  const _ = require("lodash");       // Use of _.isNull()  // method let gfg = _.isNull(void 0);         // Printing the output  console.log(gfg);
Output:
false
Example 3:  
Javascript
// Requiring the lodash library  const _ = require("lodash");       // Use of _.isNull()  // method let gfg = _.isNull(NaN);         // Printing the output  console.log(gfg);
Output:
false
JavaScript-Lodash
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
How to get selected value in dropdown list using JavaScript ?
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
GATE | GATE-CS-2015 (Set 1) | Question 56 - GeeksforGeeks

28 Jun, 2021
Consider a main memory with five page frames and the following sequence of page references: 3, 8, 2, 3, 9, 1, 6, 3, 8, 9, 3, 6, 2, 1, 3. Which one of the following is true with respect to page replacement policies First-In-First Out (FIFO) and Least Recently Used (LRU)?
(A) Both incur the same number of page faults(B) FIFO incurs 2 more page faults than LRU(C) LRU incurs 2 more page faults than FIFO(D) FIFO incurs 1 more page faults than LRUAnswer: (A)Explanation:
3, 8, 2, 3, 9, 1, 6, 3, 8, 9, 3, 6, 2, 1, 3

In both FIFO and LRU, we get following after 
considering 3, 8, 2, 3, 9, 1, 3 8 2 9 1

FIFO
6 replaces 3
8 2 9 1 6

3 replaces 8
2 9 1 6 3

8 replaces 2
9 1 6 3 8

2 replaces 9
1 6 3 8 2

No more page faults

LRU
6 replaces 8
3 2 9 1 6
 
8 replaces 2
3 9 1 6 8

2 replaces 1
3 9 6 8 2

1 replaces 8
3 9 6 2 1 
Quiz of this Question
GATE-CS-2015 (Set 1)
GATE-GATE-CS-2015 (Set 1)
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
GATE | GATE-CS-2014-(Set-1) | Question 30
GATE | GATE-CS-2015 (Set 1) | Question 65
GATE | GATE CS 2010 | Question 45
GATE | GATE-CS-2004 | Question 3
GATE | GATE-CS-2015 (Set 3) | Question 65
C++ Program to count Vowels in a string using Pointer
GATE | GATE CS 2012 | Question 40
GATE | GATE-CS-2006 | Question 49
GATE | GATE-CS-2015 (Set 1) | Question 42
GATE | GATE-CS-2014-(Set-3) | Question 65
How to add a variable to Python plt.title?

To add a varaible to Python plt.title(), we can take the following steps −
Create data points for x and y using numpy and num (is a variable) to calculate y and set this in title.
Create data points for x and y using numpy and num (is a variable) to calculate y and set this in title.
Plot x and y data points using plot() method with red color.
Plot x and y data points using plot() method with red color.
Set the title of the curve with variable num.
Set the title of the curve with variable num.
To display the figure, use show() method.
To display the figure, use show() method.
import numpy as np
from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
x = np.linspace(-1, 1, 10)
num = 2
y = num ** x
plt.plot(x, y, c='red')
plt.title(f"y=%d$^x$" % num)
plt.show()
Python – Non-overlapping Random Ranges

22 Apr, 2020
Sometimes, while working with Python, we can have problem in which we need to extract N random ranges which are non-overlapping in nature and with given range size. This can have applications in which we work with data. Lets discuss certain way in which this task can be performed.
Method : Using any() + randint() + loopThis is brute force way in which this task can be performed. In this we extract random ranges using randint(), and check for non-repetition of number ranges using any() and loop.
# Python3 code to demonstrate working of # Non-overlapping Random Ranges# Using loop + any() + randint()import random  # initializing N N = 7  # initializing K K = 5  # Non-overlapping Random Ranges# Using loop + any() + randint()tot = 10000res = set()for _ in range(N):  temp = random.randint(0, tot - K)   while any(temp >= idx and temp <= idx + K for idx in res):     temp = random.randint(0, tot - K)   res.add(temp)res = [(idx, idx + K) for idx in res]  # printing result print("The N Non-overlapping Random ranges are : " + str(res)) 
The N Non-overlapping Random ranges are : [(5347, 5352), (7108, 7113), (5479, 5484), (1906, 1911), (2228, 2233), (5206, 5211), (3260, 3265)]

Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Adding value to sublists

08 Apr, 2019
Sometimes, we just have to manipulate a list of lists by appending a similar value to all the sublists. Using a loop for achieving this particular task can be an option but sometimes leads to sacrifice the readability of code. It is always wanted to have a oneliner to perform this particular task. Let’s discuss certain ways in which this can be done.
Method #1 : Using list comprehensionList comprehension can be used to perform this particular task using a similar looping construct but in just a single line. This increases code readability.
# Python3 code to demonstrate # appending single value # using list comprehension   # initializing list of liststest_list = [[1, 3], [3, 4], [6, 5], [4, 5]]  # printing original list print("The original list : " +  str(test_list))  # declaring element to be insertedK = "GFG"  # using list comprehension # appending single valueres = [[i, j, K ] for i, j in test_list]  # printing result print("The list after adding element :  " + str(res))
The original list : [[1, 3], [3, 4], [6, 5], [4, 5]]The list after adding element : [[1, 3, ‘GFG’], [3, 4, ‘GFG’], [6, 5, ‘GFG’], [4, 5, ‘GFG’]]
 
Method #2 : Using list comprehension + "+" operatorThis method is quite similar to the above method, but the difference is that plus operator is used to add the new element to each sublist.
# Python3 code to demonstrate # appending single value # using list comprehension + "+" operator  # initializing list of liststest_list = [[1, 3], [3, 4], [6, 5], [4, 5]]  # printing original list print("The original list : " +  str(test_list))  # declaring element to be insertedK = "GFG"  # using list comprehension + "+" operator# appending single valueres = [sub + [K] for sub in test_list]  # printing result print("The list after adding element :  " + str(res))
The original list : [[1, 3], [3, 4], [6, 5], [4, 5]]The list after adding element : [[1, 3, ‘GFG’], [3, 4, ‘GFG’], [6, 5, ‘GFG’], [4, 5, ‘GFG’]]
Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
AtomicReference toString() method in Java with Examples - GeeksforGeeks

27 Dec, 2019
The toString() method of a AtomicReference class is used to return the String representation of the current value of AtomicReference object.
Syntax:
public String toString()

Parameters: This method accepts nothing.
Return value: This method returns the String representation of the current value.
Below programs illustrate the toString() method:Program 1:
// Java program to demonstrate// AtomicReference.toString() method  import java.util.concurrent.atomic.AtomicReference;  public class GFG {    public static void main(String[] args)    {          // create an atomic reference object.        AtomicReference<Double> ref            = new AtomicReference<Double>();          // set some value        ref.set(1234.00);          // apply toString()        System.out.println("Value = "                           + ref.toString());    }}
Value = 1234.0

Program 2:
// Java program to demonstrate// AtomicReference.toString() method  import java.util.concurrent.atomic.AtomicReference;  public class GFG {    public static void main(String[] args)    {          // create an atomic reference object        // which stores String.        AtomicReference<String> ref            = new AtomicReference<String>();          // set some value        ref.set("GFG");          // apply toString()        System.out.println("Value  = "                           + ref.toString());    }}
Value  = GFG

References: https://docs.oracle.com/javase/10/docs/api/java/util/concurrent/atomic/AtomicReference.html#toString()
Java-Functions
Java-util-concurrent-atomic package
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Functional Interfaces in Java
Stream In Java
Constructors in Java
Different ways of Reading a text file in Java
Exceptions in Java
Generics in Java
Comparator Interface in Java with Examples
Strings in Java
How to remove an element from ArrayList in Java?
Difference between Abstract Class and Interface in Java
GATE | GATE CS 2008 | Question 70 - GeeksforGeeks

14 Feb, 2018
Consider a file of 16384 records. Each record is 32 bytes long and its key field is of size 6 bytes. The file is ordered on a non-key field, and the file organization is unspanned. The file is stored in a file system with block size 1024 bytes, and the size of a block pointer is 10 bytes. If the secondary index is built on the key field of the file, and a multi-level index scheme is used to store the secondary index, the number of first-level and second-level blocks in the multi-level index are respectively.(A) 8 and 0(B) 128 and 6(C) 256 and 4(D) 512 and 5Answer: (C)Explanation: Indexing mechanisms are used to optimize certain accesses to data (records) managed in files. For example, the author catalog in a library is a type of index. An Index File consists of records (called index entries) of the form
-----------------------------------
| Search-Key  |  Pointer to Block |
----------------------------------- 
If even outer index is too large to fit in main memory, yet another level of index can be created, and so on.
Number of records in file = 16384

Record size = 32 bytes
Key Size = 6 bytes
Block Size on file system = 1024 bytes
Size of Block Pointer = 10 bytes

Size of a record or index Entry = 10 + 6 = 16 

Number of blocks in first level = (Number of records in file)/
                                   (Disk Block Size)
                                = (16384 * 16)/(1024)
                                = 16 * 16
                                = 256

In second level, there will be 256 * 16 entries.
Number of blocks in second level = (Number of entries) / 
                                   (Block Size)
                                 = (256 * 16) / 1024
                                 = 4
Quiz of this Question
GATE-CS-2008
GATE-GATE CS 2008
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
GATE | GATE-CS-2014-(Set-3) | Question 38
GATE | GATE-IT-2004 | Question 83
GATE | GATE CS 2018 | Question 37
GATE | GATE-CS-2016 (Set 2) | Question 48
GATE | GATE-CS-2016 (Set 1) | Question 65
GATE | GATE-CS-2016 (Set 1) | Question 63
GATE | GATE-CS-2007 | Question 17
GATE | GATE-IT-2004 | Question 12
GATE | GATE-CS-2014-(Set-3) | Question 65
GATE | GATE-CS-2007 | Question 64
How can we import only specific columns from the text file, into MySQL table?

Suppose if we have the values for some specific columns in the text file and MySQL table, in which we want to import the data, is having an extra column(s) then by mentioning the names of the columns in the query we can upload the values of those specific columns only. It can be understood with the help of the following example −
Suppose we are having the values of columns ‘id’, ‘Name’ and ‘Salary’ only in the text file as follows −
105,Chum,11000
106,Danny,12000
Now while importing this text file into MySQL table then we need to mention the names of the columns for which we are having the values in a text file in the query as follows −
mysql> LOAD DATA LOCAL INFILE 'd:\A.txt' INTO table employee9_tbl FIELDS TERMINATED BY ','(id, Name, Salary);
Query OK, 2 rows affected (0.04 sec)
Records: 2 Deleted: 0 Skipped: 0 Warnings: 0

mysql> Select * from employee9_tbl;
+------+----------------+----------+--------+
| Id   | Name           | Country  | Salary |
+------+----------------+----------+--------+
| 105  | Chum           | NULL     | 11000  |
| 106  | Danny          | NULL     | 12000  |
+------+----------------+----------+--------+
2 rows in set (0.00 sec)
From the above result set, it is clear that MySQL only uploaded the value for three columns namely Id, Name and Salary. It stores NULL in the field of ‘Country’.
splice() - Unix, Linux System Call

Unix - Home
Unix - Getting Started
Unix - File Management
Unix - Directories
Unix - File Permission
Unix - Environment
Unix - Basic Utilities
Unix - Pipes & Filters
Unix - Processes
Unix - Communication
Unix - The vi Editor
Unix - What is Shell?
Unix - Using Variables
Unix - Special Variables
Unix - Using Arrays
Unix - Basic Operators
Unix - Decision Making
Unix - Shell Loops
Unix - Loop Control
Unix - Shell Substitutions
Unix - Quoting Mechanisms
Unix - IO Redirections
Unix - Shell Functions
Unix - Manpage Help
Unix - Regular Expressions
Unix - File System Basics
Unix - User Administration
Unix - System Performance
Unix - System Logging
Unix - Signals and Traps
Unix - Useful Commands
Unix - Quick Guide
Unix - Builtin Functions
Unix - System Calls
Unix - Commands List
Unix Useful Resources
Computer Glossary
Who is Who
Copyright © 2014 by tutorialspoint
#define _GNU_SOURCE 
#include <fcntl.h> 

long splice(int fd_in, off_t *off_in, int fd_out, 
            off_t *off_out, size_t len 
", unsigned int " flags );


long splice(int fd_in, off_t *off_in, int fd_out, 
            off_t *off_out, size_t len 
", unsigned int " flags );


If
fd_in refers to a pipe, then
off_in must be NULL.
If
fd_in does not refer to a pipe and
off_in is NULL, then bytes are read from
fd_in starting from the current file offset,
and the current file offset is adjusted appropriately.
If
fd_in does not refer to a pipe and
off_in is not NULL, then
off_in must point to a buffer which specifies the starting
offset from which bytes will be read from
fd_in; in this case, the current file offset of
fd_in is not changed.
Analogous statements apply for
out_fd and
off_out. 

The
flags argument is a bit mask that is composed by ORing together
zero or more of the following values:


On error,
splice() returns -1 and
errno is set to indicate the error.
Extract text from PDF File using Python

16 Jul, 2020
All of you must be familiar with what PDFs are. In fact, they are one of the most important and widely used digital media. PDF stands for Portable Document Format. It uses .pdf extension. It is used to present and exchange documents reliably, independent of software, hardware, or operating system.
Python package PyPDF can be used to achieve what we want (text extraction), although it can do more than what we need. This package can also be used to generate, decrypting and merging PDF files.
Note: For more information, refer to Working with PDF files in Python
To install this package type the below command in the terminal.
pip install PyPDF2
Example:
Input PDF:
# importing required modules import PyPDF2     # creating a pdf file object pdfFileObj = open('example.pdf', 'rb')     # creating a pdf reader object pdfReader = PyPDF2.PdfFileReader(pdfFileObj)     # printing number of pages in pdf file print(pdfReader.numPages)     # creating a page object pageObj = pdfReader.getPage(0)     # extracting text from page print(pageObj.extractText())     # closing the pdf file object pdfFileObj.close() 
Output:
Let us try to understand the above code in chunks:
pdfFileObj = open('example.pdf', 'rb')We opened the example.pdf in binary mode. and saved the file object as pdfFileObj.
pdfFileObj = open('example.pdf', 'rb')
We opened the example.pdf in binary mode. and saved the file object as pdfFileObj.
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)Here, we create an object of PdfFileReader class of PyPDF2 module and  pass the pdf file object & get a pdf reader object.
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
Here, we create an object of PdfFileReader class of PyPDF2 module and  pass the pdf file object & get a pdf reader object.
print(pdfReader.numPages)numPages property gives the number of pages in the pdf file. For example, in our case, it is 20 (see first line of output).
print(pdfReader.numPages)
numPages property gives the number of pages in the pdf file. For example, in our case, it is 20 (see first line of output).
pageObj = pdfReader.getPage(0)Now, we create an object of PageObject class of PyPDF2 module. pdf reader object has function getPage() which takes page number (starting form index 0) as argument and returns the page object.
pageObj = pdfReader.getPage(0)
Now, we create an object of PageObject class of PyPDF2 module. pdf reader object has function getPage() which takes page number (starting form index 0) as argument and returns the page object.
print(pageObj.extractText())Page object has function extractText() to extract text from the pdf page.
print(pageObj.extractText())
Page object has function extractText() to extract text from the pdf page.
pdfFileObj.close()At last, we close the pdf file object.
pdfFileObj.close()
At last, we close the pdf file object.
Python-projects
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Pandas dataframe.mul()

06 Aug, 2021
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.Pandas dataframe.mul() function return multiplication of dataframe and other element- wise. This function essentially does the same thing as the dataframe * other, but it provides an additional support to handle missing values in one of the inputs. 
Syntax: DataFrame.mul(other, axis=’columns’, level=None, fill_value=None)Parameters : other : Series, DataFrame, or constant axis : For Series input, axis to match Series index on level : Broadcast across a level, matching Index values on the passed MultiIndex level fill_value : Fill existing missing (NaN) values, and any new element needed for successful DataFrame alignment, with this value before computation. If data in both corresponding DataFrame locations is missing the result will be missingReturns : result : DataFrame 
Example #1: Use mul() function to find the multiplication of a dataframe with a series. Note : For multiplication with series, dataframe axis used for multiplication must match series index on. 
Python3
# importing pandas as pdimport pandas as pd # Creating the first dataframedf1=pd.DataFrame({"A":[14,4,5,4,1],                  "B":[5,2,54,3,2],                  "C":[20,20,7,3,8],                  "D":[14,3,6,2,6]}) # Print the dataframedf1
Let’s create the series 
Python3
# importing pandas as pdimport pandas as pd # create seriessr = pd.Series([3, 2, 4, 5, 6]) # Print seriessr
Lets use the dataframe.mul() function to perform multiplication  
Python3
# find multiplication over the index axisdf1.mul(sr, axis = 0)
Output :  
  Example #2: Use mul() function to find the multiplication of two dataframes. One dataframe contains NA values. 
Python3
# importing pandas as pdimport pandas as pd # Creating the first dataframedf1=pd.DataFrame({"A":[14,4,5,4,1],                  "B":[5,2,54,3,2],                  "C":[20,20,7,3,8],                  "D":[14,3,6,2,6]}) # Creating the second dataframe with <code>Na</code> valuedf2=pd.DataFrame({"A":[12,4,5,None,1],                  "B":[7,2,54,3,None],                  "C":[20,16,11,3,8],                  "D":[14,3,None,2,6]}) # Print the second dataframedf2
Lets use the dataframe.mul() function to find the multiplication of two dataframes, also handle the missing values. 
Python3
# fill the missing values with 100df1.mul(df2, fill_value = 100)
Output :  
Notice, all the missing value cells has been filled with 100 before multiplication 
saurabh1990aror
Python pandas-dataFrame
Python pandas-dataFrame-methods
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Convert integer to string in Python
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
time.Time.Location() Function in Golang with Examples

19 Apr, 2020
In Go language, time packages supplies functionality for determining as well as viewing time. The Time.Location() function in Go language is used to check the data of the time zone that is associated with “t”. Moreover, this function is defined under the time package. Here, you need to import the “time” package in order to use these functions.
Syntax:
func (t Time) Location() *Location

Here, “t” is the stated time and *Location is the pointer to Location.
Return value: It returns the information of the time zone that is associated with “t”.
Example 1:
// Golang program to illustrate the usage of// Time.Location() function  // Including main packagepackage main  // Importing fmt and timeimport "fmt"import "time"  // Calling mainfunc main() {      // Defining t for calling Location method    t := time.Date(2019, 2, 11, 10, 03, 00, 00, time.UTC)      // Calling Location method    loc := t.Location()      // Prints output    fmt.Printf("%v\n", loc)}
Output:
UTC

Example 2:
// Golang program to illustrate the usage of// Time.Location() function  // Including main packagepackage main  // Importing fmt and timeimport "fmt"import "time"  // Calling mainfunc main() {      // Defining location using FixedZone method    location := time.FixedZone("UTC-7", -6*56*34)      // Defining t for calling Location method    t := time.Date(2019, 2, 11, 10, 03, 00, 00, location)      // Calling Location method    loc := t.Location()      // Prints output    fmt.Printf("%v\n", loc)}
Output:
UTC-7

Here, FixedZone() method is used in order to define the location parameter of Date() method so the data of the time zone in the output is returned according to that location.
GoLang-time
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Range Keyword in Golang
Check if the String ends with specified suffix in Golang
Time Durations in Golang
Import in GoLang
How to Map a Rune to Lowercase in Golang?
Golang - Environment Variables
Strings in Golang
Golang program that uses structs as map keys
Check if the String starts with specified prefix in Golang
Top 10 Programming Languages for Blockchain Development
How to check any script is running in linux using Python?

03 Mar, 2021
Python is a strong and exponentially growing programming language in the present day. There is a multiple-way to check which script is running in the background of a Linux environment. One of them is using the subprocess module in python. Subprocess is used to run new programs through Python code by creating new processes. In this article, we are going to see how to check any script is running in the background Linux using Python.
Requirement :
Python >=2.7, >= 3.0
pip
Installation of Subprocess :
pip install subprocess.run
We will use subprocess.checkout() methods to get all the running processes.
Syntax : subprocess.check_output(args, *, stdin=None, stderr=None, shell=False, cwd=None, encoding=None, errors=None, universal_newlines=None, timeout=None, text=None, **other_popen_kwargs)
This run command with argument and return output.
stderr=subprocess.STDOUT is used to capture standard error in the result.
Example 1 :
In the below code we will get all the py script running in the background Linux
Python3
import subprocess    pytonProcess = subprocess.check_output("ps -ef | grep .py",shell=True).decode()pytonProcess = pytonProcess.split('\n')  for process in pytonProcess:    print(process)
Output :
Example 2 :
In the below example we will check whether a particular script is running in background
Python3
import subprocess    pytonProcess = subprocess.check_output("ps -ef | grep test.py",shell=True).decode()pytonProcess = pytonProcess.split('\n')  for process in pytonProcess:    print(process)
Output :
Example 3 :
In the below code we will get all the PHP script running in background Linux.
Python3
import subprocess    pytonProcess = subprocess.check_output("ps -ef | grep .php",shell=True).decode()PHPProcess = pytonProcess.split('\n')  for process in PHPProcess:    print(process)
Output :
Picked
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Python | os.path.join() method
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python | Get unique values from a list
Python | datetime.timedelta() function
strcmpi() function in C

04 Oct, 2018
The strcmpi() function is a built-in function in C and is defined in the “string.h” header file. The strcmpi() function is same as that of the strcmp() function but the only difference is that strcmpi() function is not case sensitive and on the other hand strcmp() function is the case sensitive.
Syntax:
int strcmpi (const char * str1, const char * str2 );

Parameters:
str1: The first string.
str2: The second string.
Returns: This function returns 0 if the given two strings are same, a negative value if the length of str1 is less then the length of str2 and if the length of str1 is greater then str2 then this function returns a positive value.
Note: This is a non-standard function that works only with older versions of Microsoft C.
Below programs illustrate the strcmpi() function in C:
Program 1:
// C program to demonstrate// example of strcmpi() function  #include <stdio.h>#include <string.h>  int main( ){   char str1[] = "geeks" ;   char str2[] = "geeks" ;        int j = strcmpi ( str1, str2 ) ;        printf ( "The function returns = %d",j ) ;   return 0;}
Output:
The function returns = 0

Program 2:
// C program to demonstrate// example of strcmpi() function  #include <stdio.h>#include <string.h>  int main( ){   char str1[ ] = "geeks" ;   char str2[ ] = "ForGeeks" ;     int i = strcmpi ( str1, str2 ) ;     printf ( "The function returns = %d", i ) ;   return 0;}
Output:
The function returns = 1

C-Functions
C-Library
C-String
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Unordered Sets in C++ Standard Template Library
Operators in C / C++
What is the purpose of a function prototype?
Exception Handling in C++
TCP Server-Client implementation in C
Smart Pointers in C++ and How to Use Them
Ways to copy a vector in C++
'this' pointer in C++
Storage Classes in C
Arrow operator -> in C/C++ with Examples
numpy.interp() function – Python

11 Jun, 2020
numpy.interp() function returns the one-dimensional piecewise linear interpolant to a function with given discrete data points (xp, fp), evaluated at x.
Syntax : numpy.interp(x, xp, fp, left = None, right = None, period = None)
Parameters :x : [array_like] The x-coordinates at which to evaluate the interpolated values.xp: [1-D sequence of floats] The x-coordinates of the data points, must be increasing if the argument period is not specified. Otherwise, xp is internally sorted after normalizing the periodic boundaries with xp = xp % period.fp : [1-D sequence of float or complex] The y-coordinates of the data points, same length as xp.left : [optional float or complex corresponding to fp] Value to return for x < xp[0], default is fp[0].right : [optional float or complex corresponding to fp] Value to return for x > xp[-1], default is fp[-1].period : [None or float, optional] A period for the x-coordinates. This parameter allows the proper interpolation of angular x-coordinates. Parameters left and right are ignored if the period is specified.
Return : [float or complex or ndarray] The interpolated values, same shape as x.
Code #1 :
# Python program explaining# numpy.interp() function       # importing numpy as geek import numpy as geek    x = 3.6xp = [2, 4, 6]fp = [1, 3, 5]   gfg = geek.interp(x, xp, fp)  print (gfg)
Output :
2.6

 Code #2 :
# Python program explaining# numpy.interp() function       # importing numpy as geek import numpy as geek    x = [0, 1, 2.5, 2.72, 3.14]xp = [2, 4, 6]fp = [1, 3, 5]   gfg = geek.interp(x, xp, fp)  print (gfg)
Output :
[1.   1.   1.5  1.72 2.14]

Python numpy-ndarray
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Can we use % operator on floating point numbers?

02 Jun, 2017
Predict the output of following program:
Can % be used with floating point numbers in C++?
#include <iostream>int main(){    float f = 9.9f, m = 3.3f;    float c = f % m;  // LINE 5    std::cout << c;    return 0;}
The above program fails in compilation and compiler report the following error in line 5:Output:
invalid operands of types 'float' and 'float' 
to binary 'operator%' 
% operator cannot be used with floating point numbers in C & C++.
What about Java and C#?This behavior is different in Java & C#. % operator can be used on floating point numbers in these languages.
Consider following example of Java program:
class Test{    public static void main(String args[])    {        float f = 9.9f, m = 3.3f;        float c = f % m;        System.out.println(c);    }}
Output:
3.2999997
Same way try this C# program. It works fine:
using System;class Test{    public static void Main()    {        float f = 9.9f, m = 3.3f;        float c = f % m;        Console.WriteLine(c);    }}
Output:
3.3
This article is contributed by Meet Pravasi. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
cpp-data-types
cpp-operator
C++
cpp-operator
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Sorting a vector in C++
Polymorphism in C++
Pair in C++ Standard Template Library (STL)
Friend class and function in C++
std::string class in C++
Queue in C++ Standard Template Library (STL)
std::find in C++
Unordered Sets in C++ Standard Template Library
List in C++ Standard Template Library (STL)
vector insert() function in C++ STL
Inline HTML Helper – HTML Helpers in ASP.NET MVC

23 Jun, 2020
HTML Helpers are methods that returns HTML strings. These are used in the view. In simple terms, these are C# methods that are used to return HTML. Using HTML helpers you can render a text box, an area, image tag, etc. In MVC we have many built-in HTML helpers and we can create custom helpers too. Using HTML helpers a view can show model properties and can generate HTML as per the types of properties.
Types of HTML Helpers:
Inline HTML HelperBuilt-in HTML HelperStandard HTML helperStrongly Typed HTML helperTemplated HTMl HelperCustom HTML Helper
Inline HTML Helper
Built-in HTML HelperStandard HTML helperStrongly Typed HTML helperTemplated HTMl Helper
Standard HTML helper
Strongly Typed HTML helper
Templated HTMl Helper
Custom HTML Helper
Inline HTML HelpersThese are the type of helpers that are used on a single view and are used on the same page. inline HTML helpers can be created using @helper tag.
 
You can create your own HTML Helper with the following syntax.
@helper HelperName(parameters)
{
    // code
}
To use the above-created helper we use the following syntax
@HelperName(parameters)

Example:
@{    Layout = null;}  <!--created a inline HTMl Helper     with a single string type parameter-->@helper MyInlineHelper(string[] words){    <ol>        <!--Used a foreach loop inside HTML. similarly we can use any conditional statement          or any logic like             we use in normal C# code.-->        @foreach (string word in words)        {            <li>@word</li>          }    </ol>}<!DOCTYPE html>  <html><head>    <meta name="viewport" content="width=device-width" />    <title>Inline HTML Helper</title></head><body>    <div>        <!--called it inside this             div and to get the output-->        @MyInlineHelper(new string[] {                  "Delhi", "Punjab", "Assam", "Bihar" })      </div></body></html>  
Output:
Drawback of Inline HTML helpers
These helpers can only be used with a single view only. You can not use it with multiple views.
Reference: Setup and run code in Visual Studio
HTML-Misc
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Java.lang.Long.valueOf() method with examples

05 Dec, 2018
Java.lang.Long.valueOf() is a built-in method in Java of lang class that returns a Long object holding the value extracted from a specified String S when parsed with the radix that is given in the second argument. The first argument is interpreted as representing a signed long in the radix specified by the second argument, exactly as if the arguments were given to the parseLong(java.lang.String, int) method. It returns a result that is a Long object that represents the long value specified by the string.
Syntax:
public static Long valueOf(String s, int radix) throws NumberFormatException
Parameters: The method accepts two mandatory parameters:
S: This refers to the string which is to be parsed.
radix: This refers to the radix which is to be used in interpreting the string S.
Return type: The built-in method returns a Long object holding the value represented by the string argument in the specified radix.
Errors and Exception:
NumberFormatException: If the number does not contain a parsable long the program returns.
Below programs illustrate the Java.lang.Long.valueOf() method.
Program 1:
// Java program to demonstrate// the java.lang.Long.valueOf() methodimport java.lang.Math;  class Gfg1 {      // driver code    public static void main(String args[])    {        Long l = new Long(10);        String str = "45325";          // returns a Long instance representing         // the specified string with radix 10        System.out.println("Long instance Value = "                                + l.valueOf(str, 10));    }}
Output:
Long instance Value = 45325

Program 2:
// Java program to demonstrate// of java.lang.Long.valueOf() method// NumberFormatExceptionimport java.lang.Math;  class Gfg1 {      // driver code    public static void main(String args[])    {        Long l = new Long(10);          // not a parsable long        String str = "gopal";          // returns a Long instance representing         // the specified string with radix 10        System.out.println("Long instance Value = "                                + l.valueOf(str, 10));    }}
Output:
Exception in thread "main" java.lang.NumberFormatException: For input string: "gopal"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Long.parseLong(Long.java:589)
    at java.lang.Long.valueOf(Long.java:776)
    at Gfg1.main(File.java:15)

Java-Functions
Java-lang package
java-Long
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Interfaces in Java
ArrayList in Java
Collections in Java
Stream In Java
Multidimensional Arrays in Java
Singleton Class in Java
Set in Java
Initializing a List in Java
Stack Class in Java
Introduction to Java
Calendar setLenient() Method in Java with Examples - GeeksforGeeks

21 Feb, 2019
The setLenient(boolean leniency) method in Calendar class is used to specify whether the interpretation of the date and time is to be lenient or not.
Syntax:
public void setLenient(boolean leniency)
Parameters: The method takes one parameter leniency of the boolean type that refers to the mode of the calendar. The boolean value true turns on the leniency mode and false turns off the leniency mode.
Return Value: The method does not return any value.
Below programs illustrate the working of setFirstDayOfWeek() Method of Calendar class:Example 1:
// Java code to illustrate// setLenient() method  import java.util.*;public class Calendar_Demo {    public static void main(String args[])    {          // Creating a calendar object        Calendar calndr = Calendar.getInstance();          // Displaying the current        // mood of leniency        boolean value = calndr.isLenient();        System.out.println("Is the"                           + " Calendar lenient? "                           + value);          // Changing the leniency        calndr.setLenient(false);          // Displaying the result        System.out.println("The altered"                           + " Leniency: "                           + calndr.isLenient());    }}
Is the Calendar lenient? true
The altered Leniency: false

Example 2:
// Java code to illustrate// isLenient() method  import java.util.*;public class CalendarDemo {    public static void main(String args[])    {          // Creating a calendar object        Calendar calndr            = Calendar.getInstance();          // Displaying the calendar        System.out.println("Current Calendar: "                           + calndr.getTime());          // Checking the leniency        boolean leniency = calndr.isLenient();        calndr.setLenient(false);        leniency = calndr.isLenient();          // Displaying the leniency        System.out.println("Calendar is"                           + " lenient? "                           + leniency);          // Checking the leniency        calndr.setLenient(true);        leniency = calndr.isLenient();          // Displaying the leniency        System.out.println("Calendar is"                           + " lenient: "                           + leniency);    }}
Current Calendar: Thu Feb 21 11:00:50 UTC 2019
Calendar is lenient? false
Calendar is lenient: true

Reference: https://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html#setLenient-boolean-
Java - util package
Java-Calendar
Java-Functions
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Object Oriented Programming (OOPs) Concept in Java
Stream In Java
HashMap in Java with Examples
Interfaces in Java
How to iterate any Map in Java
ArrayList in Java
Initialize an ArrayList in Java
Stack Class in Java
Singleton Class in Java
Multithreading in Java
Finding Fibonacci sequence in an array using JavaScript

A sequence X_1, X_2, ..., X_n is fibonacci if:
n >= 3
n >= 3
X_i + X_{i+1} = X_{i+2} for all i + 2 <= n
X_i + X_{i+1} = X_{i+2} for all i + 2 <= n
We are required to write a JavaScript function that takes in an array of numbers, arr, as the first and the only argument. Our function should find and return the length of the longest Fibonacci subsequence that exists in the array arr.
A subsequence is derived from another sequence arr by deleting any number of elements (including none) from arr, without changing the order of the remaining elements.
For example, if the input to the function is
Input
const arr = [1, 3, 7, 11, 14, 25, 39];
Output
const output = 5;
Output Explanation
Because the longest Fibonacci subsequence is [3, 11, 14, 25, 39]
Following is the code:
 Live Demo
const arr = [1, 3, 7, 11, 14, 25, 39];
const longestFibonacci = (arr = []) => {
   const map = arr.reduce((acc, num, index) => {
      acc[num] = index
      return acc
   }, {})
   const memo = arr.map(() => arr.map(() => 0))
   let max = 0
   for(let i = 0; i < arr.length; i++) {
      for(let j = i + 1; j < arr.length; j++) {
         const a = arr[i]
         const b = arr[j]
         const index = map[b - a]
         if(index < i) {
            memo[i][j] = memo[index][i] + 1
         }
         max = Math.max(max, memo[i][j])
      }
   }
   return max > 0 ? max + 2 : 0
};
console.log(longestFibonacci(arr));
5